@@ -12,13 +12,19 @@ async function release() {
1212 spawn . sync ( 'pnpm' , [ 'up' ] , { stdio : 'inherit' } )
1313
1414 console . log ( cyan ( 'Linting staged...' ) )
15- spawn . sync ( 'npx' , [ 'lint-staged' ] , { stdio : 'inherit' } )
15+ if ( spawn . sync ( 'npx' , [ 'lint-staged' ] , { stdio : 'inherit' } ) . status === 1 ) {
16+ return
17+ }
1618
1719 console . log ( cyan ( 'Unit testing...' ) )
18- spawn . sync ( 'pnpm' , [ 'test-unit' ] , { stdio : 'inherit' } )
20+ if ( spawn . sync ( 'pnpm' , [ 'test-unit' ] , { stdio : 'inherit' } ) . status === 1 ) {
21+ return
22+ }
1923
2024 console . log ( cyan ( 'Building...' ) )
21- spawn . sync ( 'pnpm' , [ 'build' ] , { stdio : 'inherit' } )
25+ if ( spawn . sync ( 'pnpm' , [ 'build' ] , { stdio : 'inherit' } ) . status === 1 ) {
26+ return
27+ }
2228
2329 console . log ( cyan ( 'Packing...' ) )
2430 spawn . sync ( 'npm' , [ 'pack' ] , { stdio : 'inherit' } )
@@ -82,8 +88,7 @@ async function release() {
8288 fs . writeFileSync ( './package.json' , JSON . stringify ( pkg , null , 2 ) )
8389
8490 console . log ( cyan ( 'Publishing...' ) )
85- const { status } = spawn . sync ( 'npm' , [ 'publish' , '--registry=https://registry.npmjs.org' ] , { stdio : 'inherit' } )
86- if ( status === 1 ) {
91+ if ( spawn . sync ( 'npm' , [ 'publish' , '--registry=https://registry.npmjs.org' ] , { stdio : 'inherit' } ) . status === 1 ) {
8792 // 恢复版本号
8893 pkg . version = currentVersion
8994 fs . writeFileSync ( './package.json' , JSON . stringify ( pkg , null , 2 ) )
0 commit comments