lingo.dev 0.79.3 → 0.79.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/build/cli.mjs CHANGED
@@ -1815,10 +1815,8 @@ function createXcodeXcstringsLoader(defaultLocale) {
1815
1815
  }
1816
1816
 
1817
1817
  // src/cli/loaders/prettier.ts
1818
- import fs9 from "fs";
1819
1818
  import path11 from "path";
1820
1819
  import prettier from "prettier";
1821
- import { execSync } from "child_process";
1822
1820
  function createPrettierLoader(options) {
1823
1821
  return createLoader({
1824
1822
  async pull(locale, data) {
@@ -1847,8 +1845,9 @@ function createPrettierLoader(options) {
1847
1845
  } catch (error) {
1848
1846
  if (error instanceof Error && error.message.startsWith("Cannot find package")) {
1849
1847
  console.log();
1850
- console.log("Prettier is missing some dependecies - installing all project dependencies");
1851
- installDependencies();
1848
+ console.log("\u26A0\uFE0F Prettier plugins are not installed. Formatting without plugins.");
1849
+ console.log("\u26A0\uFE0F To use prettier plugins install project dependencies before running Lingo.dev.");
1850
+ config.plugins = [];
1852
1851
  await prettier.clearConfigCache();
1853
1852
  const result = await prettier.format(data, config);
1854
1853
  return result;
@@ -1867,27 +1866,6 @@ async function loadPrettierConfig(filePath) {
1867
1866
  return {};
1868
1867
  }
1869
1868
  }
1870
- async function installDependencies() {
1871
- const packageManager = await getPackageManager();
1872
- console.log(`Installing dependencies using ${packageManager}`);
1873
- execSync(`${packageManager} install --frozen-lockfile`, { stdio: "inherit" });
1874
- console.log(`Dependencies installed`);
1875
- }
1876
- async function getPackageManager() {
1877
- const yarnLockfile = path11.resolve(process.cwd(), "yarn.lock");
1878
- if (fs9.existsSync(yarnLockfile)) {
1879
- return "yarn";
1880
- }
1881
- const pnpmLockfile = path11.resolve(process.cwd(), "pnpm-lock.yaml");
1882
- if (fs9.existsSync(pnpmLockfile)) {
1883
- return "pnpm";
1884
- }
1885
- const bunLockfile = path11.resolve(process.cwd(), "bun.lock");
1886
- if (fs9.existsSync(bunLockfile)) {
1887
- return "bun";
1888
- }
1889
- return "npm";
1890
- }
1891
1869
 
1892
1870
  // src/cli/loaders/unlocalizable.ts
1893
1871
  import _10 from "lodash";
@@ -2102,7 +2080,7 @@ function createSrtLoader() {
2102
2080
  }
2103
2081
 
2104
2082
  // src/cli/loaders/dato/index.ts
2105
- import fs10 from "fs";
2083
+ import fs9 from "fs";
2106
2084
  import JSON5 from "json5";
2107
2085
 
2108
2086
  // src/cli/loaders/dato/_base.ts
@@ -2701,12 +2679,12 @@ function _isVideo(rawDatoValue) {
2701
2679
  // src/cli/loaders/dato/index.ts
2702
2680
  function createDatoLoader(configFilePath) {
2703
2681
  try {
2704
- const configContent = fs10.readFileSync(configFilePath, "utf-8");
2682
+ const configContent = fs9.readFileSync(configFilePath, "utf-8");
2705
2683
  const datoConfig = datoConfigSchema.parse(JSON5.parse(configContent));
2706
2684
  return composeLoaders(
2707
2685
  createDatoApiLoader(
2708
2686
  datoConfig,
2709
- (updatedConfig) => fs10.writeFileSync(configFilePath, JSON5.stringify(updatedConfig, null, 2))
2687
+ (updatedConfig) => fs9.writeFileSync(configFilePath, JSON5.stringify(updatedConfig, null, 2))
2710
2688
  ),
2711
2689
  createDatoFilterLoader(),
2712
2690
  createDatoExtractLoader()
@@ -3015,12 +2993,13 @@ function createInjectLocaleLoader(injectLocaleKeys) {
3015
2993
  if (!injectLocaleKeys) {
3016
2994
  return data;
3017
2995
  }
2996
+ const mergedData = _18.merge({}, originalInput, data);
3018
2997
  injectLocaleKeys.forEach((key) => {
3019
- if (_18.get(originalInput, key) === originalLocale) {
3020
- _18.set(data, key, locale);
2998
+ if (_18.get(mergedData, key) === originalLocale) {
2999
+ _18.set(mergedData, key, locale);
3021
3000
  }
3022
3001
  });
3023
- return data;
3002
+ return mergedData;
3024
3003
  }
3025
3004
  });
3026
3005
  }
@@ -3200,7 +3179,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
3200
3179
  }
3201
3180
 
3202
3181
  // src/cli/utils/lockfile.ts
3203
- import fs11 from "fs";
3182
+ import fs10 from "fs";
3204
3183
  import path12 from "path";
3205
3184
  import Z3 from "zod";
3206
3185
  import YAML3 from "yaml";
@@ -3210,7 +3189,7 @@ function createLockfileHelper() {
3210
3189
  return {
3211
3190
  isLockfileExists: () => {
3212
3191
  const lockfilePath = _getLockfilePath();
3213
- return fs11.existsSync(lockfilePath);
3192
+ return fs10.existsSync(lockfilePath);
3214
3193
  },
3215
3194
  registerSourceData: (pathPattern, sourceData) => {
3216
3195
  const lockfile = _loadLockfile();
@@ -3237,17 +3216,17 @@ function createLockfileHelper() {
3237
3216
  };
3238
3217
  function _loadLockfile() {
3239
3218
  const lockfilePath = _getLockfilePath();
3240
- if (!fs11.existsSync(lockfilePath)) {
3219
+ if (!fs10.existsSync(lockfilePath)) {
3241
3220
  return LockfileSchema.parse({});
3242
3221
  }
3243
- const content = fs11.readFileSync(lockfilePath, "utf-8");
3222
+ const content = fs10.readFileSync(lockfilePath, "utf-8");
3244
3223
  const result = LockfileSchema.parse(YAML3.parse(content));
3245
3224
  return result;
3246
3225
  }
3247
3226
  function _saveLockfile(lockfile) {
3248
3227
  const lockfilePath = _getLockfilePath();
3249
3228
  const content = YAML3.stringify(lockfile);
3250
- fs11.writeFileSync(lockfilePath, content);
3229
+ fs10.writeFileSync(lockfilePath, content);
3251
3230
  }
3252
3231
  function _getLockfilePath() {
3253
3232
  return path12.join(process.cwd(), "i18n.lock");
@@ -3276,7 +3255,7 @@ import externalEditor from "external-editor";
3276
3255
 
3277
3256
  // src/cli/utils/cache.ts
3278
3257
  import path13 from "path";
3279
- import fs12 from "fs";
3258
+ import fs11 from "fs";
3280
3259
  var cacheChunk = (targetLocale, sourceChunk, processedChunk) => {
3281
3260
  const rows = Object.entries(sourceChunk).map(([key, source]) => ({
3282
3261
  targetLocale,
@@ -3306,23 +3285,23 @@ function getNormalizedCache() {
3306
3285
  function deleteCache() {
3307
3286
  const cacheFilePath = _getCacheFilePath();
3308
3287
  try {
3309
- fs12.unlinkSync(cacheFilePath);
3288
+ fs11.unlinkSync(cacheFilePath);
3310
3289
  } catch (e) {
3311
3290
  }
3312
3291
  }
3313
3292
  function _loadCache() {
3314
3293
  const cacheFilePath = _getCacheFilePath();
3315
- if (!fs12.existsSync(cacheFilePath)) {
3294
+ if (!fs11.existsSync(cacheFilePath)) {
3316
3295
  return [];
3317
3296
  }
3318
- const content = fs12.readFileSync(cacheFilePath, "utf-8");
3297
+ const content = fs11.readFileSync(cacheFilePath, "utf-8");
3319
3298
  const result = _parseJSONLines(content);
3320
3299
  return result;
3321
3300
  }
3322
3301
  function _appendToCache(rows) {
3323
3302
  const cacheFilePath = _getCacheFilePath();
3324
3303
  const lines = _buildJSONLines(rows);
3325
- fs12.appendFileSync(cacheFilePath, lines);
3304
+ fs11.appendFileSync(cacheFilePath, lines);
3326
3305
  }
3327
3306
  function _getCacheFilePath() {
3328
3307
  return path13.join(process.cwd(), "i18n.cache");
@@ -4032,10 +4011,10 @@ import { Command as Command10 } from "interactive-commander";
4032
4011
  import createOra from "ora";
4033
4012
 
4034
4013
  // ../../action/src/flows/pull-request.ts
4035
- import { execSync as execSync3 } from "child_process";
4014
+ import { execSync as execSync2 } from "child_process";
4036
4015
 
4037
4016
  // ../../action/src/flows/in-branch.ts
4038
- import { execSync as execSync2 } from "child_process";
4017
+ import { execSync } from "child_process";
4039
4018
  import path14 from "path";
4040
4019
 
4041
4020
  // ../../action/src/flows/_base.ts
@@ -4063,21 +4042,21 @@ var InBranchFlow = class extends IntegrationFlow {
4063
4042
  this.ora.start("Running Lingo.dev");
4064
4043
  await this.runLingoDotDev();
4065
4044
  this.ora.succeed("Done running Lingo.dev");
4066
- execSync2(`rm -f i18n.cache`, { stdio: "inherit" });
4045
+ execSync(`rm -f i18n.cache`, { stdio: "inherit" });
4067
4046
  this.ora.start("Checking for changes");
4068
4047
  const hasChanges = this.checkCommitableChanges();
4069
4048
  this.ora.succeed(hasChanges ? "Changes detected" : "No changes detected");
4070
4049
  if (hasChanges) {
4071
4050
  this.ora.start("Committing changes");
4072
- execSync2(`git add .`, { stdio: "inherit" });
4073
- execSync2(`git status --porcelain`, { stdio: "inherit" });
4074
- execSync2(`git commit -m "${this.platformKit.config.commitMessage}"`, {
4051
+ execSync(`git add .`, { stdio: "inherit" });
4052
+ execSync(`git status --porcelain`, { stdio: "inherit" });
4053
+ execSync(`git commit -m "${this.platformKit.config.commitMessage}"`, {
4075
4054
  stdio: "inherit"
4076
4055
  });
4077
4056
  this.ora.succeed("Changes committed");
4078
4057
  this.ora.start("Pushing changes to remote");
4079
4058
  const currentBranch = this.i18nBranchName ?? this.platformKit.platformConfig.baseBranchName;
4080
- execSync2(`git push origin ${currentBranch} ${forcePush ? "--force" : ""}`, {
4059
+ execSync(`git push origin ${currentBranch} ${forcePush ? "--force" : ""}`, {
4081
4060
  stdio: "inherit"
4082
4061
  });
4083
4062
  this.ora.succeed("Changes pushed to remote");
@@ -4085,28 +4064,28 @@ var InBranchFlow = class extends IntegrationFlow {
4085
4064
  return hasChanges;
4086
4065
  }
4087
4066
  checkCommitableChanges() {
4088
- return execSync2('git status --porcelain || echo "has_changes"', {
4067
+ return execSync('git status --porcelain || echo "has_changes"', {
4089
4068
  encoding: "utf8"
4090
4069
  }).length > 0;
4091
4070
  }
4092
4071
  async runLingoDotDev() {
4093
- execSync2(`npx lingo.dev@latest i18n --api-key ${this.platformKit.config.replexicaApiKey}`, { stdio: "inherit" });
4072
+ execSync(`npx lingo.dev@latest i18n --api-key ${this.platformKit.config.replexicaApiKey}`, { stdio: "inherit" });
4094
4073
  }
4095
4074
  configureGit() {
4096
4075
  const { processOwnCommits } = this.platformKit.config;
4097
4076
  const { baseBranchName } = this.platformKit.platformConfig;
4098
4077
  this.ora.info(`Current working directory:`);
4099
- execSync2(`pwd`, { stdio: "inherit" });
4100
- execSync2(`ls -la`, { stdio: "inherit" });
4101
- execSync2(`git config --global safe.directory ${process.cwd()}`);
4102
- execSync2(`git config user.name "${gitConfig.userName}"`);
4103
- execSync2(`git config user.email "${gitConfig.userEmail}"`);
4078
+ execSync(`pwd`, { stdio: "inherit" });
4079
+ execSync(`ls -la`, { stdio: "inherit" });
4080
+ execSync(`git config --global safe.directory ${process.cwd()}`);
4081
+ execSync(`git config user.name "${gitConfig.userName}"`);
4082
+ execSync(`git config user.email "${gitConfig.userEmail}"`);
4104
4083
  this.platformKit?.gitConfig();
4105
- execSync2(`git fetch origin ${baseBranchName}`, { stdio: "inherit" });
4106
- execSync2(`git checkout ${baseBranchName} --`, { stdio: "inherit" });
4084
+ execSync(`git fetch origin ${baseBranchName}`, { stdio: "inherit" });
4085
+ execSync(`git checkout ${baseBranchName} --`, { stdio: "inherit" });
4107
4086
  if (!processOwnCommits) {
4108
4087
  const currentAuthor = `${gitConfig.userName} <${gitConfig.userEmail}>`;
4109
- const authorOfLastCommit = execSync2(`git log -1 --pretty=format:'%an <%ae>'`).toString();
4088
+ const authorOfLastCommit = execSync(`git log -1 --pretty=format:'%an <%ae>'`).toString();
4110
4089
  if (authorOfLastCommit === currentAuthor) {
4111
4090
  this.ora.warn(
4112
4091
  `The last commit was already made by ${currentAuthor}, so this run will be skipped, as running again would have no effect. See docs: https://docs.lingo.dev/ci-action/overview`
@@ -4190,15 +4169,15 @@ var PullRequestFlow = class extends InBranchFlow {
4190
4169
  return prNumber;
4191
4170
  }
4192
4171
  checkoutI18nBranch(i18nBranchName) {
4193
- execSync3(`git fetch origin ${i18nBranchName}`, { stdio: "inherit" });
4194
- execSync3(`git checkout -b ${i18nBranchName}`, {
4172
+ execSync2(`git fetch origin ${i18nBranchName}`, { stdio: "inherit" });
4173
+ execSync2(`git checkout -b ${i18nBranchName}`, {
4195
4174
  stdio: "inherit"
4196
4175
  });
4197
4176
  }
4198
4177
  createI18nBranch(i18nBranchName) {
4199
4178
  try {
4200
- execSync3(`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4201
- execSync3(`git checkout -b ${i18nBranchName} origin/${this.platformKit.platformConfig.baseBranchName}`, {
4179
+ execSync2(`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4180
+ execSync2(`git checkout -b ${i18nBranchName} origin/${this.platformKit.platformConfig.baseBranchName}`, {
4202
4181
  stdio: "inherit"
4203
4182
  });
4204
4183
  } catch (error) {
@@ -4218,31 +4197,31 @@ var PullRequestFlow = class extends InBranchFlow {
4218
4197
  throw new Error("i18nBranchName is not set");
4219
4198
  }
4220
4199
  this.ora.start(`Fetching latest changes from ${this.platformKit.platformConfig.baseBranchName}`);
4221
- execSync3(`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4200
+ execSync2(`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4222
4201
  this.ora.succeed(`Fetched latest changes from ${this.platformKit.platformConfig.baseBranchName}`);
4223
4202
  try {
4224
4203
  this.ora.start("Attempting to rebase branch");
4225
- execSync3(`git rebase origin/${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4204
+ execSync2(`git rebase origin/${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4226
4205
  this.ora.succeed("Successfully rebased branch");
4227
4206
  } catch (error) {
4228
4207
  this.ora.warn("Rebase failed, falling back to alternative sync method");
4229
4208
  this.ora.start("Aborting failed rebase");
4230
- execSync3("git rebase --abort", { stdio: "inherit" });
4209
+ execSync2("git rebase --abort", { stdio: "inherit" });
4231
4210
  this.ora.succeed("Aborted failed rebase");
4232
4211
  this.ora.start(`Resetting to ${this.platformKit.platformConfig.baseBranchName}`);
4233
- execSync3(`git reset --hard origin/${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4212
+ execSync2(`git reset --hard origin/${this.platformKit.platformConfig.baseBranchName}`, { stdio: "inherit" });
4234
4213
  this.ora.succeed(`Reset to ${this.platformKit.platformConfig.baseBranchName}`);
4235
4214
  this.ora.start("Restoring target files");
4236
4215
  const targetFiles = ["i18n.lock"];
4237
- const targetFileNames = execSync3(
4216
+ const targetFileNames = execSync2(
4238
4217
  `npx lingo.dev@latest show files --target ${this.platformKit.platformConfig.baseBranchName}`,
4239
4218
  { encoding: "utf8" }
4240
4219
  ).split("\n").filter(Boolean);
4241
4220
  targetFiles.push(...targetFileNames);
4242
- execSync3(`git fetch origin ${this.i18nBranchName}`, { stdio: "inherit" });
4221
+ execSync2(`git fetch origin ${this.i18nBranchName}`, { stdio: "inherit" });
4243
4222
  for (const file of targetFiles) {
4244
4223
  try {
4245
- execSync3(`git checkout FETCH_HEAD -- ${file}`, { stdio: "inherit" });
4224
+ execSync2(`git checkout FETCH_HEAD -- ${file}`, { stdio: "inherit" });
4246
4225
  } catch (error2) {
4247
4226
  this.ora.warn(`Skipping non-existent file: ${file}`);
4248
4227
  continue;
@@ -4253,8 +4232,8 @@ var PullRequestFlow = class extends InBranchFlow {
4253
4232
  this.ora.start("Checking for changes to commit");
4254
4233
  const hasChanges = this.checkCommitableChanges();
4255
4234
  if (hasChanges) {
4256
- execSync3("git add .", { stdio: "inherit" });
4257
- execSync3(`git commit -m "chore: sync with ${this.platformKit.platformConfig.baseBranchName}"`, {
4235
+ execSync2("git add .", { stdio: "inherit" });
4236
+ execSync2(`git commit -m "chore: sync with ${this.platformKit.platformConfig.baseBranchName}"`, {
4258
4237
  stdio: "inherit"
4259
4238
  });
4260
4239
  this.ora.succeed("Committed additional changes");
@@ -4283,7 +4262,7 @@ Hey team,
4283
4262
  };
4284
4263
 
4285
4264
  // ../../action/src/platforms/bitbucket.ts
4286
- import { execSync as execSync4 } from "child_process";
4265
+ import { execSync as execSync3 } from "child_process";
4287
4266
  import bbLib from "bitbucket";
4288
4267
  import Z8 from "zod";
4289
4268
 
@@ -4375,10 +4354,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
4375
4354
  });
4376
4355
  }
4377
4356
  async gitConfig() {
4378
- execSync4("git config --unset http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy", {
4357
+ execSync3("git config --unset http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy", {
4379
4358
  stdio: "inherit"
4380
4359
  });
4381
- execSync4("git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://host.docker.internal:29418/", {
4360
+ execSync3("git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://host.docker.internal:29418/", {
4382
4361
  stdio: "inherit"
4383
4362
  });
4384
4363
  }
@@ -4405,7 +4384,7 @@ var BitbucketPlatformKit = class extends PlatformKit {
4405
4384
  // ../../action/src/platforms/github.ts
4406
4385
  import { Octokit } from "octokit";
4407
4386
  import Z9 from "zod";
4408
- import { execSync as execSync5 } from "child_process";
4387
+ import { execSync as execSync4 } from "child_process";
4409
4388
  var GitHubPlatformKit = class extends PlatformKit {
4410
4389
  _octokit;
4411
4390
  get octokit() {
@@ -4462,7 +4441,7 @@ var GitHubPlatformKit = class extends PlatformKit {
4462
4441
  if (ghToken && processOwnCommits) {
4463
4442
  console.log("Using provided GH_TOKEN. This will trigger your CI/CD pipeline to run again.");
4464
4443
  const url = `https://${ghToken}@github.com/${repositoryOwner}/${repositoryName}.git`;
4465
- execSync5(`git remote set-url origin ${url}`, {
4444
+ execSync4(`git remote set-url origin ${url}`, {
4466
4445
  stdio: "inherit"
4467
4446
  });
4468
4447
  }
@@ -4492,7 +4471,7 @@ var GitHubPlatformKit = class extends PlatformKit {
4492
4471
  // ../../action/src/platforms/gitlab.ts
4493
4472
  import { Gitlab } from "@gitbeaker/rest";
4494
4473
  import Z10 from "zod";
4495
- import { execSync as execSync6 } from "child_process";
4474
+ import { execSync as execSync5 } from "child_process";
4496
4475
  var gl = new Gitlab({ token: "" });
4497
4476
  var GitlabPlatformKit = class extends PlatformKit {
4498
4477
  _gitlab;
@@ -4568,7 +4547,7 @@ var GitlabPlatformKit = class extends PlatformKit {
4568
4547
  }
4569
4548
  gitConfig() {
4570
4549
  const url = `https://oauth2:${this.platformConfig.glToken}@gitlab.com/${this.platformConfig.repositoryOwner}/${this.platformConfig.repositoryName}.git`;
4571
- execSync6(`git remote set-url origin ${url}`, {
4550
+ execSync5(`git remote set-url origin ${url}`, {
4572
4551
  stdio: "inherit"
4573
4552
  });
4574
4553
  }
@@ -4641,7 +4620,7 @@ var ci_default = new Command10().command("ci").description("Run Lingo.dev CI/CD
4641
4620
  // package.json
4642
4621
  var package_default = {
4643
4622
  name: "lingo.dev",
4644
- version: "0.79.3",
4623
+ version: "0.79.5",
4645
4624
  description: "Lingo.dev CLI",
4646
4625
  private: false,
4647
4626
  publishConfig: {