@intlayer/cli 5.4.2 → 5.5.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/dist/cjs/build.cjs +1 -1
- package/dist/cjs/build.cjs.map +1 -1
- package/dist/cjs/cli.cjs +242 -20
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +3 -6
- package/dist/cjs/config.cjs.map +1 -1
- package/dist/cjs/fill.cjs +362 -0
- package/dist/cjs/fill.cjs.map +1 -0
- package/dist/cjs/index.cjs +6 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/listContentDeclaration.cjs +5 -7
- package/dist/cjs/listContentDeclaration.cjs.map +1 -1
- package/dist/cjs/pull.cjs +11 -23
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/push.cjs +29 -59
- package/dist/cjs/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +5 -4
- package/dist/cjs/pushConfig.cjs.map +1 -1
- package/dist/esm/build.mjs +1 -1
- package/dist/esm/build.mjs.map +1 -1
- package/dist/esm/cli.mjs +230 -19
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +5 -8
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/fill.mjs +340 -0
- package/dist/esm/fill.mjs.map +1 -0
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/listContentDeclaration.mjs +7 -9
- package/dist/esm/listContentDeclaration.mjs.map +1 -1
- package/dist/esm/pull.mjs +14 -26
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/push.mjs +31 -61
- package/dist/esm/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +7 -6
- package/dist/esm/pushConfig.mjs.map +1 -1
- package/dist/types/build.d.ts +2 -1
- package/dist/types/build.d.ts.map +1 -1
- package/dist/types/cli.d.ts +10 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/fill.d.ts +27 -0
- package/dist/types/fill.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/listContentDeclaration.d.ts +4 -3
- package/dist/types/listContentDeclaration.d.ts.map +1 -1
- package/dist/types/pull.d.ts +2 -2
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/push.d.ts +4 -2
- package/dist/types/push.d.ts.map +1 -1
- package/dist/types/pushConfig.d.ts +2 -1
- package/dist/types/pushConfig.d.ts.map +1 -1
- package/package.json +13 -12
- package/dist/cjs/audit.cjs +0 -126
- package/dist/cjs/audit.cjs.map +0 -1
- package/dist/esm/audit.mjs +0 -94
- package/dist/esm/audit.mjs.map +0 -1
- package/dist/types/audit.d.ts +0 -38
- package/dist/types/audit.d.ts.map +0 -1
package/dist/cjs/build.cjs
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(build_exports);
|
|
|
24
24
|
var import_chokidar = require("@intlayer/chokidar");
|
|
25
25
|
var import_config = require("@intlayer/config");
|
|
26
26
|
const build = async (options) => {
|
|
27
|
-
const config = (0, import_config.getConfiguration)(options);
|
|
27
|
+
const config = (0, import_config.getConfiguration)(options?.configOptions);
|
|
28
28
|
await (0, import_chokidar.buildAndWatchIntlayer)({
|
|
29
29
|
persistent: options?.watch ?? false,
|
|
30
30
|
configuration: config
|
package/dist/cjs/build.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/build.ts"],"sourcesContent":["import { buildAndWatchIntlayer } from '@intlayer/chokidar';\nimport {\n getConfiguration,\n type GetConfigurationOptions,\n} from '@intlayer/config';\n\ntype BuildOptions = {
|
|
1
|
+
{"version":3,"sources":["../../src/build.ts"],"sourcesContent":["import { buildAndWatchIntlayer } from '@intlayer/chokidar';\nimport {\n getConfiguration,\n type GetConfigurationOptions,\n} from '@intlayer/config';\n\ntype BuildOptions = {\n watch?: boolean;\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const build = async (options?: BuildOptions) => {\n const config = getConfiguration(options?.configOptions);\n\n await buildAndWatchIntlayer({\n persistent: options?.watch ?? false,\n configuration: config,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsC;AACtC,oBAGO;AAWA,MAAM,QAAQ,OAAO,YAA2B;AACrD,QAAM,aAAS,gCAAiB,SAAS,aAAa;AAEtD,YAAM,uCAAsB;AAAA,IAC1B,YAAY,SAAS,SAAS;AAAA,IAC9B,eAAe;AAAA,EACjB,CAAC;AACH;","names":[]}
|
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,43 +17,263 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var cli_exports = {};
|
|
20
30
|
__export(cli_exports, {
|
|
21
31
|
setAPI: () => setAPI
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(cli_exports);
|
|
34
|
+
var import_built = __toESM(require("@intlayer/config/built"));
|
|
24
35
|
var import_commander = require("commander");
|
|
25
|
-
var
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
var import_path = require("path");
|
|
38
|
+
var import_url = require("url");
|
|
26
39
|
var import_build = require('./build.cjs');
|
|
27
|
-
var
|
|
40
|
+
var import_config2 = require('./config.cjs');
|
|
41
|
+
var import_fill = require('./fill.cjs');
|
|
28
42
|
var import_listContentDeclaration = require('./listContentDeclaration.cjs');
|
|
29
43
|
var import_pull = require('./pull.cjs');
|
|
30
44
|
var import_push = require('./push.cjs');
|
|
31
45
|
var import_pushConfig = require('./pushConfig.cjs');
|
|
46
|
+
const import_meta = {};
|
|
47
|
+
const CJS_ESM_Dirname = __dirname ?? (0, import_path.dirname)((0, import_url.fileURLToPath)(import_meta.url));
|
|
48
|
+
const packageJson = JSON.parse(
|
|
49
|
+
(0, import_fs.readFileSync)((0, import_path.resolve)(CJS_ESM_Dirname, "../../package.json"), "utf8")
|
|
50
|
+
);
|
|
51
|
+
const logOptions = [
|
|
52
|
+
["--verbose", "Verbose"],
|
|
53
|
+
["--prefix [prefix]", "Prefix"]
|
|
54
|
+
];
|
|
55
|
+
const configurationOptions = [
|
|
56
|
+
["--env-file [envFile]", "Environment file"],
|
|
57
|
+
["-e, --env [env]", "Environment"],
|
|
58
|
+
["--base-dir [baseDir]", "Base directory"],
|
|
59
|
+
...logOptions
|
|
60
|
+
];
|
|
61
|
+
const aiOptions = [
|
|
62
|
+
["--provider [provider]", "Provider"],
|
|
63
|
+
["--temperature [temperature]", "Temperature"],
|
|
64
|
+
["--model [model]", "Model"],
|
|
65
|
+
["--api-key [apiKey]", "Provider API key"],
|
|
66
|
+
["--custom-prompt [prompt]", "Custom prompt"],
|
|
67
|
+
["--application-context [applicationContext]", "Application context"]
|
|
68
|
+
];
|
|
69
|
+
const gitOptions = [
|
|
70
|
+
["--git-diff [gitDiff]", "Git diff mode - Check git diff between two refs"],
|
|
71
|
+
["--git-diff-base [gitDiffBase]", "Git diff base ref"],
|
|
72
|
+
["--git-diff-current [gitDiffCurrent]", "Git diff current ref"],
|
|
73
|
+
["--uncommitted [uncommitted]", "Uncommitted"],
|
|
74
|
+
["--unpushed [unpushed]", "Unpushed"],
|
|
75
|
+
["--untracked [untracked]", "Untracked"]
|
|
76
|
+
];
|
|
77
|
+
const applyOptions = (command, options) => {
|
|
78
|
+
options.forEach(([flag, description]) => command.option(flag, description));
|
|
79
|
+
return command;
|
|
80
|
+
};
|
|
81
|
+
const removeUndefined = (obj) => Object.fromEntries(
|
|
82
|
+
Object.entries(obj).filter(([_, value]) => value !== void 0)
|
|
83
|
+
);
|
|
84
|
+
const applyConfigOptions = (command) => applyOptions(command, configurationOptions);
|
|
85
|
+
const applyAIOptions = (command) => applyOptions(command, aiOptions);
|
|
86
|
+
const applyGitOptions = (command) => applyOptions(command, gitOptions);
|
|
87
|
+
const extractAiOptions = (options) => {
|
|
88
|
+
const isOptionEmpty = !Object.values(options).some(Boolean);
|
|
89
|
+
if (isOptionEmpty) {
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
const { apiKey, provider, model, temperature, applicationContext } = options;
|
|
93
|
+
return removeUndefined({
|
|
94
|
+
apiKey: apiKey ?? import_built.default.ai?.apiKey,
|
|
95
|
+
provider: provider ?? import_built.default.ai?.provider,
|
|
96
|
+
model: model ?? import_built.default.ai?.model,
|
|
97
|
+
temperature: temperature ?? import_built.default.ai?.temperature,
|
|
98
|
+
applicationContext: applicationContext ?? import_built.default.ai?.applicationContext
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
const extractGitOptions = (options) => {
|
|
102
|
+
const isOptionEmpty = !Object.values(options).some(Boolean);
|
|
103
|
+
if (isOptionEmpty) {
|
|
104
|
+
return void 0;
|
|
105
|
+
}
|
|
106
|
+
const {
|
|
107
|
+
gitDiff,
|
|
108
|
+
gitDiffBase,
|
|
109
|
+
gitDiffCurrent,
|
|
110
|
+
uncommitted,
|
|
111
|
+
unpushed,
|
|
112
|
+
untracked
|
|
113
|
+
} = options;
|
|
114
|
+
const mode = [
|
|
115
|
+
gitDiff && "gitDiff",
|
|
116
|
+
uncommitted && "uncommitted",
|
|
117
|
+
unpushed && "unpushed",
|
|
118
|
+
untracked && "untracked"
|
|
119
|
+
].filter(Boolean);
|
|
120
|
+
return removeUndefined({
|
|
121
|
+
mode,
|
|
122
|
+
baseRef: gitDiffBase,
|
|
123
|
+
currentRef: gitDiffCurrent,
|
|
124
|
+
absolute: true
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const extractConfigOptions = (options) => {
|
|
128
|
+
const { baseDir, env, envFile, verbose, prefix } = options;
|
|
129
|
+
const log = {
|
|
130
|
+
prefix: prefix ?? "",
|
|
131
|
+
// Should not consider the prefix set in the intlayer configuration file
|
|
132
|
+
verbose
|
|
133
|
+
};
|
|
134
|
+
const override = {
|
|
135
|
+
log
|
|
136
|
+
};
|
|
137
|
+
return removeUndefined({
|
|
138
|
+
baseDir,
|
|
139
|
+
env,
|
|
140
|
+
envFile,
|
|
141
|
+
override
|
|
142
|
+
});
|
|
143
|
+
};
|
|
32
144
|
const setAPI = () => {
|
|
33
145
|
const program = new import_commander.Command();
|
|
34
|
-
program.version(
|
|
146
|
+
program.version(packageJson.version).description("Intlayer CLI");
|
|
35
147
|
const dictionariesProgram = program.command("dictionary").alias("dictionaries").alias("dic").description("Dictionaries operations");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
148
|
+
const buildOptions = {
|
|
149
|
+
description: "Build the dictionaries",
|
|
150
|
+
options: [["-w, --watch", "Watch for changes"]]
|
|
151
|
+
};
|
|
152
|
+
const dictionariesBuildCmd = dictionariesProgram.command("build").description(buildOptions.description);
|
|
153
|
+
applyOptions(dictionariesBuildCmd, buildOptions.options);
|
|
154
|
+
applyConfigOptions(dictionariesBuildCmd);
|
|
155
|
+
dictionariesBuildCmd.action((options) => {
|
|
156
|
+
(0, import_build.build)({
|
|
157
|
+
...options,
|
|
158
|
+
configOptions: extractConfigOptions(options)
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
const rootBuildCmd = program.command("build").description(buildOptions.description);
|
|
162
|
+
applyOptions(rootBuildCmd, buildOptions.options);
|
|
163
|
+
applyConfigOptions(rootBuildCmd);
|
|
164
|
+
rootBuildCmd.action((options) => {
|
|
165
|
+
(0, import_build.build)({
|
|
166
|
+
...options,
|
|
167
|
+
configOptions: extractConfigOptions(options)
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
const pullOptions = {
|
|
171
|
+
description: "Pull dictionaries from the server",
|
|
172
|
+
options: [
|
|
173
|
+
["-d, --dictionaries [ids...]", "List of dictionary IDs to pull"],
|
|
174
|
+
["--newDictionariesPath [path]", "Path to save the new dictionaries"]
|
|
175
|
+
]
|
|
176
|
+
};
|
|
177
|
+
const dictionariesPullCmd = dictionariesProgram.command("pull").description(pullOptions.description);
|
|
178
|
+
applyOptions(dictionariesPullCmd, pullOptions.options);
|
|
179
|
+
applyConfigOptions(dictionariesPullCmd);
|
|
180
|
+
dictionariesPullCmd.action((options) => {
|
|
181
|
+
(0, import_pull.pull)({
|
|
182
|
+
...options,
|
|
183
|
+
configOptions: {
|
|
184
|
+
...options.configOptions,
|
|
185
|
+
baseDir: options.baseDir
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
const rootPullCmd = program.command("pull").description(pullOptions.description);
|
|
190
|
+
applyOptions(rootPullCmd, pullOptions.options);
|
|
191
|
+
applyConfigOptions(rootPullCmd);
|
|
192
|
+
rootPullCmd.action((options) => {
|
|
193
|
+
(0, import_pull.pull)({
|
|
194
|
+
...options,
|
|
195
|
+
configOptions: extractConfigOptions(options)
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
const pushOptions = {
|
|
199
|
+
description: "Push all dictionaries. Create or update the pushed dictionaries",
|
|
200
|
+
options: [
|
|
201
|
+
["-d, --dictionaries [ids...]", "List of dictionary IDs to push"],
|
|
202
|
+
[
|
|
203
|
+
"-r, --deleteLocaleDictionary",
|
|
204
|
+
"Delete the local dictionaries after pushing"
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
"-k, --keepLocaleDictionary",
|
|
208
|
+
"Keep the local dictionaries after pushing"
|
|
209
|
+
]
|
|
210
|
+
]
|
|
211
|
+
};
|
|
212
|
+
const dictionariesPushCmd = dictionariesProgram.command("push").description(pushOptions.description);
|
|
213
|
+
applyOptions(dictionariesPushCmd, pushOptions.options);
|
|
214
|
+
applyConfigOptions(dictionariesPushCmd);
|
|
215
|
+
applyGitOptions(dictionariesPushCmd);
|
|
216
|
+
dictionariesPushCmd.action(
|
|
217
|
+
(options) => (0, import_push.push)({
|
|
218
|
+
...options,
|
|
219
|
+
gitOptions: extractGitOptions(options),
|
|
220
|
+
configOptions: extractConfigOptions(options)
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
const rootPushCmd = program.command("push").description(pushOptions.description);
|
|
224
|
+
applyOptions(rootPushCmd, pushOptions.options);
|
|
225
|
+
applyConfigOptions(rootPushCmd);
|
|
226
|
+
applyGitOptions(rootPushCmd);
|
|
227
|
+
rootPushCmd.action(
|
|
228
|
+
(options) => (0, import_push.push)({
|
|
229
|
+
...options,
|
|
230
|
+
gitOptions: extractGitOptions(options),
|
|
231
|
+
configOptions: extractConfigOptions(options)
|
|
232
|
+
})
|
|
233
|
+
);
|
|
47
234
|
const configurationProgram = program.command("configuration").alias("config").alias("conf").description("Configuration operations");
|
|
48
|
-
configurationProgram.command("get").description("Get the configuration")
|
|
49
|
-
|
|
235
|
+
const configGetCmd = configurationProgram.command("get").description("Get the configuration");
|
|
236
|
+
applyConfigOptions(configGetCmd);
|
|
237
|
+
configGetCmd.action((options) => {
|
|
238
|
+
(0, import_config2.getConfig)({
|
|
239
|
+
...options,
|
|
240
|
+
configOptions: extractConfigOptions(options)
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
const configPushCmd = configurationProgram.command("push").description("Push the configuration");
|
|
244
|
+
applyConfigOptions(configPushCmd);
|
|
245
|
+
configPushCmd.action((options) => {
|
|
246
|
+
(0, import_pushConfig.pushConfig)({
|
|
247
|
+
...options,
|
|
248
|
+
configOptions: extractConfigOptions(options)
|
|
249
|
+
});
|
|
250
|
+
});
|
|
50
251
|
program.command("content list").description("List the content declaration files").action(import_listContentDeclaration.listContentDeclaration);
|
|
51
|
-
program.command("
|
|
52
|
-
"--
|
|
53
|
-
"
|
|
54
|
-
).option(
|
|
252
|
+
const fillProgram = program.command("fill").description("Fill the dictionaries").option("-f, --file [files...]", "List of Dictionary files to fill").option("--source-locale [sourceLocale]", "Source locale to translate from").option(
|
|
253
|
+
"--output-locales [outputLocales...]",
|
|
254
|
+
"Target locales to translate to"
|
|
255
|
+
).option(
|
|
256
|
+
"--mode [mode]",
|
|
257
|
+
"Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys",
|
|
258
|
+
"review"
|
|
259
|
+
).option("--keys [keys...]", "Filter dictionaries based on keys").option(
|
|
260
|
+
"--excluded-keys [excludedKeys...]",
|
|
261
|
+
"Filter out dictionaries based on keys"
|
|
262
|
+
).option(
|
|
263
|
+
"--path-filter [pathFilters...]",
|
|
264
|
+
"Filter dictionaries based on glob pattern"
|
|
265
|
+
);
|
|
266
|
+
applyConfigOptions(fillProgram);
|
|
267
|
+
applyAIOptions(fillProgram);
|
|
268
|
+
applyGitOptions(fillProgram);
|
|
269
|
+
fillProgram.action(
|
|
270
|
+
(options) => (0, import_fill.fill)({
|
|
271
|
+
...options,
|
|
272
|
+
aiOptions: extractAiOptions(options),
|
|
273
|
+
gitOptions: extractGitOptions(options),
|
|
274
|
+
configOptions: extractConfigOptions(options)
|
|
275
|
+
})
|
|
276
|
+
);
|
|
55
277
|
program.parse(process.argv);
|
|
56
278
|
return program;
|
|
57
279
|
};
|
package/dist/cjs/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { audit } from './audit';\nimport { build } from './build';\nimport { getConfig } from './config';\nimport { listContentDeclaration } from './listContentDeclaration';\nimport { pull } from './pull';\nimport { push } from './push';\nimport { pushConfig } from './pushConfig';\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const program = new Command();\n\n program.version('1.0.0').description('Intlayer CLI');\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n dictionariesProgram\n .command('build')\n .description('Build the dictionaries')\n .option('-w, --watch', 'Watch for changes')\n .option('-e, --env [env]', 'Environment')\n .action(build);\n\n dictionariesProgram\n .command('pull')\n .option('-d, --dictionaries [ids...]', 'List of dictionary IDs to pull')\n .option('--newDictionariesPath [path]', 'Path to save the new dictionaries')\n .option('-e, --env [env]', 'Environment')\n .action(pull);\n\n // Define the main `push` command\n dictionariesProgram\n .command('push')\n .description(\n 'Push all dictionaries. Create or update the pushed dictionaries'\n )\n .option('-d, --dictionaries [ids...]', 'List of dictionary IDs to push')\n .option(\n '-r, --deleteLocaleDictionary',\n 'Delete the local dictionaries after pushing'\n )\n .option(\n '-k, --keepLocaleDictionary',\n 'Keep the local dictionaries after pushing'\n )\n .option('-e, --env [env]', 'Environment')\n .action(push);\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n configurationProgram\n .command('get')\n .description('Get the configuration')\n .option('--env-file [envFile]', 'Environment file')\n .option('--verbose', 'Verbose')\n .option('-e, --env [env]', 'Environment')\n .action(getConfig);\n\n // Define the `push config` subcommand and add it to the `push` command\n configurationProgram\n .command('push')\n .description('Push the configuration')\n .option('--env-file [envFile]', 'Environment file')\n .option('--verbose', 'Verbose')\n .option('-e, --env [env]', 'Environment')\n .action(pushConfig);\n\n /**\n * CONTENT DECLARATION\n */\n\n program\n .command('content list')\n .description('List the content declaration files')\n .action(listContentDeclaration);\n\n program\n .command('audit')\n .description('Audit the dictionaries')\n .option('-f, --files [files...]', 'List of Dictionary files to audit')\n .option(\n '--exclude [excludedGlobs...]',\n 'Globs pattern to exclude from the audit'\n )\n .option('-m, --model [model]', 'Model')\n .option('-p, --custom-prompt [prompt]', 'Custom prompt')\n .option('-l, --async-limit [asyncLimit]', 'Async limit')\n .option('-k, --open-ai-api-key [openAiApiKey]', 'OpenAI API key')\n .option('-e, --env [env]', 'Environment')\n .action(audit);\n\n program.parse(process.argv);\n\n return program;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,mBAAsB;AACtB,mBAAsB;AACtB,oBAA0B;AAC1B,oCAAuC;AACvC,kBAAqB;AACrB,kBAAqB;AACrB,wBAA2B;AAUpB,MAAM,SAAS,MAAe;AACnC,QAAM,UAAU,IAAI,yBAAQ;AAE5B,UAAQ,QAAQ,OAAO,EAAE,YAAY,cAAc;AAMnD,QAAM,sBAAsB,QACzB,QAAQ,YAAY,EACpB,MAAM,cAAc,EACpB,MAAM,KAAK,EACX,YAAY,yBAAyB;AAExC,sBACG,QAAQ,O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src/cli.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { GetConfigurationOptions } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { Command } from 'commander';\nimport { readFileSync } from 'fs';\nimport { dirname, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport {\n DiffMode,\n ListGitFilesOptions,\n} from '../../chokidar/dist/types/listGitFiles';\nimport { build } from './build';\nimport { getConfig } from './config';\nimport { fill, FillOptions } from './fill';\nimport { listContentDeclaration } from './listContentDeclaration';\nimport { pull } from './pull';\nimport { push } from './push';\nimport { pushConfig } from './pushConfig';\n\nconst CJS_ESM_Dirname = __dirname ?? dirname(fileURLToPath(import.meta.url));\nconst packageJson = JSON.parse(\n readFileSync(resolve(CJS_ESM_Dirname, '../../package.json'), 'utf8')\n);\n\nconst logOptions = [\n ['--verbose', 'Verbose'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ...logOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => command.option(flag, description));\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions) => {\n const isOptionEmpty = !Object.values(options).some(Boolean);\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { apiKey, provider, model, temperature, applicationContext } = options;\n\n return removeUndefined({\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? configuration.ai?.provider,\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n });\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const isOptionEmpty = !Object.values(options).some(Boolean);\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n} & LogOptions;\n\nconst extractConfigOptions = (\n options: ConfigurationOptions\n): GetConfigurationOptions | undefined => {\n const { baseDir, env, envFile, verbose, prefix } = options;\n\n const log = {\n prefix: prefix ?? '', // Should not consider the prefix set in the intlayer configuration file\n verbose,\n };\n\n const override = {\n log,\n };\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const program = new Command();\n\n program.version(packageJson.version).description('Intlayer CLI');\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [['-w, --watch', 'Watch for changes']],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n ['--newDictionariesPath [path]', 'Path to save the new dictionaries'],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action((options) => {\n pull({\n ...options,\n configOptions: {\n ...options.configOptions,\n baseDir: options.baseDir,\n },\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action((options) => {\n pull({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '-r, --deleteLocaleDictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keepLocaleDictionary',\n 'Keep the local dictionaries after pushing',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action((options) =>\n push({\n ...options,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions)\n );\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action((options) =>\n push({\n ...options,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions)\n );\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action((options) => {\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action((options) => {\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n program\n .command('content list')\n .description('List the content declaration files')\n .action(listContentDeclaration);\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'review'\n )\n .option('--keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action((options) =>\n fill({\n ...options,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions)\n );\n\n program.parse(process.argv);\n\n return program;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAC1B,uBAAwB;AACxB,gBAA6B;AAC7B,kBAAiC;AACjC,iBAA8B;AAK9B,mBAAsB;AACtB,IAAAA,iBAA0B;AAC1B,kBAAkC;AAClC,oCAAuC;AACvC,kBAAqB;AACrB,kBAAqB;AACrB,wBAA2B;AAjB3B;AAmBA,MAAM,kBAAkB,iBAAa,yBAAQ,0BAAc,YAAY,GAAG,CAAC;AAC3E,MAAM,cAAc,KAAK;AAAA,MACvB,4BAAa,qBAAQ,iBAAiB,oBAAoB,GAAG,MAAM;AACrE;AAEA,MAAM,aAAa;AAAA,EACjB,CAAC,aAAa,SAAS;AAAA,EACvB,CAAC,qBAAqB,QAAQ;AAChC;AAEA,MAAM,uBAAuB;AAAA,EAC3B,CAAC,wBAAwB,kBAAkB;AAAA,EAC3C,CAAC,mBAAmB,aAAa;AAAA,EACjC,CAAC,wBAAwB,gBAAgB;AAAA,EACzC,GAA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AY,oCAAoC,EAChD,OAAO,oDAAsB;AAEhC,QAAM,cAAc,QACjB,QAAQ,MAAM,EACd,YAAY,uBAAuB,EACnC,OAAO,yBAAyB,kCAAkC,EAClE,OAAO,kCAAkC,iCAAiC,EAC1E;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,OAAO,oBAAoB,mCAAmC,EAC9D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,qBAAmB,WAAW;AAC9B,iBAAe,WAAW;AAC1B,kBAAgB,WAAW;AAE3B,cAAY;AAAA,IAAO,CAAC,gBAClB,kBAAK;AAAA,MACH,GAAG;AAAA,MACH,WAAW,iBAAiB,OAAO;AAAA,MACnC,YAAY,kBAAkB,OAAO;AAAA,MACrC,eAAe,qBAAqB,OAAO;AAAA,IAC7C,CAAgB;AAAA,EAClB;AAEA,UAAQ,MAAM,QAAQ,IAAI;AAE1B,SAAO;AACT;","names":["import_config","configuration"]}
|
package/dist/cjs/config.cjs
CHANGED
|
@@ -23,12 +23,9 @@ __export(config_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(config_exports);
|
|
24
24
|
var import_config = require("@intlayer/config");
|
|
25
25
|
const getConfig = (options) => {
|
|
26
|
-
const config = (0, import_config.getConfiguration)(options);
|
|
27
|
-
(0, import_config.
|
|
28
|
-
|
|
29
|
-
prefix: options?.logPrefix
|
|
30
|
-
}
|
|
31
|
-
});
|
|
26
|
+
const config = (0, import_config.getConfiguration)(options?.configOptions);
|
|
27
|
+
const appLogger = (0, import_config.getAppLogger)(config);
|
|
28
|
+
appLogger(JSON.stringify(config, null, 2));
|
|
32
29
|
};
|
|
33
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
31
|
0 && (module.exports = {
|
package/dist/cjs/config.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config.ts"],"sourcesContent":["import {\n getConfiguration,\n type GetConfigurationOptions,\n
|
|
1
|
+
{"version":3,"sources":["../../src/config.ts"],"sourcesContent":["import {\n getAppLogger,\n getConfiguration,\n type GetConfigurationOptions,\n} from '@intlayer/config';\n\ntype ConfigOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const getConfig = (options?: ConfigOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n appLogger(JSON.stringify(config, null, 2));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAIO;AAMA,MAAM,YAAY,CAAC,YAA4B;AACpD,QAAM,aAAS,gCAAiB,SAAS,aAAa;AACtD,QAAM,gBAAY,4BAAa,MAAM;AAErC,YAAU,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAC3C;","names":[]}
|