Skip to content

Commit

Permalink
chore: add es version check
Browse files Browse the repository at this point in the history
  • Loading branch information
dwbruhn committed Mar 11, 2024
1 parent 9605082 commit 9cd44be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions bin/checkES5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ensure output files are ES5

const fs = require('fs');
const acorn = require('acorn');

const files = ['./client/index.js', './server/index.js', './server/loadMeta.js'];

console.log('Ensuring files are ES5:', files);
files.forEach(file => {
const contents = fs.readFileSync(file, 'utf-8');
try {
acorn.parse(contents, { ecmaVersion: 5 });
} catch (e) {
console.error(`Error: ${file} is not ES5:`, e);
process.exit(1);
}
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
"update": "./bin/update.sh",
"upgrade": "./bin/upgrade.sh",
"build": "./bin/build.sh",
"test": "mocha test/ -R dot"
"test": "mocha test/ -R dot && node ./bin/checkES5.js"
},
"devDependencies": {
"acorn": "^8.11.3",
"chai": "^4.3.4",
"google-closure-compiler": "^20230802.0.0",
"google-closure-library": "^20230802.0.0",
Expand Down

0 comments on commit 9cd44be

Please sign in to comment.