Unverified Commit 41c1f870 authored by Joseph's avatar Joseph Committed by GitHub

[cna] For pnpm ignore postinstall from `sharp` and `unrs-resolver` (#83168)

Fixes: https://github.com/vercel/next.js/issues/83158

There's still two other postinstall that are ignored if you use tw and
eslint's next config (?):

```
╭ Warning ───────────────────────────────────────────────────────────────────────────────────╮
│                                                                                            │
│   Ignored build scripts: @tailwindcss/oxide, unrs-resolver.                                │
│   Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.   │
│                                                                                            │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
```

---------
Co-authored-by: 's avatarSebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
parent ba20a5e8
......@@ -319,6 +319,27 @@ export const installTemplate = async ({
packageJson.devDependencies = sorted(packageJson.devDependencies);
}
if (packageManager === "pnpm") {
const pnpmWorkspaceYaml = [
// required for v9, v10 doesn't need it anymore
"packages:",
" - .",
// v10 setting without counterpart in v9
"ignoredBuiltDependencies:",
// Sharp has prebuilt binaries for the platforms next-swc has binaries.
// If it needs to build binaries from source, next-swc wouldn't work either.
// See https://sharp.pixelplumbing.com/install/#:~:text=When%20using%20pnpm%2C%20add%20sharp%20to%20ignoredBuiltDependencies%20to%20silence%20warnings
" - sharp",
// Not needed for pnpm: https://github.com/unrs/unrs-resolver/issues/193#issuecomment-3295510146
" - unrs-resolver",
"",
].join(os.EOL);
await fs.writeFile(
path.join(root, "pnpm-workspace.yaml"),
pnpmWorkspaceYaml,
);
}
await fs.writeFile(
path.join(root, "package.json"),
JSON.stringify(packageJson, null, 2) + os.EOL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment