socket 1.1.2 → 1.1.3

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/dist/cli.js CHANGED
@@ -3783,7 +3783,7 @@ const hiddenFlags = {
3783
3783
  purl: {
3784
3784
  type: 'string',
3785
3785
  default: [],
3786
- description: `Provide a list of ${vendor.terminalLinkExports('PURLs', 'https://github.com/package-url/purl-spec?tab=readme-ov-file#purl')} to compute fixes for, as either a comma separated value or as\nmultiple flags, instead of querying the Socket API`,
3786
+ description: `Provide a list of ${vendor.terminalLinkExports('PURLs', 'https://github.com/package-url/purl-spec?tab=readme-ov-file#purl')} to compute fixes for, as either a comma separated value or as\nmultiple flags`,
3787
3787
  isMultiple: true,
3788
3788
  shortFlag: 'p',
3789
3789
  hidden: true
@@ -8870,7 +8870,7 @@ async function processFilePatch(packagePath, fileName, fileInfo, dryRun, socketD
8870
8870
  logger.logger.success(`File matches expected hash: ${fileName}`);
8871
8871
  logger.logger.log(`Current hash: ${currentHash}`);
8872
8872
  logger.logger.log(`Ready to patch to: ${fileInfo.afterHash}`);
8873
- {
8873
+ if (!dryRun) {
8874
8874
  const blobPath = path.join(socketDir, 'blobs', fileInfo.afterHash);
8875
8875
  if (!fs$1.existsSync(blobPath)) {
8876
8876
  logger.logger.fail(`Error: Patch file not found at ${blobPath}`);
@@ -8882,6 +8882,8 @@ async function processFilePatch(packagePath, fileName, fileInfo, dryRun, socketD
8882
8882
  } catch (error) {
8883
8883
  logger.logger.log(`Error applying patch: ${error}`);
8884
8884
  }
8885
+ } else {
8886
+ logger.logger.log(`(dry run - no changes made)`);
8885
8887
  }
8886
8888
  } else if (currentHash === fileInfo.afterHash) {
8887
8889
  logger.logger.success(`File already patched: ${fileName}`);
@@ -8908,24 +8910,23 @@ async function readPackageJson(packagePath) {
8908
8910
  }
8909
8911
  async function handlePatch({
8910
8912
  cwd,
8913
+ dryRun,
8911
8914
  outputKind,
8912
8915
  packages,
8913
8916
  spinner
8914
8917
  }) {
8915
- const dryRun = false; // TODO: Add dryRun support via config
8916
-
8917
8918
  try {
8918
8919
  const dotSocketDirPath = path.join(cwd, '.socket');
8919
8920
  const manifestPath = path.join(dotSocketDirPath, 'manifest.json');
8920
8921
 
8921
- // Read the manifest file
8922
+ // Read the manifest file.
8922
8923
  const manifestContent = await fs$1.promises.readFile(manifestPath, 'utf-8');
8923
8924
  const manifestData = JSON.parse(manifestContent);
8924
8925
 
8925
- // Validate the schema
8926
+ // Validate the schema.
8926
8927
  const validated = PatchManifestSchema.parse(manifestData);
8927
8928
 
8928
- // Parse PURLs and group by ecosystem
8929
+ // Parse PURLs and group by ecosystem.
8929
8930
  const patchesByEcosystem = {};
8930
8931
  for (const [key, patch] of Object.entries(validated.patches)) {
8931
8932
  const purl = parsePURL(key);
@@ -9037,10 +9038,6 @@ async function run$k(argv, importMeta, {
9037
9038
  if (!wasValidInput) {
9038
9039
  return;
9039
9040
  }
9040
- if (dryRun) {
9041
- logger.logger.log(constants.DRY_RUN_NOT_SAVING);
9042
- return;
9043
- }
9044
9041
  let [cwd = '.'] = cli.input;
9045
9042
  // Note: path.resolve vs .join:
9046
9043
  // If given path is absolute then cwd should not affect it.
@@ -9060,6 +9057,7 @@ async function run$k(argv, importMeta, {
9060
9057
  const packages = utils.cmdFlagValueToArray(cli.flags['package']);
9061
9058
  await handlePatch({
9062
9059
  cwd,
9060
+ dryRun,
9063
9061
  outputKind,
9064
9062
  packages,
9065
9063
  spinner
@@ -14264,5 +14262,5 @@ void (async () => {
14264
14262
  await utils.captureException(e);
14265
14263
  }
14266
14264
  })();
14267
- //# debugId=41b305c0-5c97-4685-a7f1-88a4cbb5e41c
14265
+ //# debugId=8481439d-81fb-4c40-8fb9-cbf6be031d3
14268
14266
  //# sourceMappingURL=cli.js.map