@@ -38,6 +38,13 @@ const eslintWorker = {
38
38
filesPerWorker : 100 ,
39
39
} ;
40
40
41
+ const useNpm = Boolean ( process . env . GL_USE_NPM ) ;
42
+ if ( useNpm ) {
43
+ console . log ( 'Using npm to run scripts' ) ;
44
+ }
45
+
46
+ const pkgMgr = useNpm ? 'npm' : 'pnpm' ;
47
+
41
48
/**
42
49
* @param {{ analyzeBundle?: boolean; analyzeDeps?: boolean; esbuild?: boolean; skipLint?: boolean } | undefined } env
43
50
* @param {{ mode: 'production' | 'development' | 'none' | undefined } } argv
@@ -119,13 +126,13 @@ function getExtensionConfig(target, mode, env) {
119
126
mode !== 'production'
120
127
? undefined
121
128
: ( ) =>
122
- spawnSync ( 'pnpm' , [ 'run' , 'icons:svgo' ] , {
129
+ spawnSync ( pkgMgr , [ 'run' , 'icons:svgo' ] , {
123
130
cwd : __dirname ,
124
131
encoding : 'utf8' ,
125
132
shell : true ,
126
133
} ) ,
127
134
onComplete : ( ) =>
128
- spawnSync ( 'pnpm' , [ 'run' , 'icons:apply' ] , {
135
+ spawnSync ( pkgMgr , [ 'run' , 'icons:apply' ] , {
129
136
cwd : __dirname ,
130
137
encoding : 'utf8' ,
131
138
shell : true ,
@@ -825,7 +832,7 @@ class ContributionsPlugin extends FileGeneratorPlugin {
825
832
constructor ( ) {
826
833
super ( 'contributions' , [ path . join ( __dirname , 'contributions.json' ) ] , {
827
834
name : "'package.json' contributions" ,
828
- command : 'pnpm' ,
835
+ command : pkgMgr ,
829
836
args : [ 'run' , 'generate:contributions' ] ,
830
837
} ) ;
831
838
}
@@ -835,7 +842,7 @@ class DocsPlugin extends FileGeneratorPlugin {
835
842
constructor ( ) {
836
843
super ( 'docs' , [ path . join ( __dirname , 'src' , 'constants.telemetry.ts' ) ] , {
837
844
name : 'docs' ,
838
- command : 'pnpm' ,
845
+ command : pkgMgr ,
839
846
args : [ 'run' , 'generate:docs:telemetry' ] ,
840
847
} ) ;
841
848
}
0 commit comments