Skip to content

Commit c504e99

Browse files
l0lawrenceCopilot
andcommitted
Drop unused yarn handling from command runner
No emitter target uses yarn; the presets and docs are all npm/pnpm. Remove yarn from the package-manager passthrough-separator check and the Windows shell-shim regex. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 4549bda commit c504e99

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

eng/emitter-diff/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function tokenizeCommand(command: string): string[] {
132132
/**
133133
* Build the full argv (command args + passthrough) for a regenerate command.
134134
*
135-
* `npm`/`pnpm`/`yarn run <script>` swallow subsequent flags as their own config
135+
* `npm`/`pnpm run <script>` swallow subsequent flags as their own config
136136
* unless a `--` separator forwards them to the script (e.g. `npm run regenerate
137137
* -- --name foo`). When the command is such a package-manager `run` invocation
138138
* and the user supplied passthrough args, insert that `--` automatically so
@@ -143,7 +143,7 @@ function buildRegenerateArgs(commandArgv: string[], passthrough: string[]): stri
143143
if (passthrough.length === 0) return base;
144144

145145
const bin = (commandArgv[0] ?? "").toLowerCase().replace(/\.(cmd|exe|ps1)$/, "");
146-
const isPm = bin === "npm" || bin === "pnpm" || bin === "yarn";
146+
const isPm = bin === "npm" || bin === "pnpm";
147147
// Locate the actual run subcommand (npm also spells it `run-script`).
148148
const runIndex = isPm ? base.findIndex((a) => a === "run" || a === "run-script") : -1;
149149
// A `--` only separates script args when it comes after that subcommand.

eng/emitter-diff/src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ export interface RunOptions {
6565
*/
6666
export function run(cmd: string, args: string[], opts: RunOptions = {}): Promise<RunResult> {
6767
return new Promise((resolve, reject) => {
68-
// Only route through a shell for Windows .cmd shims (npm/pnpm/npx/code/yarn).
68+
// Only route through a shell for Windows .cmd shims (npm/pnpm/npx/code).
6969
// Native binaries like git/node are spawned directly to avoid the shell
7070
// argument-escaping deprecation and quoting pitfalls.
71-
const needsShell = process.platform === "win32" && /^(npm|pnpm|npx|yarn|code)$/.test(cmd);
71+
const needsShell = process.platform === "win32" && /^(npm|pnpm|npx|code)$/.test(cmd);
7272
const spawnOpts: SpawnOptions = {
7373
cwd: opts.cwd,
7474
env: opts.env ?? process.env,

0 commit comments

Comments
 (0)