mirror of
https://github.com/smogon/sprites.git
synced 2026-07-05 02:20:32 -05:00
deploy: allow link to copy()
This commit is contained in:
parent
2a85d665bd
commit
ca17fcd6e1
|
|
@ -2,10 +2,14 @@
|
|||
import fs from 'fs';
|
||||
import pathlib from 'path';
|
||||
|
||||
export function link(pairs : {src : string, dst : string}[], dstDir : string) {
|
||||
export function link(pairs : {src : string, dst : string}[], dstDir : string, mode : 'link' | 'copy') {
|
||||
for (let {src, dst} of pairs) {
|
||||
dst = pathlib.join(dstDir, dst);
|
||||
fs.mkdirSync(pathlib.dirname(dst), {recursive: true});
|
||||
fs.linkSync(src, dst);
|
||||
if (mode === 'link') {
|
||||
fs.linkSync(src, dst);
|
||||
} else {
|
||||
fs.copyFileSync(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ program
|
|||
.action((tag : string, outputDir : string, opts) => {
|
||||
const dir = opts.dir || '.';
|
||||
const results = run(find(dir, tag));
|
||||
link(results, outputDir);
|
||||
link(results, outputDir, 'link');
|
||||
});
|
||||
|
||||
program
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user