Skip to content

Commit

Permalink
chore: update Protect types
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 committed Mar 12, 2021
1 parent 4c3fbf9 commit 15dce36
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/cli/commands/protect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import * as errors from '../../../lib/errors';
const debug = debugModule('snyk');

async function protectFunc(
options: types.PolicyOptions & types.Options & types.TestOptions,
options: types.PolicyOptions &
types.Options &
types.TestOptions &
types.ProtectOptions,
) {
const protectOptions = { ...options };
protectOptions.loose = true; // replace missing policies with empty ones
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/protect/wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ import {
Options,
MonitorMeta,
MonitorResult,
WizardOptions,
PackageJson,
ProtectOptions,
} from '../../../lib/types';
import { LegacyVulnApiResult } from '../../../lib/snyk-test/legacy';
import { MultiProjectResult } from '@snyk/cli-interface/legacy/plugin';
Expand Down Expand Up @@ -82,7 +82,7 @@ async function processPackageManager(options: Options) {
return Promise.resolve(options);
}

async function loadOrCreatePolicyFile(options: Options & WizardOptions) {
async function loadOrCreatePolicyFile(options: Options & ProtectOptions) {
let policyFile;
try {
policyFile = await snyk.policy.load(options['policy-path'], options);
Expand Down
9 changes: 5 additions & 4 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export type DepTree = legacyApi.DepTree;
export type ShowVulnPaths = 'none' | 'some' | 'all';

export interface TestOptions {
traverseNodeModules: boolean;
interactive: boolean;
traverseNodeModules?: boolean;
pruneRepeatedSubdependencies?: boolean;
showVulnPaths: ShowVulnPaths;
failOn?: FailOn;
Expand All @@ -27,7 +26,8 @@ export interface TestOptions {
iacDirFiles?: IacFileInDirectory[];
}

export interface WizardOptions {
export interface ProtectOptions {
interactive?: boolean;
newPolicy: boolean;
}

Expand Down Expand Up @@ -184,7 +184,8 @@ export type SupportedUserReachableFacingCliArgs =
| 'reachable-vulns-timeout'
| 'init-script'
| 'integration-name'
| 'integration-version';
| 'integration-version'
| 'show-vulnerable-paths';

export enum SupportedCliCommands {
version = 'version',
Expand Down

0 comments on commit 15dce36

Please sign in to comment.