lingo.dev 0.78.12 → 0.78.13

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 CHANGED
@@ -1811,7 +1811,9 @@ function createXcodeXcstringsLoader(defaultLocale) {
1811
1811
 
1812
1812
  // src/cli/loaders/prettier.ts
1813
1813
 
1814
+
1814
1815
  var _prettier = require('prettier'); var _prettier2 = _interopRequireDefault(_prettier);
1816
+ var _child_process = require('child_process');
1815
1817
  function createPrettierLoader(options) {
1816
1818
  return createLoader({
1817
1819
  async pull(locale, data) {
@@ -1824,7 +1826,7 @@ function createPrettierLoader(options) {
1824
1826
  if (!prettierConfig) {
1825
1827
  return data;
1826
1828
  }
1827
- const result = _prettier2.default.format(data, {
1829
+ const config = {
1828
1830
  ...prettierConfig || { printWidth: 2500, bracketSameLine: false },
1829
1831
  parser: options.parser,
1830
1832
  // For HTML parser, preserve comments and quotes
@@ -1833,8 +1835,22 @@ function createPrettierLoader(options) {
1833
1835
  singleQuote: false,
1834
1836
  embeddedLanguageFormatting: "off"
1835
1837
  } : {}
1836
- });
1837
- return result;
1838
+ };
1839
+ try {
1840
+ const result = await _prettier2.default.format(data, config);
1841
+ return result;
1842
+ } catch (error) {
1843
+ if (error instanceof Error && error.message.startsWith("Cannot find package")) {
1844
+ console.log();
1845
+ console.log("Prettier is missing some dependecies - installing all project dependencies");
1846
+ installDependencies();
1847
+ await _prettier2.default.clearConfigCache();
1848
+ const result = await _prettier2.default.format(data, config);
1849
+ return result;
1850
+ } else {
1851
+ throw error;
1852
+ }
1853
+ }
1838
1854
  }
1839
1855
  });
1840
1856
  }
@@ -1846,6 +1862,23 @@ async function loadPrettierConfig(filePath) {
1846
1862
  return {};
1847
1863
  }
1848
1864
  }
1865
+ async function installDependencies() {
1866
+ const packageManager = await getPackageManager();
1867
+ console.log(`Installing dependencies using ${packageManager}`);
1868
+ _child_process.execSync.call(void 0, `${packageManager} install --frozen-lockfile`, { stdio: "inherit" });
1869
+ console.log(`Dependencies installed`);
1870
+ }
1871
+ async function getPackageManager() {
1872
+ const yarnLockfile = _path2.default.resolve(process.cwd(), "yarn.lock");
1873
+ const pnpmLockfile = _path2.default.resolve(process.cwd(), "pnpm-lock.yaml");
1874
+ if (_fs2.default.existsSync(yarnLockfile)) {
1875
+ return "yarn";
1876
+ }
1877
+ if (_fs2.default.existsSync(pnpmLockfile)) {
1878
+ return "pnpm";
1879
+ }
1880
+ return "npm";
1881
+ }
1849
1882
 
1850
1883
  // src/cli/loaders/unlocalizable.ts
1851
1884
 
@@ -3916,7 +3949,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
3916
3949
  // package.json
3917
3950
  var package_default = {
3918
3951
  name: "lingo.dev",
3919
- version: "0.78.12",
3952
+ version: "0.78.13",
3920
3953
  description: "Lingo.dev CLI",
3921
3954
  private: false,
3922
3955
  publishConfig: {