@@ -159,10 +159,6 @@ var getCommonPackInfo = function (modOutDir) {
159
159
}
160
160
exports . getCommonPackInfo = getCommonPackInfo ;
161
161
162
- /**
163
- * Performs npm audit on the specified task path.
164
- * @param {string } taskPath - The path to the task directory where npm audit should be performed.
165
- */
166
162
function performNpmAudit ( taskPath ) {
167
163
console . log ( '\n🛫 Running npm audit...' ) ;
168
164
@@ -183,12 +179,12 @@ function performNpmAudit(taskPath) {
183
179
shell : true
184
180
} ) ;
185
181
186
- if ( auditResult . status ) {
182
+ if ( auditResult . error ) {
187
183
console . log ( `\x1b[A\x1b[K❌ npm audit failed because the build task at "${ taskPath } " has vulnerable dependencies.` ) ;
188
184
console . log ( '👉 Please see details by running the command' ) ;
189
185
console . log ( `\tnpm audit --prefix ${ taskPath } ` ) ;
190
186
console . log ( 'or execute the command with --BypassNpmAudit argument to skip the auditing' ) ;
191
- console . log ( `\tnode make.js build --task ${ args . task } --BypassNpmAudit` ) ;
187
+ console . log ( `\tnode make.js -- build --task ${ args . task } --BypassNpmAudit` ) ;
192
188
process . exit ( 1 ) ;
193
189
} else {
194
190
console . log ( '\x1b[A\x1b[K✅ npm audit completed successfully.' ) ;
@@ -200,24 +196,11 @@ function performNpmAudit(taskPath) {
200
196
}
201
197
}
202
198
203
- function getAdditionalTypeScriptArguments ( ) {
204
- const tsArgs = [ ] ;
205
-
206
- if ( process . argv . includes ( "--include-sourcemap" ) ) {
207
- tsArgs . push ( '--sourceMap' ) ;
208
- }
209
-
210
- return tsArgs . join ( '' ) ;
211
- }
212
-
213
199
var buildNodeTask = function ( taskPath , outDir , isServerBuild ) {
214
200
var originalDir = shell . pwd ( ) . toString ( ) ;
215
201
cd ( taskPath ) ;
216
202
var packageJsonPath = rp ( 'package.json' ) ;
217
203
var overrideTscPath ;
218
-
219
- performNpmAudit ( taskPath ) ;
220
-
221
204
if ( test ( '-f' , packageJsonPath ) ) {
222
205
// verify no dev dependencies
223
206
// we allow only two dev dependencies: typescript and @tsconfig /node10
@@ -250,14 +233,16 @@ var buildNodeTask = function (taskPath, outDir, isServerBuild) {
250
233
cd ( taskPath ) ;
251
234
}
252
235
236
+ performNpmAudit ( taskPath ) ;
237
+
253
238
// Use the tsc version supplied by the task if it is available, otherwise use the global default.
254
239
if ( overrideTscPath ) {
255
240
var tscExec = path . join ( overrideTscPath , "bin" , "tsc" ) ;
256
- run ( ` node ${ tscExec } --outDir "${ outDir } " --rootDir "${ taskPath } " ${ getAdditionalTypeScriptArguments ( ) } ` ) ;
241
+ run ( " node " + tscExec + ' --outDir "' + outDir + ' " --rootDir "' + taskPath + '"' ) ;
257
242
// Don't include typescript in node_modules
258
243
rm ( "-rf" , overrideTscPath ) ;
259
244
} else {
260
- run ( ` tsc --outDir "${ outDir } " --rootDir "${ taskPath } " ${ getAdditionalTypeScriptArguments ( ) } ` ) ;
245
+ run ( ' tsc --outDir "' + outDir + ' " --rootDir "' + taskPath + '"' ) ;
261
246
}
262
247
263
248
cd ( originalDir ) ;
0 commit comments