Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit f6007d6

Browse files
arthurfrancazpao
authored andcommitted
Update to Babel v7 (#128)
* Update to Babel v7 * Update yarn.lock and package-lock.json * Remove incompatible version of node from ci config
1 parent a9ceb57 commit f6007d6

File tree

8 files changed

+3218
-1673
lines changed

8 files changed

+3218
-1673
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
language: node_js
22
cache: yarn
33
node_js:
4-
- 4
54
- 6
65
- 8
76
script:
8-
- yarn run test-on-travis
7+
- yarn run test-on-travis

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ option | values | default
3434
`doctype` | any string that can be used as [a doctype](http://en.wikipedia.org/wiki/Document_type_declaration), this will be prepended to your document | `"<!DOCTYPE html>"`
3535
`beautify` | `true`: beautify markup before outputting (note, this can affect rendering due to additional whitespace) | `false`
3636
`transformViews` | `true`: use `babel` to apply JSX, ESNext transforms to views.<br>**Note:** if already using `babel-register` in your project, you should set this to `false` | `true`
37-
`babel` | any object containing valid Babel options<br>**Note:** does not merge with defaults | `{presets: ['react', [ 'env', {'targets': {'node': 'current'}}]]}`
37+
`babel` | any object containing valid Babel options<br>**Note:** does not merge with defaults | `{presets: ['@babel/preset-react', [ '@babel/preset-env', {'targets': {'node': 'current'}}]]}`
3838

3939
The defaults are sane, but just in case you want to change something, here's how it would look:
4040

examples/dynamic/.babelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"presets": [
3-
"react",
4-
"env"
3+
"@babel/preset-react",
4+
"@babel/preset-env"
55
]
6-
}
6+
}

examples/dynamic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"browserify -t babelify views/main.js --standalone main -o public/main.js && node app.js"
1010
},
1111
"dependencies": {
12-
"babel-preset-env": "^1.6.0",
13-
"babel-preset-react": "^6.24.1",
12+
"@babel/preset-env": "^7.0.0",
13+
"@babel/preset-react": "^7.0.0",
1414
"babelify": "^7.3.0",
1515
"browserify": "^14.3.0",
1616
"express": "^4.15.3",

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ var DEFAULT_OPTIONS = {
1919
transformViews: true,
2020
babel: {
2121
presets: [
22-
'react',
22+
'@babel/preset-react',
2323
[
24-
'env',
24+
'@babel/preset-env',
2525
{
2626
targets: {
2727
node: 'current',
2828
},
2929
},
3030
],
3131
],
32+
plugins: ['@babel/transform-flow-strip-types'],
3233
},
3334
};
3435

@@ -54,8 +55,8 @@ function createEngine(engineOptions) {
5455
if (engineOptions.transformViews && !registered) {
5556
// Passing a RegExp to Babel results in an issue on Windows so we'll just
5657
// pass the view path.
57-
require('babel-register')(
58-
assign({only: options.settings.views}, engineOptions.babel)
58+
require('@babel/register')(
59+
assign({only: [].concat(options.settings.views)}, engineOptions.babel)
5960
);
6061
registered = true;
6162
}

0 commit comments

Comments
 (0)