fix: upgrade to babel 7; dump uglify for terser; upgrade to jest 24

This commit is contained in:
Michael Vines 2019-02-17 16:24:46 -08:00
parent 32835ba047
commit 07f1f9a59c
4 changed files with 5180 additions and 2412 deletions

View File

@ -1,24 +1,27 @@
{ {
"presets": [ "presets": [
[ "env", { "modules": false } ], [ "@babel/preset-env", { "modules": false } ],
"stage-0", "@babel/preset-flow",
"flow" ],
"plugins": [
["module-resolver", {
"root": ["./src"],
}],
"@babel/transform-runtime",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-function-bind",
], ],
"env": { "env": {
"test": { "test": {
"plugins": [
"@babel/transform-runtime",
],
"presets": [ "presets": [
"env", "@babel/preset-env",
"stage-0", "@babel/preset-flow",
"flow" ],
] },
}
}, },
"plugins": [
["module-resolver", {
"root": ["./src"]
}],
"transform-runtime"
]
} }

7484
web3.js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@
"doc": "set -ex; esdoc; node -p '\"\\nDocumentation coverage: \" + require(\"./doc/coverage.json\").coverage'", "doc": "set -ex; esdoc; node -p '\"\\nDocumentation coverage: \" + require(\"./doc/coverage.json\").coverage'",
"doc:watch": "watch 'npm run doc' . --wait=1 --ignoreDirectoryPattern=/doc/", "doc:watch": "watch 'npm run doc' . --wait=1 --ignoreDirectoryPattern=/doc/",
"examples": "set -ex; for example in examples/*.js; do node $example; done", "examples": "set -ex; for example in examples/*.js; do node $example; done",
"flow": "set -ex; flow stop; flow-typed install jest@22; flow", "flow": "set -ex; flow stop; flow-typed install jest@24; flow",
"flow:stop": "flow stop", "flow:stop": "flow stop",
"flow:watch": "flow stop; watch 'flow' . --wait=1 --ignoreDirectoryPattern=/doc/", "flow:watch": "flow stop; watch 'flow' . --wait=1 --ignoreDirectoryPattern=/doc/",
"install": "npm run bpf-sdk:install", "install": "npm run bpf-sdk:install",
@ -68,7 +68,7 @@
"test:watch": "cross-env NODE_ENV=test jest --watch --useStderr" "test:watch": "cross-env NODE_ENV=test jest --watch --useStderr"
}, },
"dependencies": { "dependencies": {
"babel-runtime": "^6.26.0", "@babel/runtime": "^7.3.1",
"bn.js": "^4.11.8", "bn.js": "^4.11.8",
"bs58": "^4.0.1", "bs58": "^4.0.1",
"buffer-layout": "^1.2.0", "buffer-layout": "^1.2.0",
@ -82,13 +82,14 @@
"ws": "^6.1.0" "ws": "^6.1.0"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "6.26.3", "@babel/core": "^7.3.3",
"@babel/plugin-proposal-class-properties": "^7.3.3",
"@babel/plugin-proposal-function-bind": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1",
"@babel/preset-flow": "^7.0.0",
"babel-eslint": "10.0.1", "babel-eslint": "10.0.1",
"babel-plugin-module-resolver": "3.2.0", "babel-plugin-module-resolver": "3.2.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "1.7.0",
"babel-preset-flow": "6.23.0",
"babel-preset-stage-0": "6.24.1",
"codecov": "^3.0.4", "codecov": "^3.0.4",
"cross-env": "5.2.0", "cross-env": "5.2.0",
"elfy": "^0.1.0", "elfy": "^0.1.0",
@ -106,19 +107,19 @@
"flow-bin": "0.93.0", "flow-bin": "0.93.0",
"flow-typed": "2.5.1", "flow-typed": "2.5.1",
"fs-file-tree": "1.0.7", "fs-file-tree": "1.0.7",
"jest": "23.6.0", "jest": "24.1.0",
"marked": "^0.6.0", "marked": "^0.6.0",
"prettier": "^1.14.3", "prettier": "^1.14.3",
"rimraf": "2.6.3", "rimraf": "2.6.3",
"rollup": "1.2.1", "rollup": "1.2.1",
"rollup-plugin-babel": "3.0.7", "rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "9.2.0", "rollup-plugin-commonjs": "9.2.0",
"rollup-plugin-json": "^3.0.0", "rollup-plugin-json": "^3.0.0",
"rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.2.1", "rollup-plugin-node-globals": "^1.2.1",
"rollup-plugin-node-resolve": "4.0.0", "rollup-plugin-node-resolve": "4.0.0",
"rollup-plugin-replace": "2.1.0", "rollup-plugin-replace": "2.1.0",
"rollup-plugin-uglify": "3.0.0", "rollup-plugin-terser": "^4.0.4",
"semantic-release": "^15.9.16", "semantic-release": "^15.9.16",
"watch": "^1.0.2" "watch": "^1.0.2"
} }

View File

@ -5,7 +5,7 @@ import globals from 'rollup-plugin-node-globals';
import json from 'rollup-plugin-json'; import json from 'rollup-plugin-json';
import nodeResolve from 'rollup-plugin-node-resolve'; import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace'; import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify'; import {terser} from 'rollup-plugin-terser';
const env = process.env.NODE_ENV; const env = process.env.NODE_ENV;
@ -25,15 +25,6 @@ function generateConfig(configType) {
], ],
}; };
if (env === 'production') {
config.plugins.push(
uglify({
mangle: false,
compress: false,
}),
);
}
switch (configType) { switch (configType) {
case 'browser': case 'browser':
config.output = [ config.output = [
@ -51,6 +42,17 @@ function generateConfig(configType) {
browser: true, browser: true,
}), }),
); );
if (env === 'production') {
config.plugins.push(
terser({
mangle: false,
compress: false,
sourcemap: true,
}),
);
}
break; break;
case 'node': case 'node':
config.output = [ config.output = [
@ -71,21 +73,23 @@ function generateConfig(configType) {
// maintained. // maintained.
config.external = [ config.external = [
'assert', 'assert',
'babel-runtime/core-js/get-iterator', '@babel/runtime/core-js/get-iterator',
'babel-runtime/core-js/json/stringify', '@babel/runtime/core-js/json/stringify',
'babel-runtime/core-js/object/assign', '@babel/runtime/core-js/object/assign',
'babel-runtime/core-js/object/get-prototype-of', '@babel/runtime/core-js/object/get-prototype-of',
'babel-runtime/core-js/object/keys', '@babel/runtime/core-js/object/keys',
'babel-runtime/core-js/promise', '@babel/runtime/core-js/promise',
'babel-runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/asyncToGenerator',
'babel-runtime/helpers/classCallCheck', '@babel/runtime/helpers/classCallCheck',
'babel-runtime/helpers/createClass', '@babel/runtime/helpers/createClass',
'babel-runtime/helpers/get', '@babel/runtime/helpers/defineProperty',
'babel-runtime/helpers/inherits', '@babel/runtime/helpers/get',
'babel-runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf',
'babel-runtime/helpers/toConsumableArray', '@babel/runtime/helpers/inherits',
'babel-runtime/helpers/typeof', '@babel/runtime/helpers/possibleConstructorReturn',
'babel-runtime/regenerator', '@babel/runtime/helpers/toConsumableArray',
'@babel/runtime/helpers/typeof',
'@babel/runtime/regenerator',
'bn.js', 'bn.js',
'bs58', 'bs58',
'buffer-layout', 'buffer-layout',