@reckona/create-mreact-app 0.0.94 → 0.0.96

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 CHANGED
@@ -3,9 +3,27 @@
3
3
  Project scaffolder for mreact app-router applications.
4
4
 
5
5
  ```bash
6
- npx @reckona/create-mreact-app my-app --template app-router
6
+ npx @reckona/create-mreact-app my-app --template basic
7
7
  ```
8
8
 
9
+ ## Interactive setup
10
+
11
+ Run the command in a terminal and leave options out, and `create-mreact-app`
12
+ prompts for the missing ones with an arrow-key wizard (project directory,
13
+ template, package manager, `src/app` layout, deploy target):
14
+
15
+ ```bash
16
+ npx @reckona/create-mreact-app
17
+ ```
18
+
19
+ Only the options you did not pass as flags are prompted for; anything supplied
20
+ on the command line is used as-is. When every option is provided, or when the
21
+ command runs without an interactive terminal (pipes, CI), it scaffolds without
22
+ prompting, so existing scripts keep working unchanged. The package manager
23
+ choice defaults to the one that invoked the command (detected from
24
+ `npm_config_user_agent`). The wizard uses only Node.js built-ins -- it adds no
25
+ dependencies.
26
+
9
27
  Upgrade an existing project in place:
10
28
 
11
29
  ```bash
@@ -17,36 +35,37 @@ Generated apps include an explicit `vite.config.ts` with the mreact router plugi
17
35
 
18
36
  ## Templates
19
37
 
20
- - `basic`
21
- - `app-router`
22
- - `app-router-tailwind`
23
- - `cloudflare`
24
- - `dashboard`
25
-
26
- The `cloudflare` template uses the deployable Worker emitted by `mreact-router build --target=cloudflare` at `.mreact/cloudflare/worker.mjs`, so dynamic and non-prerendered pages do not need a hand-written Worker entrypoint or a bundler-specific `import.meta.glob` transform. The generated `dev` script builds the Worker before starting Wrangler, includes `@cloudflare/workers-types`, and writes a `worker-env.d.ts` stub plus a commented R2 binding example so loaders and route handlers can use `context.env`. For Cloudflare Pages advanced mode, run `mreact-router package cloudflare-pages --from .mreact --out .mreact/pages` after the Cloudflare build and deploy `.mreact/pages` with `wrangler pages deploy`.
38
+ The template selects the starting app content. Deploy targets (including
39
+ Cloudflare) are chosen separately with `--deploy`; see [Deploy](#deploy).
27
40
 
28
- The `dashboard` template adds Tailwind CSS, auth guards, a working demo login (`demo@example.com` / `kanban1234`), query cache hydration, and a development devtools overlay.
41
+ - `basic` -- router + TypeScript starter (default)
42
+ - `tailwind` -- adds Tailwind CSS
43
+ - `dashboard` -- full demo: Tailwind, auth guards, a working demo login (`demo@example.com` / `kanban1234`), query cache hydration, and a development devtools overlay
29
44
 
30
45
  When the target directory is inside a pnpm workspace that contains local `@reckona/*` packages, generated `@reckona/*` dependency ranges use `workspace:*` so in-repo examples exercise the checked-out source instead of the npm registry.
31
46
 
32
47
  When that workspace includes `examples/*` and you scaffold directly under `examples/<name>`, the generated package name follows the repository convention: `@reckona/example-<name>`. For example:
33
48
 
34
49
  ```bash
35
- npx @reckona/create-mreact-app examples/ai-chat --template app-router-tailwind --src-dir --pm pnpm
50
+ npx @reckona/create-mreact-app examples/ai-chat --template tailwind --src-dir --pm pnpm
36
51
  ```
37
52
 
38
- The Tailwind app-router template also includes the query, reactive DOM, and test utility packages needed for non-trivial interactive examples, plus `vitest`, `@playwright/test`, and `tsx` for local test-driven workflows.
53
+ The `tailwind` template also includes the query, reactive DOM, and test utility packages needed for non-trivial interactive examples, plus `vitest`, `@playwright/test`, and `tsx` for local test-driven workflows.
39
54
 
40
55
  For pnpm projects, generated `package.json` files include `pnpm.onlyBuiltDependencies` for the native tooling packages used by the starter. If you add a native package such as `better-sqlite3`, add that package name to `pnpm.onlyBuiltDependencies`, then run `pnpm rebuild <package>` or reinstall.
41
56
 
42
57
  ## Options
43
58
 
44
59
  ```bash
45
- npx @reckona/create-mreact-app my-app --template app-router-tailwind --pm pnpm
60
+ npx @reckona/create-mreact-app my-app --template tailwind --pm pnpm
46
61
  ```
47
62
 
48
63
  Supported package managers are `pnpm`, `npm`, and `bun`.
49
64
 
65
+ Run the command in a terminal with options left out and it prompts for the
66
+ missing ones interactively; with everything supplied (or no TTY) it scaffolds
67
+ without prompts. See [Interactive setup](#interactive-setup).
68
+
50
69
  ## Upgrade
51
70
 
52
71
  `create-mreact-app upgrade` reads `package.json`, updates `@reckona/mreact*` dependency ranges to the current package version, adds `@reckona/mreact-router/app-router-globals` to `tsconfig.json` for existing app-router projects, and reports registered codemods for the version range being crossed. Use `--dry-run` to inspect changes without writing `package.json` or `tsconfig.json`, `--from <version>` when the source version is known, and `--to <version>` to target a specific release.
@@ -54,10 +73,15 @@ Supported package managers are `pnpm`, `npm`, and `bun`.
54
73
  Deployment scaffolds:
55
74
 
56
75
  ```bash
76
+ npx @reckona/create-mreact-app my-app --deploy cloudflare
57
77
  npx @reckona/create-mreact-app my-app --deploy container
58
78
  npx @reckona/create-mreact-app my-app --deploy aws-lambda
59
79
  ```
60
80
 
81
+ Deploy targets are mutually exclusive and combine with any template (for example `--template tailwind --deploy cloudflare`).
82
+
83
+ `--deploy cloudflare` uses the deployable Worker emitted by `mreact-router build --target=cloudflare` at `.mreact/cloudflare/worker.mjs`, so dynamic and non-prerendered pages do not need a hand-written Worker entrypoint or a bundler-specific `import.meta.glob` transform. The generated `dev` script builds the Worker before starting Wrangler, includes `@cloudflare/workers-types`, and writes a `worker-env.d.ts` stub plus a commented R2 binding example so loaders and route handlers can use `context.env`. For Cloudflare Pages advanced mode, run `mreact-router package cloudflare-pages --from .mreact --out .mreact/pages` after the Cloudflare build and deploy `.mreact/pages` with `wrangler pages deploy`.
84
+
61
85
  `--deploy container` adds a generic Node 24 container image for Cloud Run, AWS
62
86
  App Runner, and similar platforms, with production builds pinned to `mreact-router build --target=node`. `--deploy aws-lambda` adds a Lambda handler starting point and defaults production builds to `mreact-router build --target=aws-lambda` plus `mreact-router package aws-lambda --from .mreact --out .lambda --skip-runtime-dependency-check` for API Gateway HTTP API v2 and Lambda Function URL payload format 2.0.
63
87
 
@@ -68,7 +92,7 @@ Package Lambda deployments from a minimal asset directory, not the full project
68
92
  Use `--src-dir` to generate a larger-app layout:
69
93
 
70
94
  ```bash
71
- npx @reckona/create-mreact-app my-app --template app-router --src-dir
95
+ npx @reckona/create-mreact-app my-app --template basic --src-dir
72
96
  ```
73
97
 
74
98
  That creates `src/app` for routes, `src/lib` for shared application code, and
@@ -2,11 +2,15 @@ import { type CreateMreactAppDeployTarget, type CreateMreactAppPackageManager, t
2
2
  export interface CreateMreactAppCreateCliOptions {
3
3
  command: "create";
4
4
  deploy?: CreateMreactAppDeployTarget | undefined;
5
- directory: string;
5
+ /** Undefined when no positional directory was given (the wizard will prompt). */
6
+ directory?: string | undefined;
6
7
  help?: boolean | undefined;
7
- packageManager: CreateMreactAppPackageManager;
8
- srcDir: boolean;
9
- template: CreateMreactAppTemplate;
8
+ /** Undefined when `--pm` was not passed (the wizard will prompt). */
9
+ packageManager?: CreateMreactAppPackageManager | undefined;
10
+ /** Undefined when `--src-dir` was not passed (the wizard will prompt). */
11
+ srcDir?: boolean | undefined;
12
+ /** Undefined when `--template` was not passed (the wizard will prompt). */
13
+ template?: CreateMreactAppTemplate | undefined;
10
14
  }
11
15
  export interface CreateMreactAppUpgradeCliOptions {
12
16
  command: "upgrade";
@@ -1 +1 @@
1
- {"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC7B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,cAAc,EAAE,6BAA6B,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,uBAAuB,CAAC;CACnC;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;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,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,MAAM,yBAAyB,GACjC,+BAA+B,GAC/B,gCAAgC,CAAC;AAErC,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,yBAAyB,CA+F9F;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CA8BhD;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,6BAA6B,CAAC;IAC9C,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GAAG,MAAM,CA6BT"}
package/dist/cli-args.js CHANGED
@@ -4,10 +4,10 @@ export function parseCreateMreactAppCliArgs(args) {
4
4
  return parseUpgradeArgs(args.slice(1));
5
5
  }
6
6
  const directories = [];
7
- let template = "app-router";
8
- let packageManager = "pnpm";
7
+ let template;
8
+ let packageManager;
9
9
  let deploy;
10
- let srcDir = false;
10
+ let srcDir;
11
11
  for (let index = 0; index < args.length; index += 1) {
12
12
  const arg = args[index];
13
13
  if (arg === "--") {
@@ -18,7 +18,7 @@ export function parseCreateMreactAppCliArgs(args) {
18
18
  return {
19
19
  command: "create",
20
20
  deploy,
21
- directory: directories[0] ?? "mreact-app",
21
+ directory: directories[0],
22
22
  help: true,
23
23
  packageManager,
24
24
  srcDir,
@@ -73,7 +73,7 @@ export function parseCreateMreactAppCliArgs(args) {
73
73
  return {
74
74
  command: "create",
75
75
  deploy,
76
- directory: directories[0] ?? "mreact-app",
76
+ directory: directories[0],
77
77
  packageManager,
78
78
  srcDir,
79
79
  template,
@@ -85,10 +85,14 @@ export function createMreactAppHelpText() {
85
85
  " create-mreact-app [directory] [options]",
86
86
  " create-mreact-app upgrade [directory] [options]",
87
87
  "",
88
+ "Run in a terminal with options left out and create-mreact-app prompts for",
89
+ "them interactively. With every option supplied (or no TTY) it runs without",
90
+ "prompts, so scripts and CI keep working unchanged.",
91
+ "",
88
92
  "Options:",
89
- ` --template <name> Template to generate: ${createMreactAppTemplates.join(", ")}. Default: app-router.`,
93
+ ` --template <name> App template: ${createMreactAppTemplates.join(", ")}. Default: basic.`,
90
94
  " --pm, --package-manager <pm> Package manager for generated scripts: pnpm, npm, or bun. Default: pnpm.",
91
- " --deploy <target> Add deploy files: container or aws-lambda.",
95
+ " --deploy <target> Deploy target: cloudflare, container, or aws-lambda.",
92
96
  " --src-dir Generate routes under src/app instead of app.",
93
97
  " -h, --help Show this help message.",
94
98
  "",
@@ -99,7 +103,8 @@ export function createMreactAppHelpText() {
99
103
  "",
100
104
  "Examples:",
101
105
  " create-mreact-app my-app",
102
- " create-mreact-app my-app --template app-router-tailwind --src-dir",
106
+ " create-mreact-app my-app --template tailwind --src-dir",
107
+ " create-mreact-app my-app --deploy cloudflare",
103
108
  " create-mreact-app my-app --deploy container",
104
109
  " create-mreact-app my-app --deploy aws-lambda",
105
110
  " create-mreact-app upgrade --dry-run",
@@ -200,11 +205,7 @@ function readOptionValue(args, index, name) {
200
205
  return value;
201
206
  }
202
207
  function parseTemplate(value) {
203
- if (value === "basic" ||
204
- value === "app-router" ||
205
- value === "app-router-tailwind" ||
206
- value === "cloudflare" ||
207
- value === "dashboard") {
208
+ if (value === "basic" || value === "tailwind" || value === "dashboard") {
208
209
  return value;
209
210
  }
210
211
  throw new Error(`Unknown template ${JSON.stringify(value)}. Available templates: ${createMreactAppTemplates.join(", ")}`);
@@ -216,9 +217,9 @@ function parsePackageManager(value) {
216
217
  throw new Error(`Unknown package manager ${JSON.stringify(value)}. Use pnpm, npm, or bun.`);
217
218
  }
218
219
  function parseDeployTarget(value) {
219
- if (value === "aws-lambda" || value === "container") {
220
+ if (value === "aws-lambda" || value === "cloudflare" || value === "container") {
220
221
  return value;
221
222
  }
222
- throw new Error(`Unknown deploy target ${JSON.stringify(value)}. Use aws-lambda or container.`);
223
+ throw new Error(`Unknown deploy target ${JSON.stringify(value)}. Use cloudflare, container, or aws-lambda.`);
223
224
  }
224
225
  //# sourceMappingURL=cli-args.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,YAAY,CAAC;AAyBpB,MAAM,UAAU,2BAA2B,CAAC,IAAuB;IACjE,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,QAAQ,GAA4B,YAAY,CAAC;IACrD,IAAI,cAAc,GAAkC,MAAM,CAAC;IAC3D,IAAI,MAA+C,CAAC;IACpD,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAExB,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM;QACR,CAAC;QAED,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACrC,OAAO;gBACL,OAAO,EAAE,QAAQ;gBACjB,MAAM;gBACN,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,YA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SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC9F,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAyB;IAClD,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAClG,CAAC","sourcesContent":["import {\n createMreactAppTemplates,\n type CreateMreactAppDeployTarget,\n type CreateMreactAppPackageManager,\n type CreateMreactAppTemplate,\n} from \"./index.js\";\n\nexport interface CreateMreactAppCreateCliOptions {\n command: \"create\";\n deploy?: CreateMreactAppDeployTarget | undefined;\n directory: string;\n help?: boolean | undefined;\n packageManager: CreateMreactAppPackageManager;\n srcDir: boolean;\n template: CreateMreactAppTemplate;\n}\n\nexport interface CreateMreactAppUpgradeCliOptions {\n command: \"upgrade\";\n directory: string;\n dryRun?: boolean | undefined;\n fromVersion?: string | undefined;\n help?: boolean | undefined;\n targetVersion?: string | undefined;\n}\n\nexport type CreateMreactAppCliOptions =\n | CreateMreactAppCreateCliOptions\n | CreateMreactAppUpgradeCliOptions;\n\nexport function parseCreateMreactAppCliArgs(args: readonly string[]): CreateMreactAppCliOptions {\n if (args[0] === \"upgrade\") {\n return parseUpgradeArgs(args.slice(1));\n }\n\n const directories: string[] = [];\n let template: CreateMreactAppTemplate = \"app-router\";\n let packageManager: CreateMreactAppPackageManager = \"pnpm\";\n let deploy: CreateMreactAppDeployTarget | undefined;\n let srcDir = false;\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n\n if (arg === \"--\") {\n directories.push(...args.slice(index + 1));\n break;\n }\n\n if (arg === \"--help\" || arg === \"-h\") {\n return {\n command: \"create\",\n deploy,\n directory: directories[0] ?? \"mreact-app\",\n help: true,\n packageManager,\n srcDir,\n template,\n };\n }\n\n if (arg === \"--template\") {\n template = parseTemplate(readOptionValue(args, index, \"template\"));\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--template=\")) {\n template = parseTemplate(arg.slice(\"--template=\".length));\n continue;\n }\n\n if (arg === \"--pm\" || arg === \"--package-manager\") {\n packageManager = parsePackageManager(readOptionValue(args, index, \"package manager\"));\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--pm=\")) {\n packageManager = parsePackageManager(arg.slice(\"--pm=\".length));\n continue;\n }\n\n if (arg?.startsWith(\"--package-manager=\")) {\n packageManager = parsePackageManager(arg.slice(\"--package-manager=\".length));\n continue;\n }\n\n if (arg === \"--deploy\") {\n deploy = parseDeployTarget(readOptionValue(args, index, \"deploy target\"));\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--deploy=\")) {\n deploy = parseDeployTarget(arg.slice(\"--deploy=\".length));\n continue;\n }\n\n if (arg === \"--src-dir\") {\n srcDir = true;\n continue;\n }\n\n if (arg?.startsWith(\"-\")) {\n throw new Error(`Unknown option ${arg}.`);\n }\n\n if (arg !== undefined) {\n directories.push(arg);\n }\n }\n\n if (directories.length > 1) {\n throw new Error(`Expected one target directory, received ${directories.length}.`);\n }\n\n return {\n command: \"create\",\n deploy,\n directory: directories[0] ?? \"mreact-app\",\n packageManager,\n srcDir,\n template,\n };\n}\n\nexport function createMreactAppHelpText(): string {\n return [\n \"Usage:\",\n \" create-mreact-app [directory] [options]\",\n \" create-mreact-app upgrade [directory] [options]\",\n \"\",\n \"Options:\",\n ` --template <name> Template to generate: ${createMreactAppTemplates.join(\", \")}. Default: app-router.`,\n \" --pm, --package-manager <pm> Package manager for generated scripts: pnpm, npm, or bun. Default: pnpm.\",\n \" --deploy <target> Add deploy files: container or aws-lambda.\",\n \" --src-dir Generate routes under src/app instead of app.\",\n \" -h, --help Show this help message.\",\n \"\",\n \"Upgrade options:\",\n \" --dry-run Report dependency and codemod changes without writing package.json.\",\n \" --from <version> Version the project is upgrading from.\",\n \" --to <version> Target mreact package version. Default: current create-mreact-app version.\",\n \"\",\n \"Examples:\",\n \" create-mreact-app my-app\",\n \" create-mreact-app my-app --template app-router-tailwind --src-dir\",\n \" create-mreact-app my-app --deploy container\",\n \" create-mreact-app my-app --deploy aws-lambda\",\n \" create-mreact-app upgrade --dry-run\",\n ].join(\"\\n\");\n}\n\nexport function createMreactAppSuccessText(options: {\n directory: string;\n displayDirectory: string;\n packageManager: CreateMreactAppPackageManager;\n template: CreateMreactAppTemplate;\n}): string {\n const installCommand =\n options.packageManager === \"npm\"\n ? \"npm install\"\n : options.packageManager === \"bun\"\n ? \"bun install\"\n : \"pnpm install\";\n const devCommand =\n options.packageManager === \"npm\"\n ? \"npm run dev\"\n : options.packageManager === \"bun\"\n ? \"bun run dev\"\n : \"pnpm dev\";\n const dashboardNote =\n options.template === \"dashboard\"\n ? [\"\", \"Demo account:\", \" demo@example.com / kanban1234\"]\n : [];\n\n return [\n `Created mreact app in ${options.directory} (template: ${options.template})`,\n \"\",\n \"Next steps:\",\n ` cd ${options.displayDirectory}`,\n ` ${installCommand}`,\n ` ${devCommand}`,\n \"\",\n \"Then open http://localhost:3001/.\",\n ...dashboardNote,\n ].join(\"\\n\");\n}\n\nfunction parseUpgradeArgs(args: readonly string[]): CreateMreactAppUpgradeCliOptions {\n const directories: string[] = [];\n let dryRun = false;\n let fromVersion: string | undefined;\n let targetVersion: string | undefined;\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n\n if (arg === \"--\") {\n directories.push(...args.slice(index + 1));\n break;\n }\n\n if (arg === \"--help\" || arg === \"-h\") {\n return {\n command: \"upgrade\",\n directory: directories[0] ?? \".\",\n dryRun,\n fromVersion,\n help: true,\n targetVersion,\n };\n }\n\n if (arg === \"--dry-run\") {\n dryRun = true;\n continue;\n }\n\n if (arg === \"--from\") {\n fromVersion = readOptionValue(args, index, \"from version\");\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--from=\")) {\n fromVersion = arg.slice(\"--from=\".length);\n continue;\n }\n\n if (arg === \"--to\") {\n targetVersion = readOptionValue(args, index, \"target version\");\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--to=\")) {\n targetVersion = arg.slice(\"--to=\".length);\n continue;\n }\n\n if (arg?.startsWith(\"-\")) {\n throw new Error(`Unknown option ${arg}.`);\n }\n\n if (arg !== undefined) {\n directories.push(arg);\n }\n }\n\n if (directories.length > 1) {\n throw new Error(`Expected one target directory, received ${directories.length}.`);\n }\n\n return {\n command: \"upgrade\",\n directory: directories[0] ?? \".\",\n dryRun,\n fromVersion,\n targetVersion,\n };\n}\n\nfunction readOptionValue(args: readonly string[], index: number, name: string): string {\n const value = args[index + 1];\n\n if (value === undefined || value.startsWith(\"-\")) {\n throw new Error(`Missing value for ${name}.`);\n }\n\n return value;\n}\n\nfunction parseTemplate(value: string | undefined): CreateMreactAppTemplate {\n if (\n value === \"basic\" ||\n value === \"app-router\" ||\n value === \"app-router-tailwind\" ||\n value === \"cloudflare\" ||\n value === \"dashboard\"\n ) {\n return value;\n }\n\n throw new Error(\n `Unknown template ${JSON.stringify(value)}. Available templates: ${createMreactAppTemplates.join(\", \")}`,\n );\n}\n\nfunction parsePackageManager(value: string | undefined): CreateMreactAppPackageManager {\n if (value === \"pnpm\" || value === \"npm\" || value === \"bun\") {\n return value;\n }\n\n throw new Error(`Unknown package manager ${JSON.stringify(value)}. Use pnpm, npm, or bun.`);\n}\n\nfunction parseDeployTarget(value: string | undefined): CreateMreactAppDeployTarget {\n if (value === \"aws-lambda\" || value === \"container\") {\n return value;\n }\n\n throw new Error(`Unknown deploy target ${JSON.stringify(value)}. Use aws-lambda or container.`);\n}\n"]}
1
+ {"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,YAAY,CAAC;AA6BpB,MAAM,UAAU,2BAA2B,CAAC,IAAuB;IACjE,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;QAC1B,OA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AE9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,GAAG,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAC,KAAyB;IAC9C,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QACvE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,KAAK,CACb,oBAAoB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,0BAA0B,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzG,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAyB;IACpD,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC9F,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAyB;IAClD,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,KAAK,CACb,yBAAyB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,6CAA6C,CAC5F,CAAC;AACJ,CAAC","sourcesContent":["import {\n createMreactAppTemplates,\n type CreateMreactAppDeployTarget,\n type CreateMreactAppPackageManager,\n type CreateMreactAppTemplate,\n} from \"./index.js\";\n\nexport interface CreateMreactAppCreateCliOptions {\n command: \"create\";\n deploy?: CreateMreactAppDeployTarget | undefined;\n /** Undefined when no positional directory was given (the wizard will prompt). */\n directory?: string | undefined;\n help?: boolean | undefined;\n /** Undefined when `--pm` was not passed (the wizard will prompt). */\n packageManager?: CreateMreactAppPackageManager | undefined;\n /** Undefined when `--src-dir` was not passed (the wizard will prompt). */\n srcDir?: boolean | undefined;\n /** Undefined when `--template` was not passed (the wizard will prompt). */\n template?: CreateMreactAppTemplate | undefined;\n}\n\nexport interface CreateMreactAppUpgradeCliOptions {\n command: \"upgrade\";\n directory: string;\n dryRun?: boolean | undefined;\n fromVersion?: string | undefined;\n help?: boolean | undefined;\n targetVersion?: string | undefined;\n}\n\nexport type CreateMreactAppCliOptions =\n | CreateMreactAppCreateCliOptions\n | CreateMreactAppUpgradeCliOptions;\n\nexport function parseCreateMreactAppCliArgs(args: readonly string[]): CreateMreactAppCliOptions {\n if (args[0] === \"upgrade\") {\n return parseUpgradeArgs(args.slice(1));\n }\n\n const directories: string[] = [];\n let template: CreateMreactAppTemplate | undefined;\n let packageManager: CreateMreactAppPackageManager | undefined;\n let deploy: CreateMreactAppDeployTarget | undefined;\n let srcDir: boolean | undefined;\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n\n if (arg === \"--\") {\n directories.push(...args.slice(index + 1));\n break;\n }\n\n if (arg === \"--help\" || arg === \"-h\") {\n return {\n command: \"create\",\n deploy,\n directory: directories[0],\n help: true,\n packageManager,\n srcDir,\n template,\n };\n }\n\n if (arg === \"--template\") {\n template = parseTemplate(readOptionValue(args, index, \"template\"));\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--template=\")) {\n template = parseTemplate(arg.slice(\"--template=\".length));\n continue;\n }\n\n if (arg === \"--pm\" || arg === \"--package-manager\") {\n packageManager = parsePackageManager(readOptionValue(args, index, \"package manager\"));\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--pm=\")) {\n packageManager = parsePackageManager(arg.slice(\"--pm=\".length));\n continue;\n }\n\n if (arg?.startsWith(\"--package-manager=\")) {\n packageManager = parsePackageManager(arg.slice(\"--package-manager=\".length));\n continue;\n }\n\n if (arg === \"--deploy\") {\n deploy = parseDeployTarget(readOptionValue(args, index, \"deploy target\"));\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--deploy=\")) {\n deploy = parseDeployTarget(arg.slice(\"--deploy=\".length));\n continue;\n }\n\n if (arg === \"--src-dir\") {\n srcDir = true;\n continue;\n }\n\n if (arg?.startsWith(\"-\")) {\n throw new Error(`Unknown option ${arg}.`);\n }\n\n if (arg !== undefined) {\n directories.push(arg);\n }\n }\n\n if (directories.length > 1) {\n throw new Error(`Expected one target directory, received ${directories.length}.`);\n }\n\n return {\n command: \"create\",\n deploy,\n directory: directories[0],\n packageManager,\n srcDir,\n template,\n };\n}\n\nexport function createMreactAppHelpText(): string {\n return [\n \"Usage:\",\n \" create-mreact-app [directory] [options]\",\n \" create-mreact-app upgrade [directory] [options]\",\n \"\",\n \"Run in a terminal with options left out and create-mreact-app prompts for\",\n \"them interactively. With every option supplied (or no TTY) it runs without\",\n \"prompts, so scripts and CI keep working unchanged.\",\n \"\",\n \"Options:\",\n ` --template <name> App template: ${createMreactAppTemplates.join(\", \")}. Default: basic.`,\n \" --pm, --package-manager <pm> Package manager for generated scripts: pnpm, npm, or bun. Default: pnpm.\",\n \" --deploy <target> Deploy target: cloudflare, container, or aws-lambda.\",\n \" --src-dir Generate routes under src/app instead of app.\",\n \" -h, --help Show this help message.\",\n \"\",\n \"Upgrade options:\",\n \" --dry-run Report dependency and codemod changes without writing package.json.\",\n \" --from <version> Version the project is upgrading from.\",\n \" --to <version> Target mreact package version. Default: current create-mreact-app version.\",\n \"\",\n \"Examples:\",\n \" create-mreact-app my-app\",\n \" create-mreact-app my-app --template tailwind --src-dir\",\n \" create-mreact-app my-app --deploy cloudflare\",\n \" create-mreact-app my-app --deploy container\",\n \" create-mreact-app my-app --deploy aws-lambda\",\n \" create-mreact-app upgrade --dry-run\",\n ].join(\"\\n\");\n}\n\nexport function createMreactAppSuccessText(options: {\n directory: string;\n displayDirectory: string;\n packageManager: CreateMreactAppPackageManager;\n template: CreateMreactAppTemplate;\n}): string {\n const installCommand =\n options.packageManager === \"npm\"\n ? \"npm install\"\n : options.packageManager === \"bun\"\n ? \"bun install\"\n : \"pnpm install\";\n const devCommand =\n options.packageManager === \"npm\"\n ? \"npm run dev\"\n : options.packageManager === \"bun\"\n ? \"bun run dev\"\n : \"pnpm dev\";\n const dashboardNote =\n options.template === \"dashboard\"\n ? [\"\", \"Demo account:\", \" demo@example.com / kanban1234\"]\n : [];\n\n return [\n `Created mreact app in ${options.directory} (template: ${options.template})`,\n \"\",\n \"Next steps:\",\n ` cd ${options.displayDirectory}`,\n ` ${installCommand}`,\n ` ${devCommand}`,\n \"\",\n \"Then open http://localhost:3001/.\",\n ...dashboardNote,\n ].join(\"\\n\");\n}\n\nfunction parseUpgradeArgs(args: readonly string[]): CreateMreactAppUpgradeCliOptions {\n const directories: string[] = [];\n let dryRun = false;\n let fromVersion: string | undefined;\n let targetVersion: string | undefined;\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n\n if (arg === \"--\") {\n directories.push(...args.slice(index + 1));\n break;\n }\n\n if (arg === \"--help\" || arg === \"-h\") {\n return {\n command: \"upgrade\",\n directory: directories[0] ?? \".\",\n dryRun,\n fromVersion,\n help: true,\n targetVersion,\n };\n }\n\n if (arg === \"--dry-run\") {\n dryRun = true;\n continue;\n }\n\n if (arg === \"--from\") {\n fromVersion = readOptionValue(args, index, \"from version\");\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--from=\")) {\n fromVersion = arg.slice(\"--from=\".length);\n continue;\n }\n\n if (arg === \"--to\") {\n targetVersion = readOptionValue(args, index, \"target version\");\n index += 1;\n continue;\n }\n\n if (arg?.startsWith(\"--to=\")) {\n targetVersion = arg.slice(\"--to=\".length);\n continue;\n }\n\n if (arg?.startsWith(\"-\")) {\n throw new Error(`Unknown option ${arg}.`);\n }\n\n if (arg !== undefined) {\n directories.push(arg);\n }\n }\n\n if (directories.length > 1) {\n throw new Error(`Expected one target directory, received ${directories.length}.`);\n }\n\n return {\n command: \"upgrade\",\n directory: directories[0] ?? \".\",\n dryRun,\n fromVersion,\n targetVersion,\n };\n}\n\nfunction readOptionValue(args: readonly string[], index: number, name: string): string {\n const value = args[index + 1];\n\n if (value === undefined || value.startsWith(\"-\")) {\n throw new Error(`Missing value for ${name}.`);\n }\n\n return value;\n}\n\nfunction parseTemplate(value: string | undefined): CreateMreactAppTemplate {\n if (value === \"basic\" || value === \"tailwind\" || value === \"dashboard\") {\n return value;\n }\n\n throw new Error(\n `Unknown template ${JSON.stringify(value)}. Available templates: ${createMreactAppTemplates.join(\", \")}`,\n );\n}\n\nfunction parsePackageManager(value: string | undefined): CreateMreactAppPackageManager {\n if (value === \"pnpm\" || value === \"npm\" || value === \"bun\") {\n return value;\n }\n\n throw new Error(`Unknown package manager ${JSON.stringify(value)}. Use pnpm, npm, or bun.`);\n}\n\nfunction parseDeployTarget(value: string | undefined): CreateMreactAppDeployTarget {\n if (value === \"aws-lambda\" || value === \"cloudflare\" || value === \"container\") {\n return value;\n }\n\n throw new Error(\n `Unknown deploy target ${JSON.stringify(value)}. Use cloudflare, container, or aws-lambda.`,\n );\n}\n"]}
package/dist/cli.js CHANGED
@@ -1,45 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { resolve } from "node:path";
3
- import { createMreactAppHelpText, createMreactAppSuccessText, parseCreateMreactAppCliArgs, } from "./cli-args.js";
4
- import { createMreactApp, upgradeMreactApp } from "./index.js";
5
- try {
6
- const options = parseCreateMreactAppCliArgs(process.argv.slice(2));
7
- if (options.help === true) {
8
- console.log(createMreactAppHelpText());
9
- process.exit(0);
10
- }
11
- if (options.command === "upgrade") {
12
- const result = await upgradeMreactApp({
13
- directory: resolve(options.directory),
14
- dryRun: options.dryRun,
15
- fromVersion: options.fromVersion,
16
- targetVersion: options.targetVersion,
17
- });
18
- console.log(result.changed
19
- ? `Updated ${result.updatedDependencies.length} mreact dependency range(s).`
20
- : "No mreact dependency ranges needed updating.");
21
- if (result.codemods.length > 0) {
22
- console.log(`Codemods: ${result.codemods.map((codemod) => codemod.id).join(", ")}`);
23
- }
24
- process.exit(0);
25
- }
26
- const result = await createMreactApp({
27
- deploy: options.deploy,
28
- directory: resolve(options.directory),
29
- name: options.directory,
30
- packageManager: options.packageManager,
31
- srcDir: options.srcDir,
32
- template: options.template,
33
- });
34
- console.log(createMreactAppSuccessText({
35
- directory: result.directory,
36
- displayDirectory: options.directory,
37
- packageManager: result.packageManager,
38
- template: result.template,
39
- }));
40
- }
41
- catch (error) {
42
- console.error(error instanceof Error ? error.message : String(error));
43
- process.exitCode = 1;
44
- }
2
+ import { runCreateMreactAppCli } from "./run-cli.js";
3
+ const isTTY = process.stdin.isTTY === true && process.stdout.isTTY === true;
4
+ process.exitCode = await runCreateMreactAppCli(process.argv.slice(2), {
5
+ env: process.env,
6
+ input: process.stdin,
7
+ isTTY,
8
+ output: process.stdout,
9
+ });
45
10
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D,IAAI,CAAC;IACH,MAAM,OAAO,GAAG,2BAA2B,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,E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C,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { resolve } from \"node:path\";\nimport {\n createMreactAppHelpText,\n createMreactAppSuccessText,\n parseCreateMreactAppCliArgs,\n} from \"./cli-args.js\";\nimport { createMreactApp, upgradeMreactApp } from \"./index.js\";\n\ntry {\n const options = parseCreateMreactAppCliArgs(process.argv.slice(2));\n if (options.help === true) {\n console.log(createMreactAppHelpText());\n process.exit(0);\n }\n\n if (options.command === \"upgrade\") {\n const result = await upgradeMreactApp({\n directory: resolve(options.directory),\n dryRun: options.dryRun,\n fromVersion: options.fromVersion,\n targetVersion: options.targetVersion,\n });\n\n console.log(\n result.changed\n ? `Updated ${result.updatedDependencies.length} mreact dependency range(s).`\n : \"No mreact dependency ranges needed updating.\",\n );\n if (result.codemods.length > 0) {\n console.log(`Codemods: ${result.codemods.map((codemod) => codemod.id).join(\", \")}`);\n }\n process.exit(0);\n }\n\n const result = await createMreactApp({\n deploy: options.deploy,\n directory: resolve(options.directory),\n name: options.directory,\n packageManager: options.packageManager,\n srcDir: options.srcDir,\n template: options.template,\n });\n\n console.log(\n createMreactAppSuccessText({\n directory: result.directory,\n displayDirectory: options.directory,\n packageManager: result.packageManager,\n template: result.template,\n }),\n );\n} catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exitCode = 1;\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;AAE5E,OAAO,CAAC,QAAQ,GAAG,MAAM,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACpE,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,KAAK;IACL,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { runCreateMreactAppCli } from \"./run-cli.js\";\n\nconst isTTY = process.stdin.isTTY === true && process.stdout.isTTY === true;\n\nprocess.exitCode = await runCreateMreactAppCli(process.argv.slice(2), {\n env: process.env,\n input: process.stdin,\n isTTY,\n output: process.stdout,\n});\n"]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export type CreateMreactAppTemplate = "basic" | "app-router" | "app-router-tailwind" | "cloudflare" | "dashboard";
1
+ export type CreateMreactAppTemplate = "basic" | "tailwind" | "dashboard";
2
2
  export type CreateMreactAppPackageManager = "pnpm" | "npm" | "bun";
3
- export type CreateMreactAppDeployTarget = "aws-lambda" | "container";
3
+ export type CreateMreactAppDeployTarget = "aws-lambda" | "cloudflare" | "container";
4
4
  export interface CreateMreactAppOptions {
5
5
  deploy?: CreateMreactAppDeployTarget | undefined;
6
6
  directory: string;
@@ -41,7 +41,8 @@ export interface UpgradeMreactAppResult {
41
41
  }
42
42
  export declare function createMreactApp(options: CreateMreactAppOptions): Promise<CreateMreactAppResult>;
43
43
  export declare function upgradeMreactApp(options: UpgradeMreactAppOptions): Promise<UpgradeMreactAppResult>;
44
- export declare const createMreactAppTemplates: readonly ["basic", "app-router", "app-router-tailwind", "cloudflare", "dashboard"];
44
+ export declare const createMreactAppTemplates: readonly ["basic", "tailwind", "dashboard"];
45
+ export declare const createMreactAppDeployTargets: readonly ["cloudflare", "container", "aws-lambda"];
45
46
  export declare const createMreactAppCodemods: readonly [{
46
47
  readonly description: "Normalize app-router import policy examples after the 0.0.16 adapter template changes.";
47
48
  readonly id: "0.0.16-import-policy-normalize";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,uBAAuB,GAC/B,OAAO,GACP,YAAY,GACZ,qBAAqB,GACrB,YAAY,GACZ,WAAW,CAAC;AAEhB,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AACnE,MAAM,MAAM,2BAA2B,GAAG,YAAY,GAAG,WAAW,CAAC;AAErE,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,6BAA6B,GAAG,SAAS,CAAC;IAC3D,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,uBAAuB,GAAG,SAAS,CAAC;CAChD;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,6BAA6B,CAAC;IAC9C,QAAQ,EAAE,uBAAuB,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,gCAAgC;IAC/C,KAAK,EAAE,sBAAsB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE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BAAsB,GAC9B,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
2
2
  import { basename, dirname, join, relative, resolve } from "node:path";
3
3
  const internalPackageVersions = {
4
- "@reckona/mreact-auth": "^0.0.94",
5
- "@reckona/mreact-devtools": "^0.0.94",
6
- "@reckona/mreact-forms": "^0.0.94",
7
- "@reckona/mreact": "^0.0.94",
8
- "@reckona/mreact-query": "^0.0.94",
9
- "@reckona/mreact-reactive-core": "^0.0.94",
4
+ "@reckona/mreact-auth": "^0.0.96",
5
+ "@reckona/mreact-devtools": "^0.0.96",
6
+ "@reckona/mreact-forms": "^0.0.96",
7
+ "@reckona/mreact": "^0.0.96",
8
+ "@reckona/mreact-query": "^0.0.96",
9
+ "@reckona/mreact-reactive-core": "^0.0.96",
10
10
  "@reckona/mreact-reactive-dom": "^0.0.51",
11
- "@reckona/mreact-router": "^0.0.94",
11
+ "@reckona/mreact-router": "^0.0.96",
12
12
  "@reckona/mreact-test-utils": "^0.0.51",
13
13
  };
14
14
  const currentMreactVersion = internalPackageVersions["@reckona/mreact"].replace(/^\^/, "");
@@ -26,7 +26,7 @@ const cloudflareWorkersTypesVersion = "^4.20260522.1";
26
26
  const appRouterGlobalsType = "@reckona/mreact-router/app-router-globals";
27
27
  const pnpmOnlyBuiltDependencies = ["@parcel/watcher", "esbuild", "sharp", "workerd"];
28
28
  export async function createMreactApp(options) {
29
- const template = options.template ?? "app-router";
29
+ const template = options.template ?? "basic";
30
30
  const packageManager = options.packageManager ?? "pnpm";
31
31
  const name = await inferPackageNameForTarget(options.directory, options.name);
32
32
  const workspacePackages = await detectWorkspacePackagesForTarget(options.directory);
@@ -97,11 +97,14 @@ export async function upgradeMreactApp(options) {
97
97
  }
98
98
  export const createMreactAppTemplates = [
99
99
  "basic",
100
- "app-router",
101
- "app-router-tailwind",
102
- "cloudflare",
100
+ "tailwind",
103
101
  "dashboard",
104
102
  ];
103
+ export const createMreactAppDeployTargets = [
104
+ "cloudflare",
105
+ "container",
106
+ "aws-lambda",
107
+ ];
105
108
  export const createMreactAppCodemods = [
106
109
  {
107
110
  description: "Normalize app-router import policy examples after the 0.0.16 adapter template changes.",
@@ -121,18 +124,11 @@ const packageDependencyFields = [
121
124
  "optionalDependencies",
122
125
  ];
123
126
  function templateDefinition(template, name, packageManager, srcDir, deploy, workspacePackages) {
124
- if (template === "basic" || template === "app-router") {
125
- return appRouterTemplate(name, packageManager, workspacePackages, {
126
- cloudflare: false,
127
- dashboard: false,
128
- deploy,
129
- srcDir,
130
- tailwind: false,
131
- });
132
- }
133
- if (template === "app-router-tailwind") {
127
+ // `cloudflare` is a deploy target, orthogonal to the app-content template.
128
+ const cloudflare = deploy === "cloudflare";
129
+ if (template === "tailwind") {
134
130
  return appRouterTemplate(name, packageManager, workspacePackages, {
135
- cloudflare: false,
131
+ cloudflare,
136
132
  dashboard: false,
137
133
  deploy,
138
134
  srcDir,
@@ -141,7 +137,7 @@ function templateDefinition(template, name, packageManager, srcDir, deploy, work
141
137
  }
142
138
  if (template === "dashboard") {
143
139
  return appRouterTemplate(name, packageManager, workspacePackages, {
144
- cloudflare: false,
140
+ cloudflare,
145
141
  dashboard: true,
146
142
  deploy,
147
143
  srcDir,
@@ -149,7 +145,7 @@ function templateDefinition(template, name, packageManager, srcDir, deploy, work
149
145
  });
150
146
  }
151
147
  return appRouterTemplate(name, packageManager, workspacePackages, {
152
- cloudflare: true,
148
+ cloudflare,
153
149
  dashboard: false,
154
150
  deploy,
155
151
  srcDir,
@@ -384,10 +380,13 @@ function packageScripts(packageManager, options) {
384
380
  scripts.build = `${run} prepare:css && ${run} build:css && mreact-router build --target=node`;
385
381
  }
386
382
  if (options.cloudflare) {
383
+ const cloudflareBuild = "mreact-router build --target=cloudflare";
387
384
  scripts.deploy = "wrangler deploy";
388
385
  scripts.dev = `${run} build && wrangler dev`;
389
386
  scripts.preview = `${run} build && wrangler dev`;
390
- scripts.build = "mreact-router build --target=cloudflare";
387
+ scripts.build = options.tailwind
388
+ ? `${run} prepare:css && ${run} build:css && ${cloudflareBuild}`
389
+ : cloudflareBuild;
391
390
  }
392
391
  if (options.deploy === "aws-lambda") {
393
392
  const lambdaBuild = "mreact-router build --target=aws-lambda";