@storm-software/linting-tools 1.134.86 → 1.134.87

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/bin/lint.cjs CHANGED
@@ -2156,11 +2156,13 @@ function getConfig(workspaceRoot, skipLogs = false) {
2156
2156
  }
2157
2157
 
2158
2158
  // src/cli/index.ts
2159
+ var _getpackages = require('@manypkg/get-packages');
2159
2160
  var _checkdependencyversionconsistency = require('check-dependency-version-consistency');
2160
2161
  var _commander = require('commander');
2161
2162
  var _cspell = require('cspell');
2162
2163
  var _dpdm = require('dpdm');
2163
2164
 
2165
+
2164
2166
  // ../../node_modules/.pnpm/actions-up@1.14.3_patch_hash=32dd3e797cb77f0406d81b94e597936599efa23c9bcf8f982de295457d4be41e/node_modules/actions-up/dist/core/ast/update/apply-updates.js
2165
2167
 
2166
2168
  async function n(n15) {
@@ -3762,7 +3764,7 @@ async function validateUser(gh, username) {
3762
3764
  // ../../node_modules/.pnpm/@manypkg+cli@0.25.1_patch_hash=93a1356678f1b712ee39c9629d429415839d8bc40fe1facac7203d8696155a45/node_modules/@manypkg/cli/dist/manypkg-cli.js
3763
3765
  var _picocolors = require('picocolors'); var _picocolors2 = _interopRequireDefault(_picocolors);
3764
3766
  var _util = require('util'); var _util2 = _interopRequireDefault(_util);
3765
- var _getpackages = require('@manypkg/get-packages');
3767
+
3766
3768
 
3767
3769
 
3768
3770
  var _sembear = require('sembear');
@@ -4486,7 +4488,25 @@ async function execCmd(args) {
4486
4488
  });
4487
4489
  })
4488
4490
  );
4489
- throw new Error(`Command ${args[0]} failed with exit code ${highestExitCode}`);
4491
+ throw new Error(
4492
+ `Command ${args[0]} failed with exit code ${highestExitCode}`
4493
+ );
4494
+ }
4495
+ async function formatPackageJsonFiles(config, files, cwd) {
4496
+ if (files.length === 0) {
4497
+ return;
4498
+ }
4499
+ try {
4500
+ await runAsync(
4501
+ config,
4502
+ `${_nullishCoalesce(config.packageManager, () => ( "pnpm"))} exec prettier --write --ignore-unknown ${files.map((file) => JSON.stringify(file)).join(" ")}`,
4503
+ cwd
4504
+ );
4505
+ } catch (e25) {
4506
+ console.warn(
4507
+ `\u26A0\uFE0F Unable to format the fixed package.json files with Prettier: ${_optionalChain([e25, 'optionalAccess', _130 => _130.message])}`
4508
+ );
4509
+ }
4490
4510
  }
4491
4511
  var MANY_PKG_TYPE_OPTIONS = [
4492
4512
  "fix",
@@ -4521,7 +4541,7 @@ async function runManypkg(config, manypkgType = "fix", manypkgArgs) {
4521
4541
  const options = {
4522
4542
  defaultBranch: "main",
4523
4543
  workspaceProtocol: "require",
4524
- ..._optionalChain([rootPackage, 'optionalAccess', _130 => _130.packageJson, 'access', _131 => _131.manypkg])
4544
+ ..._optionalChain([rootPackage, 'optionalAccess', _131 => _131.packageJson, 'access', _132 => _132.manypkg])
4525
4545
  };
4526
4546
  const packagesByName = new Map(
4527
4547
  packages.map((x) => [x.packageJson.name, x])
@@ -4530,6 +4550,12 @@ async function runManypkg(config, manypkgType = "fix", manypkgArgs) {
4530
4550
  if (rootPackage) {
4531
4551
  packagesByName.set(rootPackage.packageJson.name, rootPackage);
4532
4552
  }
4553
+ const original = new Map(
4554
+ [...packagesByName].map(([name, x]) => [
4555
+ name,
4556
+ JSON.stringify(x.packageJson)
4557
+ ])
4558
+ );
4533
4559
  const { hasErrored, requiresInstall } = runChecks(
4534
4560
  packagesByName,
4535
4561
  rootPackage,
@@ -4537,10 +4563,14 @@ async function runManypkg(config, manypkgType = "fix", manypkgArgs) {
4537
4563
  options
4538
4564
  );
4539
4565
  if (manypkgType === "fix") {
4540
- await Promise.all(
4541
- [...packagesByName].map(([_, workspace]) => {
4542
- writePackage(workspace);
4543
- })
4566
+ const changed = [...packagesByName].filter(
4567
+ ([name, x]) => original.get(name) !== JSON.stringify(x.packageJson)
4568
+ ).map(([, x]) => x);
4569
+ await Promise.all(changed.map(async (x) => writePackage(x)));
4570
+ await formatPackageJsonFiles(
4571
+ config,
4572
+ changed.map((x) => `${x.dir}/package.json`),
4573
+ rootDir
4544
4574
  );
4545
4575
  if (requiresInstall) {
4546
4576
  console.log(`Running install in ${rootDir}...`);
@@ -4896,6 +4926,13 @@ async function depsVersionAction({
4896
4926
  `${brandIcon(_config)} Linting the workspace dependency version consistency`,
4897
4927
  _config
4898
4928
  );
4929
+ const { packages, rootPackage, rootDir } = _getpackages.getPackagesSync.call(void 0, ".");
4930
+ const original = new Map(
4931
+ [...packages, ...rootPackage ? [rootPackage] : []].map((x) => {
4932
+ const file = `${x.dir}/package.json`;
4933
+ return [file, _fs.readFileSync.call(void 0, file, "utf8")];
4934
+ })
4935
+ );
4899
4936
  const cdvc = new (0, _checkdependencyversionconsistency.CDVC)(".", {
4900
4937
  fix: true,
4901
4938
  ignoreDep: ignoreDepsVersion,
@@ -4904,6 +4941,11 @@ async function depsVersionAction({
4904
4941
  });
4905
4942
  if (cdvc.hasMismatchingDependenciesFixable) {
4906
4943
  writeDebug(cdvc.toFixedSummary(), _config);
4944
+ await formatPackageJsonFiles(
4945
+ _config,
4946
+ [...original].filter(([file, content]) => _fs.readFileSync.call(void 0, file, "utf8") !== content).map(([file]) => file),
4947
+ rootDir
4948
+ );
4907
4949
  }
4908
4950
  if (cdvc.hasMismatchingDependenciesNotFixable) {
4909
4951
  throw new Error(cdvc.toMismatchSummary());
@@ -5029,7 +5071,7 @@ void (async () => {
5029
5071
  } catch (error2) {
5030
5072
  writeFatal(
5031
5073
  `A fatal error occurred while running the Storm Lint tool:
5032
- ${_optionalChain([error2, 'optionalAccess', _132 => _132.message]) ? error2.message : JSON.stringify(error2)}${_optionalChain([error2, 'optionalAccess', _133 => _133.stack]) ? `
5074
+ ${_optionalChain([error2, 'optionalAccess', _133 => _133.message]) ? error2.message : JSON.stringify(error2)}${_optionalChain([error2, 'optionalAccess', _134 => _134.stack]) ? `
5033
5075
  Stack Trace: ${error2.stack}` : ""}`,
5034
5076
  config
5035
5077
  );
package/bin/lint.js CHANGED
@@ -2156,10 +2156,12 @@ function getConfig(workspaceRoot, skipLogs = false) {
2156
2156
  }
2157
2157
 
2158
2158
  // src/cli/index.ts
2159
+ import { getPackagesSync } from "@manypkg/get-packages";
2159
2160
  import { CDVC } from "check-dependency-version-consistency";
2160
2161
  import { Command } from "commander";
2161
2162
  import { lint } from "cspell";
2162
2163
  import { parseCircular, parseDependencyTree, prettyCircular } from "dpdm";
2164
+ import { readFileSync } from "node:fs";
2163
2165
 
2164
2166
  // ../../node_modules/.pnpm/actions-up@1.14.3_patch_hash=32dd3e797cb77f0406d81b94e597936599efa23c9bcf8f982de295457d4be41e/node_modules/actions-up/dist/core/ast/update/apply-updates.js
2165
2167
  import { readFile as e, writeFile as t } from "node:fs/promises";
@@ -4486,7 +4488,25 @@ async function execCmd(args) {
4486
4488
  });
4487
4489
  })
4488
4490
  );
4489
- throw new Error(`Command ${args[0]} failed with exit code ${highestExitCode}`);
4491
+ throw new Error(
4492
+ `Command ${args[0]} failed with exit code ${highestExitCode}`
4493
+ );
4494
+ }
4495
+ async function formatPackageJsonFiles(config, files, cwd) {
4496
+ if (files.length === 0) {
4497
+ return;
4498
+ }
4499
+ try {
4500
+ await runAsync(
4501
+ config,
4502
+ `${config.packageManager ?? "pnpm"} exec prettier --write --ignore-unknown ${files.map((file) => JSON.stringify(file)).join(" ")}`,
4503
+ cwd
4504
+ );
4505
+ } catch (e25) {
4506
+ console.warn(
4507
+ `\u26A0\uFE0F Unable to format the fixed package.json files with Prettier: ${e25?.message}`
4508
+ );
4509
+ }
4490
4510
  }
4491
4511
  var MANY_PKG_TYPE_OPTIONS = [
4492
4512
  "fix",
@@ -4530,6 +4550,12 @@ async function runManypkg(config, manypkgType = "fix", manypkgArgs) {
4530
4550
  if (rootPackage) {
4531
4551
  packagesByName.set(rootPackage.packageJson.name, rootPackage);
4532
4552
  }
4553
+ const original = new Map(
4554
+ [...packagesByName].map(([name, x]) => [
4555
+ name,
4556
+ JSON.stringify(x.packageJson)
4557
+ ])
4558
+ );
4533
4559
  const { hasErrored, requiresInstall } = runChecks(
4534
4560
  packagesByName,
4535
4561
  rootPackage,
@@ -4537,10 +4563,14 @@ async function runManypkg(config, manypkgType = "fix", manypkgArgs) {
4537
4563
  options
4538
4564
  );
4539
4565
  if (manypkgType === "fix") {
4540
- await Promise.all(
4541
- [...packagesByName].map(([_, workspace]) => {
4542
- writePackage(workspace);
4543
- })
4566
+ const changed = [...packagesByName].filter(
4567
+ ([name, x]) => original.get(name) !== JSON.stringify(x.packageJson)
4568
+ ).map(([, x]) => x);
4569
+ await Promise.all(changed.map(async (x) => writePackage(x)));
4570
+ await formatPackageJsonFiles(
4571
+ config,
4572
+ changed.map((x) => `${x.dir}/package.json`),
4573
+ rootDir
4544
4574
  );
4545
4575
  if (requiresInstall) {
4546
4576
  console.log(`Running install in ${rootDir}...`);
@@ -4896,6 +4926,13 @@ async function depsVersionAction({
4896
4926
  `${brandIcon(_config)} Linting the workspace dependency version consistency`,
4897
4927
  _config
4898
4928
  );
4929
+ const { packages, rootPackage, rootDir } = getPackagesSync(".");
4930
+ const original = new Map(
4931
+ [...packages, ...rootPackage ? [rootPackage] : []].map((x) => {
4932
+ const file = `${x.dir}/package.json`;
4933
+ return [file, readFileSync(file, "utf8")];
4934
+ })
4935
+ );
4899
4936
  const cdvc = new CDVC(".", {
4900
4937
  fix: true,
4901
4938
  ignoreDep: ignoreDepsVersion,
@@ -4904,6 +4941,11 @@ async function depsVersionAction({
4904
4941
  });
4905
4942
  if (cdvc.hasMismatchingDependenciesFixable) {
4906
4943
  writeDebug(cdvc.toFixedSummary(), _config);
4944
+ await formatPackageJsonFiles(
4945
+ _config,
4946
+ [...original].filter(([file, content]) => readFileSync(file, "utf8") !== content).map(([file]) => file),
4947
+ rootDir
4948
+ );
4907
4949
  }
4908
4950
  if (cdvc.hasMismatchingDependenciesNotFixable) {
4909
4951
  throw new Error(cdvc.toMismatchSummary());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/linting-tools",
3
- "version": "1.134.86",
3
+ "version": "1.134.87",
4
4
  "private": false,
5
5
  "description": "⚡ A package containing various linting tools used to validate syntax, enforce design standards, and format code in a Storm workspace.",
6
6
  "keywords": [
@@ -162,5 +162,5 @@
162
162
  "tsup": "8.4.0"
163
163
  },
164
164
  "publishConfig": { "access": "public" },
165
- "gitHead": "55b57a5e36390af2d87855d593479f6e588f82ba"
165
+ "gitHead": "b146c778f114b18b4a31981e037fc030bfe31f9d"
166
166
  }