Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions packages/vinext/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,11 @@ async function buildApp() {
const installCmd = detectPackageManager(process.cwd()).replace(/ -D$/, "");
const [pm, ...pmArgs] = installCmd.split(" ");
console.log(" Upgrading React for RSC compatibility...");
execFileSync(pm, [...pmArgs, ...reactUpgrade], { cwd: process.cwd(), stdio: "inherit" });
execFileSync(pm, [...pmArgs, ...reactUpgrade], {
cwd: process.cwd(),
stdio: "inherit",
shell: process.platform === "win32",
});
}
}

Expand Down Expand Up @@ -567,13 +571,25 @@ async function lint() {
try {
if (hasEslint && hasNextLintConfig) {
console.log(" Using eslint (with existing config)\n");
execFileSync("npx", ["eslint", "."], { cwd, stdio: "inherit" });
execFileSync("npx", ["eslint", "."], {
cwd,
stdio: "inherit",
shell: process.platform === "win32",
});
} else if (hasOxlint) {
console.log(" Using oxlint\n");
execFileSync("npx", ["oxlint", "."], { cwd, stdio: "inherit" });
execFileSync("npx", ["oxlint", "."], {
cwd,
stdio: "inherit",
shell: process.platform === "win32",
});
} else if (hasEslint) {
console.log(" Using eslint\n");
execFileSync("npx", ["eslint", "."], { cwd, stdio: "inherit" });
execFileSync("npx", ["eslint", "."], {
cwd,
stdio: "inherit",
shell: process.platform === "win32",
});
} else {
console.log(
" No linter found. Install eslint or oxlint:\n\n" +
Expand Down
11 changes: 10 additions & 1 deletion packages/vinext/src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ function installDeps(root: string, deps: MissingDep[]): void {
execFileSync(pm, [...pmArgs, ...depSpecs], {
cwd: root,
stdio: "inherit",
shell: process.platform === "win32",
});
}

Expand Down Expand Up @@ -1210,6 +1211,10 @@ function runWranglerDeploy(root: string, options: Pick<DeployOptions, "preview"
cwd: root,
stdio: "pipe",
encoding: "utf-8",
// On Windows, .bin/wrangler is a .cmd wrapper; execFileSync can't run
// it without a shell. Enabling shell only on win32 keeps the
// no-shell-injection guarantee on other platforms.
shell: process.platform === "win32",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice — the comment here is clear and well-scoped. Just noting that the other comment a few lines below (line 1228: "Use execFileSync to avoid shell injection") is now slightly inaccurate on Windows. Consider updating that one too to acknowledge the platform split, since both comments describe the same call site.

};

const { args, env } = buildWranglerDeployArgs(options);
Expand Down Expand Up @@ -1275,7 +1280,11 @@ export async function deploy(options: DeployOptions): Promise<void> {
console.log(
` Upgrading ${reactUpgrade.map((d) => d.replace(/@latest$/, "")).join(", ")}...`,
);
execFileSync(pm, [...pmArgs, ...reactUpgrade], { cwd: root, stdio: "inherit" });
execFileSync(pm, [...pmArgs, ...reactUpgrade], {
cwd: root,
stdio: "inherit",
shell: process.platform === "win32",
});
}
}
const missingDeps = getMissingDeps(info);
Expand Down
Loading