diff --git a/.babelrc.js b/.babelrc.js index fef4c71e53..84c759ca87 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -3,6 +3,7 @@ module.exports = api => { let modules = true; switch (api.env()) { + case 'docs': case 'test': dev = true; modules = false; diff --git a/.eslintrc b/.eslintrc index 45eab0f85c..cf7d94bfc4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "extends": ["eslint-config-airbnb", "prettier"], + "extends": ["eslint-config-airbnb", "prettier", "prettier/react"], "env": { "browser": true }, @@ -101,28 +101,6 @@ "jsx-a11y/no-static-element-interactions": "off", "import/first": "off" } - }, - { - "files": ["www/src/**/*"], - "globals": { - "graphql": false - }, - "rules": { - "global-require": "off", - "no-console": "off", - "react/no-unescaped-entities": "off", - "react/prop-types": "off", - "import/no-webpack-loader-syntax": "off" - }, - "settings": { - "import/core-modules": "react-bootstrap" - } - }, - { - "files": ["www/src/examples/*"], - "rules": { - "comma-dangle": "off" - } } ] } diff --git a/package.json b/package.json index 8b08403aef..d3b606dc0b 100644 --- a/package.json +++ b/package.json @@ -56,22 +56,21 @@ "react-dom": "^0.14.9 || >=15.3.0" }, "devDependencies": { - "@babel/cli": "7.0.0-beta.42", - "@babel/core": "7.0.0-beta.42", - "@babel/plugin-proposal-class-properties": "7.0.0-beta.42", - "@babel/plugin-proposal-export-default-from": "7.0.0-beta.42", - "@babel/plugin-proposal-export-namespace-from": "7.0.0-beta.42", - "@babel/plugin-syntax-dynamic-import": "7.0.0-beta.42", - "@babel/plugin-transform-runtime": "7.0.0-beta.42", - "@babel/preset-env": "7.0.0-beta.42", - "@babel/preset-react": "7.0.0-beta.42", - "@babel/register": "7.0.0-beta.42", - "babel-core": "^7.0.0-bridge.0", - "babel-eslint": "^8.0.0", - "babel-loader": "^8.0.0-beta.2", + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "@babel/plugin-proposal-export-default-from": "^7.0.0", + "@babel/plugin-proposal-export-namespace-from": "^7.0.0", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-transform-runtime": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/preset-react": "^7.0.0", + "@babel/register": "^7.0.0", + "babel-eslint": "^9.0.0", + "babel-loader": "^8.0.2", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-dev-expression": "^0.2.1", - "babel-plugin-istanbul": "^4.1.5", + "babel-plugin-istanbul": "^5.0.1", "chai": "^3.5.0", "chalk": "^2.3.2", "codecov": "^3.0.4", @@ -83,6 +82,7 @@ "eslint": "^4.19.1", "eslint-config-airbnb": "^16.1.0", "eslint-config-prettier": "^2.9.0", + "eslint-import-resolver-webpack": "^0.10.1", "eslint-plugin-import": "^2.12.0", "eslint-plugin-jsx-a11y": "^6.0.3", "eslint-plugin-mocha": "^5.0.0", @@ -114,7 +114,7 @@ "webpack": "^4.4.1" }, "dependencies": { - "@babel/runtime": "7.0.0-beta.42", + "@babel/runtime": "^7.0.0", "classnames": "^2.2.5", "dom-helpers": "^3.2.0", "invariant": "^2.2.4", diff --git a/www/.babelrc.js b/www/.babelrc.js deleted file mode 100644 index e698941d18..0000000000 --- a/www/.babelrc.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = { - presets: [ - [ - '@babel/preset-env', - { - loose: true, - shippedProposals: true, - modules: false, - targets: { - browsers: ['last 4 versions', 'not ie <= 8'] - } - } - ], - [ - '@babel/preset-react', - { development: process.env.NODE_ENV === 'development' } - ] - ], - plugins: [ - ['@babel/plugin-proposal-class-properties', { loose: true }], - '@babel/plugin-proposal-export-default-from', - '@babel/plugin-proposal-export-namespace-from', - ['@babel/plugin-transform-runtime', { useESModules: true }], - 'babel-plugin-dev-expression' - ] -}; diff --git a/www/.eslintrc.js b/www/.eslintrc.js new file mode 100644 index 0000000000..3b634bf5f8 --- /dev/null +++ b/www/.eslintrc.js @@ -0,0 +1,37 @@ +const path = require('path'); + +module.exports = { + globals: { + graphql: false + }, + rules: { + 'global-require': 'off', + 'react/prop-types': 'off', + 'react/no-unescaped-entities': 'off', + 'import/no-webpack-loader-syntax': 'off', + 'prefer-arrow-callback': 'off' + }, + settings: { + 'import/resolver': { + webpack: { + config: { + resolve: { + alias: { + 'react-bootstrap$': path.resolve(__dirname, '../src/index.js'), + 'react-bootstrap/lib': path.resolve(__dirname, '../src') + } + } + } + } + } + }, + overrides: [ + { + files: ['src/examples/**'], + rules: { + 'comma-dangle': 'off', + 'no-console': 'off' + } + } + ] +}; diff --git a/www/gatsby-config.js b/www/gatsby-config.js index 969fb92c95..ce322e1b1a 100644 --- a/www/gatsby-config.js +++ b/www/gatsby-config.js @@ -9,7 +9,7 @@ const nodeModules = `${path.sep}node_modules${path.sep}`; // eslint-disable-next-line require('@babel/register')({ - ...require('../.babelrc.js'), + ...require('../.babelrc.js')({ env: () => 'build' }), only: [ // Only the src directory new RegExp(`^${escapeRegExp(path.join(root, '/src/'))}`, 'i') @@ -32,6 +32,7 @@ module.exports = { ] }, plugins: [ + 'gatsby-plugin-layout', { resolve: 'gatsby-source-filesystem', options: { diff --git a/www/gatsby-node.js b/www/gatsby-node.js index 9c1d871578..dd151fa937 100644 --- a/www/gatsby-node.js +++ b/www/gatsby-node.js @@ -1,11 +1,12 @@ const path = require('path'); -exports.modifyWebpackConfig = function modifyWebpackConfig({ +exports.onCreateWebpackConfig = function onCreateWebpackConfig({ actions, plugins, loaders }) { actions.setWebpackConfig({ + devtool: 'cheap-inline-module-source-map', module: { rules: [ { @@ -28,19 +29,11 @@ exports.modifyWebpackConfig = function modifyWebpackConfig({ }; exports.onCreateBabelConfig = ({ actions }) => { - actions.setBabelPreset({ - name: `@babel/preset-flow` + actions.setBabelOptions({ + options: { + babelrc: true, + envName: 'docs', + root: path.resolve(__dirname, '../') + } }); }; - -exports.onCreatePage = ({ page }) => { - if (page.path.startsWith('/getting-started')) { - page.layout = 'getting-started'; - } else if (page.path.startsWith('/layout')) { - page.layout = 'layout'; - } else if (page.path.startsWith('/components')) { - page.layout = 'components'; - } else if (page.path.startsWith('/utilities')) { - page.layout = 'utilities'; - } -}; diff --git a/www/gatsby-ssr.js b/www/gatsby-ssr.js new file mode 100644 index 0000000000..33fcda37b5 --- /dev/null +++ b/www/gatsby-ssr.js @@ -0,0 +1,19 @@ +const React = require('react'); + +exports.onRenderBody = ({ setHeadComponents, setPostBodyComponents }) => { + setHeadComponents([ + + ]); + + setPostBodyComponents([ +