@@ -5,6 +5,7 @@ const fs = require('fs-extra')
55const { obj : map } = require ( 'through2' )
66const Octokit = require ( '@octokit/rest' )
77const path = require ( 'path' )
8+ const vfs = require ( 'vinyl-fs' )
89const zip = require ( 'gulp-vinyl-zip' )
910
1011function getNextReleaseNumber ( { octokit, owner, repo, variant } ) {
@@ -35,23 +36,21 @@ function collectReleases ({ octokit, owner, repo, filter, page = 1, accum = [] }
3536
3637function 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 )
0 commit comments