Mercurial > hg > isophonics-drupal-site
comparison core/scripts/js/check.js @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 const chalk = require('chalk'); | |
2 const fs = require('fs'); | |
3 const log = require('./log'); | |
4 const compile = require('./compile'); | |
5 | |
6 module.exports = (filePath) => { | |
7 log(`'${filePath}' is being checked.`); | |
8 // Transform the file. | |
9 compile(filePath, function check(code) { | |
10 const fileName = filePath.slice(0, -7); | |
11 fs.readFile(`${fileName}.js`, function read(err, data) { | |
12 if (err) { | |
13 log(chalk.red(err)); | |
14 process.exitCode = 1; | |
15 return; | |
16 } | |
17 if (code !== data.toString()) { | |
18 log(chalk.red(`'${filePath}' is not updated.`)); | |
19 process.exitCode = 1; | |
20 } | |
21 }); | |
22 }); | |
23 } |