i18next-cli 1.47.3 → 1.47.5

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/cli.js CHANGED
@@ -31,7 +31,7 @@ const program = new commander.Command();
31
31
  program
32
32
  .name('i18next-cli')
33
33
  .description('A unified, high-performance i18next CLI.')
34
- .version('1.47.3'); // This string is replaced with the actual version at build time by rollup
34
+ .version('1.47.5'); // This string is replaced with the actual version at build time by rollup
35
35
  // new: global config override option
36
36
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
37
37
  program
@@ -110,6 +110,28 @@ LOCIZE_API_KEY=${answers.apiKey}
110
110
  version: answers.version,
111
111
  };
112
112
  }
113
+ /**
114
+ * Masks an API key for safe console output, preserving only the first
115
+ * and last 3 characters while replacing everything in between.
116
+ */
117
+ function maskApiKey(apiKey) {
118
+ if (!apiKey || apiKey.length <= 6)
119
+ return apiKey;
120
+ const first3 = apiKey.substring(0, 3);
121
+ const last3 = apiKey.substring(apiKey.length - 3);
122
+ const middle = apiKey.substring(3, apiKey.length - 3);
123
+ return `${first3}${middle.replace(/[0-9a-zA-Z]/g, '*')}${last3}`;
124
+ }
125
+ /**
126
+ * Returns a display-safe copy of args with the `--api-key` value masked.
127
+ */
128
+ function maskArgs(args) {
129
+ return args.map((arg, i) => {
130
+ if (i > 0 && args[i - 1] === '--api-key')
131
+ return maskApiKey(arg);
132
+ return arg;
133
+ });
134
+ }
113
135
  /**
114
136
  * Helper function to build the array of arguments for the execa call.
115
137
  * This ensures the logic is consistent for both the initial run and the retry.
@@ -180,6 +202,9 @@ function buildArgs(command, config, cliOptions) {
180
202
  catch {
181
203
  basePath = node_path.resolve(process.cwd(), '.');
182
204
  }
205
+ if (command === 'migrate') {
206
+ commandArgs.push('--download', 'true');
207
+ }
183
208
  commandArgs.push('--path', basePath);
184
209
  return commandArgs;
185
210
  }
@@ -217,7 +242,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
217
242
  try {
218
243
  // 1. First attempt
219
244
  const initialArgs = buildArgs(command, effectiveConfig, cliOptions);
220
- console.log(node_util.styleText('cyan', `\nRunning 'locize ${initialArgs.join(' ')}'...`));
245
+ console.log(node_util.styleText('cyan', `\nRunning 'locize ${maskArgs(initialArgs).join(' ')}'...`));
221
246
  const result = await execa.execa('locize', initialArgs, { stdio: 'pipe' });
222
247
  spinner.succeed(node_util.styleText('green', `'locize ${command}' completed successfully.`));
223
248
  if (result?.stdout)
@@ -235,7 +260,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
235
260
  try {
236
261
  // 3. Retry attempt, rebuilding args with the NOW-UPDATED currentConfig object
237
262
  const retryArgs = buildArgs(command, effectiveConfig, cliOptions);
238
- console.log(node_util.styleText('cyan', `\nRunning 'locize ${retryArgs.join(' ')}'...`));
263
+ console.log(node_util.styleText('cyan', `\nRunning 'locize ${maskArgs(retryArgs).join(' ')}'...`));
239
264
  const result = await execa.execa('locize', retryArgs, { stdio: 'pipe' });
240
265
  spinner.succeed(node_util.styleText('green', 'Retry successful!'));
241
266
  if (result?.stdout)
package/dist/esm/cli.js CHANGED
@@ -29,7 +29,7 @@ const program = new Command();
29
29
  program
30
30
  .name('i18next-cli')
31
31
  .description('A unified, high-performance i18next CLI.')
32
- .version('1.47.3'); // This string is replaced with the actual version at build time by rollup
32
+ .version('1.47.5'); // This string is replaced with the actual version at build time by rollup
33
33
  // new: global config override option
34
34
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
35
35
  program
@@ -108,6 +108,28 @@ LOCIZE_API_KEY=${answers.apiKey}
108
108
  version: answers.version,
109
109
  };
110
110
  }
111
+ /**
112
+ * Masks an API key for safe console output, preserving only the first
113
+ * and last 3 characters while replacing everything in between.
114
+ */
115
+ function maskApiKey(apiKey) {
116
+ if (!apiKey || apiKey.length <= 6)
117
+ return apiKey;
118
+ const first3 = apiKey.substring(0, 3);
119
+ const last3 = apiKey.substring(apiKey.length - 3);
120
+ const middle = apiKey.substring(3, apiKey.length - 3);
121
+ return `${first3}${middle.replace(/[0-9a-zA-Z]/g, '*')}${last3}`;
122
+ }
123
+ /**
124
+ * Returns a display-safe copy of args with the `--api-key` value masked.
125
+ */
126
+ function maskArgs(args) {
127
+ return args.map((arg, i) => {
128
+ if (i > 0 && args[i - 1] === '--api-key')
129
+ return maskApiKey(arg);
130
+ return arg;
131
+ });
132
+ }
111
133
  /**
112
134
  * Helper function to build the array of arguments for the execa call.
113
135
  * This ensures the logic is consistent for both the initial run and the retry.
@@ -178,6 +200,9 @@ function buildArgs(command, config, cliOptions) {
178
200
  catch {
179
201
  basePath = resolve(process.cwd(), '.');
180
202
  }
203
+ if (command === 'migrate') {
204
+ commandArgs.push('--download', 'true');
205
+ }
181
206
  commandArgs.push('--path', basePath);
182
207
  return commandArgs;
183
208
  }
@@ -215,7 +240,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
215
240
  try {
216
241
  // 1. First attempt
217
242
  const initialArgs = buildArgs(command, effectiveConfig, cliOptions);
218
- console.log(styleText('cyan', `\nRunning 'locize ${initialArgs.join(' ')}'...`));
243
+ console.log(styleText('cyan', `\nRunning 'locize ${maskArgs(initialArgs).join(' ')}'...`));
219
244
  const result = await execa('locize', initialArgs, { stdio: 'pipe' });
220
245
  spinner.succeed(styleText('green', `'locize ${command}' completed successfully.`));
221
246
  if (result?.stdout)
@@ -233,7 +258,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
233
258
  try {
234
259
  // 3. Retry attempt, rebuilding args with the NOW-UPDATED currentConfig object
235
260
  const retryArgs = buildArgs(command, effectiveConfig, cliOptions);
236
- console.log(styleText('cyan', `\nRunning 'locize ${retryArgs.join(' ')}'...`));
261
+ console.log(styleText('cyan', `\nRunning 'locize ${maskArgs(retryArgs).join(' ')}'...`));
237
262
  const result = await execa('locize', retryArgs, { stdio: 'pipe' });
238
263
  spinner.succeed(styleText('green', 'Retry successful!'));
239
264
  if (result?.stdout)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.47.3",
3
+ "version": "1.47.5",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"locize.d.ts","sourceRoot":"","sources":["../src/locize.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAoQnD,eAAO,MAAM,aAAa,GAAI,QAAQ,oBAAoB,EAAE,aAAa,GAAG,kBAAiD,CAAA;AAC7H,eAAO,MAAM,iBAAiB,GAAI,QAAQ,oBAAoB,EAAE,aAAa,GAAG,kBAAqD,CAAA;AACrI,eAAO,MAAM,gBAAgB,GAAI,QAAQ,oBAAoB,EAAE,aAAa,GAAG,kBAAoD,CAAA"}
1
+ {"version":3,"file":"locize.d.ts","sourceRoot":"","sources":["../src/locize.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AA8RnD,eAAO,MAAM,aAAa,GAAI,QAAQ,oBAAoB,EAAE,aAAa,GAAG,kBAAiD,CAAA;AAC7H,eAAO,MAAM,iBAAiB,GAAI,QAAQ,oBAAoB,EAAE,aAAa,GAAG,kBAAqD,CAAA;AACrI,eAAO,MAAM,gBAAgB,GAAI,QAAQ,oBAAoB,EAAE,aAAa,GAAG,kBAAoD,CAAA"}