const { ncp } = require("ncp") ncp.limit = 16 const options = { clobber: true, //overwrite dir stopOnErr: true, filter: /.*(\/dist\/|\/js\/|\/css\/|font\/|fonts\/|debug.js|min.js|min.js.map|min.css|min.css.map|ttf|svg|woff)$/ } const target = { js: "extension/Resources/Public/JavaScript/", css: "extension/Resources/Public/Css/", font: "extension/Resources/Public/fonts" } const target_dev = { js: "js/", css: "css/" } const todos = [ { name: "bootstrap", js: "node_modules/bootstrap/dist/js/", css: "node_modules/bootstrap/dist/css/", font: "node_modules/bootstrap/dist/fonts/" },{ name: "jquery", js: "node_modules/jquery/dist/" },{ name: "tablesorter", js: "node_modules/tablesorter/dist/js/" },{ name: "datetimepicker", js: "javascript/src/Plugins/bootstrap-datetimepicker.min.js", css: "javascript/src/Plugins/bootstrap-datetimepicker.min.css" },{ name: "chart-js", js: "node_modules/chart.js/dist/" },{ name: "qfq", js: "javascript/build/dist/" },{ name: "fontAwesome", css: "node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css", font: "node_modules/@fortawesome/fontawesome-free/webfonts/" },{ name: "fontPassword", font: "resources/custom_fonts/" } ] const types = ["js", "css", "font"] console.log("Async copying files:") for (const todo of todos) { for(const type of types) { if(todo.hasOwnProperty(type)) { ncp(todo[type], target[type], (err) => printProgress(err, todo.name, type)); } } } function printProgress(err, name, type) { if (err) { return console.error(err); } console.log(' * copied ' + type + ' ' + name); }