Check generated files are correct
MODIFY
.github/workflows/ci.yml
.github/workflows/ci.yml
@@ -10,7 +10,7 @@ on:
jobs:
typescript:
runs-on: ubuntu-latest
- name: TypeScript Check
+ name: TypeScript check
steps:
- uses: actions/checkout@v2
@@ -32,6 +32,18 @@ jobs:
- name: Run Rome lint
run: node scripts/dev-rome lint
+ generated:
+ name: Generated files check
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v1
+ with:
+ node-version: '13.x'
+ - name: Check if generated files need to be updated
+ run: node scripts/assert-generated
+
tests:
name: Tests
needs: [typescript, lint]

MODIFY
scripts/_utils.cjs
scripts/_utils.cjs
@@ -65,7 +65,7 @@ exports.inverse = function (str) {
exports.execDev = function(argv) {
exports.buildTrunk();
process.env.ROME_CACHE = '0';
- console.log(inverse('Executing trunk'));
+ console.log(exports.inverse('Executing trunk'));
exports.execNode([path.join(devFolder, 'index.js'), ...argv]);
};

MODIFY
scripts/assert-generated
scripts/assert-generated
require('./_setup.cjs');
+const child_process = require('child_process');
const {execDev} = require('./_utils.cjs');
// Generate files
@@ -19,3 +20,11 @@ require('./ast/update.cjs');
execDev(['lint', '--fix']);
// Check that `git status` is fine
+const out = child_process
+ .spawnSync('git', ['ls-files', '-m'])
+ .stdout.toString();
+if (out !== '') {
+ console.error('Modified files:');
+ console.error(out);
+ process.exit(1);
+}

Check generated files are correct