changeOrAdded.js 433 B

123456789101112131415
  1. const fs = require('fs');
  2. const log = require('./log');
  3. const compile = require('./compile');
  4. module.exports = (filePath) => {
  5. log(`'${filePath}' is being processed.`);
  6. // Transform the file.
  7. compile(filePath, function write(code) {
  8. const fileName = filePath.slice(0, -7);
  9. // Write the result to the filesystem.
  10. fs.writeFile(`${fileName}.js`, code, () => {
  11. log(`'${filePath}' is finished.`);
  12. });
  13. });
  14. }