2018-08-23 04:17:35 +00:00
|
|
|
const glob = require("glob");
|
|
|
|
const { resolve, relative } = require("path");
|
|
|
|
const fs = require("fs");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* COLLECT DEPENDENCIES
|
|
|
|
*/
|
|
|
|
function collectDependencies(){
|
2019-01-27 18:05:20 +00:00
|
|
|
const files = glob.sync(resolve(__dirname, "../Tone/!(shim)/!(Tone).js"));
|
|
|
|
const modules = files.map(f => f.slice(0, -3));
|
|
|
|
let reqString = modules.map(r => {
|
|
|
|
const relativePath = relative(resolve(__dirname, "../Tone"), r);
|
|
|
|
// const exportName = r.split("/")[r.split("/").length - 1];
|
|
|
|
// return `export { default as ${exportName} } from "./${relativePath}";`;
|
|
|
|
// return `import "./${relativePath}";`;
|
|
|
|
return `require("./${relativePath}");`;
|
|
|
|
}).join("\n");
|
|
|
|
// reqString += "\nexport { default } from \"./core/Tone\";\n";
|
|
|
|
reqString += "\nmodule.exports = require(\"./core/Tone\").default;\n";
|
|
|
|
fs.writeFileSync(resolve(__dirname, "../Tone/index.js"), reqString);
|
2018-08-23 04:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
collectDependencies();
|