i18next-cli 1.47.3 → 1.47.4

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.4'); // 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.
@@ -217,7 +239,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
217
239
  try {
218
240
  // 1. First attempt
219
241
  const initialArgs = buildArgs(command, effectiveConfig, cliOptions);
220
- console.log(node_util.styleText('cyan', `\nRunning 'locize ${initialArgs.join(' ')}'...`));
242
+ console.log(node_util.styleText('cyan', `\nRunning 'locize ${maskArgs(initialArgs).join(' ')}'...`));
221
243
  const result = await execa.execa('locize', initialArgs, { stdio: 'pipe' });
222
244
  spinner.succeed(node_util.styleText('green', `'locize ${command}' completed successfully.`));
223
245
  if (result?.stdout)
@@ -235,7 +257,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
235
257
  try {
236
258
  // 3. Retry attempt, rebuilding args with the NOW-UPDATED currentConfig object
237
259
  const retryArgs = buildArgs(command, effectiveConfig, cliOptions);
238
- console.log(node_util.styleText('cyan', `\nRunning 'locize ${retryArgs.join(' ')}'...`));
260
+ console.log(node_util.styleText('cyan', `\nRunning 'locize ${maskArgs(retryArgs).join(' ')}'...`));
239
261
  const result = await execa.execa('locize', retryArgs, { stdio: 'pipe' });
240
262
  spinner.succeed(node_util.styleText('green', 'Retry successful!'));
241
263
  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.4'); // 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.
@@ -215,7 +237,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
215
237
  try {
216
238
  // 1. First attempt
217
239
  const initialArgs = buildArgs(command, effectiveConfig, cliOptions);
218
- console.log(styleText('cyan', `\nRunning 'locize ${initialArgs.join(' ')}'...`));
240
+ console.log(styleText('cyan', `\nRunning 'locize ${maskArgs(initialArgs).join(' ')}'...`));
219
241
  const result = await execa('locize', initialArgs, { stdio: 'pipe' });
220
242
  spinner.succeed(styleText('green', `'locize ${command}' completed successfully.`));
221
243
  if (result?.stdout)
@@ -233,7 +255,7 @@ async function runLocizeCommand(command, config, cliOptions = {}) {
233
255
  try {
234
256
  // 3. Retry attempt, rebuilding args with the NOW-UPDATED currentConfig object
235
257
  const retryArgs = buildArgs(command, effectiveConfig, cliOptions);
236
- console.log(styleText('cyan', `\nRunning 'locize ${retryArgs.join(' ')}'...`));
258
+ console.log(styleText('cyan', `\nRunning 'locize ${maskArgs(retryArgs).join(' ')}'...`));
237
259
  const result = await execa('locize', retryArgs, { stdio: 'pipe' });
238
260
  spinner.succeed(styleText('green', 'Retry successful!'));
239
261
  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.4",
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;AA0RnD,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"}