Skip to content

Commit

Permalink
revert: feat(export): execute exported scripts in the correct workdir
Browse files Browse the repository at this point in the history
This reverts commit 446962f
  • Loading branch information
umbopepato committed Jun 30, 2020
1 parent c30307f commit ec6c502
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="assets/logo.svg" width="350">
<img src="https://github.com/umbopepato/velociraptor/raw/master/assets/logo.svg" width="350">
</p>

<p align="center">
Expand Down
12 changes: 12 additions & 0 deletions egg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: velociraptor
description: An npm-style script runner for Deno
stable: false
version: 1.0.0-beta.11
repository: https://github.com/umbopepato/velociraptor/
files:
- src/**/*
- cli.ts
- deps.ts
- mod.ts
- README.md
- CONTRIBUTING.md
16 changes: 5 additions & 11 deletions src/export_scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function exportScripts(
const scriptDef = config.scripts[script];
const { scripts, ...rootConfig } = config;
const commands = normalizeScript(scriptDef, rootConfig);
const content = generateExecutableFile(commands, cwd);
const content = generateExecutableFile(commands);
if (content) {
const filePath = path.join(outDirPath, script);
if (
Expand All @@ -53,24 +53,18 @@ export async function exportScripts(
);
}

function generateExecutableFile(
commands: CompoundCommandItem[],
cwd: string,
) {
function generateExecutableFile(commands: CompoundCommandItem[]) {
if (isWindows) {
log.warning("Scripts exporting only supports sh.");
}
return `#!/bin/sh
# ${VR_MARK}
${exportCommands(commands, cwd)}
${exportCommands(commands)}
`;
}

function exportCommands(
commands: CompoundCommandItem[],
cwd: string,
): string {
function exportCommands(commands: CompoundCommandItem[]): string {
const _exportCommands = (
commands: OneOrMore<CompoundCommandItem>,
doGroup: boolean = false,
Expand Down Expand Up @@ -102,5 +96,5 @@ function exportCommands(
return res;
}
};
return `( cd "${escape(cwd, '"')}" && ${_exportCommands(commands)} )`;
return _exportCommands(commands);
}

0 comments on commit ec6c502

Please sign in to comment.