lingo.dev 0.79.0 → 0.79.1
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/build/cli.cjs +45 -15
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +32 -2
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -3305,7 +3305,16 @@ function _tryParseJSON(line) {
|
|
|
3305
3305
|
}
|
|
3306
3306
|
|
|
3307
3307
|
// src/cli/cmd/i18n.ts
|
|
3308
|
-
var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option("--locale <locale>", "Locale to process", (val, prev) => prev ? [...prev, val] : [val]).option("--bucket <bucket>", "Bucket to process", (val, prev) => prev ? [...prev, val] : [val]).option(
|
|
3308
|
+
var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option("--locale <locale>", "Locale to process", (val, prev) => prev ? [...prev, val] : [val]).option("--bucket <bucket>", "Bucket to process", (val, prev) => prev ? [...prev, val] : [val]).option(
|
|
3309
|
+
"--key <key>",
|
|
3310
|
+
"Key to process. Process only a specific translation key, useful for debugging or updating a single entry"
|
|
3311
|
+
).option(
|
|
3312
|
+
"--file [files...]",
|
|
3313
|
+
"File to process. Process only a specific path, may contain asterisk * to match multiple files. Useful if you have a lot of files and want to focus on a specific one. Specify more files separated by commas or spaces."
|
|
3314
|
+
).option(
|
|
3315
|
+
"--frozen",
|
|
3316
|
+
`Run in read-only mode - fails if any translations need updating, useful for CI/CD pipelines to detect missing translations`
|
|
3317
|
+
).option("--force", "Ignore lockfile and process all keys, useful for full re-translation").option("--verbose", "Show detailed output including intermediate processing data and API communication details").option("--interactive", "Enable interactive mode for reviewing and editing translations before they are applied").option("--api-key <api-key>", "Explicitly set the API key to use, override the default API key from settings").option("--debug", "Pause execution at start for debugging purposes, waits for user confirmation before proceeding").option("--strict", "Stop processing on first error instead of continuing with other locales/buckets").action(async function(options) {
|
|
3309
3318
|
updateGitignore();
|
|
3310
3319
|
const ora = _ora2.default.call(void 0, );
|
|
3311
3320
|
const flags = parseFlags(options);
|
|
@@ -3335,7 +3344,27 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3335
3344
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
3336
3345
|
}
|
|
3337
3346
|
ora.succeed("Buckets retrieved");
|
|
3338
|
-
|
|
3347
|
+
if (_optionalChain([flags, 'access', _138 => _138.file, 'optionalAccess', _139 => _139.length])) {
|
|
3348
|
+
buckets = buckets.map((bucket) => {
|
|
3349
|
+
const config = bucket.config.filter(
|
|
3350
|
+
(config2) => flags.file.find((file) => _optionalChain([config2, 'access', _140 => _140.pathPattern, 'optionalAccess', _141 => _141.match, 'call', _142 => _142(file)]))
|
|
3351
|
+
);
|
|
3352
|
+
return { ...bucket, config };
|
|
3353
|
+
}).filter((bucket) => bucket.config.length > 0);
|
|
3354
|
+
if (buckets.length === 0) {
|
|
3355
|
+
ora.fail("No buckets found. All buckets were filtered out by --file option.");
|
|
3356
|
+
process.exit(1);
|
|
3357
|
+
} else {
|
|
3358
|
+
ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
|
|
3359
|
+
buckets.map((bucket) => {
|
|
3360
|
+
ora.info(` ${bucket.type}:`);
|
|
3361
|
+
bucket.config.forEach((config) => {
|
|
3362
|
+
ora.info(` - ${config.pathPattern}`);
|
|
3363
|
+
});
|
|
3364
|
+
});
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
const targetLocales = _optionalChain([flags, 'access', _143 => _143.locale, 'optionalAccess', _144 => _144.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
3339
3368
|
const lockfileHelper = createLockfileHelper();
|
|
3340
3369
|
ora.start("Ensuring i18n.lock exists...");
|
|
3341
3370
|
if (!lockfileHelper.isLockfileExists()) {
|
|
@@ -3630,6 +3659,7 @@ function parseFlags(options) {
|
|
|
3630
3659
|
verbose: _zod2.default.boolean().optional(),
|
|
3631
3660
|
strict: _zod2.default.boolean().optional(),
|
|
3632
3661
|
key: _zod2.default.string().optional(),
|
|
3662
|
+
file: _zod2.default.array(_zod2.default.string()).optional(),
|
|
3633
3663
|
interactive: _zod2.default.boolean().default(false),
|
|
3634
3664
|
debug: _zod2.default.boolean().default(false)
|
|
3635
3665
|
}).parse(options);
|
|
@@ -3665,12 +3695,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
3665
3695
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
3666
3696
|
docUrl: "bucketNotFound"
|
|
3667
3697
|
});
|
|
3668
|
-
} else if (_optionalChain([flags, 'access',
|
|
3698
|
+
} else if (_optionalChain([flags, 'access', _145 => _145.locale, 'optionalAccess', _146 => _146.some, 'call', _147 => _147((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
3669
3699
|
throw new CLIError({
|
|
3670
3700
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
3671
3701
|
docUrl: "localeTargetNotFound"
|
|
3672
3702
|
});
|
|
3673
|
-
} else if (_optionalChain([flags, 'access',
|
|
3703
|
+
} else if (_optionalChain([flags, 'access', _148 => _148.bucket, 'optionalAccess', _149 => _149.some, 'call', _150 => _150((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
3674
3704
|
throw new CLIError({
|
|
3675
3705
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
3676
3706
|
docUrl: "bucketNotFound"
|
|
@@ -4029,7 +4059,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4029
4059
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
4030
4060
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
4031
4061
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
4032
|
-
_optionalChain([this, 'access',
|
|
4062
|
+
_optionalChain([this, 'access', _151 => _151.platformKit, 'optionalAccess', _152 => _152.gitConfig, 'call', _153 => _153()]);
|
|
4033
4063
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
4034
4064
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
4035
4065
|
if (!processOwnCommits) {
|
|
@@ -4054,7 +4084,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4054
4084
|
// ../../action/src/flows/pull-request.ts
|
|
4055
4085
|
var PullRequestFlow = class extends InBranchFlow {
|
|
4056
4086
|
async preRun() {
|
|
4057
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
4087
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _154 => _154()]);
|
|
4058
4088
|
if (!canContinue) {
|
|
4059
4089
|
return false;
|
|
4060
4090
|
}
|
|
@@ -4280,10 +4310,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
4280
4310
|
repo_slug: this.platformConfig.repositoryName,
|
|
4281
4311
|
state: "OPEN"
|
|
4282
4312
|
}).then(({ data: { values } }) => {
|
|
4283
|
-
return _optionalChain([values, 'optionalAccess',
|
|
4284
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
4313
|
+
return _optionalChain([values, 'optionalAccess', _155 => _155.find, 'call', _156 => _156(
|
|
4314
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _157 => _157.branch, 'optionalAccess', _158 => _158.name]) === branch && _optionalChain([destination, 'optionalAccess', _159 => _159.branch, 'optionalAccess', _160 => _160.name]) === this.platformConfig.baseBranchName
|
|
4285
4315
|
)]);
|
|
4286
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
4316
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _161 => _161.id]));
|
|
4287
4317
|
}
|
|
4288
4318
|
async closePullRequest({ pullRequestNumber }) {
|
|
4289
4319
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -4370,7 +4400,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
4370
4400
|
repo: this.platformConfig.repositoryName,
|
|
4371
4401
|
base: this.platformConfig.baseBranchName,
|
|
4372
4402
|
state: "open"
|
|
4373
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
4403
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _162 => _162.number]));
|
|
4374
4404
|
}
|
|
4375
4405
|
async closePullRequest({ pullRequestNumber }) {
|
|
4376
4406
|
await this.octokit.rest.pulls.update({
|
|
@@ -4486,7 +4516,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
4486
4516
|
sourceBranch: branch,
|
|
4487
4517
|
state: "opened"
|
|
4488
4518
|
});
|
|
4489
|
-
return _optionalChain([mergeRequests, 'access',
|
|
4519
|
+
return _optionalChain([mergeRequests, 'access', _163 => _163[0], 'optionalAccess', _164 => _164.iid]);
|
|
4490
4520
|
}
|
|
4491
4521
|
async closePullRequest({ pullRequestNumber }) {
|
|
4492
4522
|
await this.gitlab.MergeRequests.edit(this.platformConfig.gitlabProjectId, pullRequestNumber, {
|
|
@@ -4540,7 +4570,7 @@ async function main() {
|
|
|
4540
4570
|
const { isPullRequestMode } = platformKit.config;
|
|
4541
4571
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
4542
4572
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
4543
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
4573
|
+
const canRun = await _optionalChain([flow, 'access', _165 => _165.preRun, 'optionalCall', _166 => _166()]);
|
|
4544
4574
|
if (canRun === false) {
|
|
4545
4575
|
return;
|
|
4546
4576
|
}
|
|
@@ -4548,7 +4578,7 @@ async function main() {
|
|
|
4548
4578
|
if (!hasChanges) {
|
|
4549
4579
|
return;
|
|
4550
4580
|
}
|
|
4551
|
-
await _optionalChain([flow, 'access',
|
|
4581
|
+
await _optionalChain([flow, 'access', _167 => _167.postRun, 'optionalCall', _168 => _168()]);
|
|
4552
4582
|
}
|
|
4553
4583
|
|
|
4554
4584
|
// src/cli/cmd/ci.ts
|
|
@@ -4570,7 +4600,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
4570
4600
|
}
|
|
4571
4601
|
const env = {
|
|
4572
4602
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
4573
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
4603
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _169 => _169.pullRequest, 'optionalAccess', _170 => _170.toString, 'call', _171 => _171()]) || "false",
|
|
4574
4604
|
...options.commitMessage && { LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage },
|
|
4575
4605
|
...options.pullRequestTitle && { LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle },
|
|
4576
4606
|
...options.workingDirectory && { LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory },
|
|
@@ -4583,7 +4613,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
4583
4613
|
// package.json
|
|
4584
4614
|
var package_default = {
|
|
4585
4615
|
name: "lingo.dev",
|
|
4586
|
-
version: "0.79.
|
|
4616
|
+
version: "0.79.1",
|
|
4587
4617
|
description: "Lingo.dev CLI",
|
|
4588
4618
|
private: false,
|
|
4589
4619
|
publishConfig: {
|