Skip to content

Commit

Permalink
fix(script-config): add ParallelScripts to CompositeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
umbopepato committed May 23, 2020
1 parent 772e741 commit bb3d7bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/merge_params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScriptOptions, FlagsObject } from "./scripts_config.ts";
import { ScriptOptions, FlagsObject, AllowFlags } from "./scripts_config.ts";

export function mergeParams(
childParams: ScriptOptions,
Expand All @@ -12,8 +12,8 @@ export function mergeParams(
...childParams.env,
},
allow: {
...normalizeFlags(parentParams.allow),
...normalizeFlags(childParams.allow),
...normalizeFlags(parentParams.allow as string[] | FlagsObject),
...normalizeFlags(childParams.allow as string[] | FlagsObject),
},
v8Flags: {
...normalizeFlags(parentParams.v8Flags),
Expand Down
14 changes: 12 additions & 2 deletions src/scripts_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface ScriptObject extends ScriptOptions {
* An array of scripts or an object representing script
* to be executed in parallel
*/
export type CompositeScript = Array<Script | ParallelScripts>;
export type CompositeScript = ParallelScripts | Array<Script | ParallelScripts>;

/**
* An object representing scripts
Expand Down Expand Up @@ -87,7 +87,7 @@ export interface ScriptOptions {
* - read
* ```
*/
allow?: string[] | FlagsObject;
allow?: Array<keyof AllowFlags> | AllowFlags;
/**
* A list of boolean V8 flags or
* a map of V8 option names to values
Expand Down Expand Up @@ -142,6 +142,16 @@ export interface ScriptOptions {
inspectBrk?: string;
}

export interface AllowFlags {
all?: boolean;
env?: boolean;
hrtime?: boolean;
net?: string | boolean;
plugin?: boolean;
read?: string | boolean;
run?: boolean;
}

export type FlagsObject = Record<string, unknown>;

export type EnvironmentVariables = Record<string, string>;
Expand Down

0 comments on commit bb3d7bf

Please sign in to comment.