@loom-js/create 0.0.0-stage → 0.1.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.
Files changed (42) hide show
  1. package/README.md +51 -2
  2. package/bin/create.mjs +18 -0
  3. package/dist/index.mjs +1202 -0
  4. package/dist/templates/biome/js/base/public/styles/base.css +17 -0
  5. package/dist/templates/biome/js/base/src/app.js +23 -0
  6. package/dist/templates/biome/js/base/src/pages/about.js +12 -0
  7. package/dist/templates/biome/js/base/src/pages/home.js +22 -0
  8. package/dist/templates/biome/js/base/src/routes.js +3 -0
  9. package/dist/templates/biome/js/server/src/prerender.entry.js +22 -0
  10. package/dist/templates/biome/js/tailwind/scripts/dev.mjs +66 -0
  11. package/dist/templates/biome/js/tailwind/src/app.js +23 -0
  12. package/dist/templates/biome/js/ui/pink/src/pages/home.js +21 -0
  13. package/dist/templates/biome/ts/base/public/styles/base.css +17 -0
  14. package/dist/templates/biome/ts/base/src/app.ts +23 -0
  15. package/dist/templates/biome/ts/base/src/pages/about.ts +12 -0
  16. package/dist/templates/biome/ts/base/src/pages/home.ts +22 -0
  17. package/dist/templates/biome/ts/base/src/routes.ts +3 -0
  18. package/dist/templates/biome/ts/base/src/types.d.ts +4 -0
  19. package/dist/templates/biome/ts/server/src/prerender.entry.ts +26 -0
  20. package/dist/templates/biome/ts/tailwind/scripts/dev.mjs +66 -0
  21. package/dist/templates/biome/ts/tailwind/src/app.ts +23 -0
  22. package/dist/templates/biome/ts/ui/pink/src/pages/home.ts +21 -0
  23. package/dist/templates/prettier/js/base/public/styles/base.css +17 -0
  24. package/dist/templates/prettier/js/base/src/app.js +23 -0
  25. package/dist/templates/prettier/js/base/src/pages/about.js +12 -0
  26. package/dist/templates/prettier/js/base/src/pages/home.js +22 -0
  27. package/dist/templates/prettier/js/base/src/routes.js +3 -0
  28. package/dist/templates/prettier/js/server/src/prerender.entry.js +22 -0
  29. package/dist/templates/prettier/js/tailwind/scripts/dev.mjs +66 -0
  30. package/dist/templates/prettier/js/tailwind/src/app.js +23 -0
  31. package/dist/templates/prettier/js/ui/pink/src/pages/home.js +21 -0
  32. package/dist/templates/prettier/ts/base/public/styles/base.css +17 -0
  33. package/dist/templates/prettier/ts/base/src/app.ts +23 -0
  34. package/dist/templates/prettier/ts/base/src/pages/about.ts +12 -0
  35. package/dist/templates/prettier/ts/base/src/pages/home.ts +22 -0
  36. package/dist/templates/prettier/ts/base/src/routes.ts +3 -0
  37. package/dist/templates/prettier/ts/base/src/types.d.ts +4 -0
  38. package/dist/templates/prettier/ts/server/src/prerender.entry.ts +26 -0
  39. package/dist/templates/prettier/ts/tailwind/scripts/dev.mjs +66 -0
  40. package/dist/templates/prettier/ts/tailwind/src/app.ts +23 -0
  41. package/dist/templates/prettier/ts/ui/pink/src/pages/home.ts +21 -0
  42. package/package.json +51 -3
package/README.md CHANGED
@@ -1,3 +1,52 @@
1
- # Temporary Holding Version
1
+ # @loom-js/create
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Creates a loom app. Run it through your package manager; nothing is installed into your project or globally.
4
+
5
+ ```sh
6
+ npm create @loom-js@latest my-app
7
+ pnpm create @loom-js my-app
8
+ yarn create @loom-js my-app
9
+ bun create @loom-js my-app
10
+ ```
11
+
12
+ The direct forms do the same: `npx @loom-js/create`, `pnpm dlx @loom-js/create`, `yarn dlx @loom-js/create`, `bunx @loom-js/create`. With npm, pass flags after `--` (`npm create @loom-js@latest my-app -- --yes`).
13
+
14
+ Requires Node 20.12 or later.
15
+
16
+ ## What you get
17
+
18
+ By default: a single app that builds with [`@loom-js/build`](https://www.npmjs.com/package/@loom-js/build), server-first (every route prerendered at build time, then hydrated), in TypeScript, formatted with Biome, in a new git repository with one commit, with dependencies installed.
19
+
20
+ ```
21
+ my-app/
22
+ loom.config.ts entry, routes, styles, prerender
23
+ src/app.ts the app: nav + lazily loaded pages
24
+ src/bootstrap.ts the browser entry: dev reload, prime + hydrate
25
+ src/prerender.entry.ts the server module: renders one route
26
+ src/routes.ts the route list the config and prerender read
27
+ src/pages/ home and about
28
+ public/styles/base.css
29
+ ```
30
+
31
+ Then `cd my-app` and run the `dev` script. The README the scaffold writes names every script with your package manager's commands.
32
+
33
+ ## Choices
34
+
35
+ In a terminal, every choice you don't pass as a flag is prompted for. With `--yes`, or when stdin isn't a terminal, unanswered choices take their defaults.
36
+
37
+ | Flag | Default | What it does |
38
+ | ------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
+ | `[directory]` | `loom-app` | Where to create the app. Must be new or empty (a lone `.git` is fine). The package name is its basename, lowercased. |
40
+ | `--layout <single\|monorepo>` | `single` | `monorepo` puts the app at `apps/web` under workspaces, with an empty `packages/` and root scripts that run through the task runner. |
41
+ | `--task-runner <turbo>` | `turbo` | The monorepo's task runner. Implies `--layout monorepo`. |
42
+ | `--spa` | server-first | Client-only rendering: no server module, empty shells, `init` instead of `hydrate`. |
43
+ | `--ui <none\|pink>` | `none` | A UI kit. `pink` adds `@loom-js/pink`, its stylesheets and theme class, and a home page built from pink components. |
44
+ | `--tailwind` | off | Tailwind CSS v4. `build` compiles the stylesheet first; `dev` keeps the Tailwind CLI watching next to `loom dev`. With a UI kit, Tailwind's utilities win over the kit. |
45
+ | `--formatter <none\|biome\|prettier>` | `biome` | `format` / `format:check` scripts. Biome also sorts imports. Prettier comes plain, with no plugins. |
46
+ | `--js` | TypeScript | JavaScript instead: no `tsconfig.json`, no `type-check`, a `jsconfig.json` with the same `@app/*` alias. |
47
+ | `--git <new\|none\|url>` | `new` | `new`: `git init` and one commit. `<url>`: clone the repository and scaffold on top (its `README.md`, `LICENSE` and `.gitignore` are kept; any other clash aborts). Never pushes. |
48
+ | `--install`, `--no-install` | install | Installs with the package manager that ran the command. |
49
+
50
+ ## Versions
51
+
52
+ The scaffold depends on the `@loom-js` versions this release of `@loom-js/create` was tested against, as caret ranges. Every combination of choices is built and type-checked against them before release.
package/bin/create.mjs ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { nodeIo, nodeSpawn, run } from '../dist/index.mjs';
3
+
4
+ run({
5
+ argv: process.argv.slice(2),
6
+ cwd: process.cwd(),
7
+ env: process.env,
8
+ io: nodeIo(),
9
+ spawn: nodeSpawn
10
+ }).then(
11
+ (code) => {
12
+ process.exitCode = code;
13
+ },
14
+ (error) => {
15
+ console.error(error instanceof Error ? error.message : error);
16
+ process.exitCode = 1;
17
+ }
18
+ );