@cmj/create-juice-app 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 (2) hide show
  1. package/index.js +68 -0
  2. package/package.json +31 -0
package/index.js ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // ─────────────────────────────────────────────────────────────────
3
+ // create-juice-app — thin shim that delegates to @cmj/juice CLI
4
+ // Usage: npx create-juice-app my-app [--target bun|node|cloudflare|deno]
5
+ // ─────────────────────────────────────────────────────────────────
6
+
7
+ import { createApp, promptTarget, JuiceCreateError, TARGET_LABELS, DEPLOY_TARGETS } from '@cmj/juice/create';
8
+
9
+ const args = process.argv.slice(2);
10
+
11
+ // Parse --target flag
12
+ function parseTarget(argv) {
13
+ const idx = argv.indexOf('--target');
14
+ if (idx === -1) return undefined;
15
+ const value = argv[idx + 1]?.toLowerCase();
16
+ if (!value || !DEPLOY_TARGETS.includes(value)) {
17
+ console.error(
18
+ `\n 🧃 Invalid target "${value ?? '(empty)'}".` +
19
+ `\n Valid targets: ${DEPLOY_TARGETS.join(', ')}\n`,
20
+ );
21
+ process.exit(1);
22
+ }
23
+ return value;
24
+ }
25
+
26
+ // Filter positional args (skip --target and its value)
27
+ const positional = args.filter((a, i, arr) => a !== '--target' && arr[i - 1] !== '--target');
28
+ const name = positional[0];
29
+
30
+ if (!name || name === '--help' || name === '-h') {
31
+ console.log(`
32
+ 🧃 Create Juice App
33
+
34
+ Usage:
35
+ npx create-juice-app <name>
36
+ npx create-juice-app <name> --target bun|node|cloudflare|deno
37
+
38
+ Examples:
39
+ npx create-juice-app my-app
40
+ npx create-juice-app my-app --target cloudflare
41
+ `);
42
+ process.exit(name ? 0 : 1);
43
+ }
44
+
45
+ try {
46
+ const flagTarget = parseTarget(args);
47
+ const target = flagTarget ?? await promptTarget();
48
+ const result = createApp(name, { target });
49
+
50
+ console.log(`\n 🧃 Created ${result.files.length} files in ./${name}/ (${TARGET_LABELS[result.target]})\n`);
51
+ for (const file of result.files) {
52
+ console.log(` ${file}`);
53
+ }
54
+
55
+ const install = result.target === 'bun' ? 'bun install' : 'npm install';
56
+ const dev = result.target === 'bun' ? 'bun run dev' : 'npm run dev';
57
+
58
+ console.log(`\n Next steps:\n`);
59
+ console.log(` cd ${name}`);
60
+ console.log(` ${install}`);
61
+ console.log(` ${dev}\n`);
62
+ } catch (error) {
63
+ if (error instanceof JuiceCreateError) {
64
+ console.error(`\n 🧃 ${error.message}`);
65
+ process.exit(1);
66
+ }
67
+ throw error;
68
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@cmj/create-juice-app",
3
+ "version": "0.0.1",
4
+ "description": "Create a new Juice app — zero-bloat React 19 RSC framework",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-juice-app": "./index.js"
8
+ },
9
+ "keywords": [
10
+ "create",
11
+ "juice",
12
+ "react",
13
+ "rsc",
14
+ "scaffolder",
15
+ "cli"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/cmj/juice.git",
20
+ "directory": "packages/create-juice-app"
21
+ },
22
+ "homepage": "https://github.com/cmj/juice#readme",
23
+ "author": "cmj",
24
+ "license": "MIT",
25
+ "files": [
26
+ "index.js"
27
+ ],
28
+ "dependencies": {
29
+ "@cmj/juice": ">=0.0.1"
30
+ }
31
+ }