Merge pull request #94 from the-sun-will-rise-tomorrow/fix-nix-yarn
src/generate.ts: Undo Nix shebang patching
This commit is contained in:
+7
-3
@@ -59,9 +59,13 @@ export default async (
|
|||||||
let yarnBinExpr: string;
|
let yarnBinExpr: string;
|
||||||
if (yarnPathAbs === null) {
|
if (yarnPathAbs === null) {
|
||||||
// Assume the current running script is the correct Yarn.
|
// Assume the current running script is the correct Yarn.
|
||||||
const sha512 = await hashUtils.checksumFile(
|
let text = (await xfs.readFilePromise(process.argv[1] as PortablePath)).toString();
|
||||||
process.argv[1] as PortablePath,
|
// If yarn was installed via Nix, revert shebang patching to get correct checksum
|
||||||
);
|
if (text.startsWith("#!/nix/store/")) {
|
||||||
|
const code = text.substring(text.indexOf("\n") + 1);
|
||||||
|
text = `#!/usr/bin/env node\n${code}`;
|
||||||
|
}
|
||||||
|
const sha512 = hashUtils.makeHash(Buffer.from(text));
|
||||||
yarnBinExpr = [
|
yarnBinExpr = [
|
||||||
"fetchurl {",
|
"fetchurl {",
|
||||||
` url = "https://repo.yarnpkg.com/${YarnVersion!}/packages/yarnpkg-cli/bin/yarn.js";`,
|
` url = "https://repo.yarnpkg.com/${YarnVersion!}/packages/yarnpkg-cli/bin/yarn.js";`,
|
||||||
|
|||||||
Reference in New Issue
Block a user