js-waku-examples/create-waku-app/build.js

30 lines
759 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
const path = require("path");
const fs = require("fs-extra");
const examplesSource = path.resolve(__dirname, "../examples");
const examplesDestination = path.resolve(__dirname, "./examples");
function run() {
fs.ensureDirSync(examplesDestination);
2022-12-08 17:34:38 +00:00
try {
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);
throw Error(error.message);
2022-12-08 17:34:38 +00:00
}
}
function nodeModulesFiler(src) {
if (src.includes("node_modules")) {
return false;
}
return true;
}
run();