@modular-react/cli-core 0.1.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.
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +41 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/create-journey.d.ts +17 -0
- package/dist/commands/create-journey.d.ts.map +1 -0
- package/dist/commands/create-journey.js +193 -0
- package/dist/commands/create-journey.js.map +1 -0
- package/dist/commands/create-module.d.ts +17 -0
- package/dist/commands/create-module.d.ts.map +1 -0
- package/dist/commands/create-module.js +112 -0
- package/dist/commands/create-module.js.map +1 -0
- package/dist/commands/create-store.d.ts +9 -0
- package/dist/commands/create-store.d.ts.map +1 -0
- package/dist/commands/create-store.js +68 -0
- package/dist/commands/create-store.js.map +1 -0
- package/dist/commands/init.d.ts +17 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +184 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/naming.d.ts +4 -0
- package/dist/naming.d.ts.map +1 -0
- package/dist/naming.js +15 -0
- package/dist/naming.js.map +1 -0
- package/dist/preset.d.ts +112 -0
- package/dist/preset.d.ts.map +1 -0
- package/dist/preset.js +2 -0
- package/dist/preset.js.map +1 -0
- package/dist/runtime-versions.d.ts +15 -0
- package/dist/runtime-versions.d.ts.map +1 -0
- package/dist/runtime-versions.js +15 -0
- package/dist/runtime-versions.js.map +1 -0
- package/dist/templates/app-shared.d.ts +8 -0
- package/dist/templates/app-shared.d.ts.map +1 -0
- package/dist/templates/app-shared.js +63 -0
- package/dist/templates/app-shared.js.map +1 -0
- package/dist/templates/journey.d.ts +30 -0
- package/dist/templates/journey.d.ts.map +1 -0
- package/dist/templates/journey.js +166 -0
- package/dist/templates/journey.js.map +1 -0
- package/dist/templates/module.d.ts +8 -0
- package/dist/templates/module.d.ts.map +1 -0
- package/dist/templates/module.js +43 -0
- package/dist/templates/module.js.map +1 -0
- package/dist/templates/shell.d.ts +25 -0
- package/dist/templates/shell.d.ts.map +1 -0
- package/dist/templates/shell.js +162 -0
- package/dist/templates/shell.js.map +1 -0
- package/dist/templates/store.d.ts +6 -0
- package/dist/templates/store.d.ts.map +1 -0
- package/dist/templates/store.js +10 -0
- package/dist/templates/store.js.map +1 -0
- package/dist/templates/workspace.d.ts +8 -0
- package/dist/templates/workspace.d.ts.map +1 -0
- package/dist/templates/workspace.js +58 -0
- package/dist/templates/workspace.js.map +1 -0
- package/dist/utils/detect-scope.d.ts +2 -0
- package/dist/utils/detect-scope.d.ts.map +1 -0
- package/dist/utils/detect-scope.js +13 -0
- package/dist/utils/detect-scope.js.map +1 -0
- package/dist/utils/prompt.d.ts +14 -0
- package/dist/utils/prompt.d.ts.map +1 -0
- package/dist/utils/prompt.js +26 -0
- package/dist/utils/prompt.js.map +1 -0
- package/dist/utils/resolve-project.d.ts +9 -0
- package/dist/utils/resolve-project.d.ts.map +1 -0
- package/dist/utils/resolve-project.js +22 -0
- package/dist/utils/resolve-project.js.map +1 -0
- package/dist/utils/transform.d.ts +83 -0
- package/dist/utils/transform.d.ts.map +1 -0
- package/dist/utils/transform.js +250 -0
- package/dist/utils/transform.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add a module import and `registry.register()` call to `shell/src/main.tsx`.
|
|
3
|
+
* Uses string manipulation rather than AST — the file is generated by the
|
|
4
|
+
* same CLI, so its shape is predictable.
|
|
5
|
+
*/
|
|
6
|
+
export declare function addModuleToMain(shellDir: string, params: {
|
|
7
|
+
scope: string;
|
|
8
|
+
moduleName: string;
|
|
9
|
+
importName: string;
|
|
10
|
+
}): void;
|
|
11
|
+
/**
|
|
12
|
+
* Add a module dependency to the shell's `package.json`, sorting deps
|
|
13
|
+
* alphabetically so subsequent additions don't reshuffle the file.
|
|
14
|
+
*/
|
|
15
|
+
export declare function addModuleToShellPackageJson(shellDir: string, params: {
|
|
16
|
+
scope: string;
|
|
17
|
+
moduleName: string;
|
|
18
|
+
}): void;
|
|
19
|
+
/**
|
|
20
|
+
* Add a store interface to `app-shared/src/index.ts` and wire it into
|
|
21
|
+
* `AppDependencies`. Anchored on the `// ---- The contract ----` comment
|
|
22
|
+
* and the `export interface AppDependencies` block the templates emit —
|
|
23
|
+
* if either is missing we bail out rather than producing partial,
|
|
24
|
+
* type-broken edits (a store property pointing at a never-declared
|
|
25
|
+
* interface).
|
|
26
|
+
*/
|
|
27
|
+
export declare function addStoreToAppShared(appSharedDir: string, params: {
|
|
28
|
+
storeName: string;
|
|
29
|
+
interfaceName: string;
|
|
30
|
+
}): void;
|
|
31
|
+
/**
|
|
32
|
+
* Add a store import + entry to `createRegistry({ stores: ... })` in
|
|
33
|
+
* `shell/src/main.tsx`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function addStoreToMain(shellDir: string, params: {
|
|
36
|
+
storeName: string;
|
|
37
|
+
importName: string;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Add a journey package as a dependency on the shell. Keeps deps sorted.
|
|
41
|
+
*/
|
|
42
|
+
export declare function addJourneyToShellPackageJson(shellDir: string, params: {
|
|
43
|
+
scope: string;
|
|
44
|
+
journeyName: string;
|
|
45
|
+
}): void;
|
|
46
|
+
/**
|
|
47
|
+
* Wire a journey into `shell/src/main.tsx`:
|
|
48
|
+
* - import the handle + journey (and persistence binding when requested)
|
|
49
|
+
* - install `journeysPlugin()` via `.use(...)` on the registry (idempotent)
|
|
50
|
+
* - call `registry.registerJourney(<journey>, { persistence })` (the
|
|
51
|
+
* options object is omitted entirely when `persistence` isn't supplied)
|
|
52
|
+
*
|
|
53
|
+
* The transform stays string-based: `main.tsx` is generated by this same
|
|
54
|
+
* CLI so its shape is predictable. If a user reformats the file in ways
|
|
55
|
+
* that break these searches, the function is idempotent — re-running
|
|
56
|
+
* after fixing the shape converges.
|
|
57
|
+
*/
|
|
58
|
+
export declare function addJourneyToMain(shellDir: string, params: {
|
|
59
|
+
scope: string;
|
|
60
|
+
journeyName: string;
|
|
61
|
+
journeyExportName: string;
|
|
62
|
+
handleExportName: string;
|
|
63
|
+
/**
|
|
64
|
+
* When set, also import this binding from
|
|
65
|
+
* `./<journeyName>-persistence.js` and pass it to `registerJourney` as
|
|
66
|
+
* `{ persistence }`.
|
|
67
|
+
*/
|
|
68
|
+
persistenceExportName?: string;
|
|
69
|
+
}): void;
|
|
70
|
+
/**
|
|
71
|
+
* Ensure `pnpm-workspace.yaml` includes the `journeys/*` glob. The CLI's
|
|
72
|
+
* default workspace template already lists `modules/*` and `app-shared`/
|
|
73
|
+
* `shell`; older projects scaffolded before this command landed get
|
|
74
|
+
* `journeys/*` added on first journey creation.
|
|
75
|
+
*
|
|
76
|
+
* Insertion is anchored on the `packages:` block — we walk only the list
|
|
77
|
+
* items that follow it and stop at the first dedented line. Without that
|
|
78
|
+
* anchor, an `onlyBuiltDependencies:` (or any other) yaml list lower in
|
|
79
|
+
* the file would steal the insertion point and we'd quietly add
|
|
80
|
+
* `journeys/*` under the wrong key.
|
|
81
|
+
*/
|
|
82
|
+
export declare function ensureJourneysInWorkspace(projectRoot: string): void;
|
|
83
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/utils/transform.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAChE,IAAI,CAoCN;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC5C,IAAI,CASN;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACnD,IAAI,CAkCN;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAChD,IAAI,CA0BN;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC7C,IAAI,CAcN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE;IACN,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,GACA,IAAI,CAoFN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CA4BnE"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
2
|
+
import { resolve } from "pathe";
|
|
3
|
+
import { RUNTIME_VERSIONS } from "../runtime-versions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Add a module import and `registry.register()` call to `shell/src/main.tsx`.
|
|
6
|
+
* Uses string manipulation rather than AST — the file is generated by the
|
|
7
|
+
* same CLI, so its shape is predictable.
|
|
8
|
+
*/
|
|
9
|
+
export function addModuleToMain(shellDir, params) {
|
|
10
|
+
const mainPath = resolve(shellDir, "src", "main.tsx");
|
|
11
|
+
let content = readFileSync(mainPath, "utf-8");
|
|
12
|
+
const importLine = `import ${params.importName} from '${params.scope}/${params.moduleName}-module'`;
|
|
13
|
+
// Add the import line right after the last existing import.
|
|
14
|
+
const importLines = content.split("\n").filter((line) => line.startsWith("import "));
|
|
15
|
+
const lastImport = importLines[importLines.length - 1];
|
|
16
|
+
content = content.replace(lastImport, `${lastImport}\n${importLine}`);
|
|
17
|
+
// Add registry.register(...) right after the last existing one. If the
|
|
18
|
+
// shell has none yet (first module), fall back to inserting before
|
|
19
|
+
// `registry.resolve(`.
|
|
20
|
+
const lines = content.split("\n");
|
|
21
|
+
let lastRegisterIndex = -1;
|
|
22
|
+
for (let i = 0; i < lines.length; i++) {
|
|
23
|
+
if (lines[i].includes("registry.register(")) {
|
|
24
|
+
lastRegisterIndex = i;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (lastRegisterIndex !== -1) {
|
|
28
|
+
lines.splice(lastRegisterIndex + 1, 0, `registry.register(${params.importName})`);
|
|
29
|
+
content = lines.join("\n");
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const resolveMatch = content.match(/^.*registry\.resolve\(/m);
|
|
33
|
+
if (resolveMatch) {
|
|
34
|
+
content = content.replace(resolveMatch[0], `registry.register(${params.importName})\n\n${resolveMatch[0]}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
writeFileSync(mainPath, content);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Add a module dependency to the shell's `package.json`, sorting deps
|
|
41
|
+
* alphabetically so subsequent additions don't reshuffle the file.
|
|
42
|
+
*/
|
|
43
|
+
export function addModuleToShellPackageJson(shellDir, params) {
|
|
44
|
+
const pkgPath = resolve(shellDir, "package.json");
|
|
45
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
46
|
+
pkg.dependencies = pkg.dependencies || {};
|
|
47
|
+
pkg.dependencies[`${params.scope}/${params.moduleName}-module`] = "workspace:*";
|
|
48
|
+
pkg.dependencies = sortObject(pkg.dependencies);
|
|
49
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Add a store interface to `app-shared/src/index.ts` and wire it into
|
|
53
|
+
* `AppDependencies`. Anchored on the `// ---- The contract ----` comment
|
|
54
|
+
* and the `export interface AppDependencies` block the templates emit —
|
|
55
|
+
* if either is missing we bail out rather than producing partial,
|
|
56
|
+
* type-broken edits (a store property pointing at a never-declared
|
|
57
|
+
* interface).
|
|
58
|
+
*/
|
|
59
|
+
export function addStoreToAppShared(appSharedDir, params) {
|
|
60
|
+
const indexPath = resolve(appSharedDir, "src", "index.ts");
|
|
61
|
+
const content = readFileSync(indexPath, "utf-8");
|
|
62
|
+
const marker = "// ---- The contract ----";
|
|
63
|
+
const appDepsAnchor = "export interface AppDependencies";
|
|
64
|
+
if (!content.includes(marker)) {
|
|
65
|
+
throw new Error(`Could not find "${marker}" in ${indexPath}. Was the file edited away from the CLI's template?`);
|
|
66
|
+
}
|
|
67
|
+
const appDepsIndex = content.indexOf(appDepsAnchor);
|
|
68
|
+
if (appDepsIndex === -1) {
|
|
69
|
+
throw new Error(`Could not find "${appDepsAnchor}" in ${indexPath}. The store cannot be wired without it.`);
|
|
70
|
+
}
|
|
71
|
+
const closingBrace = content.indexOf("}", appDepsIndex);
|
|
72
|
+
if (closingBrace === -1) {
|
|
73
|
+
throw new Error(`Could not find the closing brace of AppDependencies in ${indexPath}.`);
|
|
74
|
+
}
|
|
75
|
+
const storeInterface = `export interface ${params.interfaceName} {\n // TODO: Add store state and actions\n}\n\n`;
|
|
76
|
+
const withInterface = content.replace(marker, storeInterface + marker);
|
|
77
|
+
// Recompute the closing brace against `withInterface` — the interface
|
|
78
|
+
// we just inserted shifts every offset that follows it.
|
|
79
|
+
const shiftedAppDepsIndex = withInterface.indexOf(appDepsAnchor);
|
|
80
|
+
const shiftedClosingBrace = withInterface.indexOf("}", shiftedAppDepsIndex);
|
|
81
|
+
const before = withInterface.slice(0, shiftedClosingBrace);
|
|
82
|
+
const after = withInterface.slice(shiftedClosingBrace);
|
|
83
|
+
const finalContent = before + ` ${params.storeName}: ${params.interfaceName}\n` + after;
|
|
84
|
+
writeFileSync(indexPath, finalContent);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Add a store import + entry to `createRegistry({ stores: ... })` in
|
|
88
|
+
* `shell/src/main.tsx`.
|
|
89
|
+
*/
|
|
90
|
+
export function addStoreToMain(shellDir, params) {
|
|
91
|
+
const mainPath = resolve(shellDir, "src", "main.tsx");
|
|
92
|
+
let content = readFileSync(mainPath, "utf-8");
|
|
93
|
+
const storeImports = content
|
|
94
|
+
.split("\n")
|
|
95
|
+
.filter((line) => /^import \{.*\} from '\.\/stores\//.test(line));
|
|
96
|
+
const lastStoreImport = storeImports[storeImports.length - 1];
|
|
97
|
+
if (lastStoreImport) {
|
|
98
|
+
content = content.replace(lastStoreImport, `${lastStoreImport}\nimport { ${params.importName} } from './stores/${params.storeName}.js'`);
|
|
99
|
+
}
|
|
100
|
+
const storesMatch = content.match(/stores:\s*\{([^}]+)\}/);
|
|
101
|
+
if (storesMatch) {
|
|
102
|
+
const currentStores = storesMatch[1].trim();
|
|
103
|
+
content = content.replace(storesMatch[0], `stores: { ${currentStores}, ${params.storeName}: ${params.importName} }`);
|
|
104
|
+
}
|
|
105
|
+
writeFileSync(mainPath, content);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Add a journey package as a dependency on the shell. Keeps deps sorted.
|
|
109
|
+
*/
|
|
110
|
+
export function addJourneyToShellPackageJson(shellDir, params) {
|
|
111
|
+
const pkgPath = resolve(shellDir, "package.json");
|
|
112
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
113
|
+
pkg.dependencies = pkg.dependencies || {};
|
|
114
|
+
pkg.dependencies[`${params.scope}/${params.journeyName}-journey`] = "workspace:*";
|
|
115
|
+
// Modules-runtime always carries journeys transitively; the shell still
|
|
116
|
+
// wants a direct dep so it can `import { journeysPlugin }` etc.
|
|
117
|
+
if (!pkg.dependencies["@modular-react/journeys"]) {
|
|
118
|
+
pkg.dependencies["@modular-react/journeys"] = RUNTIME_VERSIONS.journeys;
|
|
119
|
+
}
|
|
120
|
+
pkg.dependencies = sortObject(pkg.dependencies);
|
|
121
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Wire a journey into `shell/src/main.tsx`:
|
|
125
|
+
* - import the handle + journey (and persistence binding when requested)
|
|
126
|
+
* - install `journeysPlugin()` via `.use(...)` on the registry (idempotent)
|
|
127
|
+
* - call `registry.registerJourney(<journey>, { persistence })` (the
|
|
128
|
+
* options object is omitted entirely when `persistence` isn't supplied)
|
|
129
|
+
*
|
|
130
|
+
* The transform stays string-based: `main.tsx` is generated by this same
|
|
131
|
+
* CLI so its shape is predictable. If a user reformats the file in ways
|
|
132
|
+
* that break these searches, the function is idempotent — re-running
|
|
133
|
+
* after fixing the shape converges.
|
|
134
|
+
*/
|
|
135
|
+
export function addJourneyToMain(shellDir, params) {
|
|
136
|
+
const mainPath = resolve(shellDir, "src", "main.tsx");
|
|
137
|
+
let content = readFileSync(mainPath, "utf-8");
|
|
138
|
+
// 1. Import the journeys plugin if not already imported.
|
|
139
|
+
if (!content.includes("from '@modular-react/journeys'")) {
|
|
140
|
+
const lines = content.split("\n");
|
|
141
|
+
const lastImportIndex = findLastImportIndex(lines);
|
|
142
|
+
lines.splice(lastImportIndex + 1, 0, `import { journeysPlugin } from '@modular-react/journeys'`);
|
|
143
|
+
content = lines.join("\n");
|
|
144
|
+
}
|
|
145
|
+
// 2. Import the journey + handle.
|
|
146
|
+
const journeyImport = `import { ${params.journeyExportName}, ${params.handleExportName} } from '${params.scope}/${params.journeyName}-journey'`;
|
|
147
|
+
if (!content.includes(`from '${params.scope}/${params.journeyName}-journey'`)) {
|
|
148
|
+
const lines = content.split("\n");
|
|
149
|
+
const lastImportIndex = findLastImportIndex(lines);
|
|
150
|
+
lines.splice(lastImportIndex + 1, 0, journeyImport);
|
|
151
|
+
content = lines.join("\n");
|
|
152
|
+
}
|
|
153
|
+
// 2b. Import the persistence binding (when --persistence was passed).
|
|
154
|
+
const persistencePath = `./${params.journeyName}-persistence.js`;
|
|
155
|
+
if (params.persistenceExportName && !content.includes(`from '${persistencePath}'`)) {
|
|
156
|
+
const lines = content.split("\n");
|
|
157
|
+
const lastImportIndex = findLastImportIndex(lines);
|
|
158
|
+
lines.splice(lastImportIndex + 1, 0, `import { ${params.persistenceExportName} } from '${persistencePath}'`);
|
|
159
|
+
content = lines.join("\n");
|
|
160
|
+
}
|
|
161
|
+
// 3. Install the plugin on the registry. We look for a bare
|
|
162
|
+
// `createRegistry<...>({...})` call and append `.use(journeysPlugin())`
|
|
163
|
+
// if no `.use(` is present yet.
|
|
164
|
+
if (!content.includes("journeysPlugin(")) {
|
|
165
|
+
content = content.replace(/const registry = createRegistry<([\s\S]+?)>\(([\s\S]*?)\}\)(?!\s*\.use)/, (_match, generic, body) => `const registry = createRegistry<${generic}>(${body}}).use(journeysPlugin())`);
|
|
166
|
+
}
|
|
167
|
+
// 4. Append registerJourney(...) after the last registry.register(...) call.
|
|
168
|
+
// When persistence is wired, pass the adapter as the second arg so the
|
|
169
|
+
// runtime actually persists state across reloads.
|
|
170
|
+
const registerCall = params.persistenceExportName
|
|
171
|
+
? `registry.registerJourney(${params.journeyExportName}, { persistence: ${params.persistenceExportName} })`
|
|
172
|
+
: `registry.registerJourney(${params.journeyExportName})`;
|
|
173
|
+
if (!content.includes(`registerJourney(${params.journeyExportName}`)) {
|
|
174
|
+
const lines = content.split("\n");
|
|
175
|
+
let insertAfter = -1;
|
|
176
|
+
for (let i = 0; i < lines.length; i++) {
|
|
177
|
+
if (lines[i].includes("registry.register(") ||
|
|
178
|
+
lines[i].includes("registry.registerJourney(")) {
|
|
179
|
+
insertAfter = i;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (insertAfter !== -1) {
|
|
183
|
+
lines.splice(insertAfter + 1, 0, registerCall);
|
|
184
|
+
content = lines.join("\n");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// 5. Reference the handle in a comment block so a fresh handle import
|
|
188
|
+
// isn't dead-code-eliminated by the editor's auto-cleaner. Modules
|
|
189
|
+
// open journeys via `runtime.start(handle, input)` — see
|
|
190
|
+
// @modular-react/journeys README.
|
|
191
|
+
if (!content.includes(`// Use ${params.handleExportName}`)) {
|
|
192
|
+
content = content.replace(`import { ${params.journeyExportName}, ${params.handleExportName} } from`, `// Use ${params.handleExportName} (typed token) at call sites: runtime.start(${params.handleExportName}, input).\nimport { ${params.journeyExportName}, ${params.handleExportName} } from`);
|
|
193
|
+
}
|
|
194
|
+
writeFileSync(mainPath, content);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Ensure `pnpm-workspace.yaml` includes the `journeys/*` glob. The CLI's
|
|
198
|
+
* default workspace template already lists `modules/*` and `app-shared`/
|
|
199
|
+
* `shell`; older projects scaffolded before this command landed get
|
|
200
|
+
* `journeys/*` added on first journey creation.
|
|
201
|
+
*
|
|
202
|
+
* Insertion is anchored on the `packages:` block — we walk only the list
|
|
203
|
+
* items that follow it and stop at the first dedented line. Without that
|
|
204
|
+
* anchor, an `onlyBuiltDependencies:` (or any other) yaml list lower in
|
|
205
|
+
* the file would steal the insertion point and we'd quietly add
|
|
206
|
+
* `journeys/*` under the wrong key.
|
|
207
|
+
*/
|
|
208
|
+
export function ensureJourneysInWorkspace(projectRoot) {
|
|
209
|
+
const workspacePath = resolve(projectRoot, "pnpm-workspace.yaml");
|
|
210
|
+
if (!existsSync(workspacePath))
|
|
211
|
+
return;
|
|
212
|
+
const content = readFileSync(workspacePath, "utf-8");
|
|
213
|
+
if (content.includes("journeys/*"))
|
|
214
|
+
return;
|
|
215
|
+
const lines = content.split("\n");
|
|
216
|
+
const packagesHeaderIndex = lines.findIndex((line) => /^packages\s*:\s*$/.test(line));
|
|
217
|
+
if (packagesHeaderIndex === -1)
|
|
218
|
+
return;
|
|
219
|
+
let lastPackagesItemIndex = -1;
|
|
220
|
+
for (let i = packagesHeaderIndex + 1; i < lines.length; i++) {
|
|
221
|
+
const line = lines[i];
|
|
222
|
+
if (/^\s+-\s+/.test(line)) {
|
|
223
|
+
lastPackagesItemIndex = i;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (line.trim() === "") {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
// Any other content (e.g. `onlyBuiltDependencies:`) means the
|
|
230
|
+
// packages block is over.
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
if (lastPackagesItemIndex === -1)
|
|
234
|
+
return;
|
|
235
|
+
lines.splice(lastPackagesItemIndex + 1, 0, " - journeys/*");
|
|
236
|
+
writeFileSync(workspacePath, lines.join("\n"));
|
|
237
|
+
}
|
|
238
|
+
function findLastImportIndex(lines) {
|
|
239
|
+
let lastImportIndex = -1;
|
|
240
|
+
for (let i = 0; i < lines.length; i++) {
|
|
241
|
+
if (lines[i].startsWith("import ")) {
|
|
242
|
+
lastImportIndex = i;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return lastImportIndex;
|
|
246
|
+
}
|
|
247
|
+
function sortObject(obj) {
|
|
248
|
+
return Object.fromEntries(Object.entries(obj).sort(([a], [b]) => a.localeCompare(b)));
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/utils/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EA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,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,qBAAqB,GAAG,CAAC,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACvB,SAAS;QACX,CAAC;QACD,8DAA8D;QAC9D,0BAA0B;QAC1B,MAAM;IACR,CAAC;IACD,IAAI,qBAAqB,KAAK,CAAC,CAAC;QAAE,OAAO;IAEzC,KAAK,CAAC,MAAM,CAAC,qBAAqB,GAAG,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC7D,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAwB;IACnD,IAAI,eAAe,GAAG,CAAC,CAAC,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,eAAe,GAAG,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,SAAS,UAAU,CAAI,GAAsB;IAC3C,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@modular-react/cli-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared command implementations and templates for the modular-react CLI binaries (@react-router-modules/cli, @tanstack-react-modules/cli).",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git://github.com/kibertoad/modular-react.git",
|
|
8
|
+
"directory": "packages/cli-core"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@clack/prompts": "^1.2.0",
|
|
27
|
+
"citty": "^0.2.2",
|
|
28
|
+
"pathe": "^2.0.3"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^25.6.0",
|
|
32
|
+
"typescript": "^6.0.2"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=22.0.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc",
|
|
39
|
+
"dev": "tsc --watch",
|
|
40
|
+
"typecheck": "tsc --noEmit"
|
|
41
|
+
}
|
|
42
|
+
}
|