2
0

copy-folder.mjs 465 B

12345678910111213141516
  1. // eslint-disable-next-line import/no-extraneous-dependencies
  2. import { copyDir } from 'hexo-fs';
  3. (async () => {
  4. if (process.argv.length < 4) {
  5. console.error('Usage: node --experimental-modules copy-folder.mjs ...srcDirs tarDir');
  6. process.exit(1);
  7. }
  8. const [, , ...srcDirs] = process.argv;
  9. const tarDir = srcDirs.pop();
  10. await Promise.allSettled(
  11. srcDirs.map((srcDir) => copyDir(`./node_modules/${srcDir}`, `${tarDir}/${srcDir}`)),
  12. );
  13. })();