Security update for Core, with self-updated composer
[yaffs-website] / web / core / scripts / js / changeOrAdded.js
diff --git a/web/core/scripts/js/changeOrAdded.js b/web/core/scripts/js/changeOrAdded.js
new file mode 100644 (file)
index 0000000..18fd710
--- /dev/null
@@ -0,0 +1,15 @@
+const fs = require('fs');
+const log = require('./log');
+const compile = require('./compile');
+
+module.exports = (filePath) => {
+  log(`'${filePath}' is being processed.`);
+  // Transform the file.
+  compile(filePath, function write(code) {
+    const fileName = filePath.slice(0, -7);
+    // Write the result to the filesystem.
+    fs.writeFile(`${fileName}.js`, code, () => {
+      log(`'${filePath}' is finished.`);
+    });
+  });
+}