Skip to content

Commit

Permalink
chore: fix postinstall when using tarball (#60443)
Browse files Browse the repository at this point in the history
The postinstall script was failing In the case when you download [a
zip](https://codeload.github.com/vercel/next.js/zip/refs/heads/canary)
of the repo.

This PR fixes it so that `git config` can fail silently in that case
when the repo is not using git.

- Related to nodejs/citgm#1044

Closes NEXT-2036
  • Loading branch information
styfle authored Jan 9, 2024
1 parent 51bda32 commit 1662362
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"next-no-sourcemaps": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation packages/next/dist/bin/next",
"clean-trace-jaeger": "node scripts/rm.mjs test/integration/basic/.next && TRACE_TARGET=JAEGER pnpm next build test/integration/basic",
"debug": "cross-env NEXT_TELEMETRY_DISABLED=1 node --inspect packages/next/dist/bin/next",
"postinstall": "git config index.skipHash false && node scripts/install-native.mjs",
"postinstall": "node scripts/git-configure.mjs && node scripts/install-native.mjs",
"version": "pnpm install --no-frozen-lockfile && IS_PUBLISH=yes ./scripts/check-pre-compiled.sh && git add .",
"prepare": "husky install",
"sync-react": "node ./scripts/sync-react.js",
Expand Down
12 changes: 12 additions & 0 deletions scripts/git-configure.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import execa from 'execa'

// See https://github.com/vercel/next.js/pull/47375
const { stdout, stderr } = await execa(
'git',
['config', 'index.skipHash', 'false'],
{
reject: false,
}
)

console.log(stderr + stdout)

0 comments on commit 1662362

Please sign in to comment.