@@ -17,26 +17,28 @@ if (!semver.satisfies(process.versions.node, '>= 10.12.0')) {
17
17
18
18
commander
19
19
. requiredOption ( '-T, --tag <tag>' , 'NPM published tag' )
20
- . arguments ( '<dist_tar_file >' )
20
+ . arguments ( '<artifact_zip_file >' )
21
21
. option ( '--dry-run' , 'Dry run mode for npm publish' )
22
22
. parse ( process . argv ) ;
23
23
24
- const distTarFile = verifyFile ( commander . args [ 0 ] , '<dist_tar_file >' ) ;
24
+ const artifactZipFile = verifyFile ( commander . args [ 0 ] , '<artifact_zip_file >' ) ;
25
25
const rootDir = path . dirname ( __dirname ) ;
26
26
const workDir = path . join ( rootDir , 'build' , 'publish' ) ;
27
27
const distDir = path . join ( rootDir , 'dist' ) ;
28
- if ( ! fs . existsSync ( workDir ) ) {
29
- fs . mkdirSync ( workDir , { recursive : true } ) ;
28
+ if ( fs . existsSync ( workDir ) ) {
29
+ rimraf . sync ( workDir ) ;
30
30
}
31
+ fs . mkdirSync ( workDir , { recursive : true } ) ;
32
+
33
+ child_process . execFileSync ( 'unzip' , [ artifactZipFile , '-d' , workDir ] ) ;
31
34
32
35
// Publish standard package
33
36
console . log ( '\n\n========== Publish standard package ==========' ) ;
34
37
createPatchedContext ( rootDir , '' , ( ) => {
35
38
if ( fs . existsSync ( distDir ) ) {
36
39
rimraf . sync ( distDir ) ;
37
40
}
38
- child_process . execFileSync ( 'tar' , [ '-xf' , distTarFile , '-C' , workDir ] ) ;
39
- fs . renameSync ( path . join ( workDir , 'dist' ) , distDir ) ;
41
+ fs . renameSync ( path . join ( workDir , 'archive' , 'dist' ) , distDir ) ;
40
42
const publishArgs = [ 'publish' , '--tag' , commander . tag ] ;
41
43
if ( commander . dryRun ) {
42
44
publishArgs . push ( '--dry-run' ) ;
@@ -47,14 +49,13 @@ createPatchedContext(rootDir, '', () => {
47
49
// Publish unstripped package
48
50
// 1. Add suffix in version, e.g. 245459.0.0-unstripped
49
51
// 2. Add suffix in tag, e.g. latest-unstripped
50
- // 3. Get unstripped distribution from dist.unstripped/ in CI dist.tgz
52
+ // 3. Get unstripped distribution from dist.unstripped/ in CI archive.zip
51
53
console . log ( '\n\n========== Publish unstripped package ==========' ) ;
52
54
createPatchedContext ( rootDir , 'unstripped' , ( ) => {
53
55
if ( fs . existsSync ( distDir ) ) {
54
56
rimraf . sync ( distDir ) ;
55
57
}
56
- child_process . execFileSync ( 'tar' , [ '-xf' , distTarFile , '-C' , workDir ] ) ;
57
- fs . renameSync ( path . join ( workDir , 'dist.unstripped' ) , distDir ) ;
58
+ fs . renameSync ( path . join ( workDir , 'archive' , 'dist.unstripped' ) , distDir ) ;
58
59
const publishArgs = [ 'publish' , '--tag' , `${ commander . tag } -unstripped` ] ;
59
60
if ( commander . dryRun ) {
60
61
publishArgs . push ( '--dry-run' ) ;
0 commit comments