2022-12-06 20:03:34 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
const path = require("path");
|
|
|
|
const fs = require("fs-extra");
|
|
|
|
|
2022-12-21 22:34:20 +00:00
|
|
|
const examplesSource = path.resolve(__dirname, "../examples");
|
2022-12-21 22:30:02 +00:00
|
|
|
const examplesDestination = path.resolve(__dirname, "./examples");
|
2022-12-06 20:03:34 +00:00
|
|
|
|
2022-12-21 22:30:02 +00:00
|
|
|
function run() {
|
|
|
|
fs.ensureDirSync(examplesDestination);
|
2022-12-06 20:03:34 +00:00
|
|
|
|
2022-12-08 17:34:38 +00:00
|
|
|
try {
|
2022-12-21 22:30:02 +00:00
|
|
|
console.log("Started copying supported Waku examples.");
|
|
|
|
fs.copySync(examplesSource, examplesDestination, { filter: nodeModulesFiler });
|
2022-12-08 17:34:38 +00:00
|
|
|
console.log("Finished copying examples.");
|
|
|
|
} catch (error) {
|
|
|
|
console.error("Failed to copy examples due to " + error.message);
|
2022-12-21 22:30:02 +00:00
|
|
|
throw Error(error.message);
|
2022-12-08 17:34:38 +00:00
|
|
|
}
|
2022-12-06 20:03:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function nodeModulesFiler(src) {
|
|
|
|
if (src.includes("node_modules")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
run();
|