diff --git a/tools/deploy/index.ts b/tools/deploy/index.ts index 7d69d658..9490b655 100644 --- a/tools/deploy/index.ts +++ b/tools/deploy/index.ts @@ -30,11 +30,10 @@ program const aq = new script.ActionQueue; - for (const file of files) { - const src = pathlib.path(file); + for (const src of files) { const output = script.runOnFile(scr, src); - const dst = pathlib.join(outputDir, output); - aq.copy(pathlib.format(src), pathlib.format(dst)); + const dst = nodePath.join(outputDir, output); + aq.copy(src, dst); } if (act) { diff --git a/tools/deploy/script.test.ts b/tools/deploy/script.test.ts index 27100c1c..d6e14eb8 100644 --- a/tools/deploy/script.test.ts +++ b/tools/deploy/script.test.ts @@ -13,9 +13,8 @@ test('aq', () => { test('runOnFile', () => { const scr = new script.Script('({name: "25"})', 'expr'); - const src = pathlib.path('/foo/bar/pikachu.png'); - const dst = script.runOnFile(scr, src); - expect(dst).toEqual(pathlib.path('25.png')); + const dst = script.runOnFile(scr, '/foo/bar/pikachu.png'); + expect(dst).toEqual('25.png'); }); test('run identity', () => { diff --git a/tools/deploy/script.ts b/tools/deploy/script.ts index 0e9ed378..fed390e9 100644 --- a/tools/deploy/script.ts +++ b/tools/deploy/script.ts @@ -101,18 +101,19 @@ function makeEnv(srcDir : string, queue: ActionQueue) { } } -export function runOnFile(scr : Script, src : pathlib.Path) : pathlib.Path { - const input = pathlib.update(src, {dir: ""}); +export function runOnFile(scr : Script, src : string) : string { + const input = pathlib.path(src, {dir: ""}); const result = scr.runInNewContext({ __proto__: ENV_PROTO, path: input, ...input }); if (result === undefined) { - throw new Error(`undefined output on ${pathlib.format(src)}`); + throw new Error(`undefined output on ${src}`); } - const output = pathlib.path(input, result); - return output; + const output = pathlib.update(input, result); + const dst = pathlib.format(output); + return dst; } export function run(scr : Script, srcDir : string, queue : ActionQueue) {