File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -18,28 +18,21 @@ const isCheckMode = process.argv.includes("-check");
18
18
const rootPath = path . join ( __dirname , ".." ) ;
19
19
const fileListPath = path . join ( rootPath , "packages" , "artifacts.txt" ) ;
20
20
21
- const output = spawnSync ( `npm pack --dry-run` , {
21
+ const output = spawnSync ( `npm pack --dry-run --json ` , {
22
22
cwd : rootPath ,
23
23
encoding : "utf8" ,
24
24
shell : true ,
25
- } ) . stderr ;
25
+ } ) . stdout ;
26
26
27
- let files = output
28
- . slice (
29
- output . indexOf ( "Tarball Contents" ) ,
30
- output . lastIndexOf ( "npm notice === Tarball Details ===" )
31
- )
32
- . split ( "\n" )
33
- . map ( x => x . split ( " " ) . filter ( Boolean ) )
34
- . filter ( x => x [ 0 ] === "npm" && x [ 1 ] === "notice" )
35
- . map ( x => x [ x . length - 1 ] ) ;
27
+ const [ { files } ] = JSON . parse ( output ) ;
28
+ let filePaths = files . map ( file => file . path ) ;
36
29
37
30
if ( ! isCheckMode ) {
38
- files = Array . from ( new Set ( files . concat ( getFilesAddedByCI ( ) ) ) ) ;
31
+ filePaths = Array . from ( new Set ( filePaths . concat ( getFilesAddedByCI ( ) ) ) ) ;
39
32
}
40
33
41
- files . sort ( ) ;
42
- fs . writeFileSync ( fileListPath , files . join ( "\n" ) ) ;
34
+ filePaths . sort ( ) ;
35
+ fs . writeFileSync ( fileListPath , filePaths . join ( "\n" ) ) ;
43
36
44
37
if ( isCheckMode ) {
45
38
execSync ( `git diff --exit-code ${ fileListPath } ` , { stdio : "inherit" } ) ;
You can’t perform that action at this time.
0 commit comments