Add node as npm script runner (#236967)

* refactor: Separate `createScriptRunnerTask` and `createInstallationTask` from `createTask`

* feat: Add `npm.scriptRunner`

* feat: Add Node.js as script runner

* refactor: Refactor `isPrePostScript`

* refactor: Extract `get*Command`

* fix: Typo

* style: Remove no-op `catch`es

* fix: `node --run` doesn't support `--silent`

* refactor: Use `.map` in `escapeCommandLine`

* chore: Remove TODO

Upstream reviewer is ok with current state
This commit is contained in:
xymopen_Official
2025-02-08 01:26:29 +08:00
committed by GitHub
parent 5a42ab46c9
commit 6a5991cfb6
8 changed files with 223 additions and 152 deletions

View File

@@ -251,6 +251,28 @@
"default": "auto",
"description": "%config.npm.packageManager%"
},
"npm.scriptRunner": {
"scope": "resource",
"type": "string",
"enum": [
"auto",
"npm",
"yarn",
"pnpm",
"bun",
"node"
],
"enumDescriptions": [
"%config.npm.scriptRunner.auto%",
"%config.npm.scriptRunner.npm%",
"%config.npm.scriptRunner.yarn%",
"%config.npm.scriptRunner.pnpm%",
"%config.npm.scriptRunner.bun%",
"%config.npm.scriptRunner.node%"
],
"default": "auto",
"description": "%config.npm.scriptRunner%"
},
"npm.exclude": {
"type": [
"string",
@@ -341,18 +363,18 @@
}
],
"terminalQuickFixes": [
{
"id": "ms-vscode.npm-command",
"commandLineMatcher": "npm",
"commandExitResult": "error",
"outputMatcher": {
"anchor": "bottom",
"length": 8,
"lineMatcher": "Did you mean (?:this|one of these)\\?((?:\\n.+?npm .+ #.+)+)",
"offset": 2
}
{
"id": "ms-vscode.npm-command",
"commandLineMatcher": "npm",
"commandExitResult": "error",
"outputMatcher": {
"anchor": "bottom",
"length": 8,
"lineMatcher": "Did you mean (?:this|one of these)\\?((?:\\n.+?npm .+ #.+)+)",
"offset": 2
}
]
}
]
},
"repository": {
"type": "git",