git.iko.soy/rowtype-yoga/purescript-native
on 896bbcd help sign in
22 lines 615 B history raw
1var glob = require("glob");
2var fs = require("fs");
4try {
5 fs.mkdirSync("./flattened");
6} catch(e) {
7 // ignore the error if it already exists
8 if (e.code !== "EEXIST") {
9 throw(e);
10 }
13glob("bower_components/*/src/**/*.{js,purs}", function(err, files) {
14 if (err) throw err;
15 files.forEach(function(file) {
16 // We join with "-" because Cabal is weird about file extensions.
17 var dest = "./flattened/" + file.split("/").slice(3).join("-");
18 console.log("Copying " + file + " to " + dest);
19 var content = fs.readFileSync(file, "utf-8");
20 fs.writeFileSync(dest, content, "utf-8");
21 });
22})