forked from pluralsight/classic-design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (48 loc) · 1.43 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const argv = require('yargs').argv
const bump = require('gulp-bump')
const gulp = require('gulp')
const octo = require('@octopusdeploy/gulp-octo')
const path = require('path')
function verifyApp() {
if (!argv.app || !argv.pkgVersion) {
throw new Error(
'So which app and version did you want to publish then? Set with --app {name} --pkgVersion {semVer}'
)
}
}
gulp.task('bump', () => {
verifyApp()
return gulp
.src(`${argv.app}/package.json`)
.pipe(bump({ version: argv.pkgVersion }))
.pipe(gulp.dest(argv.app))
})
gulp.task('octopus-publish', ['bump'], () => {
verifyApp()
if (!argv.host || !argv.apiKey) {
throw new Error('Forgot to include --host or --apiKey')
}
const pkg = [
`packages/${argv.app}/dist/**/*`,
`packages/${argv.app}/src/**/*`,
`packages/${argv.app}/build/**/*`,
`packages/${argv.app}/node_modules/**/*`,
`packages/${argv.app}/.env.example`,
`packages/${argv.app}/.babelrc`,
`packages/${argv.app}/.flowconfig`,
`packages/${argv.app}/next.config.js`,
`packages/${argv.app}/package-lock.json`,
`packages/${argv.app}/package.json`,
'!**/__specs__/**/*',
'!**/test/**/*'
]
return gulp
.src(pkg, {
base: path.join('packages', argv.app),
nodir: true
})
.pipe(
octo.pack({ id: 'design-system-' + argv.app, version: argv.pkgVersion })
)
.pipe(octo.push({ apiKey: argv.apiKey, host: argv.host, replace: true }))
})