Mercurial > hg > isophonics-drupal-site
annotate core/scripts/js/check.js @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 const chalk = require('chalk'); |
Chris@0 | 2 const fs = require('fs'); |
Chris@0 | 3 const log = require('./log'); |
Chris@0 | 4 const compile = require('./compile'); |
Chris@0 | 5 |
Chris@0 | 6 module.exports = (filePath) => { |
Chris@0 | 7 log(`'${filePath}' is being checked.`); |
Chris@0 | 8 // Transform the file. |
Chris@0 | 9 compile(filePath, function check(code) { |
Chris@0 | 10 const fileName = filePath.slice(0, -7); |
Chris@0 | 11 fs.readFile(`${fileName}.js`, function read(err, data) { |
Chris@0 | 12 if (err) { |
Chris@0 | 13 log(chalk.red(err)); |
Chris@0 | 14 process.exitCode = 1; |
Chris@0 | 15 return; |
Chris@0 | 16 } |
Chris@0 | 17 if (code !== data.toString()) { |
Chris@0 | 18 log(chalk.red(`'${filePath}' is not updated.`)); |
Chris@0 | 19 process.exitCode = 1; |
Chris@0 | 20 } |
Chris@0 | 21 }); |
Chris@0 | 22 }); |
Chris@0 | 23 } |