@nexusts/cli 0.8.3 → 0.9.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.
@@ -4,27 +4,17 @@
4
4
  * Unlike `nx new <name>` — which requires a fresh, empty directory —
5
5
  * `nx init` is non-destructive: it skips files that already exist,
6
6
  * preserves the user's existing `package.json` (only adding the
7
- * `nexusjs` dependency if missing), and merges its `tsconfig.json`
7
+ * nexusjs dependency if missing), and merges its `tsconfig.json`
8
8
  * additions into the user's existing config.
9
9
  *
10
- * The matching pattern from other ecosystems:
11
- * - `bun init` / `npm init` → init in the current directory
12
- * - `cargo init` → init in the current directory
13
- * - `nx new <name>` → create a fresh project in a new dir
14
- *
15
10
  * Typical use case: the user already ran `bun init` (or has an
16
11
  * existing app) and now wants to add NexusTS to it without losing
17
12
  * their existing setup.
18
13
  *
19
- * $ bun init
20
- * $ bun add nexusjs
21
- * $ nx init
22
- * $ bun run dev
23
- *
24
14
  * Flags:
25
15
  * --target <dir> Scaffold into <dir> instead of the cwd
26
16
  * --style <name> Routing style (nest|adonis|functional)
27
- * --view <name> View engine (rendu|edge|eta|inertia|none)
17
+ * --view <name> View engine (rendu|edge|eta|inertia|none)
28
18
  * --orm <name> ORM driver (drizzle|prisma|kysely|none)
29
19
  * --db <name> Database driver (bun-sqlite|node-sqlite|libsql|postgres|mysql|none)
30
20
  * --frontend <name> Inertia frontend (react|vue|svelte|solid)
@@ -1,12 +1,12 @@
1
1
  /**
2
- * `nx new <name>` — scaffold a new project.
2
+ * `nx new <name>` — create a new NexusTS project in a fresh directory.
3
3
  *
4
- * Creates a fresh directory with `nx.config.ts`, `package.json`,
5
- * `tsconfig.json`, `app/main.ts`, and a README. Useful as a
6
- * starting point for kicking off a new app without `bun create`.
4
+ * Unlike `nx init` (which merges into existing files), `nx new` requires
5
+ * the target directory to not exist. It creates a complete project from
6
+ * scratch.
7
7
  *
8
- * This is intentionally minimal — it does not run `bun install`. After
9
- * generation, the user runs `bun install` themselves.
8
+ * nx new my-app
9
+ * nx new my-app --style nest --view inertia --orm drizzle --db bun-sqlite
10
10
  */
11
11
  import type { Command } from "../core/index.js";
12
12
  export declare const newCommand: Command;
@@ -9,6 +9,7 @@ export * from "./loose-json.js";
9
9
  export * from "./prompts.js";
10
10
  export * from "./template.js";
11
11
  export { VERSION } from "./version.js";
12
+ export { ensureDirectories, computeDeps, buildPackageJson, generateProjectFiles } from "./scaffold.js";
12
13
  /**
13
14
  * The CLI command contract. Every command module exports a default
14
15
  * `Command` object that the entry point dispatches against.
@@ -0,0 +1,38 @@
1
+ export interface ScaffoldOptions {
2
+ target: string;
3
+ name: string;
4
+ routing: string;
5
+ view: string;
6
+ orm: string;
7
+ db: string;
8
+ frontend: string;
9
+ ssr: boolean;
10
+ dbUrl: string;
11
+ }
12
+ /**
13
+ * Create the directory structure for a new NexusTS project.
14
+ */
15
+ export declare function ensureDirectories(target: string, view: string): void;
16
+ /**
17
+ * Compute dependencies based on project options.
18
+ */
19
+ export declare function computeDeps(view: string, orm: string, db: string, frontend: string): {
20
+ deps: Record<string, string>;
21
+ devDeps: Record<string, string>;
22
+ };
23
+ /**
24
+ * Build a default package.json object.
25
+ */
26
+ export declare function buildPackageJson(name: string, deps: Record<string, string>, devDeps: Record<string, string>, view?: string, frontend?: string): Record<string, any>;
27
+ /**
28
+ * Generate an nx.config.ts file.
29
+ */
30
+ export declare function generateNxConfig(target: string, opts: ScaffoldOptions): void;
31
+ /**
32
+ * Generate a drizzle.config.ts file (only when ORM is drizzle).
33
+ */
34
+ export declare function generateDrizzleConfig(target: string, db: string, dbUrl: string): void;
35
+ /**
36
+ * Generate all project template files.
37
+ */
38
+ export declare function generateProjectFiles(target: string, opts: ScaffoldOptions): string[];