Skip to content

Commit

Permalink
fix: Better env specific tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Apr 25, 2016
1 parent 941141f commit 1f26923
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 20 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,23 @@ $ gulp build

```bash
# Major release
$ gulp release major
$ aegir-release major
$ gulp release --type major
$ aegir-release --type major
# Minor relase
$ gulp release minor
$ aegir-release minor
$ gulp release --type minor
$ aegir-release --type minor
# Patch release
$ gulp release
$ aegir-release
```

You can also specify a `--env` for a release, which can be either
`'node'`, `'browser'` or `'no-build'`.

```bash
$ aegir-release --env node
$ gulp release --env node
```

## Other Notes

Expand Down
11 changes: 1 addition & 10 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,8 @@
'use strict'

const gulp = require('gulp')
const args = require('args-parser')(process.argv)

require('../src/gulp-log')(gulp)
require('../gulp')(gulp)

if (args.browser) {
gulp.start('release:browser')
} else if (args.node) {
gulp.start('release:node')
} else if (args['no-build']) {
gulp.start('release-no-build')
} else {
gulp.start('release')
}
gulp.start('release')
15 changes: 12 additions & 3 deletions tasks/release.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
'use strict'

const $ = require('gulp-load-plugins')()
const runSequence = require('run-sequence')
const _ = require('lodash')

function getEnv () {
if (_.includes($.util.env._, 'browser')) return 'browser'
if (_.includes($.util.env._, 'node')) return 'node'
if (_.includes($.util.env._, 'no-build')) return 'no-build'
if ($.util.env.env) return $.util.env.env

return 'default'
}

module.exports = (gulp, done) => {
runSequence.use(gulp)(
'release:pre-build',
'build',
'release:post-build',
`release:${getEnv()}`,
done
)
}
10 changes: 9 additions & 1 deletion tasks/release/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
const runSequence = require('run-sequence')

module.exports = (gulp, done) => {
gulp.task('release:pre-build:browser', (done1) => {
runSequence.use(gulp)(
'lint',
'test:browser',
done1
)
})

runSequence.use(gulp)(
'release:pre-build',
'release:pre-build:browser',
'build:browser',
'release:post-build',
done
Expand Down
1 change: 1 addition & 0 deletions tasks/release/bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const _ = require('lodash')
function getType () {
if (_.includes($.util.env._, 'major')) return 'major'
if (_.includes($.util.env._, 'minor')) return 'minor'
if ($.util.env.type) return $.util.env.type

return 'patch'
}
Expand Down
1 change: 1 addition & 0 deletions tasks/release-no-build.js → tasks/release/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const runSequence = require('run-sequence')
module.exports = (gulp, done) => {
runSequence.use(gulp)(
'release:pre-build',
'build',
'release:post-build',
done
)
Expand Down
18 changes: 18 additions & 0 deletions tasks/release/no-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict'

const runSequence = require('run-sequence')

module.exports = (gulp, done) => {
gulp.task('release:pre-build:no-build', (done1) => {
runSequence.use(gulp)(
'lint',
done1
)
})

runSequence.use(gulp)(
'release:pre-build:no-build',
'release:post-build',
done
)
}
10 changes: 9 additions & 1 deletion tasks/release/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
const runSequence = require('run-sequence')

module.exports = (gulp, done) => {
gulp.task('release:pre-build:node', (done1) => {
runSequence.use(gulp)(
'lint',
'test:node',
done1
)
})

runSequence.use(gulp)(
'release:pre-build',
'release:pre-build:node',
'build:node',
'release:post-build',
done
Expand Down
2 changes: 1 addition & 1 deletion tasks/release/post-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const runSequence = require('run-sequence')

module.exports = (gulp, done) => {
runSequence.use(gulp)(
'release:bump',
'release:contributors',
'release:bump',
'release:push',
'release:publish',
done
Expand Down

0 comments on commit 1f26923

Please sign in to comment.