33This project uses two runtime modes:
44
55- Local development mode: dynamic CDN resolution from ` src/modules/cdn.js ` with esm.sh as default.
6- - Production mode: CDN-first build artifacts in ` dist ` , with ` build:esm ` as the current preferred deploy build .
6+ - Production mode: CDN-first build artifacts in ` dist ` , with ` npm run build` defaulting to ESM unless ` KNIGHTED_PRIMARY_CDN ` is set .
77
88## Local Development
99
@@ -29,6 +29,7 @@ Select a different production primary CDN at build time:
2929``` sh
3030KNIGHTED_PRIMARY_CDN=esm npm run build
3131KNIGHTED_PRIMARY_CDN=jspmGa npm run build
32+ KNIGHTED_PRIMARY_CDN=importMap npm run build
3233```
3334
3435Convenience scripts are also available:
@@ -44,25 +45,29 @@ npm run build:importmap-mode
4445<!-- prettier-ignore-start -->
4546| Mode | Resolver | Import map step | JSPM index needed | Typical use |
4647| --- | --- | --- | --- | --- |
47- | ` importMap ` | Import map in ` dist/index.html ` | Yes | Yes | Default production mode |
48- | ` esm ` | ` src/modules/cdn.js ` (` esm.sh ` primary) | No | No | Stable fallback mode |
48+ | ` importMap ` | Import map in ` dist/index.html ` | Yes | Yes | JSPM-indexed release builds |
49+ | ` esm ` | ` src/modules/cdn.js ` (` esm.sh ` primary) | No | No | Current default and deploy mode |
4950| ` jspmGa ` | ` src/modules/cdn.js ` (` ga.jspm.io ` primary) | No | No | Direct ga.jspm.io testing |
5051<!-- prettier-ignore-end -->
5152
5253Mode notes:
5354
5455- ` importMap ` : Import-map mode when JSPM has indexed the required graph.
55- - ` esm ` : Current preferred deploy build mode.
56+ - ` esm ` : Current default ` build ` mode and preferred deploy build mode.
5657- ` jspmGa ` : Direct ga.jspm.io URL mode without import-map generation.
5758
58- This runs two steps:
59+ ` npm run build ` runs five steps:
5960
60611 . ` npm run build:prepare `
6162
6263- Copies ` src ` to ` dist `
6364- Injects ` window.__KNIGHTED_PRIMARY_CDN__ ` into ` dist/index.html `
6465
65- 2 . ` npm run build:importmap `
66+ 2 . ` npm run build:css `
67+
68+ - Bundles and minifies ` dist/styles.css ` with Lightning CSS
69+
70+ 3 . ` npm run build:importmap `
6671
6772- Runs only when ` KNIGHTED_PRIMARY_CDN=importMap `
6873- Runs ` jspm link ` with ` --provider jspm.io `
@@ -74,6 +79,15 @@ This runs two steps:
7479- Traces generated ` dist/prod-imports.js `
7580- Import specifiers come from ` importMap ` entries in ` src/modules/cdn.js ` (` cdnImportSpecs ` )
7681
82+ 4 . ` npm run build:js `
83+
84+ - Minifies ` dist/**/*.js ` and ` dist/**/*.mjs ` with esbuild
85+ - Uses syntax + whitespace minification only (no identifier mangling)
86+
87+ 5 . ` npm run build:html `
88+
89+ - Minifies ` dist/index.html ` with ` html-minifier-terser `
90+
7791Preview the built site locally:
7892
7993``` sh
@@ -86,11 +100,13 @@ End-to-end tests run against a preview build by default:
86100npm run test:e2e
87101```
88102
89- This command builds with ` build:esm ` first, then runs Playwright against the preview server.
103+ This command forces ` KNIGHTED_PRIMARY_CDN=esm ` and runs ` npm run build ` first, then runs Playwright against the preview server.
104+
105+ ` preview ` also forces an ESM build (` KNIGHTED_PRIMARY_CDN=esm npm run build ` ) before serving ` dist ` .
90106
91107## CI And Deployment
92108
93- - CI workflow (` .github/workflows/ci.yml ` ) installs dependencies, runs lint, and runs ` npm run build ` .
109+ - CI workflow (` .github/workflows/ci.yml ` ) installs dependencies, runs lint, and runs ` npm run build:esm ` .
94110- Deploy workflow (` .github/workflows/deploy.yml ` ) builds the production site and publishes ` dist ` to GitHub Pages.
95111
96112## Notes
0 commit comments