create-spark-html-app 0.8.1 → 0.8.3
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.
- package/README.md +8 -9
- package/bin/index.js +3 -2
- package/package.json +1 -1
- package/template/index.html +6 -4
- package/template/package.json +2 -1
- package/template/spark.config.js +20 -0
package/README.md
CHANGED
|
@@ -7,9 +7,7 @@ Bun-powered project (dev / build / preview via `spark-html-bun`) wired to
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
# or
|
|
12
|
-
bunx create-spark-html-app my-app
|
|
10
|
+
bunx create-spark-html-app@latest my-app
|
|
13
11
|
```
|
|
14
12
|
|
|
15
13
|
Then:
|
|
@@ -23,7 +21,7 @@ bun run dev
|
|
|
23
21
|
Run it with no name to be prompted:
|
|
24
22
|
|
|
25
23
|
```bash
|
|
26
|
-
|
|
24
|
+
bunx create-spark-html-app@latest
|
|
27
25
|
```
|
|
28
26
|
|
|
29
27
|
## What you get
|
|
@@ -44,10 +42,10 @@ Every included feature ships with a live demo component, ready to run.
|
|
|
44
42
|
Non-interactive? Pass flags instead of answering prompts:
|
|
45
43
|
|
|
46
44
|
```bash
|
|
47
|
-
bunx create-spark-html-app my-app --yes # accept the defaults
|
|
48
|
-
bunx create-spark-html-app my-app --all # everything on
|
|
49
|
-
bunx create-spark-html-app my-app --minimal # core only
|
|
50
|
-
bunx create-spark-html-app my-app --pwa --no-image # per-feature
|
|
45
|
+
bunx create-spark-html-app@latest my-app --yes # accept the defaults
|
|
46
|
+
bunx create-spark-html-app@latest my-app --all # everything on
|
|
47
|
+
bunx create-spark-html-app@latest my-app --minimal # core only
|
|
48
|
+
bunx create-spark-html-app@latest my-app --pwa --no-image # per-feature
|
|
51
49
|
```
|
|
52
50
|
|
|
53
51
|
Everything is plain HTML and JavaScript — no compiler, no virtual DOM, no
|
|
@@ -56,7 +54,8 @@ proprietary file format. Edit a component, save, and the page updates.
|
|
|
56
54
|
## The Spark family
|
|
57
55
|
|
|
58
56
|
Small, single-purpose packages that share one philosophy: no compiler, no
|
|
59
|
-
virtual DOM, no build step required
|
|
57
|
+
virtual DOM, no build step required — built for humans who love hand-writing
|
|
58
|
+
their web apps. Add only what you use.
|
|
60
59
|
|
|
61
60
|
| Package | What it does |
|
|
62
61
|
|---|---|
|
package/bin/index.js
CHANGED
|
@@ -106,6 +106,7 @@ async function prompt(question, fallback) {
|
|
|
106
106
|
const FEATURES = [
|
|
107
107
|
{ key: 'router', question: 'Include router (multi-page SPA)?', def: true, deps: ['spark-html-router'], files: ['public/components/about.html'] },
|
|
108
108
|
{ key: 'theme', question: 'Include theme (dark/light toggle)?', def: true, deps: ['spark-html-theme'], files: [] },
|
|
109
|
+
{ key: 'font', question: 'Include font loading optimizer (no FOUT)?', def: true, deps: ['spark-html-font'], files: [] },
|
|
109
110
|
{ key: 'image', question: 'Include image optimization?', def: true, deps: ['spark-html-image'], files: ['public/components/demo-image.html', 'public/sample.jpg'] },
|
|
110
111
|
{ key: 'sri', question: 'Include SRI integrity checks?', def: true, deps: ['spark-html-sri'], files: [] },
|
|
111
112
|
{ key: 'pwa', question: 'Include PWA support (manifest + offline shell)?', def: false, deps: ['spark-html-manifest'], files: ['public/icon.png'] },
|
|
@@ -122,7 +123,7 @@ async function pickFeatures() {
|
|
|
122
123
|
if (flags.includes(`--no-${f.key}`)) on[f.key] = false;
|
|
123
124
|
}
|
|
124
125
|
// Interactive only on a TTY, and only when no preset flag was given.
|
|
125
|
-
const preset = flags.some((a) => /^--(yes|all|minimal|(no-)?(router|theme|image|sri|pwa))$/.test(a));
|
|
126
|
+
const preset = flags.some((a) => /^--(yes|all|minimal|(no-)?(router|theme|font|image|sri|pwa))$/.test(a));
|
|
126
127
|
if (stdin.isTTY && !preset) {
|
|
127
128
|
for (const f of FEATURES) {
|
|
128
129
|
const hint = f.def ? '(Y/n)' : '(y/N)';
|
|
@@ -181,7 +182,7 @@ function applyFeatures(targetDir, on) {
|
|
|
181
182
|
|
|
182
183
|
async function main() {
|
|
183
184
|
stdout.write(`\n${BOLT} ${c.bold('create-spark-html-app')}\n`);
|
|
184
|
-
stdout.write(`${c.dim(' HTML that reacts — no compiler, no virtual DOM.')}\n\n`);
|
|
185
|
+
stdout.write(`${c.dim(' HTML that reacts. Built for humans — no compiler, no virtual DOM.')}\n\n`);
|
|
185
186
|
|
|
186
187
|
// 1 ─ figure out the target directory ────────────────────────────────
|
|
187
188
|
let targetArg = argv[2];
|
package/package.json
CHANGED
package/template/index.html
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<title>Spark App</title>
|
|
7
7
|
<meta name="description" content="A reactive app built with Spark — single-file HTML components, no compiler, no virtual DOM." />
|
|
8
8
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
<!-- Fonts are injected by spark-html-font/bun (see spark.config.js):
|
|
10
|
+
preconnects, the stylesheet, and a size-adjusted fallback face so the
|
|
11
|
+
swap never moves the page. -->
|
|
12
12
|
<style>
|
|
13
13
|
/* Design system — the same palette and monospace type as the Spark
|
|
14
14
|
website. Tokens + base + a shared card/button/input system live here in
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
--spark-ink: #ffd24a;
|
|
35
35
|
--danger: #ff6b6b;
|
|
36
36
|
--radius: 12px;
|
|
37
|
-
--font
|
|
37
|
+
/* the injected --font-jetbrains-mono stack includes the fallback face;
|
|
38
|
+
the var() fallback list covers a config without the font step */
|
|
39
|
+
--font: var(--font-jetbrains-mono, "JetBrains Mono", ui-monospace, monospace);
|
|
38
40
|
}
|
|
39
41
|
[data-theme="light"] {
|
|
40
42
|
--bg: #fff;
|
package/template/package.json
CHANGED
package/template/spark.config.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import prerender from 'spark-prerender/bun';
|
|
2
|
+
// @spark:theme
|
|
3
|
+
import theme from 'spark-html-theme/bun';
|
|
4
|
+
// @spark:end
|
|
5
|
+
// @spark:font
|
|
6
|
+
import font from 'spark-html-font/bun';
|
|
7
|
+
// @spark:end
|
|
2
8
|
// @spark:image
|
|
3
9
|
import image from 'spark-html-image/bun';
|
|
4
10
|
// @spark:end
|
|
@@ -26,6 +32,20 @@ import sri from 'spark-html-sri/bun';
|
|
|
26
32
|
export default {
|
|
27
33
|
pipeline: [
|
|
28
34
|
prerender({ pages: ['index.html'] }),
|
|
35
|
+
// @spark:theme
|
|
36
|
+
// Bakes the tiny no-flash script into each page (dev too) so the saved /
|
|
37
|
+
// OS theme is on <html> before first paint — no wrong-theme flash on load.
|
|
38
|
+
theme(),
|
|
39
|
+
// @spark:end
|
|
40
|
+
// @spark:font
|
|
41
|
+
// Preconnect + the Google stylesheet + a size-adjusted local fallback
|
|
42
|
+
// face, baked into each page (dev too) — the font swap never moves or
|
|
43
|
+
// visibly reflows the page.
|
|
44
|
+
font({
|
|
45
|
+
fallback: ['ui-monospace', 'monospace'],
|
|
46
|
+
fonts: [{ family: 'JetBrains Mono', google: true, weights: [300, 400, 500, 600, 700, 800] }],
|
|
47
|
+
}),
|
|
48
|
+
// @spark:end
|
|
29
49
|
// @spark:image
|
|
30
50
|
// Every <img> in pages and components: converted to webp/avif at multiple
|
|
31
51
|
// widths, srcset + width/height added (no layout shift), loading="lazy".
|