Skip to content

Commit

Permalink
Merge pull request #76 from paambaati/main
Browse files Browse the repository at this point in the history
feat: support desc field for concurrent scripts & Deno v1.13.x compatibility
  • Loading branch information
umbopepato authored Aug 31, 2021
2 parents a5d1115 + 00fd1b1 commit 716ee4d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/build_command_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum DenoOptions {
unstable = "unstable",
v8Flags = "v8Flags",
watch = "watch",
shuffle = "shuffle",
}

const denoCmdOptions: { [key: string]: DenoOptions[] } = {
Expand Down Expand Up @@ -85,6 +86,7 @@ const denoCmdOptions: { [key: string]: DenoOptions[] } = {
DenoOptions.tsconfig,
DenoOptions.unstable,
DenoOptions.v8Flags,
DenoOptions.shuffle,
],
cache: [
DenoOptions.cert,
Expand Down
8 changes: 7 additions & 1 deletion src/scripts_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ export type CompositeScript = ParallelScripts | Array<Script | ParallelScripts>;
* to be executed in parallel
*/
export interface ParallelScripts {
/**
* A textual description of what this set of scripts do.
* This will be shown in the list of available scripts,
* when calling `vr` without arguments.
*/
desc?: string;
/**
* The list of script to be executed in parallel
*/
Expand Down Expand Up @@ -199,7 +205,7 @@ export interface AllowFlags {
env?: boolean;
hrtime?: boolean;
net?: string | boolean;
plugin?: boolean;
ffi?: boolean;
read?: string | boolean;
run?: boolean;
write?: string | boolean;
Expand Down
8 changes: 7 additions & 1 deletion src/scripts_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
ScriptsConfiguration,
} from "./scripts_config.ts";
import { flattenCommands, normalizeScript } from "./normalize_script.ts";
import { isMultiCompositeScript, isScriptObject } from "./util.ts";
import {
isMultiCompositeScript,
isParallelScripts,
isScriptObject,
} from "./util.ts";

export function printScriptsInfo(config: ScriptsConfiguration) {
const scripts = Object.entries(config.scripts);
Expand Down Expand Up @@ -45,6 +49,8 @@ function scriptInfo(script: ScriptDefinition): string {
return s.desc;
}).filter(Boolean);
info.push(`${indent}${combinedDescriptions.join(", ")}`);
} else if (isParallelScripts(script)) {
if (script.desc) info.push(`${indent}${script.desc}`);
}
const commands = flattenCommands(normalizeScript(script, {}));
info.push(
Expand Down

0 comments on commit 716ee4d

Please sign in to comment.