@intlayer/cli 9.0.0-canary.13 → 9.0.0-canary.15
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/cjs/bundle.cjs +32 -1
- package/dist/cjs/bundle.cjs.map +1 -1
- package/dist/cjs/cli.cjs +145 -120
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -3
- package/dist/cjs/pull.cjs +1 -1
- package/dist/cjs/watch.cjs +22 -2
- package/dist/cjs/watch.cjs.map +1 -1
- package/dist/esm/bundle.mjs +32 -1
- package/dist/esm/bundle.mjs.map +1 -1
- package/dist/esm/cli.mjs +123 -98
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/pull.mjs +1 -1
- package/dist/esm/watch.mjs +22 -2
- package/dist/esm/watch.mjs.map +1 -1
- package/dist/types/bundle.d.ts.map +1 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/watch.d.ts.map +1 -1
- package/package.json +12 -12
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
//#region src/bundle.ts
|
|
4
|
+
/**
|
|
5
|
+
* Computes the tree-shaking defines derived from the project's built
|
|
6
|
+
* dictionaries (unused node types, dictionary selector usage) so the generated
|
|
7
|
+
* bundle drops the corresponding runtime logic, mirroring what the bundler
|
|
8
|
+
* plugins (vite / webpack / esbuild) inject at application build time.
|
|
9
|
+
*
|
|
10
|
+
* Returns an empty object when no dictionary has been built yet: shaking based
|
|
11
|
+
* on an empty dictionary set would mark every node type as unused and strip
|
|
12
|
+
* logic that the runtime content may require.
|
|
13
|
+
*/
|
|
14
|
+
const getDictionaryTreeShakingDefines = async (options) => {
|
|
15
|
+
const { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar } = await import("@intlayer/config/envVars");
|
|
16
|
+
const { getConfiguration } = await import("@intlayer/config/node");
|
|
17
|
+
const { getHasDictionarySelector, getUnusedNodeTypesAsync } = await import("@intlayer/config/utils");
|
|
18
|
+
const { getDictionaries } = await import("@intlayer/dictionaries-entry");
|
|
19
|
+
const dictionaries = getDictionaries(getConfiguration(options.configOptions));
|
|
20
|
+
if (Object.keys(dictionaries).length === 0) return {};
|
|
21
|
+
const wrapKey = (key) => `process.env.${key}`;
|
|
22
|
+
const wrapValue = (value) => `"${value}"`;
|
|
23
|
+
return {
|
|
24
|
+
...formatNodeTypeToEnvVar(await getUnusedNodeTypesAsync(dictionaries), wrapKey, wrapValue),
|
|
25
|
+
...formatDictionarySelectorEnvVar(getHasDictionarySelector(dictionaries), wrapKey, wrapValue)
|
|
26
|
+
};
|
|
27
|
+
};
|
|
4
28
|
const bundle = async (options) => {
|
|
5
29
|
try {
|
|
6
30
|
const { bundleIntlayer } = await import("@intlayer/config/bundle");
|
|
7
|
-
await
|
|
31
|
+
const dictionaryDefines = await getDictionaryTreeShakingDefines(options);
|
|
32
|
+
await bundleIntlayer({
|
|
33
|
+
...options,
|
|
34
|
+
define: {
|
|
35
|
+
...dictionaryDefines,
|
|
36
|
+
...options.define
|
|
37
|
+
}
|
|
38
|
+
});
|
|
8
39
|
} catch (error) {
|
|
9
40
|
console.error("Failed to create bundle:", error);
|
|
10
41
|
process.exit(1);
|
package/dist/cjs/bundle.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.cjs","names":[],"sources":["../../src/bundle.ts"],"sourcesContent":["import type { BundleIntlayerOptions } from '@intlayer/config/bundle';\n\nexport const bundle = async (options: BundleIntlayerOptions): Promise<void> => {\n try {\n // Dynamic import for performance reason\n const { bundleIntlayer } = await import('@intlayer/config/bundle');\n await bundleIntlayer(options);\n } catch (error) {\n console.error('Failed to create bundle:', error);\n process.exit(1);\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.cjs","names":[],"sources":["../../src/bundle.ts"],"sourcesContent":["import type { BundleIntlayerOptions } from '@intlayer/config/bundle';\n\n/**\n * Computes the tree-shaking defines derived from the project's built\n * dictionaries (unused node types, dictionary selector usage) so the generated\n * bundle drops the corresponding runtime logic, mirroring what the bundler\n * plugins (vite / webpack / esbuild) inject at application build time.\n *\n * Returns an empty object when no dictionary has been built yet: shaking based\n * on an empty dictionary set would mark every node type as unused and strip\n * logic that the runtime content may require.\n */\nconst getDictionaryTreeShakingDefines = async (\n options: BundleIntlayerOptions\n): Promise<Record<string, string>> => {\n // Dynamic imports for performance reason\n const { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar } =\n await import('@intlayer/config/envVars');\n const { getConfiguration } = await import('@intlayer/config/node');\n const { getHasDictionarySelector, getUnusedNodeTypesAsync } = await import(\n '@intlayer/config/utils'\n );\n const { getDictionaries } = await import('@intlayer/dictionaries-entry');\n\n const configuration = getConfiguration(options.configOptions);\n const dictionaries = getDictionaries(configuration);\n\n if (Object.keys(dictionaries).length === 0) return {};\n\n const wrapKey = (key: string) => `process.env.${key}`;\n const wrapValue = (value: string) => `\"${value}\"`;\n\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n return {\n // Tree shaking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes, wrapKey, wrapValue),\n // Tree shaking the dictionary selector logic (collections / variants)\n ...formatDictionarySelectorEnvVar(\n getHasDictionarySelector(dictionaries),\n wrapKey,\n wrapValue\n ),\n };\n};\n\nexport const bundle = async (options: BundleIntlayerOptions): Promise<void> => {\n try {\n // Dynamic import for performance reason\n const { bundleIntlayer } = await import('@intlayer/config/bundle');\n\n const dictionaryDefines = await getDictionaryTreeShakingDefines(options);\n\n await bundleIntlayer({\n ...options,\n define: {\n ...dictionaryDefines,\n // Caller-supplied defines take precedence\n ...options.define,\n },\n });\n } catch (error) {\n console.error('Failed to create bundle:', error);\n process.exit(1);\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,kCAAkC,OACtC,YACoC;CAEpC,MAAM,EAAE,gCAAgC,2BACtC,MAAM,OAAO;CACf,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,MAAM,EAAE,0BAA0B,4BAA4B,MAAM,OAClE;CAEF,MAAM,EAAE,oBAAoB,MAAM,OAAO;CAGzC,MAAM,eAAe,gBADC,iBAAiB,QAAQ,cACG,CAAC;AAEnD,KAAI,OAAO,KAAK,aAAa,CAAC,WAAW,EAAG,QAAO,EAAE;CAErD,MAAM,WAAW,QAAgB,eAAe;CAChD,MAAM,aAAa,UAAkB,IAAI,MAAM;AAI/C,QAAO;EAEL,GAAG,uBAAuB,MAJE,wBAAwB,aAAa,EAItB,SAAS,UAAU;EAE9D,GAAG,+BACD,yBAAyB,aAAa,EACtC,SACA,UACD;EACF;;AAGH,MAAa,SAAS,OAAO,YAAkD;AAC7E,KAAI;EAEF,MAAM,EAAE,mBAAmB,MAAM,OAAO;EAExC,MAAM,oBAAoB,MAAM,gCAAgC,QAAQ;AAExE,QAAM,eAAe;GACnB,GAAG;GACH,QAAQ;IACN,GAAG;IAEH,GAAG,QAAQ;IACZ;GACF,CAAC;UACK,OAAO;AACd,UAAQ,MAAM,4BAA4B,MAAM;AAChD,UAAQ,KAAK,EAAE"}
|
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_extract = require('./extract.cjs');
|
|
4
|
-
const require_listProjects = require('./listProjects.cjs');
|
|
5
|
-
const require_liveSync = require('./liveSync.cjs');
|
|
6
|
-
const require_listContentDeclaration = require('./listContentDeclaration.cjs');
|
|
7
|
-
const require_auth_login = require('./auth/login.cjs');
|
|
8
|
-
const require_initBuildOptimization = require('./initBuildOptimization.cjs');
|
|
9
|
-
const require_initSkills = require('./initSkills.cjs');
|
|
10
|
-
const require_initMCP = require('./initMCP.cjs');
|
|
11
|
-
const require_init = require('./init.cjs');
|
|
12
|
-
const require_editor = require('./editor.cjs');
|
|
13
|
-
const require_watch = require('./watch.cjs');
|
|
14
|
-
const require_scan = require('./scan.cjs');
|
|
15
|
-
const require_build = require('./build.cjs');
|
|
16
|
-
const require_bundle = require('./bundle.cjs');
|
|
17
|
-
const require_ci = require('./ci.cjs');
|
|
18
|
-
const require_config = require('./config.cjs');
|
|
19
|
-
const require_test_test = require('./test/test.cjs');
|
|
20
|
-
const require_fill_fill = require('./fill/fill.cjs');
|
|
21
|
-
const require_pull = require('./pull.cjs');
|
|
22
|
-
const require_push_push = require('./push/push.cjs');
|
|
23
|
-
const require_pushConfig = require('./pushConfig.cjs');
|
|
24
|
-
const require_reviewDoc_reviewDoc = require('./reviewDoc/reviewDoc.cjs');
|
|
25
|
-
const require_searchDoc = require('./searchDoc.cjs');
|
|
26
|
-
const require_translateDoc_translateDoc = require('./translateDoc/translateDoc.cjs');
|
|
27
3
|
const require_utils_getParentPackageJSON = require('./utils/getParentPackageJSON.cjs');
|
|
28
4
|
let node_path = require("node:path");
|
|
29
5
|
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
@@ -156,12 +132,13 @@ const setAPI = () => {
|
|
|
156
132
|
*/
|
|
157
133
|
const loginCmd = program.command("login").description("Login to Intlayer").option("--cms-url [cmsUrl]", "CMS URL");
|
|
158
134
|
applyConfigOptions(loginCmd);
|
|
159
|
-
loginCmd.action((options) => {
|
|
135
|
+
loginCmd.action(async (options) => {
|
|
136
|
+
const { login } = await Promise.resolve().then(() => require("./auth/login.cjs"));
|
|
160
137
|
const configOptions = extractConfigOptions(options) ?? { override: { log: {
|
|
161
138
|
prefix: "",
|
|
162
139
|
mode: "verbose"
|
|
163
140
|
} } };
|
|
164
|
-
return
|
|
141
|
+
return login({
|
|
165
142
|
cmsUrl: options.cmsUrl,
|
|
166
143
|
configOptions
|
|
167
144
|
});
|
|
@@ -169,15 +146,27 @@ const setAPI = () => {
|
|
|
169
146
|
/**
|
|
170
147
|
* INIT
|
|
171
148
|
*/
|
|
172
|
-
const initCmd = program.command("init").description("Initialize Intlayer in the project").option("--project-root [projectRoot]", "Project root directory").option("--no-gitignore", "Do not add .intlayer to .gitignore").option("--no-github-actions", "Do not scaffold the fill and test GitHub Actions workflows").option("--no-framework-setup", "Do not scaffold framework middleware/proxy and providers in layout/page").option("-i, --interactive", "Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …)").action((options) =>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
149
|
+
const initCmd = program.command("init").description("Initialize Intlayer in the project").option("--project-root [projectRoot]", "Project root directory").option("--no-gitignore", "Do not add .intlayer to .gitignore").option("--no-github-actions", "Do not scaffold the fill and test GitHub Actions workflows").option("--no-framework-setup", "Do not scaffold framework middleware/proxy and providers in layout/page").option("-i, --interactive", "Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …)").action(async (options) => {
|
|
150
|
+
const { init } = await Promise.resolve().then(() => require("./init.cjs"));
|
|
151
|
+
return init(options.projectRoot, {
|
|
152
|
+
noGitignore: options.gitignore === false,
|
|
153
|
+
noGithubActions: options.githubActions === false,
|
|
154
|
+
noFrameworkSetup: options.frameworkSetup === false,
|
|
155
|
+
upgradeToVersion: packageJson.version
|
|
156
|
+
}, options.interactive === true);
|
|
157
|
+
});
|
|
158
|
+
initCmd.command("skills").description("Initialize Intlayer skills in the project").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
|
|
159
|
+
const { initSkills } = await Promise.resolve().then(() => require("./initSkills.cjs"));
|
|
160
|
+
return initSkills(options.projectRoot);
|
|
161
|
+
});
|
|
162
|
+
initCmd.command("mcp").description("Initialize Intlayer MCP server in the project").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
|
|
163
|
+
const { initMCP } = await Promise.resolve().then(() => require("./initMCP.cjs"));
|
|
164
|
+
return initMCP(options.projectRoot);
|
|
165
|
+
});
|
|
166
|
+
initCmd.command("build-optimization").description("Configure build optimization for Next.js (@intlayer/swc or @intlayer/babel)").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
|
|
167
|
+
const { initBuildOptimization } = await Promise.resolve().then(() => require("./initBuildOptimization.cjs"));
|
|
168
|
+
return initBuildOptimization(options.projectRoot);
|
|
169
|
+
});
|
|
181
170
|
/**
|
|
182
171
|
* DICTIONARIES
|
|
183
172
|
*/
|
|
@@ -194,8 +183,9 @@ const setAPI = () => {
|
|
|
194
183
|
const dictionariesBuildCmd = dictionariesProgram.command("build").description(buildOptions.description);
|
|
195
184
|
applyOptions(dictionariesBuildCmd, buildOptions.options);
|
|
196
185
|
applyConfigOptions(dictionariesBuildCmd);
|
|
197
|
-
dictionariesBuildCmd.action((options) => {
|
|
198
|
-
|
|
186
|
+
dictionariesBuildCmd.action(async (options) => {
|
|
187
|
+
const { build } = await Promise.resolve().then(() => require("./build.cjs"));
|
|
188
|
+
build({
|
|
199
189
|
...options,
|
|
200
190
|
configOptions: extractConfigOptions(options)
|
|
201
191
|
});
|
|
@@ -203,8 +193,9 @@ const setAPI = () => {
|
|
|
203
193
|
const rootBuildCmd = program.command("build").description(buildOptions.description);
|
|
204
194
|
applyOptions(rootBuildCmd, buildOptions.options);
|
|
205
195
|
applyConfigOptions(rootBuildCmd);
|
|
206
|
-
rootBuildCmd.action((options) => {
|
|
207
|
-
|
|
196
|
+
rootBuildCmd.action(async (options) => {
|
|
197
|
+
const { build } = await Promise.resolve().then(() => require("./build.cjs"));
|
|
198
|
+
build({
|
|
208
199
|
...options,
|
|
209
200
|
configOptions: extractConfigOptions(options)
|
|
210
201
|
});
|
|
@@ -216,8 +207,9 @@ const setAPI = () => {
|
|
|
216
207
|
const dictionariesWatchCmd = dictionariesProgram.command("watch").description(buildOptions.description);
|
|
217
208
|
applyOptions(dictionariesWatchCmd, watchOptions.options);
|
|
218
209
|
applyConfigOptions(dictionariesWatchCmd);
|
|
219
|
-
dictionariesWatchCmd.action((options) => {
|
|
220
|
-
|
|
210
|
+
dictionariesWatchCmd.action(async (options) => {
|
|
211
|
+
const { watchContentDeclaration } = await Promise.resolve().then(() => require("./watch.cjs"));
|
|
212
|
+
watchContentDeclaration({
|
|
221
213
|
...options,
|
|
222
214
|
configOptions: extractConfigOptions(options)
|
|
223
215
|
});
|
|
@@ -225,8 +217,9 @@ const setAPI = () => {
|
|
|
225
217
|
const rootWatchCmd = program.command("watch").description(buildOptions.description);
|
|
226
218
|
applyOptions(rootWatchCmd, watchOptions.options);
|
|
227
219
|
applyConfigOptions(rootWatchCmd);
|
|
228
|
-
rootWatchCmd.action((options) => {
|
|
229
|
-
|
|
220
|
+
rootWatchCmd.action(async (options) => {
|
|
221
|
+
const { watchContentDeclaration } = await Promise.resolve().then(() => require("./watch.cjs"));
|
|
222
|
+
watchContentDeclaration({
|
|
230
223
|
...options,
|
|
231
224
|
configOptions: extractConfigOptions(options)
|
|
232
225
|
});
|
|
@@ -243,9 +236,10 @@ const setAPI = () => {
|
|
|
243
236
|
const dictionariesPullCmd = dictionariesProgram.command("pull").description(pullOptions.description);
|
|
244
237
|
applyOptions(dictionariesPullCmd, pullOptions.options);
|
|
245
238
|
applyConfigOptions(dictionariesPullCmd);
|
|
246
|
-
dictionariesPullCmd.action((options) => {
|
|
239
|
+
dictionariesPullCmd.action(async (options) => {
|
|
240
|
+
const { pull } = await Promise.resolve().then(() => require("./pull.cjs"));
|
|
247
241
|
const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
|
|
248
|
-
|
|
242
|
+
pull({
|
|
249
243
|
...options,
|
|
250
244
|
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
251
245
|
configOptions: extractConfigOptions(options)
|
|
@@ -254,9 +248,10 @@ const setAPI = () => {
|
|
|
254
248
|
const rootPullCmd = program.command("pull").description(pullOptions.description);
|
|
255
249
|
applyOptions(rootPullCmd, pullOptions.options);
|
|
256
250
|
applyConfigOptions(rootPullCmd);
|
|
257
|
-
rootPullCmd.action((options) => {
|
|
251
|
+
rootPullCmd.action(async (options) => {
|
|
252
|
+
const { pull } = await Promise.resolve().then(() => require("./pull.cjs"));
|
|
258
253
|
const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
|
|
259
|
-
|
|
254
|
+
pull({
|
|
260
255
|
...options,
|
|
261
256
|
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
262
257
|
configOptions: extractConfigOptions(options)
|
|
@@ -278,9 +273,10 @@ const setAPI = () => {
|
|
|
278
273
|
applyOptions(dictionariesPushCmd, pushOptions.options);
|
|
279
274
|
applyConfigOptions(dictionariesPushCmd);
|
|
280
275
|
applyGitOptions(dictionariesPushCmd);
|
|
281
|
-
dictionariesPushCmd.action((options) => {
|
|
276
|
+
dictionariesPushCmd.action(async (options) => {
|
|
277
|
+
const { push } = await Promise.resolve().then(() => require("./push/push.cjs"));
|
|
282
278
|
const dictionaries = [...options.dictionaries || [], ...options.dictionary || []];
|
|
283
|
-
return
|
|
279
|
+
return push({
|
|
284
280
|
...options,
|
|
285
281
|
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
286
282
|
gitOptions: extractGitOptions(options),
|
|
@@ -291,9 +287,10 @@ const setAPI = () => {
|
|
|
291
287
|
applyOptions(rootPushCmd, pushOptions.options);
|
|
292
288
|
applyConfigOptions(rootPushCmd);
|
|
293
289
|
applyGitOptions(rootPushCmd);
|
|
294
|
-
rootPushCmd.action((options) => {
|
|
290
|
+
rootPushCmd.action(async (options) => {
|
|
291
|
+
const { push } = await Promise.resolve().then(() => require("./push/push.cjs"));
|
|
295
292
|
const dictionaries = [...options.dictionaries || [], ...options.dictionary || []];
|
|
296
|
-
return
|
|
293
|
+
return push({
|
|
297
294
|
...options,
|
|
298
295
|
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
299
296
|
gitOptions: extractGitOptions(options),
|
|
@@ -306,29 +303,33 @@ const setAPI = () => {
|
|
|
306
303
|
const configurationProgram = program.command("configuration").alias("config").alias("conf").description("Configuration operations");
|
|
307
304
|
const configGetCmd = configurationProgram.command("get").description("Get the configuration");
|
|
308
305
|
applyConfigOptions(configGetCmd);
|
|
309
|
-
configGetCmd.action((options) => {
|
|
310
|
-
|
|
306
|
+
configGetCmd.action(async (options) => {
|
|
307
|
+
const { getConfig } = await Promise.resolve().then(() => require("./config.cjs"));
|
|
308
|
+
getConfig({
|
|
311
309
|
...options,
|
|
312
310
|
configOptions: extractConfigOptions(options)
|
|
313
311
|
});
|
|
314
312
|
});
|
|
315
313
|
const configPushCmd = configurationProgram.command("push").description("Push the configuration");
|
|
316
314
|
applyConfigOptions(configPushCmd);
|
|
317
|
-
configPushCmd.action((options) => {
|
|
318
|
-
|
|
315
|
+
configPushCmd.action(async (options) => {
|
|
316
|
+
const { pushConfig } = await Promise.resolve().then(() => require("./pushConfig.cjs"));
|
|
317
|
+
pushConfig({
|
|
319
318
|
...options,
|
|
320
319
|
configOptions: extractConfigOptions(options)
|
|
321
320
|
});
|
|
322
321
|
});
|
|
323
|
-
program.command("projects").alias("project").description("List Intlayer projects").command("list").description("List all Intlayer projects in the directory").option("--base-dir [baseDir]", "Base directory to search from").option("--git-root", "Search from the git root directory instead of the base directory").option("--json", "Output the results as JSON").action((options) => {
|
|
324
|
-
|
|
322
|
+
program.command("projects").alias("project").description("List Intlayer projects").command("list").description("List all Intlayer projects in the directory").option("--base-dir [baseDir]", "Base directory to search from").option("--git-root", "Search from the git root directory instead of the base directory").option("--json", "Output the results as JSON").action(async (options) => {
|
|
323
|
+
const { listProjectsCommand } = await Promise.resolve().then(() => require("./listProjects.cjs"));
|
|
324
|
+
listProjectsCommand({
|
|
325
325
|
baseDir: options.baseDir,
|
|
326
326
|
gitRoot: options.gitRoot,
|
|
327
327
|
json: options.json
|
|
328
328
|
});
|
|
329
329
|
});
|
|
330
|
-
program.command("projects-list").alias("pl").description("List all Intlayer projects in the directory").option("--base-dir [baseDir]", "Base directory to search from").option("--git-root", "Search from the git root directory instead of the base directory").option("--absolute", "Output the results as absolute paths").option("--json", "Output the results as JSON").action((options) => {
|
|
331
|
-
|
|
330
|
+
program.command("projects-list").alias("pl").description("List all Intlayer projects in the directory").option("--base-dir [baseDir]", "Base directory to search from").option("--git-root", "Search from the git root directory instead of the base directory").option("--absolute", "Output the results as absolute paths").option("--json", "Output the results as JSON").action(async (options) => {
|
|
331
|
+
const { listProjectsCommand } = await Promise.resolve().then(() => require("./listProjects.cjs"));
|
|
332
|
+
listProjectsCommand({
|
|
332
333
|
baseDir: options.baseDir,
|
|
333
334
|
gitRoot: options.gitRoot,
|
|
334
335
|
json: options.json,
|
|
@@ -339,30 +340,34 @@ const setAPI = () => {
|
|
|
339
340
|
* CONTENT DECLARATION
|
|
340
341
|
*/
|
|
341
342
|
const contentProgram = program.command("content").description("Content declaration operations");
|
|
342
|
-
contentProgram.command("list").description("List the content declaration files").option("--json", "Output the results as JSON").option("--absolute", "Output the results as absolute paths").action((options) => {
|
|
343
|
-
|
|
343
|
+
contentProgram.command("list").description("List the content declaration files").option("--json", "Output the results as JSON").option("--absolute", "Output the results as absolute paths").action(async (options) => {
|
|
344
|
+
const { listContentDeclaration } = await Promise.resolve().then(() => require("./listContentDeclaration.cjs"));
|
|
345
|
+
listContentDeclaration({
|
|
344
346
|
json: options.json,
|
|
345
347
|
absolute: options.absolute
|
|
346
348
|
});
|
|
347
349
|
});
|
|
348
|
-
program.command("list").description("List the content declaration files").option("--json", "Output the results as JSON").option("--absolute", "Output the results as absolute paths").action((options) => {
|
|
349
|
-
|
|
350
|
+
program.command("list").description("List the content declaration files").option("--json", "Output the results as JSON").option("--absolute", "Output the results as absolute paths").action(async (options) => {
|
|
351
|
+
const { listContentDeclaration } = await Promise.resolve().then(() => require("./listContentDeclaration.cjs"));
|
|
352
|
+
listContentDeclaration({
|
|
350
353
|
json: options.json,
|
|
351
354
|
absolute: options.absolute
|
|
352
355
|
});
|
|
353
356
|
});
|
|
354
357
|
const testProgram = contentProgram.command("test").description("Test if there are missing translations").option("--build [build]", "Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build");
|
|
355
358
|
applyConfigOptions(testProgram);
|
|
356
|
-
testProgram.action((options) => {
|
|
357
|
-
|
|
359
|
+
testProgram.action(async (options) => {
|
|
360
|
+
const { testMissingTranslations } = await Promise.resolve().then(() => require("./test/index.cjs"));
|
|
361
|
+
testMissingTranslations({
|
|
358
362
|
...options,
|
|
359
363
|
configOptions: extractConfigOptions(options)
|
|
360
364
|
});
|
|
361
365
|
});
|
|
362
366
|
const rootTestCmd = program.command("test").description("Test if there are missing translations").option("--build [build]", "Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build");
|
|
363
367
|
applyConfigOptions(rootTestCmd);
|
|
364
|
-
rootTestCmd.action((options) => {
|
|
365
|
-
|
|
368
|
+
rootTestCmd.action(async (options) => {
|
|
369
|
+
const { testMissingTranslations } = await Promise.resolve().then(() => require("./test/index.cjs"));
|
|
370
|
+
testMissingTranslations({
|
|
366
371
|
...options,
|
|
367
372
|
configOptions: extractConfigOptions(options)
|
|
368
373
|
});
|
|
@@ -371,11 +376,12 @@ const setAPI = () => {
|
|
|
371
376
|
applyConfigOptions(fillProgram);
|
|
372
377
|
applyAIOptions(fillProgram);
|
|
373
378
|
applyGitOptions(fillProgram);
|
|
374
|
-
fillProgram.action((options) => {
|
|
379
|
+
fillProgram.action(async (options) => {
|
|
380
|
+
const { fill } = await Promise.resolve().then(() => require("./fill/fill.cjs"));
|
|
375
381
|
const keys = [...options.keys ?? [], ...options.key ?? []];
|
|
376
382
|
const excludedKeys = [...options.excludedKeys ?? [], ...options.excludedKey ?? []];
|
|
377
383
|
const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
|
|
378
|
-
return
|
|
384
|
+
return fill({
|
|
379
385
|
...options,
|
|
380
386
|
keys: keys.length > 0 ? keys : void 0,
|
|
381
387
|
excludedKeys: excludedKeys.length > 0 ? excludedKeys : void 0,
|
|
@@ -405,47 +411,56 @@ const setAPI = () => {
|
|
|
405
411
|
applyAIOptions(translateProgram);
|
|
406
412
|
applyGitOptions(translateProgram);
|
|
407
413
|
applyOptions(translateProgram, docParams);
|
|
408
|
-
translateProgram.action((options) =>
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
414
|
+
translateProgram.action(async (options) => {
|
|
415
|
+
const { translateDoc } = await Promise.resolve().then(() => require("./translateDoc/translateDoc.cjs"));
|
|
416
|
+
return translateDoc({
|
|
417
|
+
docPattern: options.docPattern,
|
|
418
|
+
excludedGlobPattern: options.excludedGlobPattern,
|
|
419
|
+
locales: options.locales,
|
|
420
|
+
baseLocale: options.baseLocale,
|
|
421
|
+
aiOptions: extractAiOptions(options),
|
|
422
|
+
gitOptions: extractGitOptions(options),
|
|
423
|
+
nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
|
|
424
|
+
configOptions: extractConfigOptions(options),
|
|
425
|
+
customInstructions: options.customInstructions,
|
|
426
|
+
skipIfModifiedBefore: options.skipIfModifiedBefore,
|
|
427
|
+
skipIfModifiedAfter: options.skipIfModifiedAfter,
|
|
428
|
+
skipIfExists: options.skipIfExists
|
|
429
|
+
});
|
|
430
|
+
});
|
|
422
431
|
const reviewProgram = docProgram.command("review").description("Review the documentation").option("--log", "Log-only mode. Do not translate with AI; instead log the blocks that need attention (with line numbers and content) for the base and target locales, to help another agent generate the translations.");
|
|
423
432
|
applyConfigOptions(reviewProgram);
|
|
424
433
|
applyAIOptions(reviewProgram);
|
|
425
434
|
applyGitOptions(reviewProgram);
|
|
426
435
|
applyOptions(reviewProgram, docParams);
|
|
427
|
-
reviewProgram.action((options) =>
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
436
|
+
reviewProgram.action(async (options) => {
|
|
437
|
+
const { reviewDoc } = await Promise.resolve().then(() => require("./reviewDoc/reviewDoc.cjs"));
|
|
438
|
+
return reviewDoc({
|
|
439
|
+
docPattern: options.docPattern,
|
|
440
|
+
excludedGlobPattern: options.excludedGlobPattern,
|
|
441
|
+
locales: options.locales,
|
|
442
|
+
baseLocale: options.baseLocale,
|
|
443
|
+
aiOptions: extractAiOptions(options),
|
|
444
|
+
gitOptions: extractGitOptions(options),
|
|
445
|
+
nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
|
|
446
|
+
configOptions: extractConfigOptions(options),
|
|
447
|
+
customInstructions: options.customInstructions,
|
|
448
|
+
skipIfModifiedBefore: options.skipIfModifiedBefore,
|
|
449
|
+
skipIfModifiedAfter: options.skipIfModifiedAfter,
|
|
450
|
+
skipIfExists: options.skipIfExists,
|
|
451
|
+
log: options.log
|
|
452
|
+
});
|
|
453
|
+
});
|
|
442
454
|
const searchProgram = docProgram.command("search").description("Search the documentation").argument("<query>", "Search query").option("--limit [limit]", "Limit the number of results", "10");
|
|
443
455
|
applyConfigOptions(searchProgram);
|
|
444
|
-
searchProgram.action((query, options) =>
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
456
|
+
searchProgram.action(async (query, options) => {
|
|
457
|
+
const { searchDoc } = await Promise.resolve().then(() => require("./searchDoc.cjs"));
|
|
458
|
+
return searchDoc({
|
|
459
|
+
query,
|
|
460
|
+
limit: options.limit ? parseInt(options.limit, 10) : 10,
|
|
461
|
+
configOptions: extractConfigOptions(options)
|
|
462
|
+
});
|
|
463
|
+
});
|
|
449
464
|
/**
|
|
450
465
|
* LIVE SYNC
|
|
451
466
|
*/
|
|
@@ -453,14 +468,18 @@ const setAPI = () => {
|
|
|
453
468
|
const liveCmd = program.command("live").description("Live sync - Watch for changes made on the CMS and update the application content accordingly");
|
|
454
469
|
applyOptions(liveCmd, liveOptions);
|
|
455
470
|
applyConfigOptions(liveCmd);
|
|
456
|
-
liveCmd.action((options) =>
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
471
|
+
liveCmd.action(async (options) => {
|
|
472
|
+
const { liveSync } = await Promise.resolve().then(() => require("./liveSync.cjs"));
|
|
473
|
+
return liveSync({
|
|
474
|
+
...options,
|
|
475
|
+
configOptions: extractConfigOptions(options)
|
|
476
|
+
});
|
|
477
|
+
});
|
|
460
478
|
const editorStartCmd = program.command("editor").description("Visual editor operations").command("start").description("Start the Intlayer visual editor");
|
|
461
479
|
applyConfigOptions(editorStartCmd);
|
|
462
|
-
editorStartCmd.action((options) => {
|
|
463
|
-
|
|
480
|
+
editorStartCmd.action(async (options) => {
|
|
481
|
+
const { startEditor } = await Promise.resolve().then(() => require("./editor.cjs"));
|
|
482
|
+
startEditor({
|
|
464
483
|
env: options.env,
|
|
465
484
|
envFile: options.envFile
|
|
466
485
|
});
|
|
@@ -470,16 +489,18 @@ const setAPI = () => {
|
|
|
470
489
|
*/
|
|
471
490
|
const extractProgram = program.command("extract").alias("ext").description("Extract strings from components to be placed in a .content file close to the component");
|
|
472
491
|
applyConfigOptions(extractProgram);
|
|
473
|
-
extractProgram.option("-f, --file [files...]", "List of files to extract").option("--code-only", "Only extract the component code", false).option("--declaration-only", "Only generate content declaration", false).action((options) => {
|
|
474
|
-
|
|
492
|
+
extractProgram.option("-f, --file [files...]", "List of files to extract").option("--code-only", "Only extract the component code", false).option("--declaration-only", "Only generate content declaration", false).action(async (options) => {
|
|
493
|
+
const { extract } = await Promise.resolve().then(() => require("./extract.cjs"));
|
|
494
|
+
extract({
|
|
475
495
|
files: options.file,
|
|
476
496
|
configOptions: extractConfigOptions(options),
|
|
477
497
|
codeOnly: options.codeOnly,
|
|
478
498
|
declarationOnly: options.declarationOnly
|
|
479
499
|
});
|
|
480
500
|
});
|
|
481
|
-
applyConfigOptions(program.command("standalone").description("Create a standalone bundle of the application content").option("-o, --outfile [outfile]", "Output file for the bundle", "intlayer-bundle.js").option("--packages [packages...]", "List of packages to bundle").option("--version [version]", "Version of the packages to bundle").option("--minify", "Minify the output").option("--platform [platform]", "Target platform", "browser").option("--format [format]", "Output format", "esm").action((options) => {
|
|
482
|
-
|
|
501
|
+
applyConfigOptions(program.command("standalone").description("Create a standalone bundle of the application content").option("-o, --outfile [outfile]", "Output file for the bundle", "intlayer-bundle.js").option("--packages [packages...]", "List of packages to bundle").option("--version [version]", "Version of the packages to bundle").option("--minify", "Minify the output").option("--platform [platform]", "Target platform", "browser").option("--format [format]", "Output format", "esm").action(async (options) => {
|
|
502
|
+
const { bundle } = await Promise.resolve().then(() => require("./bundle.cjs"));
|
|
503
|
+
bundle({
|
|
483
504
|
outfile: options.outfile,
|
|
484
505
|
bundlePackages: options.packages,
|
|
485
506
|
version: options.version,
|
|
@@ -494,19 +515,23 @@ const setAPI = () => {
|
|
|
494
515
|
*/
|
|
495
516
|
const scanCmd = program.command("scan").description("Scan a website to measure its page size and audit its i18n / SEO health").argument("<url>", "URL of the website to scan").option("--no-deep", "Disable the deeper puppeteer-based render scan").option("--json", "Output the results as JSON");
|
|
496
517
|
applyConfigOptions(scanCmd);
|
|
497
|
-
scanCmd.action((url, options) =>
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
518
|
+
scanCmd.action(async (url, options) => {
|
|
519
|
+
const { scan } = await Promise.resolve().then(() => require("./scan.cjs"));
|
|
520
|
+
return scan(url, {
|
|
521
|
+
deep: options.deep,
|
|
522
|
+
json: options.json,
|
|
523
|
+
configOptions: extractConfigOptions(options)
|
|
524
|
+
});
|
|
525
|
+
});
|
|
502
526
|
program.parse(process.argv);
|
|
503
527
|
/**
|
|
504
528
|
* CI / AUTOMATION
|
|
505
529
|
*
|
|
506
530
|
* Used to iterate over all projects in a monorepo, and help to parse secrets
|
|
507
531
|
*/
|
|
508
|
-
program.command("ci").description("Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.").argument("<command...>", "The intlayer command to execute (e.g., \"fill\", \"push\")").allowUnknownOption().action((args) => {
|
|
509
|
-
|
|
532
|
+
program.command("ci").description("Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.").argument("<command...>", "The intlayer command to execute (e.g., \"fill\", \"push\")").allowUnknownOption().action(async (args) => {
|
|
533
|
+
const { runCI } = await Promise.resolve().then(() => require("./ci.cjs"));
|
|
534
|
+
runCI(args);
|
|
510
535
|
});
|
|
511
536
|
return program;
|
|
512
537
|
};
|