How to use the @snyk/cli-interface.legacyPlugin function in @snyk/cli-interface

To help you get started, we’ve selected a few @snyk/cli-interface examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github snyk / snyk / src / lib / plugins / get-multi-plugin-result.ts View on Github external
options: Options & TestOptions,
  targetFiles: string[],
): Promise {
  const allResults: ScannedProjectCustom[] = [];

  for (const targetFile of targetFiles) {
    const optionsClone = _.cloneDeep(options);
    optionsClone.file = path.basename(targetFile);
    optionsClone.packageManager = detectPackageManagerFromFile(
      optionsClone.file,
    );
    try {
      const inspectRes = await getSinglePluginResult(root, optionsClone);
      let resultWithScannedProjects: cliInterface.legacyPlugin.MultiProjectResult;

      if (!cliInterface.legacyPlugin.isMultiResult(inspectRes)) {
        resultWithScannedProjects = {
          plugin: inspectRes.plugin,
          scannedProjects: [
            {
              depTree: inspectRes.package,
              targetFile: inspectRes.plugin.targetFile,
              meta: inspectRes.meta,
            },
          ],
        };
      } else {
        resultWithScannedProjects = inspectRes;
      }

      // annotate the package manager, project name & targetFile to be used
      // for test & monitor

@snyk/cli-interface

Snyk CLI interface definitions

Apache-2.0
Latest version published 10 months ago

Package Health Score

64 / 100
Full package analysis

Similar packages