From a83f8dde25eef1f0b7124d3a01957779321159ea Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Thu, 27 Oct 2016 12:20:02 +0200 Subject: [PATCH] feat: stop transpiling and use uglify-harmony --- README.md | 1 - config/babel.js | 5 ----- config/karma.conf.js | 4 +--- config/webpack.js | 16 +++------------- package.json | 27 +++++++++++---------------- tasks/build/browser.js | 21 ++++++++++++--------- 6 files changed, 27 insertions(+), 47 deletions(-) delete mode 100644 config/babel.js diff --git a/README.md b/README.md index 49f7c526a..9e3c53b5a 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ Your `package.json` should have the following entries. To bring you its many benefits, `aegir` requires -- [ES6 / Babel](https://github.com/babel/babel) transpilation - JS written in [Standard](https://github.com/feross/standard) style - Tests written in [Mocha](https://github.com/mochajs/mocha) - [Karma](https://github.com/karma-runner/karma) for browser tests diff --git a/config/babel.js b/config/babel.js deleted file mode 100644 index 10bb88b29..000000000 --- a/config/babel.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict' - -module.exports = { - presets: [require.resolve('babel-preset-es2015')] -} diff --git a/config/karma.conf.js b/config/karma.conf.js index af3ce7644..f5566d516 100644 --- a/config/karma.conf.js +++ b/config/karma.conf.js @@ -1,6 +1,5 @@ 'use strict' -const path = require('path') const webpackConfig = require('./webpack') const timeout = require('./custom').timeout @@ -63,7 +62,7 @@ let browsers = [] if (process.env.TRAVIS) { if (process.env.SAUCE_USERNAME) { browsers = Object.keys(launchers) - concurrency = 2 + concurrency = 3 reporters = ['progress', 'saucelabs'] } else { browsers.push('Firefox') @@ -82,7 +81,6 @@ module.exports = function (config) { } }, files: [ - path.join(require.resolve('babel-polyfill'), '/../../dist/polyfill.js'), 'test/browser.js', 'test/**/*.spec.js' ], diff --git a/config/webpack.js b/config/webpack.js index 6f60afc99..1032e0591 100644 --- a/config/webpack.js +++ b/config/webpack.js @@ -4,6 +4,7 @@ const path = require('path') const upperFirst = require('lodash.upperfirst') const camelCase = require('lodash.camelcase') const merge = require('webpack-merge') +const webpack = require('webpack') const pkg = require(path.resolve('package.json')) let customConfig = {} @@ -11,7 +12,6 @@ try { customConfig = require(path.resolve('.aegir.js')) } catch (err) { } -const babel = require('./babel') // e.g. peer-id -> PeerId const libraryName = upperFirst(camelCase(pkg.name)) @@ -31,7 +31,6 @@ const specific = merge(custom1, custom2) const shared = { entry: [ - require.resolve('babel-polyfill'), path.resolve('src/index.js') ], output: { @@ -53,16 +52,6 @@ const shared = { }, module: { loaders: [{ - test: /\.js$/, - exclude: /node_modules|vendor/, - loader: 'babel', - query: babel - }, { - test: /\.js$/, - include: /node_modules\/(hoek|qs|wreck|boom|ipfs|promisify-es|whatwg-fetch|node-fetch|isomorphic-fetch|db\.js)/, - loader: 'babel', - query: babel - }, { test: /\.json$/, loader: 'json' }] @@ -70,7 +59,8 @@ const shared = { node: { Buffer: true }, - plugins: [] + plugins: [], + target: 'web' } const dev = merge(shared, { diff --git a/package.json b/package.json index 4fd9bec45..03185e6c7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ }, "keywords": [ "webpack", - "babel", "standard", "lint", "build" @@ -25,25 +24,19 @@ "license": "MIT", "dependencies": { "args-parser": "^1.0.2", - "babel-core": "^6.14.0", - "babel-loader": "^6.2.5", - "babel-polyfill": "^6.13.0", - "babel-preset-es2015": "^6.14.0", - "brfs": "^1.4.3", "chalk": "^1.1.3", "conventional-github-releaser": "^1.1.3", "coveralls": "^2.11.14", - "eslint": "^3.6.0", - "eslint-config-standard": "^6.1.0", - "eslint-plugin-promise": "^3.0.0", - "eslint-plugin-standard": "^2.0.0", + "eslint": "^3.8.1", + "eslint-config-standard": "^6.2.1", + "eslint-plugin-promise": "^3.3.0", + "eslint-plugin-standard": "^2.0.1", "gulp": "^3.9.1", - "gulp-babel": "^6.1.2", "gulp-bump": "^2.4.0", "gulp-conventional-changelog": "^1.1.0", "gulp-eslint": "^3.0.1", "gulp-filter": "^4.0.0", - "gulp-git": "^1.11.3", + "gulp-git": "^1.12.0", "gulp-mocha": "^3.0.1", "gulp-rename": "^1.2.2", "gulp-size": "^2.1.0", @@ -57,7 +50,7 @@ "karma": "^1.3.0", "karma-chrome-launcher": "^2.0.0", "karma-firefox-launcher": "^1.0.0", - "karma-mocha": "^1.1.1", + "karma-mocha": "^1.2.0", "karma-mocha-own-reporter": "^1.1.2", "karma-sauce-launcher": "^1.1.0", "karma-sourcemap-loader": "^0.3.7", @@ -65,23 +58,25 @@ "lodash.camelcase": "^4.3.0", "lodash.includes": "^4.3.0", "lodash.upperfirst": "^4.3.1", - "mocha": "^3.0.2", + "mocha": "^3.1.2", "pretty-hrtime": "^1.0.2", + "pump": "^1.0.1", "rimraf": "^2.5.4", "run-sequence": "^1.2.2", "semver": "^5.3.0", "signal-exit": "^3.0.1", "stream-http": "^2.4.0", "transform-loader": "^0.2.3", + "uglify-js": "github:mishoo/UglifyJS2#harmony", "webpack": "^2.1.0-beta.25", - "webpack-merge": "^0.14.1" + "webpack-merge": "^0.15.0" }, "repository": { "type": "git", "url": "https://github.com/dignifiedquire/aegir" }, "engines": { - "node": ">=4.2.2" + "node": ">=4.0.0" }, "contributors": [ "David Dias ", diff --git a/tasks/build/browser.js b/tasks/build/browser.js index f0839317d..830985f11 100644 --- a/tasks/build/browser.js +++ b/tasks/build/browser.js @@ -3,10 +3,12 @@ module.exports = (gulp) => { gulp.task('build:browser', ['clean:browser'], (done) => { const webpack = require('webpack') - const uglify = require('gulp-uglify') + const minifier = require('gulp-uglify/minifier') const util = require('gulp-util') const size = require('gulp-size') const rename = require('gulp-rename') + const uglify = require('uglify-js') + const pump = require('pump') const config = require('../../config/webpack') @@ -18,16 +20,17 @@ module.exports = (gulp) => { ) webpack(c, webpackDone(() => { - gulp.src('dist/index.js') - .pipe(uglify({ + pump([ + gulp.src('dist/index.js'), + minifier({ mangle: false - })) - .pipe(rename({ + }, uglify), + rename({ suffix: '.min' - })) - .pipe(size()) - .pipe(gulp.dest('dist')) - .once('end', done) + }), + size(), + gulp.dest('dist') + ], done) })) function webpackDone (done) {