You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
645 B
30 lines
645 B
/* eslint-disable no-console */ |
|
const path = require('path'); |
|
const fse = require('fs-extra'); |
|
const glob = require('fast-glob'); |
|
|
|
async function typescriptCopy({ from, to }) { |
|
if (!(await fse.pathExists(to))) { |
|
console.warn(`path ${to} does not exists`); |
|
return []; |
|
} |
|
|
|
const files = await glob(['**/*.png', '**/*.svg', '**/*.css'], { cwd: from }); |
|
|
|
const cmds = files.map((file) => |
|
fse.copy(path.resolve(from, file), path.resolve(to, file)), |
|
); |
|
|
|
return Promise.all(cmds); |
|
} |
|
|
|
async function run() { |
|
try { |
|
await typescriptCopy({ from: './src', to: './lib' }); |
|
} catch (err) { |
|
console.error(err); |
|
process.exit(1); |
|
} |
|
} |
|
|
|
run();
|
|
|