Skip to content

Commit 4cf4a4e

Browse files
authored
Update to babel 7 final (#3261)
* chore(babel): Upgrade master to babel 7 release * update gatsby and babel * rm custom html
1 parent aa678fd commit 4cf4a4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3960
-4024
lines changed

.babelrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = api => {
33
let modules = true;
44

55
switch (api.env()) {
6+
case 'docs':
67
case 'test':
78
dev = true;
89
modules = false;

.eslintrc

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["eslint-config-airbnb", "prettier"],
2+
"extends": ["eslint-config-airbnb", "prettier", "prettier/react"],
33
"env": {
44
"browser": true
55
},
@@ -101,28 +101,6 @@
101101
"jsx-a11y/no-static-element-interactions": "off",
102102
"import/first": "off"
103103
}
104-
},
105-
{
106-
"files": ["www/src/**/*"],
107-
"globals": {
108-
"graphql": false
109-
},
110-
"rules": {
111-
"global-require": "off",
112-
"no-console": "off",
113-
"react/no-unescaped-entities": "off",
114-
"react/prop-types": "off",
115-
"import/no-webpack-loader-syntax": "off"
116-
},
117-
"settings": {
118-
"import/core-modules": "react-bootstrap"
119-
}
120-
},
121-
{
122-
"files": ["www/src/examples/*"],
123-
"rules": {
124-
"comma-dangle": "off"
125-
}
126104
}
127105
]
128106
}

package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,21 @@
5656
"react-dom": "^0.14.9 || >=15.3.0"
5757
},
5858
"devDependencies": {
59-
"@babel/cli": "7.0.0-beta.42",
60-
"@babel/core": "7.0.0-beta.42",
61-
"@babel/plugin-proposal-class-properties": "7.0.0-beta.42",
62-
"@babel/plugin-proposal-export-default-from": "7.0.0-beta.42",
63-
"@babel/plugin-proposal-export-namespace-from": "7.0.0-beta.42",
64-
"@babel/plugin-syntax-dynamic-import": "7.0.0-beta.42",
65-
"@babel/plugin-transform-runtime": "7.0.0-beta.42",
66-
"@babel/preset-env": "7.0.0-beta.42",
67-
"@babel/preset-react": "7.0.0-beta.42",
68-
"@babel/register": "7.0.0-beta.42",
69-
"babel-core": "^7.0.0-bridge.0",
70-
"babel-eslint": "^8.0.0",
71-
"babel-loader": "^8.0.0-beta.2",
59+
"@babel/cli": "^7.0.0",
60+
"@babel/core": "^7.0.0",
61+
"@babel/plugin-proposal-class-properties": "^7.0.0",
62+
"@babel/plugin-proposal-export-default-from": "^7.0.0",
63+
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
64+
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
65+
"@babel/plugin-transform-runtime": "^7.0.0",
66+
"@babel/preset-env": "^7.0.0",
67+
"@babel/preset-react": "^7.0.0",
68+
"@babel/register": "^7.0.0",
69+
"babel-eslint": "^9.0.0",
70+
"babel-loader": "^8.0.2",
7271
"babel-plugin-add-module-exports": "^0.2.1",
7372
"babel-plugin-dev-expression": "^0.2.1",
74-
"babel-plugin-istanbul": "^4.1.5",
73+
"babel-plugin-istanbul": "^5.0.1",
7574
"chai": "^3.5.0",
7675
"chalk": "^2.3.2",
7776
"codecov": "^3.0.4",
@@ -83,6 +82,7 @@
8382
"eslint": "^4.19.1",
8483
"eslint-config-airbnb": "^16.1.0",
8584
"eslint-config-prettier": "^2.9.0",
85+
"eslint-import-resolver-webpack": "^0.10.1",
8686
"eslint-plugin-import": "^2.12.0",
8787
"eslint-plugin-jsx-a11y": "^6.0.3",
8888
"eslint-plugin-mocha": "^5.0.0",
@@ -114,7 +114,7 @@
114114
"webpack": "^4.4.1"
115115
},
116116
"dependencies": {
117-
"@babel/runtime": "7.0.0-beta.42",
117+
"@babel/runtime": "^7.0.0",
118118
"classnames": "^2.2.5",
119119
"dom-helpers": "^3.2.0",
120120
"invariant": "^2.2.4",

www/.babelrc.js

-26
This file was deleted.

www/.eslintrc.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
globals: {
5+
graphql: false
6+
},
7+
rules: {
8+
'global-require': 'off',
9+
'react/prop-types': 'off',
10+
'react/no-unescaped-entities': 'off',
11+
'import/no-webpack-loader-syntax': 'off',
12+
'prefer-arrow-callback': 'off'
13+
},
14+
settings: {
15+
'import/resolver': {
16+
webpack: {
17+
config: {
18+
resolve: {
19+
alias: {
20+
'react-bootstrap$': path.resolve(__dirname, '../src/index.js'),
21+
'react-bootstrap/lib': path.resolve(__dirname, '../src')
22+
}
23+
}
24+
}
25+
}
26+
}
27+
},
28+
overrides: [
29+
{
30+
files: ['src/examples/**'],
31+
rules: {
32+
'comma-dangle': 'off',
33+
'no-console': 'off'
34+
}
35+
}
36+
]
37+
};

www/gatsby-config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const nodeModules = `${path.sep}node_modules${path.sep}`;
99

1010
// eslint-disable-next-line
1111
require('@babel/register')({
12-
...require('../.babelrc.js'),
12+
...require('../.babelrc.js')({ env: () => 'build' }),
1313
only: [
1414
// Only the src directory
1515
new RegExp(`^${escapeRegExp(path.join(root, '/src/'))}`, 'i')
@@ -32,6 +32,7 @@ module.exports = {
3232
]
3333
},
3434
plugins: [
35+
'gatsby-plugin-layout',
3536
{
3637
resolve: 'gatsby-source-filesystem',
3738
options: {

www/gatsby-node.js

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const path = require('path');
22

3-
exports.modifyWebpackConfig = function modifyWebpackConfig({
3+
exports.onCreateWebpackConfig = function onCreateWebpackConfig({
44
actions,
55
plugins,
66
loaders
77
}) {
88
actions.setWebpackConfig({
9+
devtool: 'cheap-inline-module-source-map',
910
module: {
1011
rules: [
1112
{
@@ -28,19 +29,11 @@ exports.modifyWebpackConfig = function modifyWebpackConfig({
2829
};
2930

3031
exports.onCreateBabelConfig = ({ actions }) => {
31-
actions.setBabelPreset({
32-
name: `@babel/preset-flow`
32+
actions.setBabelOptions({
33+
options: {
34+
babelrc: true,
35+
envName: 'docs',
36+
root: path.resolve(__dirname, '../')
37+
}
3338
});
3439
};
35-
36-
exports.onCreatePage = ({ page }) => {
37-
if (page.path.startsWith('/getting-started')) {
38-
page.layout = 'getting-started';
39-
} else if (page.path.startsWith('/layout')) {
40-
page.layout = 'layout';
41-
} else if (page.path.startsWith('/components')) {
42-
page.layout = 'components';
43-
} else if (page.path.startsWith('/utilities')) {
44-
page.layout = 'utilities';
45-
}
46-
};

www/gatsby-ssr.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const React = require('react');
2+
3+
exports.onRenderBody = ({ setHeadComponents, setPostBodyComponents }) => {
4+
setHeadComponents([
5+
<link
6+
key="eeee"
7+
rel="stylesheet"
8+
href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css"
9+
/>
10+
]);
11+
12+
setPostBodyComponents([
13+
<script
14+
key="asfasfasfas"
15+
type="text/javascript"
16+
src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"
17+
/>
18+
]);
19+
};

www/package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,25 @@
99
"dependencies": {
1010
"bootstrap": "^3.3.6",
1111
"classnames": "^2.2.5",
12-
"gatsby": "2.0.0-alpha.8",
13-
"gatsby-link": "^1.6.30",
12+
"gatsby": "^2.0.0-rc.11",
13+
"gatsby-link": "^2.0.0-rc.2",
1414
"gatsby-plugin-catch-links": "2.0.1-1",
15-
"gatsby-plugin-less": "2.0.0-alpha.3",
16-
"gatsby-remark-prismjs": "^1.2.17",
17-
"gatsby-source-filesystem": "2.0.0-alpha.3",
18-
"gatsby-transformer-react-docgen": "2.0.1-1",
19-
"gatsby-transformer-remark": "2.0.1-1",
20-
"graphql": "^0.11.7",
21-
"graphql-type-json": "^0.1.4",
15+
"gatsby-plugin-layout": "^1.0.0-beta.1",
16+
"gatsby-plugin-less": "^2.0.0-rc.1",
17+
"gatsby-remark-prismjs": "^3.0.0-rc.2",
18+
"gatsby-source-filesystem": "^2.0.1-rc.1",
19+
"gatsby-transformer-react-docgen": "^2.1.1-rc.1",
20+
"gatsby-transformer-remark": "^2.1.1-rc.1",
21+
"less": "^2.0.0",
2222
"lodash": "^4.15.0",
23+
"prismjs": "^1.15.0",
2324
"prop-types": "^15.6.0",
2425
"react": "^16.4.2",
25-
"react-bootstrap": "*",
26+
"react-docgen": "3.0.0-rc.0",
2627
"react-dom": "^16.4.2",
2728
"react-helmet": "^5.2.0",
2829
"react-live": "^1.9.2"
2930
},
30-
"devDependencies": {
31-
"@babel/core": "^7.0.0-beta.42",
32-
"@babel/preset-flow": "^7.0.0-beta.40"
33-
},
3431
"homepage": "https://react-bootstrap.github.io/",
3532
"keywords": [
3633
"gatsby"
@@ -46,6 +43,9 @@
4643
"deploy": "gatsby build --prefix-links && gh-pages -d public"
4744
},
4845
"resolutions": {
49-
"gatsby/@babel/core": "7.0.0-beta.42"
46+
"react-docgen": "3.0.0-rc.0"
47+
},
48+
"devDependencies": {
49+
"gatsby-codemods": "^1.0.0-rc.3"
5050
}
5151
}

www/src/components/PropTable.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { graphql } from 'gatsby';
12
import React from 'react';
23
import PropTypes from 'prop-types';
34

@@ -217,10 +218,7 @@ export const metadataFragment = graphql`
217218
}
218219
props {
219220
name
220-
doclets {
221-
type
222-
controllable
223-
}
221+
doclets
224222
defaultValue {
225223
value
226224
computed

www/src/html.js

-54
This file was deleted.

www/src/layouts/components.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33

44
import PageHeader from '../components/PageHeader';
55
import Main from '../components/Main';
6-
import Default from './index';
6+
import Default from './default';
77

88
const propTypes = {
99
location: PropTypes.object.isRequired
@@ -13,7 +13,7 @@ function ComponentsLayout({ children, ...props }) {
1313
return (
1414
<Default {...props}>
1515
<PageHeader title="Components" />
16-
<Main location={props.location}>{children()}</Main>
16+
<Main location={props.location}>{children}</Main>
1717
</Default>
1818
);
1919
}

0 commit comments

Comments
 (0)