@@ -145,14 +145,10 @@ function tag() {
145145 execSync ( `git config --global user.name ${ process . env . GITHUB_USER_NAME } ` ) ;
146146 execSync ( `git tag ${ version } ` ) ;
147147 execSync (
148- `git push https://${
149- process . env . GITHUB_TOKEN
150- } @github.com/vueComponent/ant-design-vue.git ${ version } :${ version } `,
148+ `git push https://${ process . env . GITHUB_TOKEN } @github.com/vueComponent/ant-design-vue.git ${ version } :${ version } ` ,
151149 ) ;
152150 execSync (
153- `git push https://${
154- process . env . GITHUB_TOKEN
155- } @github.com/vueComponent/ant-design-vue.git master:master`,
151+ `git push https://${ process . env . GITHUB_TOKEN } @github.com/vueComponent/ant-design-vue.git master:master` ,
156152 ) ;
157153 console . log ( 'tagged' ) ;
158154}
@@ -204,24 +200,30 @@ function githubRelease(done) {
204200 } ) ;
205201}
206202
207- gulp . task ( 'tag' , done => {
208- tag ( ) ;
209- githubRelease ( done ) ;
210- } ) ;
203+ gulp . task (
204+ 'tag' ,
205+ gulp . series ( done => {
206+ tag ( ) ;
207+ githubRelease ( done ) ;
208+ } ) ,
209+ ) ;
211210
212- gulp . task ( 'check-git' , done => {
213- runCmd ( 'git' , [ 'status' , '--porcelain' ] , ( code , result ) => {
214- if ( / ^ \? \? / m. test ( result ) ) {
215- return done ( `There are untracked files in the working tree.\n${ result }
211+ gulp . task (
212+ 'check-git' ,
213+ gulp . series ( done => {
214+ runCmd ( 'git' , [ 'status' , '--porcelain' ] , ( code , result ) => {
215+ if ( / ^ \? \? / m. test ( result ) ) {
216+ return done ( `There are untracked files in the working tree.\n${ result }
216217 ` ) ;
217- }
218- if ( / ^ ( [ A D R M ] | [ A D R M ] ) / m. test ( result ) ) {
219- return done ( `There are uncommitted changes in the working tree.\n${ result }
218+ }
219+ if ( / ^ ( [ A D R M ] | [ A D R M ] ) / m. test ( result ) ) {
220+ return done ( `There are uncommitted changes in the working tree.\n${ result }
220221 ` ) ;
221- }
222- return done ( ) ;
223- } ) ;
224- } ) ;
222+ }
223+ return done ( ) ;
224+ } ) ;
225+ } ) ,
226+ ) ;
225227
226228function publish ( tagString , done ) {
227229 let args = [ 'publish' , '--with-antd-tools' ] ;
@@ -265,86 +267,105 @@ function pub(done) {
265267 } ) ;
266268}
267269
268- gulp . task ( 'dist' , [ 'compile' ] , done => {
269- dist ( done ) ;
270- } ) ;
271- gulp . task ( 'compile' , [ 'compile-with-es' ] , done => {
272- compile ( ) . on ( 'finish' , function ( ) {
273- done ( ) ;
274- } ) ;
275- } ) ;
276- gulp . task ( 'compile-with-es' , done => {
277- compile ( false ) . on ( 'finish' , function ( ) {
278- done ( ) ;
279- } ) ;
280- } ) ;
281-
282- gulp . task ( 'pub' , [ 'check-git' , 'compile' ] , done => {
283- if ( ! process . env . GITHUB_TOKEN ) {
284- console . log ( 'no GitHub token found, skip' ) ;
285- } else {
286- pub ( done ) ;
287- }
288- } ) ;
289-
290- gulp . task ( 'pub-with-ci' , done => {
291- if ( ! process . env . NPM_TOKEN ) {
292- console . log ( 'no NPM token found, skip' ) ;
293- } else {
294- const github = new GitHub ( ) ;
295- github . authenticate ( {
296- type : 'oauth' ,
297- token : process . env . GITHUB_TOKEN ,
298- } ) ;
299- const [ _ , owner , repo ] = execSync ( 'git remote get-url origin' ) // eslint-disable-line
300- . toString ( )
301- . match ( / g i t h u b .c o m [: / ] ( .+ ) \/ ( .+ ) \. g i t / ) ;
302- const getLatestRelease = github . repos . getLatestRelease ( {
303- owner,
304- repo,
305- } ) ;
306- const getCommits = github . repos . getCommits ( {
307- owner,
308- repo,
309- per_page : 1 ,
270+ gulp . task (
271+ 'compile-with-es' ,
272+ gulp . series ( done => {
273+ compile ( false ) . on ( 'finish' , function ( ) {
274+ done ( ) ;
310275 } ) ;
311- Promise . all ( [ getLatestRelease , getCommits ] ) . then ( ( [ latestRelease , commits ] ) => {
312- const preVersion = latestRelease . data . tag_name ;
313- const { version } = packageJson ;
314- const [ _ , newVersion ] = commits . data [ 0 ] . commit . message . trim ( ) . match ( / b u m p ( .+ ) / ) || [ ] ; // eslint-disable-line
315- if (
316- compareVersions ( version , preVersion ) === 1 &&
317- newVersion &&
318- newVersion . trim ( ) === version
319- ) {
320- gulp . run ( 'pub' , err => {
321- err && console . log ( 'err' , err ) ;
322- done ( ) ;
323- } ) ;
324- } else {
325- console . log ( 'donot need publish' + version ) ;
326- }
276+ } ) ,
277+ ) ;
278+
279+ gulp . task (
280+ 'compile' ,
281+ gulp . series ( 'compile-with-es' , done => {
282+ compile ( ) . on ( 'finish' , function ( ) {
283+ done ( ) ;
327284 } ) ;
328- }
329- } ) ;
285+ } ) ,
286+ ) ;
330287
331- function reportError ( ) {
332- console . log ( chalk . bgRed ( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' ) ) ;
333- console . log ( chalk . bgRed ( '!! `npm publish` is forbidden for this package. !!' ) ) ;
334- console . log ( chalk . bgRed ( '!! Use `npm run pub` instead. !!' ) ) ;
335- console . log ( chalk . bgRed ( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' ) ) ;
336- }
288+ gulp . task (
289+ 'dist' ,
290+ gulp . series ( 'compile' , done => {
291+ dist ( done ) ;
292+ } ) ,
293+ ) ;
294+
295+ gulp . task (
296+ 'pub' ,
297+ gulp . series ( 'check-git' , 'compile' , done => {
298+ if ( ! process . env . GITHUB_TOKEN ) {
299+ console . log ( 'no GitHub token found, skip' ) ;
300+ } else {
301+ pub ( done ) ;
302+ }
303+ } ) ,
304+ ) ;
305+
306+ gulp . task (
307+ 'pub-with-ci' ,
308+ gulp . series ( done => {
309+ if ( ! process . env . NPM_TOKEN ) {
310+ console . log ( 'no NPM token found, skip' ) ;
311+ } else {
312+ const github = new GitHub ( ) ;
313+ github . authenticate ( {
314+ type : 'oauth' ,
315+ token : process . env . GITHUB_TOKEN ,
316+ } ) ;
317+ const [ _ , owner , repo ] = execSync ( 'git remote get-url origin' ) // eslint-disable-line
318+ . toString ( )
319+ . match ( / g i t h u b .c o m [: / ] ( .+ ) \/ ( .+ ) \. g i t / ) ;
320+ const getLatestRelease = github . repos . getLatestRelease ( {
321+ owner,
322+ repo,
323+ } ) ;
324+ const getCommits = github . repos . getCommits ( {
325+ owner,
326+ repo,
327+ per_page : 1 ,
328+ } ) ;
329+ Promise . all ( [ getLatestRelease , getCommits ] ) . then ( ( [ latestRelease , commits ] ) => {
330+ const preVersion = latestRelease . data . tag_name ;
331+ const { version } = packageJson ;
332+ const [ _ , newVersion ] = commits . data [ 0 ] . commit . message . trim ( ) . match ( / b u m p ( .+ ) / ) || [ ] ; // eslint-disable-line
333+ if (
334+ compareVersions ( version , preVersion ) === 1 &&
335+ newVersion &&
336+ newVersion . trim ( ) === version
337+ ) {
338+ gulp . run ( 'pub' , err => {
339+ err && console . log ( 'err' , err ) ;
340+ done ( ) ;
341+ } ) ;
342+ } else {
343+ console . log ( 'donot need publish' + version ) ;
344+ }
345+ } ) ;
346+ }
347+ } ) ,
348+ ) ;
337349
338- gulp . task ( 'guard' , done => {
339- const npmArgs = getNpmArgs ( ) ;
340- if ( npmArgs ) {
341- for ( let arg = npmArgs . shift ( ) ; arg ; arg = npmArgs . shift ( ) ) {
342- if ( / ^ p u ( b ( l ( i ( s h ? ) ? ) ? ) ? ) ? $ / . test ( arg ) && npmArgs . indexOf ( '--with-antd-tools' ) < 0 ) {
343- reportError ( ) ;
344- done ( 1 ) ;
345- return ;
350+ gulp . task (
351+ 'guard' ,
352+ gulp . series ( done => {
353+ function reportError ( ) {
354+ console . log ( chalk . bgRed ( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' ) ) ;
355+ console . log ( chalk . bgRed ( '!! `npm publish` is forbidden for this package. !!' ) ) ;
356+ console . log ( chalk . bgRed ( '!! Use `npm run pub` instead. !!' ) ) ;
357+ console . log ( chalk . bgRed ( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' ) ) ;
358+ }
359+ const npmArgs = getNpmArgs ( ) ;
360+ if ( npmArgs ) {
361+ for ( let arg = npmArgs . shift ( ) ; arg ; arg = npmArgs . shift ( ) ) {
362+ if ( / ^ p u ( b ( l ( i ( s h ? ) ? ) ? ) ? ) ? $ / . test ( arg ) && npmArgs . indexOf ( '--with-antd-tools' ) < 0 ) {
363+ reportError ( ) ;
364+ done ( 1 ) ;
365+ return ;
366+ }
346367 }
347368 }
348- }
349- done ( ) ;
350- } ) ;
369+ done ( ) ;
370+ } ) ,
371+ ) ;
0 commit comments