Skip to content

Commit

Permalink
fix(repo): use a platform agnostic copy script (#20364)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Nov 22, 2023
1 parent a22c422 commit 31df83b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nx/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
},
"copy-native-package-directories": {
"command": "cp -R build/packages/nx/native-packages/* build/packages"
"command": "node scripts/copy.js build/packages/nx/native-packages/* build/packages"
},
"artifacts": {
"dependsOn": ["copy-native-package-directories"],
Expand Down
30 changes: 30 additions & 0 deletions scripts/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//@ts-check
const { mkdirSync, copySync } = require('fs-extra');
const glob = require('fast-glob');
const { join, basename } = require('path');

const p = process.argv[2];

const args = process.argv.slice(2);
const dest = args[args.length - 1];
const from = args.slice(0, args.length - 1);

try {
mkdirSync(dest, {
recursive: true,
});
} catch {}
for (const f of from) {
const matchingFiles = glob.sync(f, {
cwd: process.cwd(),
onlyDirectories: true,
});

console.log(f, matchingFiles);

for (const file of matchingFiles) {
const destFile = join(dest, basename(file));
console.log(file, '=>', destFile);
copySync(file, destFile);
}
}

0 comments on commit 31df83b

Please sign in to comment.