Skip to content

Commit

Permalink
[core] Upgrade to babel@rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 19, 2018
1 parent a29c7f1 commit 6918cb5
Show file tree
Hide file tree
Showing 242 changed files with 973 additions and 30,646 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ jobs:
- run:
name: Lint
command: yarn lint
- run:
name: Flow
command: yarn flow
- run:
name: TypeScript
command: yarn typescript
Expand Down
11 changes: 1 addition & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
ecmaVersion: 7,
sourceType: 'module',
},
plugins: ['babel', 'import', 'jsx-a11y', 'mocha', 'flowtype', 'material-ui'],
plugins: ['babel', 'import', 'jsx-a11y', 'mocha', 'material-ui'],
settings: {
'import/resolver': {
webpack: {
Expand Down Expand Up @@ -95,15 +95,6 @@ module.exports = {
'mocha/no-pending-tests': 'error',
'mocha/no-skipped-tests': 'error',

'flowtype/define-flow-type': 'error',
'flowtype/require-valid-file-annotation': 'off',
'flowtype/require-parameter-type': 'off',
'flowtype/require-return-type': 'off',
'flowtype/space-after-type-colon': 'off',
'flowtype/space-before-type-colon': 'off',
'flowtype/type-id-match': 'off',
'flowtype/use-flow-type': 'error',

'jsx-a11y/label-has-associated-control': 'off',
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/no-autofocus': 'off', // We are a library, people do what they want.
Expand Down
50 changes: 0 additions & 50 deletions .flowconfig

This file was deleted.

35 changes: 16 additions & 19 deletions .size-limit.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
const fs = require('fs');

function getMainFile() {
const dirname = '.next/static/commons';
const files = fs.readdirSync(dirname);
const [file] = files
.reduce((result, filename) => {
if (!/^main-[a-f0-9]+\.js$/.test(filename)) {
return result;
}
const buildId = fs.readFileSync('.next/BUILD_ID', 'utf8');

const path = `${dirname}/${filename}`;
return [...result, { path, ctime: fs.statSync(path).ctimeMs }];
}, [])
.sort((x, y) => y.ctime - x.ctime);
return file;
}
const dirname = '.next/static/chunks';
const [main] = fs.readdirSync(dirname).reduce((result, filename) => {
if (filename.length === 23) {
return [...result, { path: `${dirname}/${filename}` }];
}

return result;
}, []);

console.log('-', main)

module.exports = [
{
Expand All @@ -27,18 +24,18 @@ module.exports = [
name: 'The size of all the modules of material-ui.',
webpack: true,
path: 'packages/material-ui/build/index.js',
limit: '95.6 KB',
limit: '89.4 KB',
},
{
name: 'The main bundle of the docs',
webpack: false,
path: getMainFile().path,
limit: '181 KB',
path: main.path,
limit: '162 KB',
},
{
name: 'The home page of the docs',
webpack: false,
path: '.next/bundles/pages/index.js',
limit: '5.9 KB',
path: `.next/static/${buildId}/pages/index.js`,
limit: '6 KB',
},
];
39 changes: 21 additions & 18 deletions .babelrc.js → babel.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const ENV = process.env.BABEL_ENV;
let defaultPresets;

// We release a ES version of Material-UI.
// It's something that matches the latest official supported features of JavaScript.
// Nothing more (stage-1, etc), nothing less (require, etc).
if (ENV === 'es') {
if (process.env.BABEL_ENV === 'es') {
defaultPresets = [];
} else {
defaultPresets = [
Expand All @@ -19,28 +18,29 @@ if (ENV === 'es') {
safari: 10,
node: '6.11',
},
modules: ['modules', 'production-umd'].includes(ENV) ? false : 'commonjs',
modules: ['modules', 'production-umd'].includes(process.env.BABEL_ENV) ? false : 'commonjs',
},
],
];
}

module.exports = {
presets: defaultPresets.concat([
['@babel/preset-stage-1', { loose: true }],
'@babel/preset-react',
'@babel/flow',
]),
presets: defaultPresets.concat(['@babel/preset-react']),
plugins: [
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-object-rest-spread', {
// Workaround for https://github.com/babel/babel/issues/8323
loose: process.env.BABEL_ENV !== 'es',
}],
'@babel/plugin-transform-object-assign',
['@babel/plugin-transform-runtime', { polyfill: false, useBuiltIns: true }],
'@babel/plugin-transform-runtime',
],
env: {
coverage: {
plugins: [
'istanbul',
'babel-plugin-istanbul',
[
'module-resolver',
'babel-plugin-module-resolver',
{
root: ['./'],
alias: {
Expand All @@ -54,7 +54,7 @@ module.exports = {
development: {
plugins: [
[
'module-resolver',
'babel-plugin-module-resolver',
{
alias: {
modules: './modules',
Expand All @@ -67,7 +67,7 @@ module.exports = {
plugins: [
'babel-plugin-preval',
[
'module-resolver',
'babel-plugin-module-resolver',
{
alias: {
'@material-ui/core': './packages/material-ui/src',
Expand All @@ -86,7 +86,7 @@ module.exports = {
plugins: [
'babel-plugin-preval',
[
'module-resolver',
'babel-plugin-module-resolver',
{
alias: {
'@material-ui/core': './packages/material-ui/src',
Expand Down Expand Up @@ -117,7 +117,9 @@ module.exports = {
},
],
],
ignore: ['**/*.test*'],
// It's most likely a babel bug.
// We are using this ignore option in the CLI command but that has no effect.
ignore: ['**/*.test.js'],
},
production: {
plugins: [
Expand All @@ -131,7 +133,9 @@ module.exports = {
},
],
],
ignore: ['**/*.test*'],
// It's most likely a babel bug.
// We are using this ignore option in the CLI command but that has no effect.
ignore: ['**/*.test.js'],
},
'production-umd': {
plugins: [
Expand All @@ -150,7 +154,7 @@ module.exports = {
sourceMaps: 'both',
plugins: [
[
'module-resolver',
'babel-plugin-module-resolver',
{
root: ['./'],
alias: {
Expand All @@ -162,5 +166,4 @@ module.exports = {
],
},
},
ignore: ['scripts/*.js'],
};
Loading

0 comments on commit 6918cb5

Please sign in to comment.