@nimbus-sh/cli 0.1.3 → 0.1.4

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.
@@ -16,7 +16,7 @@
16
16
  * print the exact commands to run as a "next steps" trailer.
17
17
  */
18
18
  import { mkdirSync, writeFileSync, existsSync } from 'node:fs';
19
- import { resolve, join, basename } from 'node:path';
19
+ import { resolve, join, basename, relative } from 'node:path';
20
20
  /**
21
21
  * Scaffold a new Nimbus project at the given directory.
22
22
  *
@@ -41,15 +41,16 @@ Options:
41
41
  return 0;
42
42
  }
43
43
  const rawProjectName = args[0];
44
- const projectName = rawProjectName === '.'
45
- ? basename(process.cwd())
46
- : rawProjectName;
47
- if (!projectName || projectName.startsWith('-')) {
44
+ if (!rawProjectName || rawProjectName.startsWith('-')) {
48
45
  process.stderr.write('create-nimbus-app: <project-name> required\n');
49
46
  process.stderr.write('Usage: create-nimbus-app my-app [--name my-worker] [--force]\n');
50
47
  return 64;
51
48
  }
52
49
  const parsed = parseFlags(args.slice(1));
50
+ const target = rawProjectName === '.'
51
+ ? process.cwd()
52
+ : resolve(process.cwd(), rawProjectName);
53
+ const projectName = basename(target);
53
54
  const wranglerName = parsed['--name'] || projectName;
54
55
  const force = '--force' in parsed;
55
56
  const template = parsed['--template'] || 'worker-only';
@@ -57,9 +58,6 @@ Options:
57
58
  process.stderr.write(`create-nimbus-app: unknown template "${template}". Only "worker-only" ships in v0.1.\n`);
58
59
  return 64;
59
60
  }
60
- const target = rawProjectName === '.'
61
- ? process.cwd()
62
- : resolve(process.cwd(), projectName);
63
61
  if (existsSync(target) && !force) {
64
62
  process.stderr.write(`create-nimbus-app: directory exists: ${target} (use --force to overwrite)\n`);
65
63
  return 73;
@@ -72,12 +70,13 @@ Options:
72
70
  writeFileSync(join(target, 'README.md'), renderReadme(projectName, wranglerName));
73
71
  writeFileSync(join(target, '.gitignore'), '.wrangler\nnode_modules\ndist\n');
74
72
  writeFileSync(join(target, 'tsconfig.json'), renderTsconfig());
73
+ const cdTarget = renderCdTarget(target);
75
74
  // Stdout — JSON for machine, friendly stderr for humans.
76
75
  process.stdout.write(JSON.stringify({
77
76
  ok: true,
78
77
  path: target,
79
78
  nextSteps: [
80
- `cd ${projectName}`,
79
+ `cd ${cdTarget}`,
81
80
  'npm install',
82
81
  `CLOUDFLARE_ACCOUNT_ID=<account-id> npx @nimbus-sh/cli setup cloudflare --name ${wranglerName}`,
83
82
  'npx wrangler secret put JWT_SECRET',
@@ -88,7 +87,7 @@ Options:
88
87
  ✨ Scaffolded ${projectName} at ${target}
89
88
 
90
89
  Next steps:
91
- cd ${projectName}
90
+ cd ${cdTarget}
92
91
  npm install
93
92
  CLOUDFLARE_ACCOUNT_ID=<account-id> npx @nimbus-sh/cli setup cloudflare --name ${wranglerName}
94
93
  npx wrangler secret put JWT_SECRET # paste a 32+ char hex secret
@@ -105,6 +104,14 @@ Docs: https://github.com/AshishKumar4/Nimbus#readme
105
104
  return 0;
106
105
  }
107
106
  // ── template renderers ──────────────────────────────────────────────
107
+ function renderCdTarget(target) {
108
+ const rel = relative(process.cwd(), target);
109
+ if (!rel)
110
+ return '.';
111
+ if (!rel.startsWith('..') && !rel.startsWith('/'))
112
+ return rel;
113
+ return target;
114
+ }
108
115
  function renderPackageJson(name) {
109
116
  return JSON.stringify({
110
117
  name,
package/dist/version.d.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  * `require('./package.json')` because that breaks under bun's
4
4
  * single-file binary mode.
5
5
  */
6
- export declare const CLI_VERSION = "0.1.3";
6
+ export declare const CLI_VERSION = "0.1.4";
7
7
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * `require('./package.json')` because that breaks under bun's
4
4
  * single-file binary mode.
5
5
  */
6
- export const CLI_VERSION = '0.1.3';
6
+ export const CLI_VERSION = '0.1.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbus-sh/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Nimbus CLI — `create-nimbus-app` scaffolder + `token mint` + `runtime sync`.",
5
5
  "homepage": "https://github.com/AshishKumar4/Nimbus",
6
6
  "repository": {