Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better antlr4 workaround #1325

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion dev/fixAntlr4.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@

const fs = require('fs-extra');
const path = require('path');
const execSync = require('child_process').execSync;
// the directory containing .babelrc is one step up
const antlr4Path = path.join(path.dirname(require.resolve('antlr4')), '..');

const antlr4BabelPath = path.join(__dirname, '..', 'node_modules', 'antlr4', '.babelrc');
const antlr4BabelPath = path.join(antlr4Path, '.babelrc');
const babelContents = {
presets: ['@babel/preset-env'],
targets: 'defaults'
};
fs.writeJSONSync(antlr4BabelPath, babelContents);

execSync('npm install', { cwd: antlr4Path });
12 changes: 3 additions & 9 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"postinstall": "npm run fixAntlr4",
"prepublishOnly": "npm run check && npm run fixGrammarTypes",
"fixGrammarTypes": "ts-node dev/fixGrammarTypes.ts",
"fixAntlr4": "node dev/fixAntlr4.js && cd node_modules && cd antlr4 && npm install && npm run build"
"fixAntlr4": "node dev/fixAntlr4.js"
},
"contributors": [
"Julia Afeltra <[email protected]>",
Expand Down
Loading