Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ Your `package.json` should have the following entries.


```json
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"main": "src/index.js",
"scripts": {
"lint": "aegir-lint",
"release": "aegir-release",
Expand All @@ -35,13 +34,10 @@ Your `package.json` should have the following entries.
}
```

You should also add `babel-runtime` to your `dependencies` as it is required by the babelified version in `lib`.

## Stack Requirements

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
Expand Down Expand Up @@ -111,8 +107,6 @@ https://unpkg.com/<module-name>/dist/index.js
https://unpkg.com/<module-name>/dist/index.min.js
```

There is also an ES5 build that will be placed in `lib` that will be required by default from consumers using `require`.

You can run it using

```bash
Expand Down
5 changes: 0 additions & 5 deletions config/babel.js

This file was deleted.

75 changes: 65 additions & 10 deletions config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,76 @@
'use strict'

const path = require('path')
const webpackConfig = require('./webpack')
const timeout = require('./custom').timeout

const browsers = []
let concurrency = 1
let reporters = ['mocha-own']

const launchers = {
sl_chrome: {
base: 'SauceLabs',
browserName: 'Chrome',
platform: 'Windows 10',
version: '53'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'Firefox',
platform: 'Windows 10',
version: '48'
},
sl_safari: {
base: 'SauceLabs',
browserName: 'Safari',
platform: 'OS X 10.11',
version: 'latest'
},
sl_ie_11: {
base: 'SauceLabs',
browserName: 'Internet Explorer',
platform: 'Windows 10',
version: '11'
},
sl_edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: '14.14393'
},
sl_android: {
base: 'SauceLabs',
browserName: 'Browser',
deviceName: 'Android Emulator',
platformName: 'Android',
appiumVersion: '1.5.3',
platformVersion: '5.1',
deviceOrientation: 'portrait'
},
sl_iphone: {
base: 'SauceLabs',
browserName: 'Safari',
deviceName: 'iPhone Simulator',
platformName: 'iOS',
platformVersion: '9.3',
appiumVersion: '1.5.3',
deviceOrientation: 'portrait'
}
}

let browsers = []

if (process.env.TRAVIS) {
browsers.push('Firefox')
if (process.env.SAUCE_USERNAME) {
browsers = Object.keys(launchers)
concurrency = 3
reporters = ['progress', 'saucelabs']
} else {
browsers.push('Firefox')
}
} else {
browsers.push('Chrome')
}

if (!process.env.DEBUG && process.env.PHANTOM !== 'off') {
browsers.push('PhantomJS')
}

module.exports = function (config) {
config.set({
basePath: process.cwd(),
Expand All @@ -26,7 +81,6 @@ module.exports = function (config) {
}
},
files: [
path.join(require.resolve('babel-polyfill'), '/../../dist/polyfill.js'),
'test/browser.js',
'test/**/*.spec.js'
],
Expand All @@ -38,7 +92,7 @@ module.exports = function (config) {
webpackMiddleware: {
noInfo: true
},
reporters: ['mocha-own'],
reporters: reporters,
mochaOwnReporter: {
reporter: 'spec'
},
Expand All @@ -47,8 +101,9 @@ module.exports = function (config) {
logLevel: process.env.DEBUG ? config.LOG_DEBUG : config.LOG_INFO,
autoWatch: false,
browsers: browsers,
customLaunchers: launchers,
singleRun: false,
concurrency: 1,
concurrency: concurrency,
browserNoActivityTimeout: timeout,
failOnEmptyTestSuite: false
})
Expand Down
67 changes: 4 additions & 63 deletions config/webpack.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
'use strict'

const webpack = require('webpack')
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 = {}
try {
customConfig = require(path.resolve('.aegir.js'))
} catch (err) {
}
const babel = require('./babel')

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

const shared = {
entry: [
require.resolve('babel-polyfill'),
path.resolve('src/index.js')
],
output: {
Expand All @@ -44,11 +42,7 @@ const shared = {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
alias: {
http: require.resolve('stream-http'),
https: require.resolve('https-browserify')
}
]
},
resolveLoader: {
modules: [
Expand All @@ -58,68 +52,15 @@ 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: /\.js$/,
include: /node_modules\/cbor/,
loader: 'babel',
query: {
plugins: [
// All things supported by node >= 4.0
'babel-plugin-transform-es2015-template-literals',
'babel-plugin-transform-es2015-literals',
'babel-plugin-transform-es2015-function-name',
'babel-plugin-transform-es2015-arrow-functions',
'babel-plugin-transform-es2015-block-scoped-functions',
'babel-plugin-transform-es2015-classes',
'babel-plugin-transform-es2015-object-super',
'babel-plugin-transform-es2015-shorthand-properties',
'babel-plugin-transform-es2015-duplicate-keys',
'babel-plugin-transform-es2015-computed-properties',
'babel-plugin-transform-es2015-for-of',
// 'babel-plugin-transform-es2015-sticky-regex',
// 'babel-plugin-transform-es2015-unicode-regex',
'babel-plugin-check-es2015-constants',
// 'babel-plugin-transform-es2015-spread',
// 'babel-plugin-transform-es2015-parameters',
// 'babel-plugin-transform-es2015-destructuring',
'babel-plugin-transform-es2015-block-scoping',
'babel-plugin-transform-es2015-typeof-symbol',
// 'babel-plugin-transform-es2015-modules-commonjs',
'babel-plugin-transform-regenerator'
].map((p) => require.resolve(p))
}
}, {
test: /\.json$/,
loader: 'json'
}, {
test: /\.js$/,
loader: 'transform?brfs',
enforce: 'pre'
}]
},
externals: {
net: '{}',
fs: '{}',
tls: '{}',
console: '{}',
'require-dir': '{}',
ursa: '{}'
},
node: {
Buffer: true
},
plugins: [
new webpack.DefinePlugin({'fs.writeSync': false})
]
plugins: [],
target: 'web'
}

const dev = merge(shared, {
Expand Down
32 changes: 13 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"keywords": [
"webpack",
"babel",
"standard",
"lint",
"build"
Expand All @@ -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",
Expand All @@ -57,32 +50,33 @@
"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-phantomjs-launcher": "^1.0.2",
"karma-sauce-launcher": "^1.1.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"lodash.camelcase": "^4.3.0",
"lodash.includes": "^4.3.0",
"lodash.upperfirst": "^4.3.1",
"mocha": "^3.0.2",
"phantomjs-prebuilt": "^2.1.12",
"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 <daviddias.p@gmail.com>",
Expand All @@ -92,4 +86,4 @@
"Stephen Whitmore <stephen.whitmore@gmail.com>",
"npmcdn-to-unpkg-bot <npmcdn-to-unpkg-bot@users.noreply.github.com>"
]
}
}
2 changes: 1 addition & 1 deletion tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module.exports = (gulp) => {
require('./build/browser')(gulp)
require('./clean')(gulp)

gulp.task('build', ['build:browser', 'build:node'])
gulp.task('build', ['build:browser'])
}
21 changes: 12 additions & 9 deletions tasks/build/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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) {
Expand Down
Loading