create-rasti 0.0.1

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 (75) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +96 -0
  3. package/bin/create-rasti.js +4 -0
  4. package/extras/cn/README.md +57 -0
  5. package/extras/cn/package.json +9 -0
  6. package/extras/cn/src/index.js +37 -0
  7. package/extras/micro-router/README.md +78 -0
  8. package/extras/micro-router/package-lock.json +26 -0
  9. package/extras/micro-router/package.json +12 -0
  10. package/extras/micro-router/src/index.js +192 -0
  11. package/extras/rasti-icons/README.md +65 -0
  12. package/extras/rasti-icons/bin/rasti-icons.js +84 -0
  13. package/extras/rasti-icons/package.json +11 -0
  14. package/extras/rasti-icons/src/generate.js +119 -0
  15. package/extras/rasti-icons/src/presets.js +57 -0
  16. package/package.json +54 -0
  17. package/src/apply/base.js +29 -0
  18. package/src/apply/cssfun.js +38 -0
  19. package/src/apply/description.js +56 -0
  20. package/src/apply/featuresInclude.js +75 -0
  21. package/src/apply/icons.js +21 -0
  22. package/src/apply/index.js +134 -0
  23. package/src/apply/router.js +50 -0
  24. package/src/apply/ssr.js +29 -0
  25. package/src/apply/static.js +46 -0
  26. package/src/apply/tailwind.js +33 -0
  27. package/src/args.js +55 -0
  28. package/src/cli.js +91 -0
  29. package/src/plan.js +33 -0
  30. package/src/prompts.js +116 -0
  31. package/src/utils/copy.js +21 -0
  32. package/src/utils/exec.js +83 -0
  33. package/src/utils/logger.js +79 -0
  34. package/src/utils/pkg.js +87 -0
  35. package/src/utils/template.js +205 -0
  36. package/src/validate.js +48 -0
  37. package/src/versions.js +17 -0
  38. package/templates/AGENTS.md +48 -0
  39. package/templates/_base/App-cssfun.js +88 -0
  40. package/templates/_base/App-tailwind.js +58 -0
  41. package/templates/_base/App.js +58 -0
  42. package/templates/_base/components/Button-cssfun.js +51 -0
  43. package/templates/_base/components/Button-tailwind.js +52 -0
  44. package/templates/_base/components/Button.js +22 -0
  45. package/templates/_base/components/Header-cssfun.js +69 -0
  46. package/templates/_base/components/Header-tailwind.js +17 -0
  47. package/templates/_base/components/Header.js +17 -0
  48. package/templates/_base/components/Home-cssfun.js +98 -0
  49. package/templates/_base/components/Home-tailwind.js +35 -0
  50. package/templates/_base/components/Home.js +35 -0
  51. package/templates/_base/style.css +170 -0
  52. package/templates/_extras/router/components/About-cssfun.js +43 -0
  53. package/templates/_extras/router/components/About-tailwind.js +14 -0
  54. package/templates/_extras/router/components/About.js +16 -0
  55. package/templates/_extras/router/router-setup.js +60 -0
  56. package/templates/_features/cssfun/index.html +14 -0
  57. package/templates/_features/cssfun/theme.js +60 -0
  58. package/templates/_features/tailwind/style.css +26 -0
  59. package/templates/_features/tailwind/vite.config.js +8 -0
  60. package/templates/spa/index.html +14 -0
  61. package/templates/spa/package.json +17 -0
  62. package/templates/spa/public/.gitkeep +0 -0
  63. package/templates/spa/src/main.js +15 -0
  64. package/templates/spa/vite.config.js +6 -0
  65. package/templates/ssr/app.js +71 -0
  66. package/templates/ssr/index.html +16 -0
  67. package/templates/ssr/package.json +23 -0
  68. package/templates/ssr/public/.gitkeep +0 -0
  69. package/templates/ssr/server.js +7 -0
  70. package/templates/ssr/src/entry-client.js +15 -0
  71. package/templates/ssr/src/entry-server.js +49 -0
  72. package/templates/ssr/vite.config.js +6 -0
  73. package/templates/static/scripts/build-static.js +161 -0
  74. package/templates/static/scripts/serve-static.js +19 -0
  75. package/templates/static/static.config.js +14 -0
@@ -0,0 +1,19 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { createServer } from 'node:http';
4
+ import sirv from 'sirv';
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const dir = path.resolve(__dirname, '..', 'dist', 'static');
8
+ const port = Number(process.env.PORT) || 5173;
9
+
10
+ const handler = sirv(dir, { dev : true });
11
+
12
+ createServer((req, res) => {
13
+ handler(req, res, () => {
14
+ res.statusCode = 404;
15
+ res.end();
16
+ });
17
+ }).listen(port, () => {
18
+ console.log(`Serving dist/static at http://localhost:${port}`);
19
+ });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Routes to pre-render for `npm run build:static`.
3
+ *
4
+ * Each entry is either:
5
+ * - A string path (trailing slash added if missing; output path is derived, e.g. `/about/` -> `about/index.html`).
6
+ * - `{ route: string, output: string }` to fetch `route` and write HTML to `output` under dist/static (e.g. root `404.html`).
7
+ *
8
+ * @type {Array<string | { route: string, output: string }>}
9
+ */
10
+ export default [
11
+ {{STATIC_ROUTES}}
12
+ // Example: custom output file (uncomment and add a /404/ route in the app/router if needed)
13
+ // { route : '/404/', output : '404.html' },
14
+ ];