@wise/wds-codemods 1.0.0-experimental-5d002fd → 1.0.0-experimental-a536a63

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.
@@ -1451,6 +1451,7 @@ var require_semver = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/semver@7.7
1451
1451
 
1452
1452
  //#endregion
1453
1453
  //#region src/controller/helpers/getCodemodConfig.ts
1454
+ /** Retrieves a JSON object from a file path, returning null if the file does not exist */
1454
1455
  const getJsonFromPath = (baseDir, fileName) => {
1455
1456
  const jsonPath = (0, node_path.join)(baseDir, fileName);
1456
1457
  try {
@@ -1612,10 +1613,12 @@ const assessPrerequisites = (packagePath, codemodPath) => {
1612
1613
  return false;
1613
1614
  }
1614
1615
  if (actualPackagePath !== resolvedPackagePath) console.info(`Using package.json from ${actualPackagePath} for dependency checks`);
1615
- const { dependencies = {}, peerDependencies = {} } = getJsonFromPath(actualPackagePath, "package.json");
1616
+ const packageJson = getJsonFromPath(actualPackagePath, "package.json");
1617
+ if (!packageJson) return false;
1618
+ const { dependencies = {}, peerDependencies = {} } = packageJson;
1616
1619
  const comparisons = {};
1617
1620
  let isCompliant = true;
1618
- if (codemodConfig.prerequisites) Object.entries(codemodConfig.prerequisites).forEach(([name, versionRequirement]) => {
1621
+ if (codemodConfig?.prerequisites) Object.entries(codemodConfig.prerequisites).forEach(([name, versionRequirement]) => {
1619
1622
  const nodeModulesVersion = getVersionFromNodeModules(actualPackagePath, name);
1620
1623
  const isDependencySatisfied = isVersionSatisfied(dependencies[name], versionRequirement);
1621
1624
  const isPeerDependencySatisfied = isVersionSatisfied(peerDependencies[name], versionRequirement);
@@ -1999,4 +2002,4 @@ Object.defineProperty(exports, 'runTransformPrompts', {
1999
2002
  return runTransformPrompts;
2000
2003
  }
2001
2004
  });
2002
- //# sourceMappingURL=helpers-CghwwYSg.js.map
2005
+ //# sourceMappingURL=helpers-RWhTD5Is.js.map