Skip to content

Commit

Permalink
Merge pull request #2341 from atom-ide-community/@babel
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Dec 30, 2020
2 parents a344c30 + a7d48ff commit 7ef1f4c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
13 changes: 13 additions & 0 deletions lib/grammars/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
'@babel/preset-react',
],
],
};
3 changes: 2 additions & 1 deletion lib/grammars/coffeescript.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ path = require 'path'
bin = path.join __dirname, '../..', 'node_modules', '.bin'
coffee = path.join bin, 'coffee'
babel = path.join bin, 'babel'
babelConfig = path.join __dirname, 'babel.config.js'

args = ({filepath}) ->
cmd = "'#{coffee}' -p '#{filepath}'|'#{babel}' --filename '#{bin}'| node"
cmd = "'#{coffee}' -p '#{filepath}'|'#{babel}' --filename '#{bin} --config-file #{babelConfig}'| node"
return GrammarUtils.formatArgs(cmd)

exports.CoffeeScript =
Expand Down
7 changes: 4 additions & 3 deletions lib/grammars/javascript.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use babel';

import path from 'path';
import GrammarUtils, { command } from '../grammar-utils';
import GrammarUtils, { command, OperatingSystem } from '../grammar-utils';

const babel = path.join(__dirname, '../..', 'node_modules', '.bin', 'babel');
const babel = path.join(__dirname, '../..', 'node_modules', '.bin', OperatingSystem.isWindows() ? 'babel.cmd' : 'babel');
const babelConfig = path.join(__dirname, 'babel.config.js');

const args = ({ filepath }) => {
const cmd = `'${babel}' --filename '${babel}' < '${filepath}'| node`;
const cmd = `'${babel}' --filename '${filepath}' --config-file ${babelConfig} < '${filepath}'| node`;
return GrammarUtils.formatArgs(cmd);
};
exports.Dart = {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@
]
},
"dependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.12.10",
"ansi-to-html": "^0.4.2",
"atom-message-panel": "1.3.1",
"atom-space-pen-views-plus": "^3.0.4",
"babel-preset-env": "^1.6.0",
"strip-ansi": "^3.0.0",
"underscore": "^1.8.3",
"uuid": "^8.3.2"
},
"optionalDependencies": {
"babel-cli": "^6.26.0",
"coffeescript": "^2"
},
"devDependencies": {
Expand Down

0 comments on commit 7ef1f4c

Please sign in to comment.