castle-web-cli 0.4.116 → 0.4.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/init.js +7 -3
  2. package/package.json +1 -1
package/dist/init.js CHANGED
@@ -166,10 +166,14 @@ export function isPristineBareDeck(dir) {
166
166
  }
167
167
  }
168
168
  // Repoint a deck's entry at an imported deck's main module.
169
+ //
170
+ // Writes the SAME index.html `init --kit` writes, rather than swapping the bare
171
+ // stub's script tag: a kit mounts React into `<div id="root">`, which the bare
172
+ // page has no element for -- the result was a deck that loaded the kit and
173
+ // rendered nothing -- and the bare page also lacks the dark color-scheme
174
+ // declaration, so it painted white before the kit's CSS arrived.
169
175
  export function adoptImportEntry(deckDir, alias, mainFile) {
170
- const file = path.join(deckDir, 'index.html');
171
- const html = fs.readFileSync(file, 'utf8');
172
- fs.writeFileSync(file, html.replace(/<script type="module" src="[^"]*"><\/script>/, `<script type="module" src="/${IMPORTS_DIR}/${alias}/${mainFile}"></script>`), 'utf8');
176
+ writeDeckIndexHtml(deckDir, alias, path.basename(deckDir), mainFile);
173
177
  fs.rmSync(path.join(deckDir, 'game.js'), { force: true });
174
178
  }
175
179
  function scaffoldBare(projectDir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "castle-web-cli",
3
- "version": "0.4.116",
3
+ "version": "0.4.117",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "castle-web": "./dist/index.js"