File tree Expand file tree Collapse file tree 2 files changed +8
-39
lines changed
Expand file tree Collapse file tree 2 files changed +8
-39
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -370,28 +370,31 @@ function escapeRegex(str) {
370370function getCommandPattern ( action ) {
371371 const patterns = [ ] ;
372372
373- if ( action === 'dev' ) {
373+ // Trim spaces from action to handle leading/trailing whitespace gracefully
374+ const trimmedAction = action . trim ( ) ;
375+
376+ if ( trimmedAction === 'dev' ) {
374377 patterns . push (
375378 'npm run dev' ,
376379 'pnpm( run)? dev' ,
377380 'yarn dev' ,
378381 'bun run dev'
379382 ) ;
380- } else if ( action === 'install' ) {
383+ } else if ( trimmedAction === 'install' ) {
381384 patterns . push (
382385 'npm install' ,
383386 'pnpm install' ,
384387 'yarn( install)?' ,
385388 'bun install'
386389 ) ;
387- } else if ( action === 'test' ) {
390+ } else if ( trimmedAction === 'test' ) {
388391 patterns . push (
389392 'npm test' ,
390393 'pnpm test' ,
391394 'yarn test' ,
392395 'bun test'
393396 ) ;
394- } else if ( action === 'build' ) {
397+ } else if ( trimmedAction === 'build' ) {
395398 patterns . push (
396399 'npm run build' ,
397400 'pnpm( run)? build' ,
@@ -400,7 +403,7 @@ function getCommandPattern(action) {
400403 ) ;
401404 } else {
402405 // Generic run command — escape regex metacharacters in action
403- const escaped = escapeRegex ( action ) ;
406+ const escaped = escapeRegex ( trimmedAction ) ;
404407 patterns . push (
405408 `npm run ${ escaped } ` ,
406409 `pnpm( run)? ${ escaped } ` ,
You can’t perform that action at this time.
0 commit comments