Skip to content

Commit

Permalink
fix: correct validation functions imports
Browse files Browse the repository at this point in the history
  • Loading branch information
umbopepato committed May 22, 2020
1 parent d3cc40e commit 454cb75
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/export_scripts.ts
@@ -1,6 +1,6 @@
import { ConfigData } from "./load_config.ts";
import { validateConfigData } from "./check_config_data.ts";
import { checkScript } from "./check_script.ts";
import { validateConfigData } from "./validate_config_data.ts";
import { validateScript } from "./validate_script.ts";
import { isWindows, OneOrMore, makeFileExecutable } from "./util.ts";
import { normalizeScript } from "./normalize_script.ts";
import { CompoundCommandItem } from "./command.ts";
Expand Down Expand Up @@ -33,7 +33,7 @@ export async function exportScripts(
}
await Promise.all(
scripts.map(async (script) => {
checkScript(script, config);
validateScript(script, config);
const scriptDef = config.scripts[script];
const { scripts, ...rootConfig } = config;
const commands = normalizeScript(scriptDef, rootConfig);
Expand Down
6 changes: 3 additions & 3 deletions src/resolve_shell.ts
Expand Up @@ -6,13 +6,13 @@ const OS_FALLBACK_SHELL = isWindows ? "cmd.exe" : "sh";

export function resolveShell(): string {
let shell = Deno.env.get(SHELL_ENV_NAME);
if (checkShellFile(shell)) return shell as string;
if (validateShellFile(shell)) return shell as string;
shell = Deno.env.get(OS_SHELL_ENV_NAME);
if (checkShellFile(shell)) return shell as string;
if (validateShellFile(shell)) return shell as string;
return OS_FALLBACK_SHELL;
}

function checkShellFile(shell: string | undefined) {
function validateShellFile(shell: string | undefined) {
try {
return shell && Deno.statSync(shell).isFile; // TODO check executable
} catch (e) {
Expand Down
6 changes: 3 additions & 3 deletions src/run_script.ts
Expand Up @@ -5,8 +5,8 @@ import { bold } from "../deps.ts";
import { normalizeScript } from "./normalize_script.ts";
import { resolveShell } from "./resolve_shell.ts";
import { runCommands } from "./run_commands.ts";
import { validateConfigData } from "./check_config_data.ts";
import { checkScript } from "./check_script.ts";
import { validateConfigData } from "./validate_config_data.ts";
import { validateScript } from "./validate_script.ts";

export async function runScript(
configData: ConfigData | null,
Expand All @@ -19,7 +19,7 @@ export async function runScript(
printScriptsInfo(config);
Deno.exit();
}
checkScript(script, config);
validateScript(script, config);
const scriptDef = config.scripts[script];
const { scripts, ...rootConfig } = config;
const commands = normalizeScript(scriptDef, rootConfig);
Expand Down

0 comments on commit 454cb75

Please sign in to comment.