lingo.dev 0.95.0 → 0.96.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/build/cli.cjs +46 -18
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +29 -1
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.cjs
CHANGED
|
@@ -6170,6 +6170,23 @@ var flagsSchema2 = _zod.z.object({
|
|
|
6170
6170
|
|
|
6171
6171
|
// src/cli/cmd/run/index.ts
|
|
6172
6172
|
|
|
6173
|
+
|
|
6174
|
+
// src/cli/cmd/run/_utils.ts
|
|
6175
|
+
async function determineAuthId(ctx) {
|
|
6176
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _199 => _199.config, 'optionalAccess', _200 => _200.provider]);
|
|
6177
|
+
if (isByokMode) {
|
|
6178
|
+
return null;
|
|
6179
|
+
} else {
|
|
6180
|
+
try {
|
|
6181
|
+
const authStatus = await _optionalChain([ctx, 'access', _201 => _201.localizer, 'optionalAccess', _202 => _202.checkAuth, 'call', _203 => _203()]);
|
|
6182
|
+
return _optionalChain([authStatus, 'optionalAccess', _204 => _204.username]) || null;
|
|
6183
|
+
} catch (e3) {
|
|
6184
|
+
return null;
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
}
|
|
6188
|
+
|
|
6189
|
+
// src/cli/cmd/run/index.ts
|
|
6173
6190
|
var run_default = new (0, _interactivecommander.Command)().command("run").description("Run Lingo.dev localization engine").helpOption("-h, --help", "Show help").option(
|
|
6174
6191
|
"--source-locale <source-locale>",
|
|
6175
6192
|
"Locale to use as source locale. Defaults to i18n.json locale.source",
|
|
@@ -6226,6 +6243,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
6226
6243
|
"Number of concurrent tasks to run",
|
|
6227
6244
|
(val) => parseInt(val)
|
|
6228
6245
|
).action(async (args) => {
|
|
6246
|
+
let authId = null;
|
|
6229
6247
|
try {
|
|
6230
6248
|
const ctx = {
|
|
6231
6249
|
flags: flagsSchema2.parse(args),
|
|
@@ -6241,6 +6259,11 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
6241
6259
|
await renderHero();
|
|
6242
6260
|
await renderSpacer();
|
|
6243
6261
|
await setup(ctx);
|
|
6262
|
+
authId = await determineAuthId(ctx);
|
|
6263
|
+
trackEvent(authId, "cmd.run.start", {
|
|
6264
|
+
config: ctx.config,
|
|
6265
|
+
flags: ctx.flags
|
|
6266
|
+
});
|
|
6244
6267
|
await renderSpacer();
|
|
6245
6268
|
await plan(ctx);
|
|
6246
6269
|
await renderSpacer();
|
|
@@ -6248,7 +6271,12 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
6248
6271
|
await renderSpacer();
|
|
6249
6272
|
await renderSummary(ctx.results);
|
|
6250
6273
|
await renderSpacer();
|
|
6274
|
+
trackEvent(authId, "cmd.run.success", {
|
|
6275
|
+
config: ctx.config,
|
|
6276
|
+
flags: ctx.flags
|
|
6277
|
+
});
|
|
6251
6278
|
} catch (error) {
|
|
6279
|
+
trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
6252
6280
|
process.exit(1);
|
|
6253
6281
|
}
|
|
6254
6282
|
});
|
|
@@ -6322,7 +6350,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
6322
6350
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
6323
6351
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
6324
6352
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
6325
|
-
_optionalChain([this, 'access',
|
|
6353
|
+
_optionalChain([this, 'access', _205 => _205.platformKit, 'optionalAccess', _206 => _206.gitConfig, 'call', _207 => _207()]);
|
|
6326
6354
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
6327
6355
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
6328
6356
|
if (!processOwnCommits) {
|
|
@@ -6354,7 +6382,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
6354
6382
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
6355
6383
|
var PullRequestFlow = class extends InBranchFlow {
|
|
6356
6384
|
async preRun() {
|
|
6357
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
6385
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _208 => _208()]);
|
|
6358
6386
|
if (!canContinue) {
|
|
6359
6387
|
return false;
|
|
6360
6388
|
}
|
|
@@ -6609,10 +6637,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
6609
6637
|
repo_slug: this.platformConfig.repositoryName,
|
|
6610
6638
|
state: "OPEN"
|
|
6611
6639
|
}).then(({ data: { values } }) => {
|
|
6612
|
-
return _optionalChain([values, 'optionalAccess',
|
|
6613
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
6640
|
+
return _optionalChain([values, 'optionalAccess', _209 => _209.find, 'call', _210 => _210(
|
|
6641
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _211 => _211.branch, 'optionalAccess', _212 => _212.name]) === branch && _optionalChain([destination, 'optionalAccess', _213 => _213.branch, 'optionalAccess', _214 => _214.name]) === this.platformConfig.baseBranchName
|
|
6614
6642
|
)]);
|
|
6615
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
6643
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _215 => _215.id]));
|
|
6616
6644
|
}
|
|
6617
6645
|
async closePullRequest({ pullRequestNumber }) {
|
|
6618
6646
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -6708,7 +6736,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
6708
6736
|
repo: this.platformConfig.repositoryName,
|
|
6709
6737
|
base: this.platformConfig.baseBranchName,
|
|
6710
6738
|
state: "open"
|
|
6711
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
6739
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _216 => _216.number]));
|
|
6712
6740
|
}
|
|
6713
6741
|
async closePullRequest({ pullRequestNumber }) {
|
|
6714
6742
|
await this.octokit.rest.pulls.update({
|
|
@@ -6823,7 +6851,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
6823
6851
|
branch
|
|
6824
6852
|
);
|
|
6825
6853
|
return true;
|
|
6826
|
-
} catch (
|
|
6854
|
+
} catch (e4) {
|
|
6827
6855
|
return false;
|
|
6828
6856
|
}
|
|
6829
6857
|
}
|
|
@@ -6835,7 +6863,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
6835
6863
|
sourceBranch: branch,
|
|
6836
6864
|
state: "opened"
|
|
6837
6865
|
});
|
|
6838
|
-
return _optionalChain([mergeRequests, 'access',
|
|
6866
|
+
return _optionalChain([mergeRequests, 'access', _217 => _217[0], 'optionalAccess', _218 => _218.iid]);
|
|
6839
6867
|
}
|
|
6840
6868
|
async closePullRequest({
|
|
6841
6869
|
pullRequestNumber
|
|
@@ -6925,7 +6953,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
6925
6953
|
}
|
|
6926
6954
|
const env = {
|
|
6927
6955
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
6928
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
6956
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _219 => _219.pullRequest, 'optionalAccess', _220 => _220.toString, 'call', _221 => _221()]) || "false",
|
|
6929
6957
|
...options.commitMessage && {
|
|
6930
6958
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
6931
6959
|
},
|
|
@@ -6945,7 +6973,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
6945
6973
|
const { isPullRequestMode } = platformKit.config;
|
|
6946
6974
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
6947
6975
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
6948
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
6976
|
+
const canRun = await _optionalChain([flow, 'access', _222 => _222.preRun, 'optionalCall', _223 => _223()]);
|
|
6949
6977
|
if (canRun === false) {
|
|
6950
6978
|
return;
|
|
6951
6979
|
}
|
|
@@ -6955,7 +6983,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
6955
6983
|
if (!hasChanges) {
|
|
6956
6984
|
return;
|
|
6957
6985
|
}
|
|
6958
|
-
await _optionalChain([flow, 'access',
|
|
6986
|
+
await _optionalChain([flow, 'access', _224 => _224.postRun, 'optionalCall', _225 => _225()]);
|
|
6959
6987
|
});
|
|
6960
6988
|
function parseBooleanArg(val) {
|
|
6961
6989
|
if (val === true) return true;
|
|
@@ -7006,13 +7034,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
7006
7034
|
flags
|
|
7007
7035
|
});
|
|
7008
7036
|
let buckets = getBuckets(i18nConfig);
|
|
7009
|
-
if (_optionalChain([flags, 'access',
|
|
7037
|
+
if (_optionalChain([flags, 'access', _226 => _226.bucket, 'optionalAccess', _227 => _227.length])) {
|
|
7010
7038
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
7011
7039
|
}
|
|
7012
7040
|
ora.succeed("Buckets retrieved");
|
|
7013
|
-
if (_optionalChain([flags, 'access',
|
|
7041
|
+
if (_optionalChain([flags, 'access', _228 => _228.file, 'optionalAccess', _229 => _229.length])) {
|
|
7014
7042
|
buckets = buckets.map((bucket) => {
|
|
7015
|
-
const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access',
|
|
7043
|
+
const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _230 => _230.pathPattern, 'optionalAccess', _231 => _231.match, 'call', _232 => _232(file)])));
|
|
7016
7044
|
return { ...bucket, paths };
|
|
7017
7045
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
7018
7046
|
if (buckets.length === 0) {
|
|
@@ -7028,7 +7056,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
7028
7056
|
});
|
|
7029
7057
|
}
|
|
7030
7058
|
}
|
|
7031
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
7059
|
+
const targetLocales = _optionalChain([flags, 'access', _233 => _233.locale, 'optionalAccess', _234 => _234.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
7032
7060
|
let totalSourceKeyCount = 0;
|
|
7033
7061
|
let uniqueKeysToTranslate = 0;
|
|
7034
7062
|
let totalExistingTranslations = 0;
|
|
@@ -7369,12 +7397,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
7369
7397
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
7370
7398
|
docUrl: "bucketNotFound"
|
|
7371
7399
|
});
|
|
7372
|
-
} else if (_optionalChain([flags, 'access',
|
|
7400
|
+
} else if (_optionalChain([flags, 'access', _235 => _235.locale, 'optionalAccess', _236 => _236.some, 'call', _237 => _237((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
7373
7401
|
throw new CLIError({
|
|
7374
7402
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
7375
7403
|
docUrl: "localeTargetNotFound"
|
|
7376
7404
|
});
|
|
7377
|
-
} else if (_optionalChain([flags, 'access',
|
|
7405
|
+
} else if (_optionalChain([flags, 'access', _238 => _238.bucket, 'optionalAccess', _239 => _239.some, 'call', _240 => _240((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
7378
7406
|
throw new CLIError({
|
|
7379
7407
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
7380
7408
|
docUrl: "bucketNotFound"
|
|
@@ -7457,7 +7485,7 @@ async function renderHero2() {
|
|
|
7457
7485
|
// package.json
|
|
7458
7486
|
var package_default = {
|
|
7459
7487
|
name: "lingo.dev",
|
|
7460
|
-
version: "0.
|
|
7488
|
+
version: "0.96.0",
|
|
7461
7489
|
description: "Lingo.dev CLI",
|
|
7462
7490
|
private: false,
|
|
7463
7491
|
publishConfig: {
|