Skip to content

Commit 6d4f674

Browse files
Merge pull request #65 from dignifiedquire/next
Streamline and simplify
2 parents 5273a9b + a83f8dd commit 6d4f674

File tree

12 files changed

+105
-152
lines changed

12 files changed

+105
-152
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ Your `package.json` should have the following entries.
2121

2222

2323
```json
24-
"main": "lib/index.js",
25-
"jsnext:main": "src/index.js",
24+
"main": "src/index.js",
2625
"scripts": {
2726
"lint": "aegir-lint",
2827
"release": "aegir-release",
@@ -35,13 +34,10 @@ Your `package.json` should have the following entries.
3534
}
3635
```
3736

38-
You should also add `babel-runtime` to your `dependencies` as it is required by the babelified version in `lib`.
39-
4037
## Stack Requirements
4138

4239
To bring you its many benefits, `aegir` requires
4340

44-
- [ES6 / Babel](https://github.com/babel/babel) transpilation
4541
- JS written in [Standard](https://github.com/feross/standard) style
4642
- Tests written in [Mocha](https://github.com/mochajs/mocha)
4743
- [Karma](https://github.com/karma-runner/karma) for browser tests
@@ -111,8 +107,6 @@ https://unpkg.com/<module-name>/dist/index.js
111107
https://unpkg.com/<module-name>/dist/index.min.js
112108
```
113109
114-
There is also an ES5 build that will be placed in `lib` that will be required by default from consumers using `require`.
115-
116110
You can run it using
117111
118112
```bash

config/babel.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

config/karma.conf.js

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,76 @@
11
'use strict'
22

3-
const path = require('path')
43
const webpackConfig = require('./webpack')
54
const timeout = require('./custom').timeout
65

7-
const browsers = []
6+
let concurrency = 1
7+
let reporters = ['mocha-own']
8+
9+
const launchers = {
10+
sl_chrome: {
11+
base: 'SauceLabs',
12+
browserName: 'Chrome',
13+
platform: 'Windows 10',
14+
version: '53'
15+
},
16+
sl_firefox: {
17+
base: 'SauceLabs',
18+
browserName: 'Firefox',
19+
platform: 'Windows 10',
20+
version: '48'
21+
},
22+
sl_safari: {
23+
base: 'SauceLabs',
24+
browserName: 'Safari',
25+
platform: 'OS X 10.11',
26+
version: 'latest'
27+
},
28+
sl_ie_11: {
29+
base: 'SauceLabs',
30+
browserName: 'Internet Explorer',
31+
platform: 'Windows 10',
32+
version: '11'
33+
},
34+
sl_edge: {
35+
base: 'SauceLabs',
36+
browserName: 'MicrosoftEdge',
37+
platform: 'Windows 10',
38+
version: '14.14393'
39+
},
40+
sl_android: {
41+
base: 'SauceLabs',
42+
browserName: 'Browser',
43+
deviceName: 'Android Emulator',
44+
platformName: 'Android',
45+
appiumVersion: '1.5.3',
46+
platformVersion: '5.1',
47+
deviceOrientation: 'portrait'
48+
},
49+
sl_iphone: {
50+
base: 'SauceLabs',
51+
browserName: 'Safari',
52+
deviceName: 'iPhone Simulator',
53+
platformName: 'iOS',
54+
platformVersion: '9.3',
55+
appiumVersion: '1.5.3',
56+
deviceOrientation: 'portrait'
57+
}
58+
}
59+
60+
let browsers = []
861

962
if (process.env.TRAVIS) {
10-
browsers.push('Firefox')
63+
if (process.env.SAUCE_USERNAME) {
64+
browsers = Object.keys(launchers)
65+
concurrency = 3
66+
reporters = ['progress', 'saucelabs']
67+
} else {
68+
browsers.push('Firefox')
69+
}
1170
} else {
1271
browsers.push('Chrome')
1372
}
1473

15-
if (!process.env.DEBUG && process.env.PHANTOM !== 'off') {
16-
browsers.push('PhantomJS')
17-
}
18-
1974
module.exports = function (config) {
2075
config.set({
2176
basePath: process.cwd(),
@@ -26,7 +81,6 @@ module.exports = function (config) {
2681
}
2782
},
2883
files: [
29-
path.join(require.resolve('babel-polyfill'), '/../../dist/polyfill.js'),
3084
'test/browser.js',
3185
'test/**/*.spec.js'
3286
],
@@ -38,7 +92,7 @@ module.exports = function (config) {
3892
webpackMiddleware: {
3993
noInfo: true
4094
},
41-
reporters: ['mocha-own'],
95+
reporters: reporters,
4296
mochaOwnReporter: {
4397
reporter: 'spec'
4498
},
@@ -47,8 +101,9 @@ module.exports = function (config) {
47101
logLevel: process.env.DEBUG ? config.LOG_DEBUG : config.LOG_INFO,
48102
autoWatch: false,
49103
browsers: browsers,
104+
customLaunchers: launchers,
50105
singleRun: false,
51-
concurrency: 1,
106+
concurrency: concurrency,
52107
browserNoActivityTimeout: timeout,
53108
failOnEmptyTestSuite: false
54109
})

config/webpack.js

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
'use strict'
22

3-
const webpack = require('webpack')
43
const path = require('path')
54
const upperFirst = require('lodash.upperfirst')
65
const camelCase = require('lodash.camelcase')
76
const merge = require('webpack-merge')
7+
const webpack = require('webpack')
88

99
const pkg = require(path.resolve('package.json'))
1010
let customConfig = {}
1111
try {
1212
customConfig = require(path.resolve('.aegir.js'))
1313
} catch (err) {
1414
}
15-
const babel = require('./babel')
1615

1716
// e.g. peer-id -> PeerId
1817
const libraryName = upperFirst(camelCase(pkg.name))
@@ -32,7 +31,6 @@ const specific = merge(custom1, custom2)
3231

3332
const shared = {
3433
entry: [
35-
require.resolve('babel-polyfill'),
3634
path.resolve('src/index.js')
3735
],
3836
output: {
@@ -44,11 +42,7 @@ const shared = {
4442
modules: [
4543
'node_modules',
4644
path.resolve(__dirname, '../node_modules')
47-
],
48-
alias: {
49-
http: require.resolve('stream-http'),
50-
https: require.resolve('https-browserify')
51-
}
45+
]
5246
},
5347
resolveLoader: {
5448
modules: [
@@ -58,68 +52,15 @@ const shared = {
5852
},
5953
module: {
6054
loaders: [{
61-
test: /\.js$/,
62-
exclude: /node_modules|vendor/,
63-
loader: 'babel',
64-
query: babel
65-
}, {
66-
test: /\.js$/,
67-
include: /node_modules\/(hoek|qs|wreck|boom|ipfs|promisify-es|whatwg-fetch|node-fetch|isomorphic-fetch|db\.js)/,
68-
loader: 'babel',
69-
query: babel
70-
}, {
71-
test: /\.js$/,
72-
include: /node_modules\/cbor/,
73-
loader: 'babel',
74-
query: {
75-
plugins: [
76-
// All things supported by node >= 4.0
77-
'babel-plugin-transform-es2015-template-literals',
78-
'babel-plugin-transform-es2015-literals',
79-
'babel-plugin-transform-es2015-function-name',
80-
'babel-plugin-transform-es2015-arrow-functions',
81-
'babel-plugin-transform-es2015-block-scoped-functions',
82-
'babel-plugin-transform-es2015-classes',
83-
'babel-plugin-transform-es2015-object-super',
84-
'babel-plugin-transform-es2015-shorthand-properties',
85-
'babel-plugin-transform-es2015-duplicate-keys',
86-
'babel-plugin-transform-es2015-computed-properties',
87-
'babel-plugin-transform-es2015-for-of',
88-
// 'babel-plugin-transform-es2015-sticky-regex',
89-
// 'babel-plugin-transform-es2015-unicode-regex',
90-
'babel-plugin-check-es2015-constants',
91-
// 'babel-plugin-transform-es2015-spread',
92-
// 'babel-plugin-transform-es2015-parameters',
93-
// 'babel-plugin-transform-es2015-destructuring',
94-
'babel-plugin-transform-es2015-block-scoping',
95-
'babel-plugin-transform-es2015-typeof-symbol',
96-
// 'babel-plugin-transform-es2015-modules-commonjs',
97-
'babel-plugin-transform-regenerator'
98-
].map((p) => require.resolve(p))
99-
}
100-
}, {
10155
test: /\.json$/,
10256
loader: 'json'
103-
}, {
104-
test: /\.js$/,
105-
loader: 'transform?brfs',
106-
enforce: 'pre'
10757
}]
10858
},
109-
externals: {
110-
net: '{}',
111-
fs: '{}',
112-
tls: '{}',
113-
console: '{}',
114-
'require-dir': '{}',
115-
ursa: '{}'
116-
},
11759
node: {
11860
Buffer: true
11961
},
120-
plugins: [
121-
new webpack.DefinePlugin({'fs.writeSync': false})
122-
]
62+
plugins: [],
63+
target: 'web'
12364
}
12465

12566
const dev = merge(shared, {

package.json

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
},
1717
"keywords": [
1818
"webpack",
19-
"babel",
2019
"standard",
2120
"lint",
2221
"build"
@@ -25,25 +24,19 @@
2524
"license": "MIT",
2625
"dependencies": {
2726
"args-parser": "^1.0.2",
28-
"babel-core": "^6.14.0",
29-
"babel-loader": "^6.2.5",
30-
"babel-polyfill": "^6.13.0",
31-
"babel-preset-es2015": "^6.14.0",
32-
"brfs": "^1.4.3",
3327
"chalk": "^1.1.3",
3428
"conventional-github-releaser": "^1.1.3",
3529
"coveralls": "^2.11.14",
36-
"eslint": "^3.6.0",
37-
"eslint-config-standard": "^6.1.0",
38-
"eslint-plugin-promise": "^3.0.0",
39-
"eslint-plugin-standard": "^2.0.0",
30+
"eslint": "^3.8.1",
31+
"eslint-config-standard": "^6.2.1",
32+
"eslint-plugin-promise": "^3.3.0",
33+
"eslint-plugin-standard": "^2.0.1",
4034
"gulp": "^3.9.1",
41-
"gulp-babel": "^6.1.2",
4235
"gulp-bump": "^2.4.0",
4336
"gulp-conventional-changelog": "^1.1.0",
4437
"gulp-eslint": "^3.0.1",
4538
"gulp-filter": "^4.0.0",
46-
"gulp-git": "^1.11.3",
39+
"gulp-git": "^1.12.0",
4740
"gulp-mocha": "^3.0.1",
4841
"gulp-rename": "^1.2.2",
4942
"gulp-size": "^2.1.0",
@@ -57,32 +50,33 @@
5750
"karma": "^1.3.0",
5851
"karma-chrome-launcher": "^2.0.0",
5952
"karma-firefox-launcher": "^1.0.0",
60-
"karma-mocha": "^1.1.1",
53+
"karma-mocha": "^1.2.0",
6154
"karma-mocha-own-reporter": "^1.1.2",
62-
"karma-phantomjs-launcher": "^1.0.2",
55+
"karma-sauce-launcher": "^1.1.0",
6356
"karma-sourcemap-loader": "^0.3.7",
6457
"karma-webpack": "^1.8.0",
6558
"lodash.camelcase": "^4.3.0",
6659
"lodash.includes": "^4.3.0",
6760
"lodash.upperfirst": "^4.3.1",
68-
"mocha": "^3.0.2",
69-
"phantomjs-prebuilt": "^2.1.12",
61+
"mocha": "^3.1.2",
7062
"pretty-hrtime": "^1.0.2",
63+
"pump": "^1.0.1",
7164
"rimraf": "^2.5.4",
7265
"run-sequence": "^1.2.2",
7366
"semver": "^5.3.0",
7467
"signal-exit": "^3.0.1",
7568
"stream-http": "^2.4.0",
7669
"transform-loader": "^0.2.3",
70+
"uglify-js": "github:mishoo/UglifyJS2#harmony",
7771
"webpack": "^2.1.0-beta.25",
78-
"webpack-merge": "^0.14.1"
72+
"webpack-merge": "^0.15.0"
7973
},
8074
"repository": {
8175
"type": "git",
8276
"url": "https://github.com/dignifiedquire/aegir"
8377
},
8478
"engines": {
85-
"node": ">=4.2.2"
79+
"node": ">=4.0.0"
8680
},
8781
"contributors": [
8882
"David Dias <[email protected]>",
@@ -92,4 +86,4 @@
9286
"Stephen Whitmore <[email protected]>",
9387
"npmcdn-to-unpkg-bot <[email protected]>"
9488
]
95-
}
89+
}

tasks/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ module.exports = (gulp) => {
55
require('./build/browser')(gulp)
66
require('./clean')(gulp)
77

8-
gulp.task('build', ['build:browser', 'build:node'])
8+
gulp.task('build', ['build:browser'])
99
}

tasks/build/browser.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
module.exports = (gulp) => {
44
gulp.task('build:browser', ['clean:browser'], (done) => {
55
const webpack = require('webpack')
6-
const uglify = require('gulp-uglify')
6+
const minifier = require('gulp-uglify/minifier')
77
const util = require('gulp-util')
88
const size = require('gulp-size')
99
const rename = require('gulp-rename')
10+
const uglify = require('uglify-js')
11+
const pump = require('pump')
1012

1113
const config = require('../../config/webpack')
1214

@@ -18,16 +20,17 @@ module.exports = (gulp) => {
1820
)
1921

2022
webpack(c, webpackDone(() => {
21-
gulp.src('dist/index.js')
22-
.pipe(uglify({
23+
pump([
24+
gulp.src('dist/index.js'),
25+
minifier({
2326
mangle: false
24-
}))
25-
.pipe(rename({
27+
}, uglify),
28+
rename({
2629
suffix: '.min'
27-
}))
28-
.pipe(size())
29-
.pipe(gulp.dest('dist'))
30-
.once('end', done)
30+
}),
31+
size(),
32+
gulp.dest('dist')
33+
], done)
3134
}))
3235

3336
function webpackDone (done) {

0 commit comments

Comments
 (0)