Resolve values of package.json scripts Follow
Answered
I'm implementing the new `terminal.shellCommandHandler` extention in my plugin and at the moment I'm only able to detect commands directly referencing what I want to offer a smart handler for. IE: `stryker run` and `npx stryker run`. What I'd like to do is be able to scan the package.json scripts to see if there's an alias to `stryker run` somewhere. For example, if there's a script `"test:mutation": "stryker run"` in the package.json, I'd like to be able to detect that and offer a match if a user starts typing in `npm run test:mutation` or `yarn test:mutation`.
I can't find a method like this in the NpmUtils class, is there a way to do this?
Please sign in to leave a comment.
You can list all available tasks in the given package.json file using
Using
You can access the JsonProperty holding the script value. A specific string is available in