nx-factory-cli 2.1.25 → 2.1.26

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/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
- import { printBanner } from "./ui.js";
4
- import { initCommand } from "./commands/init.js";
3
+ import { createRequire } from "node:module";
5
4
  import { addAppCommand } from "./commands/add-app.js";
5
+ import { addAuthCommand } from "./commands/add-auth.js";
6
6
  import { addComponentCommand } from "./commands/add-component.js";
7
- import { removeComponentCommand } from "./commands/remove-component.js";
8
- import { updateCommand } from "./commands/update.js";
9
- import { listCommand } from "./commands/list.js";
10
- import { doctorCommand } from "./commands/doctor.js";
11
7
  import { addLibCommand } from "./commands/add-lib.js";
12
8
  import { addStorybookCommand } from "./commands/add-storybook.js";
9
+ import { doctorCommand } from "./commands/doctor.js";
10
+ import { initCommand } from "./commands/init.js";
11
+ import { listCommand } from "./commands/list.js";
12
+ import { cleanupMigrationBackups, migrateCommand } from "./commands/migrate.js";
13
13
  import { publishCommand } from "./commands/publish.js";
14
- import { addAuthCommand } from "./commands/add-auth.js";
15
- import { migrateCommand } from "./commands/migrate.js";
16
- import { createRequire } from "module";
14
+ import { removeComponentCommand } from "./commands/remove-component.js";
15
+ import { updateCommand } from "./commands/update.js";
16
+ import { printBanner } from "./ui.js";
17
17
  const _require = createRequire(import.meta.url);
18
18
  const _pkg = _require("../package.json");
19
19
  const program = new Command();
@@ -101,5 +101,48 @@ program
101
101
  .option("-y, --yes", "Skip confirmation prompts")
102
102
  .option("--dry-run", "Preview what would be changed without writing anything")
103
103
  .action(migrateCommand);
104
+ program
105
+ .command("cleanup-backups")
106
+ .description("Delete all .migration-backup files left by a previous migrate run")
107
+ .option("--dry-run", "Preview which files would be deleted without deleting them")
108
+ .action(async (opts) => {
109
+ const { requireMonorepoRoot, MonorepoRootNotFoundError } = await import("./resolve-root.js");
110
+ const { printError, printSuccess, c } = await import("./ui.js");
111
+ let root;
112
+ try {
113
+ root = await requireMonorepoRoot();
114
+ }
115
+ catch (err) {
116
+ if (err instanceof MonorepoRootNotFoundError) {
117
+ printError({
118
+ title: "Could not find workspace root",
119
+ detail: String(err),
120
+ recovery: [{ label: "", cmd: "cd <workspace-root>" }],
121
+ });
122
+ }
123
+ else {
124
+ printError({
125
+ title: "Unexpected error",
126
+ detail: String(err),
127
+ recovery: [],
128
+ });
129
+ }
130
+ process.exit(1);
131
+ }
132
+ const count = await cleanupMigrationBackups(root, opts.dryRun);
133
+ if (count === 0) {
134
+ console.log(`\n ${c.green("✓")} No .migration-backup files found.\n`);
135
+ }
136
+ else if (opts.dryRun) {
137
+ console.log(`\n ${c.dim("○")} Would delete ${count} .migration-backup file(s). Run without --dry-run to apply.\n`);
138
+ }
139
+ else {
140
+ printSuccess({
141
+ title: `Deleted ${count} .migration-backup file(s)`,
142
+ commands: [],
143
+ tips: [],
144
+ });
145
+ }
146
+ });
104
147
  program.parse();
105
148
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAA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M,CAAC,CAAC;IAC/D,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACzE,CAAC;SAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CACV,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,KAAK,+DAA+D,CACvG,CAAC;IACH,CAAC;SAAM,CAAC;QACP,YAAY,CAAC;YACZ,KAAK,EAAE,WAAW,KAAK,4BAA4B;YACnD,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;SACR,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,CAAC,CAAC;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -1,54 +1,88 @@
1
1
  /**
2
- * tsconfigs.ts — single source of truth for every tsconfig shape the CLI writes.
3
- *
4
- * Rules that govern the choices below:
5
- *
6
- * ROOT tsconfig.base.json
7
- * "module": "NodeNext" / "moduleResolution": "NodeNext"
8
- * the CLI itself uses NodeNext, and apps compiled by Next.js / tsc directly
9
- * also use NodeNext. All relative imports in source must end with .js.
10
- * — baseUrl + paths live here so every package and app inherits them without
11
- * repeating the mapping.
12
- *
13
- * PACKAGE tsconfig.json (internal or public)
14
- * Extends ../../tsconfig.base.json inherits paths, strict, target.
15
- * Overrides only what the package specifically needs (jsx, lib, outDir).
16
- *
17
- * Internal (private: true in package.json)
18
- * no `declaration` / `declarationMap` needed in theory, but we keep them
19
- * so IDEs get go-to-definition inside the monorepo.
20
- * composite: true + incremental for fast Nx caching.
21
- *
22
- * Public (to be published to npm)
23
- * — declaration + declarationMap required by consumers.
24
- * composite: true for project references.
25
- * — stripInternal: true so @internal JSDoc strips from .d.ts.
26
- * — no `rootDir` override needed because extend covers it.
27
- *
28
- * APP tsconfig.json
29
- * Extends ../../tsconfig.base.json.
30
- * Each framework adds its own lib / jsx overrides.
31
- * No packages/**\/* in `include` — paths handles resolution, and polluting
32
- * include causes duplicate type-checking and false errors.
2
+ * tsconfigs.ts — single source of truth for every tsconfig file the CLI writes.
3
+ *
4
+ * ── Architecture of the generated workspace ───────────────────────────────────
5
+ *
6
+ * The CLI scaffolds a `packages/typescript` workspace package at init time.
7
+ * It is a private, never-built package whose only purpose is to own and
8
+ * distribute the shared tsconfig presets for the whole monorepo.
9
+ *
10
+ * my-monorepo/
11
+ * ├── tsconfig.base.json ← strict settings + global paths (no module/resolution)
12
+ * ├── tsconfig.json ← solution file: references all packages + apps
13
+ * └── packages/
14
+ * └── typescript/ ← workspace package: @scope/typescript
15
+ * ├── package.json ← private: true, exports all tsconfig files
16
+ * ├── tsconfig.base.json ← re-exports root base (one hop)
17
+ * ├── tsconfig.internal.json ESNext + Bundler, noEmit — for source-only packages
18
+ * ├── tsconfig.package.json ← NodeNext + NodeNext, composite for published packages
19
+ * ├── tsconfig.nextjs.json ← ESNext + Bundler, jsx:preserve, Next.js plugin
20
+ * ├── tsconfig.vite.json ← ESNext + Bundler, jsx:react-jsx
21
+ * ├── tsconfig.remix.json ← ESNext + Bundler, jsx:react-jsx
22
+ * └── tsconfig.expo.json ← ESNext + Bundler, jsx:react-native
23
+ *
24
+ * Packages and apps extend like this:
25
+ *
26
+ * packages/ui/tsconfig.json:
27
+ * { "extends": "@scope/typescript/tsconfig.internal.json" }
28
+ *
29
+ * apps/dashboard/tsconfig.json:
30
+ * { "extends": "@scope/typescript/tsconfig.nextjs.json" }
31
+ *
32
+ * ── Two strategies for packages ───────────────────────────────────────────────
33
+ *
34
+ * INTERNAL (private: true, never published):
35
+ * - noEmit: true — no dist/, no build script, no build step ever
36
+ * - Consumed via path alias: @scope/pkg → packages/pkg/index.ts (source)
37
+ * - ESNext + Bundler: the bundler (Vite/Next.js/esbuild) handles resolution
38
+ * at app build time, so no .js extensions needed in source imports
39
+ *
40
+ * PUBLIC (published to npm):
41
+ * - Emits to dist/ via tsc
42
+ * - NodeNext + NodeNext: Node.js ESM requires .js extensions in source
43
+ * - composite + incremental for Nx project reference caching
44
+ *
45
+ * ── The root tsconfig.base.json ───────────────────────────────────────────────
46
+ * Only holds: target, strict flags, esModuleInterop, isolatedModules, and
47
+ * the global paths map. Does NOT set module or moduleResolution — those
48
+ * belong in the per-preset files inside packages/typescript/.
33
49
  */
34
50
  import type { PackageVisibility } from "./config.js";
35
51
  export type { PackageVisibility };
52
+ export type AppFramework = "nextjs" | "vite" | "remix" | "expo";
36
53
  export declare function rootTsConfigBase(scope: string): object;
54
+ /**
55
+ * Returns the package.json for the @scope/typescript workspace package.
56
+ * Private, never published. Its exports point at the tsconfig preset files
57
+ * so other packages can extend them by package name.
58
+ */
59
+ export declare function typescriptPackageJson(scope: string): object;
60
+ /**
61
+ * Returns a map of filename → content for every file inside packages/typescript/.
62
+ * Written by `init` and regenerated by `migrate`.
63
+ */
64
+ export declare function typescriptPresets(): Record<string, object>;
37
65
  interface PackageTsConfigOptions {
38
66
  scope: string;
39
67
  pkgName: string;
40
68
  visibility: PackageVisibility;
41
- /** true for React component packages — adds jsx and DOM lib */
69
+ /** true for React packages — adds jsx:react-jsx and DOM lib */
42
70
  react?: boolean;
43
- /** Relative path from package dir to workspace root, default "../../" */
44
- rootRelative?: string;
45
71
  }
46
72
  export declare function packageTsConfig(opts: PackageTsConfigOptions): object;
47
- type AppFramework = "nextjs" | "vite" | "remix" | "expo";
48
73
  interface AppTsConfigOptions {
49
74
  scope: string;
50
75
  framework: AppFramework;
51
76
  hasSrcDir: boolean;
77
+ /**
78
+ * Whether packages/typescript/ exists in the workspace.
79
+ * Falls back to ../../tsconfig.base.json for pre-migration workspaces.
80
+ * Defaults to true — all new workspaces have it.
81
+ */
82
+ typescriptPkgExists?: boolean;
52
83
  }
53
84
  export declare function appTsConfig(opts: AppTsConfigOptions): object;
85
+ export declare function rootTsConfigSolution(packages: string[], apps: string[]): object;
86
+ /** @deprecated Use typescriptPresets() instead */
87
+ export declare const toolingPresets: typeof typescriptPresets;
54
88
  //# sourceMappingURL=tsconfigs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfigs.d.ts","sourceRoot":"","sources":["../src/tsconfigs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAIlC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA6BtD;AAID,UAAU,sBAAsB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CA4CpE;AAID,KAAK,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzD,UAAU,kBAAkB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,YAAY,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CA6B5D"}
1
+ {"version":3,"file":"tsconfigs.d.ts","sourceRoot":"","sources":["../src/tsconfigs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;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