File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @ast-grep/setup-lang " : patch
3+ ---
4+
5+ skip logging when running
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ interface SetupConfig {
1919 */
2020function postinstall ( config : SetupConfig ) {
2121 const dir = config . dirname
22- const prebuild = resolvePrebuild ( dir )
22+ const prebuild = resolvePrebuild ( dir , true )
2323 if ( prebuild ) {
2424 log ( 'prebuild found, do not need to build' )
2525 return
@@ -61,7 +61,7 @@ const ARCH_MAP: Record<string, string> = {
6161/**
6262 * Resolve prebuild path
6363 */
64- function resolvePrebuild ( dir : string ) {
64+ function resolvePrebuild ( dir : string , needLog = false ) {
6565 const os = PLATFORM_MAP [ process . platform ]
6666 const arch = ARCH_MAP [ process . arch ]
6767 const prebuild = path . join (
@@ -71,10 +71,14 @@ function resolvePrebuild(dir: string) {
7171 'parser.so' ,
7272 )
7373 if ( ! os || ! arch || ! fs . existsSync ( prebuild ) ) {
74- log ( `no prebuild for ${ os } ${ arch } ` )
74+ if ( needLog ) {
75+ log ( `no prebuild for ${ os } ${ arch } ` )
76+ }
7577 return undefined
7678 }
77- log ( `found prebuild for ${ os } ${ arch } ` )
79+ if ( needLog ) {
80+ log ( `found prebuild for ${ os } ${ arch } ` )
81+ }
7882 return prebuild
7983}
8084
You can’t perform that action at this time.
0 commit comments