8000 Refactor py-config and the general initialization logic of the page by antocuni · Pull Request #806 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
77be53a
start to remove module-level statements, and put all the logic in its…
antocuni Sep 29, 2022
a1124da
add a JS API to get the pyscript config and two integration tests to …
antocuni Sep 29, 2022
894a1c7
rename this file
antocuni Sep 29, 2022
4bc4029
introduce the class PyScriptApp, so have a global singleton where to …
antocuni Sep 29, 2022
5798923
small refactoring of pyconfig.ts, in preparation to make py-config NO…
antocuni Sep 29, 2022
1faeb3b
improve logging
antocuni Sep 29, 2022
6479860
start moving all the config logic to config.ts
antocuni Sep 29, 2022
540b129
move all the config logic from utils.ts into config.ts
antocuni Sep 29, 2022
62ddb90
WIP: start to refactor pyconfig.test.ts to test directly loadConfigFr…
antocuni Sep 29, 2022
634be61
WIP: allow to call loadConfigFromElement(null)
antocuni Sep 30, 2022
6ca9be5
WIP: more progress in porting tests, create a brand new element inste…
antocuni Sep 30, 2022
798c436
fix typos :)
antocuni Sep 30, 2022
ef79c64
WIP: one more test
antocuni Sep 30, 2022
257c1e9
WIP: more tests
antocuni Sep 30, 2022
07a4548
WIP: more tests
antocuni Sep 30, 2022
4789705
move the last tests to PyConfig
antocuni Sep 30, 2022
46c8aab
another small step: PyConfig is no longer a web component but it's ma…
antocuni Sep 30, 2022
c6123f3
Merge branch 'main' of github.com:pyscript/pyscript into main
antocuni Sep 30, 2022
2a185af
fix tests which were broken after the merge
antocuni Sep 30, 2022
c51621a
use JSON.stringify to get a human-readable version of the config
antocuni Sep 30, 2022
2964124
add an integration test for <py-config>paths=...
antocuni Sep 30, 2022
fe702ce
add a test for <py-config>packages...
antocuni Sep 30, 2022
35a8201
move the loadPackages logic from pyconfig into main.ts
antocuni Sep 30, 2022
d4a3138
move the loadPaths logic from pyconfig into main.ts
antocuni Sep 30, 2022
6ee7794
move the loadRuntimes() logic into main.ts
antocuni Sep 30, 2022
e2ae490
kill all the remaining references to PyConfig
antocuni Sep 30, 2022
b9e77ae
finally kill pyconfig.ts
antocuni Sep 30, 2022
8f8b4b1
now that the old pyconfig.ts has gone, we can reuse its name
antocuni Sep 30, 2022
4b37b8b
wooo, kill the appConfig store: instead of using a global variable to…
antocuni Sep 30, 2022
c0577d6
Update pyscriptjs/src/pyconfig.ts
antocuni Oct 3, 2022
c65a8ba
improve this comment
antocuni Oct 3, 2022
0dca198
try to use an older version of eslint
antocuni Oct 3, 2022
b7d4b04
Merge remote-tracking branch 'origin/main' into antocuni/refactor-py-…
antocuni Oct 4, 2022
7239e2d
use expect().toThrow instead of it.failing()
antocuni Oct 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve logging
  • Loading branch information
antocuni committed Sep 29, 2022
commit 1faeb3bc0a9c7aacd6f19f8ee2195d9b0f3008c2
8 changes: 4 additions & 4 deletions pyscriptjs/src/components/pyconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ function loadConfigFromElement(el: HTMLElement): AppConfig {
const configType: string = el.hasAttribute("type") ? el.getAttribute("type") : "toml";
let srcConfig = extractFromSrc(el, configType);
const inlineConfig = extractFromInline(el, configType);
// first make config from src whole if it is partial
srcConfig = mergeConfig(srcConfig, defaultConfig);
// then merge inline config and config from src
const result = mergeConfig(inlineConfig, srcConfig);
Expand All @@ -43,8 +42,9 @@ function loadConfigFromElement(el: HTMLElement): AppConfig {
function extractFromSrc(el: HTMLElement, configType: string) {
if (el.hasAttribute('src'))
{
logger.info('config set from src attribute');
return validateConfig(readTextFromPath(el.getAttribute('src')), configType);
const src = el.getAttribute('src');
logger.info('loading ', src)
return validateConfig(readTextFromPath(src), configType);
}
return {};
}
Expand All @@ -53,7 +53,7 @@ function extractFromSrc(el: HTMLElement, configType: string) {
function extractFromInline(el: HTMLElement, configType: string) {
if (el.innerHTML!=='')
{
logger.info('config set from inline');
logger.info('loading <py-config> content');
return validateConfig(el.innerHTML, configType);
}
return {};
Expand Down
0