create-what 0.1.2 → 0.2.0
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/index.js +20 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -46,15 +46,24 @@ const dirs = [
|
|
|
46
46
|
];
|
|
47
47
|
dirs.forEach(d => mkdirSync(join(root, d), { recursive: true }));
|
|
48
48
|
|
|
49
|
+
// --- .gitignore ---
|
|
50
|
+
writeFileSync(join(root, '.gitignore'), `node_modules
|
|
51
|
+
dist
|
|
52
|
+
.vite
|
|
53
|
+
.DS_Store
|
|
54
|
+
*.local
|
|
55
|
+
`);
|
|
56
|
+
|
|
49
57
|
// --- package.json ---
|
|
50
58
|
const pkgDeps = {
|
|
51
|
-
'what-framework': '^0.
|
|
59
|
+
'what-framework': '^0.2.0',
|
|
52
60
|
'what-framework-cli': '^0.1.0',
|
|
53
61
|
};
|
|
54
62
|
|
|
55
63
|
const pkgDevDeps = useJSX
|
|
56
64
|
? {
|
|
57
|
-
'what-compiler': '^0.
|
|
65
|
+
'what-compiler': '^0.2.0',
|
|
66
|
+
'@babel/core': '^7.23.0',
|
|
58
67
|
'vite': '^5.0.0',
|
|
59
68
|
}
|
|
60
69
|
: {};
|
|
@@ -107,9 +116,9 @@ export default {
|
|
|
107
116
|
};
|
|
108
117
|
`);
|
|
109
118
|
|
|
110
|
-
// ---
|
|
111
|
-
const appScript = useJSX ? '/app.jsx' : '/app.js';
|
|
112
|
-
writeFileSync(join(root, '
|
|
119
|
+
// --- index.html (root — required by Vite) ---
|
|
120
|
+
const appScript = useJSX ? '/src/app.jsx' : '/src/app.js';
|
|
121
|
+
writeFileSync(join(root, 'index.html'), `<!DOCTYPE html>
|
|
113
122
|
<html lang="en">
|
|
114
123
|
<head>
|
|
115
124
|
<meta charset="UTF-8">
|
|
@@ -433,8 +442,8 @@ ${name}/
|
|
|
433
442
|
layouts/ # Page layouts
|
|
434
443
|
islands/ # Hydrated interactive islands
|
|
435
444
|
${useJSX ? ' app.jsx # App entry point (JSX)' : ' app.js # App entry point'}
|
|
436
|
-
index.html # HTML shell
|
|
437
445
|
public/ # Static assets
|
|
446
|
+
index.html # HTML shell (Vite entry)
|
|
438
447
|
what.config.js # Framework configuration
|
|
439
448
|
${useJSX ? ' vite.config.js # Vite + what-compiler plugin\n' : ''} package.json
|
|
440
449
|
\`\`\`
|
|
@@ -442,10 +451,12 @@ ${useJSX ? ' vite.config.js # Vite + what-compiler plugin\n' : ''} package.
|
|
|
442
451
|
## Learn More
|
|
443
452
|
|
|
444
453
|
- [What Framework docs](https://github.com/aspect/what-fw)
|
|
445
|
-
- JSX authoring: uses \`what-compiler\` to
|
|
454
|
+
- JSX authoring: uses \`what-compiler\` to compile JSX to h() calls through the core reconciler
|
|
446
455
|
- Vanilla authoring: use \`h(tag, props, ...children)\` directly -- zero build step needed
|
|
447
456
|
`);
|
|
448
457
|
|
|
458
|
+
// --- styles.css (move from public/ to root for Vite) ---
|
|
459
|
+
|
|
449
460
|
// --- Done ---
|
|
450
461
|
console.log(` Done! Next steps:\n`);
|
|
451
462
|
console.log(` cd ${name}`);
|
|
@@ -454,7 +465,8 @@ console.log(` npm run dev\n`);
|
|
|
454
465
|
|
|
455
466
|
if (useJSX) {
|
|
456
467
|
console.log(` JSX mode enabled. Components use .jsx extensions.`);
|
|
457
|
-
console.log(` The what-compiler Vite plugin
|
|
468
|
+
console.log(` The what-compiler Vite plugin compiles JSX to h() calls.`);
|
|
469
|
+
console.log(` Open http://localhost:5173 after running dev.\n`);
|
|
458
470
|
} else {
|
|
459
471
|
console.log(` Vanilla mode. Components use h() calls -- no compiler needed.\n`);
|
|
460
472
|
}
|