Skip to content

Commit 74ee046

Browse files
committed
fix release task; upgrade gulp-vinyl-zip
1 parent d15ed88 commit 74ee046

File tree

3 files changed

+13
-70
lines changed

3 files changed

+13
-70
lines changed

gulp.d/tasks/release.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const fs = require('fs-extra')
55
const { obj: map } = require('through2')
66
const Octokit = require('@octokit/rest')
77
const path = require('path')
8+
const vfs = require('vinyl-fs')
89
const zip = require('gulp-vinyl-zip')
910

1011
function getNextReleaseNumber ({ octokit, owner, repo, variant }) {
@@ -35,23 +36,21 @@ function collectReleases ({ octokit, owner, repo, filter, page = 1, accum = [] }
3536

3637
function versionBundle (bundleFile, tagName) {
3738
return new Promise((resolve, reject) =>
38-
zip
39+
vfs
3940
.src(bundleFile)
40-
.on('error', reject)
41+
.pipe(zip.src().on('error', reject))
4142
.pipe(
42-
(() => {
43-
const meta = new File({ path: 'ui.yml', contents: Buffer.from(`version: ${tagName}\n`) })
44-
const stream = map((file, _, next) => (file.path === meta.path && file !== meta ? next() : next(null, file)))
45-
stream.write(meta)
46-
return stream
47-
})()
43+
map((file, enc, next) => next(null, file), function (done) {
44+
this.push(new File({ path: 'ui.yml', contents: Buffer.from(`version: ${tagName}\n`) }))
45+
done()
46+
})
4847
)
4948
.pipe(zip.dest(bundleFile))
5049
.on('finish', () => resolve(bundleFile))
5150
)
5251
}
5352

54-
module.exports = (dest, bundleName, owner, repo, token, updateBranch) => async () => {
53+
module.exports = (dest, bundleName, owner, repo, token, updateBranch) => async (done) => {
5554
const octokit = new Octokit({ auth: `token ${token}` })
5655
let branchName = process.env.GIT_BRANCH || 'master'
5756
if (branchName.startsWith('origin/')) branchName = branchName.substr(7)

package-lock.json

Lines changed: 4 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"gulp-postcss": "~8.0",
3737
"gulp-stylelint": "~9.0",
3838
"gulp-uglify": "~3.0",
39-
"gulp-vinyl-zip": "~2.1 >=2.1.2",
39+
"gulp-vinyl-zip": "~2.2",
4040
"handlebars": "~4.4",
4141
"highlight.js": "~9.15",
4242
"jquery": "~3.4",

0 commit comments

Comments
 (0)