diff --git a/README.md b/README.md index 7814dd4..9f6cd5f 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,30 @@ **WORK IN PROGRESS** -Generates a Nix expression to build a Yarn v2 package. +Generates a Nix expression to build a Yarn v2 project (not using zero-install). ## Usage ```sh yarn plugin import https://raw.githubusercontent.com/stephank/yarn-plugin-nixify/main/dist/yarn-plugin-nixify.js yarn -yarn nixify nix-build ``` -The `yarn nixify` command always updates `yarn-project.nix`, but only writes a -(minimal) `default.nix` if it doesn't exist yet. The `default.nix` is intended -to be customized, for example: +Running `yarn` with this plugin enabled will generate two files: + +- `yarn-project.nix`: This file is always overwritten, and contains a basic + derivation for your project. + +- `default.nix`: Only generated if it does not exist yet. This file is intended + to be customized with any project-specific logic you need. + +When building the basic derivation without any customization, it'll run `yarn` +inside your project, copy your project to `$out/libexec/`, and setup +wrappers in `$out/bin` for any executables declared in the `bin` field of your +top-level `package.json`. + +Some examples of how to customize your build from within `default.nix`: ```nix { pkgs ? import { } }: @@ -62,4 +72,5 @@ yarn build-dev yarn plugin import /path/to/yarn-plugin-nixify/dist/yarn-plugin-nixify.dev.js ``` -(Alternatively, add a direct reference in `.yarnrc.yml`.) +(Alternatively, add a direct reference in `.yarnrc.yml`. This will likely only +work if the Nix sandbox is disabled.) diff --git a/dist/yarn-plugin-nixify.js b/dist/yarn-plugin-nixify.js index af25bcf..c305a31 100644 --- a/dist/yarn-plugin-nixify.js +++ b/dist/yarn-plugin-nixify.js @@ -1 +1 @@ -module.exports={name:"yarn-plugin-nixify",factory:function(e){return(()=>{"use strict";var n={609:(e,n,t)=>{t.r(n),t.d(n,{default:()=>P});var i,r,o,a,s,c,l,p,u,h,d=t(42),f=t(688),b=t(798),y=t(966);function m(e,n,t,i){t&&Object.defineProperty(e,n,{enumerable:t.enumerable,configurable:t.configurable,writable:t.writable,value:t.initializer?t.initializer.call(i):void 0})}function g(e,n,t,i,r){var o={};return Object.keys(i).forEach((function(e){o[e]=i[e]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=t.slice().reverse().reduce((function(t,i){return i(e,n,t)||t}),o),r&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(r):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,n,o),o=null),o}const x=["pnp","node-modules"],P={commands:[(i=d.Command.String(),r=d.Command.Path("nixify","fetch-one"),s=class extends d.Command{constructor(...e){super(...e),m(this,"locatorHash",a,this)}async execute(){const e=await y.Configuration.find(this.context.cwd,this.context.plugins),{project:n}=await y.Project.find(e,this.context.cwd),t=await y.Cache.find(e),i=e.makeFetcher();return(await y.StreamReport.start({configuration:e,stdout:this.context.stdout},async e=>{const r=n.originalPackages.get(this.locatorHash);r?await i.fetch(r,{checksums:n.storedChecksums,project:n,cache:t,fetcher:i,report:e}):e.reportError(0,"Invalid locator hash")})).exitCode()}},a=g((o=s).prototype,"locatorHash",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),g(o.prototype,"execute",[r],Object.getOwnPropertyDescriptor(o.prototype,"execute"),o.prototype),o),(c=d.Command.String(),l=d.Command.Path("nixify","install-bin"),h=class extends d.Command{constructor(...e){super(...e),m(this,"binDir",u,this)}async execute(){const e=await y.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:t}=await y.Project.find(e,this.context.cwd);await y.StreamReport.start({configuration:e,stdout:this.context.stdout},async i=>{if(!t||0===t.manifest.bin.size)return;let r=e.get("nodeLinker");x.includes(r)||(r="node-modules",i.reportWarning(0,`The nodeLinker ${r} is not supported - executables may have trouble finding dependencies`));const o=f.npath.toPortablePath(this.binDir),a=(0,b.getPnpPath)(n).main;for(const[e,i]of t.manifest.bin){const t=f.ppath.join(o,e),s=f.ppath.join(n.cwd,f.npath.toPortablePath(i));let c;switch(r){case"pnp":c="#!/bin/sh\nexec node -r '@@PNP_PATH@@' '@@SCRIPT_PATH@@' \"$@\"\n".replace("@@PNP_PATH@@",a).replace("@@SCRIPT_PATH@@",s);break;case"node-modules":c="#!/bin/sh\nexec node '@@SCRIPT_PATH@@' \"$@\"\n".replace("@@SCRIPT_PATH@@",s);break;default:throw Error("Invalid nodeLinker "+r)}f.xfs.writeFileSync(t,c),f.xfs.chmodSync(t,493)}})}},u=g((p=h).prototype,"binDir",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),g(p.prototype,"execute",[l],Object.getOwnPropertyDescriptor(p.prototype,"execute"),p.prototype),p)],hooks:{afterAllInstalled:async(e,n)=>{!1!==n.persistProject&&await(async(e,n,t)=>{const{configuration:i,cwd:r}=e,o=i.get("yarnPath"),a=i.get("cacheFolder");let s=f.ppath.relative(r,o);s.startsWith("../")&&(s=o,t.reportWarning(0,`The Yarn path ${o} is outside the project - it may not be reachable by the Nix build`));let c=f.ppath.relative(r,a);c.startsWith("../")&&(c=a,t.reportWarning(0,`The cache folder ${a} is outside the project - it may not be reachable by the Nix build`));for(const e of i.sources.values())e.startsWith("<")||f.ppath.relative(r,e).startsWith("../")&&t.reportWarning(0,`The config file ${e} is outside the project - it may not be reachable by the Nix build`);let l=[];const p=new Set(f.xfs.readdirSync(n.cwd));for(const t of e.storedPackages.values()){const i=e.storedChecksums.get(t.locatorHash);if(!i)continue;const r=n.getLocatorPath(t,i);if(!r)continue;const o=f.ppath.basename(r);if(!p.has(o))continue;const a=i.split("/").pop();l.push([`filename = ${JSON.stringify(o)};`,`sha512 = ${JSON.stringify(a)};`,`locator-hash = ${JSON.stringify(t.locatorHash)};`])}const u=e.topLevelWorkspace.manifest.name,h=u?y.structUtils.stringifyIdent(u):"workspace",d="# This file is generated by running \"yarn install\" inside your project.\n# Manual changes might be lost - proceed with caution!\n\n{ lib, coreutils, nodejs, stdenv, src ? ./. }:\n\nwith lib;\n\nlet\n\n # Variables provided by the generator.\n project-name = @@PROJECT_NAME@@;\n yarn-path = @@YARN_PATH@@;\n cache-folder = @@CACHE_FOLDER@@;\n cache-entries = @@CACHE_ENTRIES@@;\n\n # Defines the shell alias to run Yarn.\n yarn-alias = ''\n yarn() {\n CI=1 node \"$NIX_YARN_PATH\" \"$@\"\n }\n '';\n\n # Fetch a single dependency.\n fetch = { filename, sha512, locator-hash }: stdenv.mkDerivation {\n name = replaceStrings [ \"@\" ] [ \"-\" ] filename;\n buildInputs = [ nodejs ];\n builder = builtins.toFile \"builder.sh\" ''\n source $stdenv/setup\n\n # Yarn may need a writable home directory for the global cache mirror.\n # TODO: Can't disable the mirror, because it changes cache filenames.\n export HOME=\"$PWD\"\n\n # Fetch into the build directory.\n export yarn_cache_folder=\"$PWD\"\n\n # Setup to environment so we can run Yarn.\n pushd '${src}' > /dev/null\n\n export NIX_YARN_PATH=\"$(readlink -f '${yarn-path}')\"\n ${yarn-alias}\n\n # Invoke a plugin internal command to build the cache.\n yarn nixify fetch-one '${locator-hash}'\n\n popd > /dev/null\n\n # The cache file that was just fetched is our output.\n mv '${filename}' $out\n '';\n outputHashMode = \"flat\";\n outputHashAlgo = \"sha512\";\n outputHash = sha512;\n };\n\n # Shell snippet to collect all project dependencies.\n collect-cache = concatMapStrings (args: ''\n cp ${fetch args} './${args.filename}'\n '') cache-entries;\n\nin stdenv.mkDerivation {\n name = project-name;\n inherit src;\n\n # Tell node-gyp to use the provided Node.js headers for native code builds.\n npm_config_nodedir = nodejs;\n # Tell node-pre-gyp to never fetch binaries / always build from source.\n npm_config_build_from_source = \"true\";\n\n # Make sure the build uses the right Node.js version everywhere.\n buildInputs = [ coreutils nodejs ];\n\n # Define the Yarn alias in the build environment.\n postHook = yarn-alias;\n\n configurePhase = ''\n runHook preConfigure\n\n # Copy over the Yarn cache.\n # TODO: Can we do without the copy somehow? Links don't work.\n rm -fr '${cache-folder}'\n mkdir -p '${cache-folder}'\n pushd '${cache-folder}' > /dev/null\n ${collect-cache}\n popd > /dev/null\n\n # Store the absolute path to Yarn for the 'yarn' alias.\n export NIX_YARN_PATH=\"$(readlink -f '${yarn-path}')\"\n\n # Run normal Yarn install to complete dependency installation.\n yarn install --immutable --immutable-cache\n\n runHook postConfigure\n '';\n\n buildPhase = ''\n runHook preBuild\n runHook postBuild\n '';\n\n installPhase = ''\n runHook preInstall\n\n mkdir -p $out/libexec $out/bin\n\n # Move the entire project to the output directory.\n mv $PWD \"$out/libexec/$sourceRoot\"\n cd \"$out/libexec/$sourceRoot\"\n\n # Update the path to Yarn.\n export NIX_YARN_PATH=\"$(readlink -f '${yarn-path}')\"\n\n # Invoke a plugin internal command to setup binaries.\n yarn nixify install-bin $out/bin\n\n runHook postInstall\n '';\n\n passthru = {\n inherit offline-cache;\n };\n}\n".replace("@@PROJECT_NAME@@",JSON.stringify(h)).replace("@@YARN_PATH@@",JSON.stringify(s)).replace("@@CACHE_FOLDER@@",JSON.stringify(c)).replace("@@CACHE_ENTRIES@@","[\n"+[...l].map(e=>` { ${e.join(" ")} }\n`).join("")+" ]"),b=f.ppath.join(r,"yarn-project.nix");f.xfs.writeFileSync(b,d);const m=f.ppath.join(r,"default.nix");f.xfs.existsSync(m)||(f.xfs.writeFileSync(m,"# This is a minimal `default.nix` by yarn-plugin-nixify. You can customize it\n# as needed, it will not be overwritten by the plugin.\n\n{ pkgs ? import {} }:\n\npkgs.callPackage ./yarn-project.nix {}\n"),t.reportInfo(0,"A minimal default.nix was created. You may want to customize it."))})(e,n.cache,n.report)}}}},966:n=>{n.exports=e("@yarnpkg/core")},688:n=>{n.exports=e("@yarnpkg/fslib")},798:n=>{n.exports=e("@yarnpkg/plugin-pnp")},42:n=>{n.exports=e("clipanion")}},t={};function i(e){if(t[e])return t[e].exports;var r=t[e]={exports:{}};return n[e](r,r.exports,i),r.exports}return i.d=(e,n)=>{for(var t in n)i.o(n,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},i.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(609)})()}}; \ No newline at end of file +module.exports={name:"yarn-plugin-nixify",factory:function(e){return(()=>{"use strict";var t={540:(e,t,n)=>{n.r(t),n.d(t,{default:()=>j});var i,r,o,a,s,c=n(42),l=n(966);function u(e,t,n,i,r){var o={};return Object.keys(i).forEach((function(e){o[e]=i[e]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce((function(n,i){return i(e,t,n)||n}),o),r&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(r):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}let p=(i=c.Command.String(),r=c.Command.Path("nixify","fetch-one"),s=class extends c.Command{constructor(...e){var t;super(...e),(t=a)&&Object.defineProperty(this,"locatorHash",{enumerable:t.enumerable,configurable:t.configurable,writable:t.writable,value:t.initializer?t.initializer.call(this):void 0})}async execute(){const e=await l.Configuration.find(this.context.cwd,this.context.plugins),{project:t}=await l.Project.find(e,this.context.cwd),n=await l.Cache.find(e),i=e.makeFetcher();return(await l.StreamReport.start({configuration:e,stdout:this.context.stdout},async e=>{const r=t.originalPackages.get(this.locatorHash);r?await i.fetch(r,{checksums:t.storedChecksums,project:t,cache:n,fetcher:i,report:e}):e.reportError(0,"Invalid locator hash")})).exitCode()}},a=u((o=s).prototype,"locatorHash",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),u(o.prototype,"execute",[r],Object.getOwnPropertyDescriptor(o.prototype,"execute"),o.prototype),o);var d,h,f,b,m,y=n(688),g=n(417),x=n(798);function P(e,t,n,i,r){var o={};return Object.keys(i).forEach((function(e){o[e]=i[e]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce((function(n,i){return i(e,t,n)||n}),o),r&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(r):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}const v=["pnp","node-modules"];let w=(d=c.Command.String(),h=c.Command.Path("nixify","install-bin"),m=class extends c.Command{constructor(...e){var t;super(...e),(t=b)&&Object.defineProperty(this,"binDir",{enumerable:t.enumerable,configurable:t.configurable,writable:t.writable,value:t.initializer?t.initializer.call(this):void 0})}async execute(){const e=await l.Configuration.find(this.context.cwd,this.context.plugins),{project:t,workspace:n}=await l.Project.find(e,this.context.cwd);return(await l.StreamReport.start({configuration:e,stdout:this.context.stdout},async i=>{if(!n||0===n.manifest.bin.size)return;let r=e.get("nodeLinker");v.includes(r)||(r="node-modules",i.reportWarning(0,`The nodeLinker ${r} is not supported - executables may have trouble finding dependencies`));const o=y.npath.toPortablePath(this.binDir),a=(0,x.getPnpPath)(t).main;for(const[e,i]of n.manifest.bin){const n=y.ppath.join(o,e),s=y.ppath.join(t.cwd,y.npath.toPortablePath(i));let c;switch(r){case"pnp":c="#!/bin/sh\nexec node -r '@@PNP_PATH@@' '@@SCRIPT_PATH@@' \"$@\"\n".replace("@@PNP_PATH@@",a).replace("@@SCRIPT_PATH@@",s);break;case"node-modules":c="#!/bin/sh\nexec node '@@SCRIPT_PATH@@' \"$@\"\n".replace("@@SCRIPT_PATH@@",s);break;default:throw Error("Invalid nodeLinker "+r)}y.xfs.writeFileSync(n,c),y.xfs.chmodSync(n,493)}})).exitCode()}},b=P((f=m).prototype,"binDir",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),P(f.prototype,"execute",[h],Object.getOwnPropertyDescriptor(f.prototype,"execute"),f.prototype),f);const $=(e,t)=>(0,g.createHash)(e).update(t).digest(),k=(e,t,n,i="/nix/store")=>{const r=n.toString("hex"),o=$("sha256",`fixed:out:${t}:${r}:`).toString("hex"),a=(e=>{let t="",n=[...e].reverse().map(e=>e.toString(2).padStart(8,"0")).join("");for(;n;)t+="0123456789abcdfghijklmnpqrsvwxyz"[parseInt(n.slice(0,5),2)],n=n.slice(5);return t})(((e,t)=>{const n=Buffer.alloc(20);for(let t=0;t{!1!==t.persistProject&&await(async(e,t,n)=>{const{configuration:i,cwd:r}=e,o=i.get("yarnPath"),a=i.get("cacheFolder");let s=y.ppath.relative(r,o);s.startsWith("../")&&(s=o,n.reportWarning(0,`The Yarn path ${o} is outside the project - it may not be reachable by the Nix build`));let c=y.ppath.relative(r,a);c.startsWith("../")&&(c=a,n.reportWarning(0,`The cache folder ${a} is outside the project - it may not be reachable by the Nix build`));for(const e of i.sources.values())e.startsWith("<")||y.ppath.relative(r,e).startsWith("../")&&n.reportWarning(0,`The config file ${e} is outside the project - it may not be reachable by the Nix build`);let u=[];const p=new Set(y.xfs.readdirSync(t.cwd));for(const n of e.storedPackages.values()){const{version:i,locatorHash:r}=n,o=e.storedChecksums.get(r);if(!o)continue;const a=t.getLocatorPath(n,o);if(!a)continue;const s=y.ppath.basename(a);if(!p.has(s))continue;let c=l.structUtils.slugifyIdent(n).replace(/^@/,"_at_");i&&(c+="-"+i);const d=o.split("/").pop();u.push({name:c,filename:s,sha512:d,locatorHash:r})}const d=e.topLevelWorkspace.manifest.name,h=d?l.structUtils.stringifyIdent(d):"workspace",f="# This file is generated by running \"yarn install\" inside your project.\n# Manual changes might be lost - proceed with caution!\n\n{ lib, coreutils, nodejs, stdenv }: src:\n\nlet\n\n yarnPath = @@YARN_PATH@@;\n cacheFolder = @@CACHE_FOLDER@@;\n cacheEntries = @@CACHE_ENTRIES@@;\n\n # Fetch a single dependency.\n fetchOne = let\n builder = builtins.toFile \"builder.sh\" ''\n source $stdenv/setup\n cd \"$src\"\n HOME=\"$TMP\" yarn_cache_folder=\"$TMP\" CI=1 \\\n node '${yarnPath}' nixify fetch-one $locatorHash\n mv \"$TMP/$outputFilename\" $out\n '';\n in { name, filename, sha512, locatorHash }: stdenv.mkDerivation {\n inherit name src builder locatorHash;\n buildInputs = [ nodejs ];\n outputFilename = filename;\n outputHashMode = \"flat\";\n outputHashAlgo = \"sha512\";\n outputHash = sha512;\n };\n\n # Shell snippet to collect all project dependencies.\n collectCache = lib.concatMapStrings (args: ''\n cp ${fetchOne args} '${args.filename}'\n '') cacheEntries;\n\nin stdenv.mkDerivation {\n name = @@PROJECT_NAME@@;\n inherit src;\n\n # Tell node-gyp to use the provided Node.js headers for native code builds.\n npm_config_nodedir = nodejs;\n # Tell node-pre-gyp to never fetch binaries / always build from source.\n npm_config_build_from_source = \"true\";\n\n # Make sure the build uses the right Node.js version everywhere.\n buildInputs = [ nodejs ];\n\n # Defines the shell alias to run Yarn.\n postHook = ''\n yarn() {\n CI=1 node \"$NIX_YARN_PATH\" \"$@\"\n }\n '';\n\n configurePhase = ''\n runHook preConfigure\n\n # Copy over the Yarn cache.\n # TODO: Can we do without the copy somehow? Links don't work.\n rm -fr '${cacheFolder}'\n mkdir -p '${cacheFolder}'\n pushd '${cacheFolder}' > /dev/null\n ${collectCache}\n popd > /dev/null\n\n # Store the absolute path to Yarn for the 'yarn' alias.\n export NIX_YARN_PATH=\"$(readlink -f '${yarnPath}')\"\n\n # Run normal Yarn install to complete dependency installation.\n yarn install --immutable --immutable-cache\n\n runHook postConfigure\n '';\n\n buildPhase = ''\n runHook preBuild\n runHook postBuild\n '';\n\n installPhase = ''\n runHook preInstall\n\n mkdir -p $out/libexec $out/bin\n\n # Move the entire project to the output directory.\n mv $PWD \"$out/libexec/$sourceRoot\"\n cd \"$out/libexec/$sourceRoot\"\n\n # Update the path to Yarn.\n export NIX_YARN_PATH=\"$(readlink -f '${yarnPath}')\"\n\n # Invoke a plugin internal command to setup binaries.\n yarn nixify install-bin $out/bin\n\n runHook postInstall\n '';\n}\n".replace("@@PROJECT_NAME@@",JSON.stringify(h)).replace("@@YARN_PATH@@",JSON.stringify(s)).replace("@@CACHE_FOLDER@@",JSON.stringify(c)).replace("@@CACHE_ENTRIES@@","[\n"+u.map(e=>` { ${(e=>[`name = ${JSON.stringify(e.name)};`,`filename = ${JSON.stringify(e.filename)};`,`sha512 = ${JSON.stringify(e.sha512)};`,`locatorHash = ${JSON.stringify(e.locatorHash)};`].join(" "))(e)} }\n`).join("")+" ]"),b=y.ppath.join(r,"yarn-project.nix");y.xfs.writeFileSync(b,f);const m=y.ppath.join(r,"default.nix");y.xfs.existsSync(m)||(y.xfs.writeFileSync(m,"# This is a minimal `default.nix` by yarn-plugin-nixify. You can customize it\n# as needed, it will not be overwritten by the plugin.\n\n{ pkgs ? import { } }:\n\npkgs.callPackage ./yarn-project.nix { } ./.\n"),n.reportInfo(0,"A minimal default.nix was created. You may want to customize it.")),y.xfs.existsSync(y.npath.toPortablePath("/nix/store"))&&y.xfs.mktempPromise(async i=>{const r=[];for(const{name:e,filename:n,sha512:o}of u){const a=Buffer.from(o,"hex"),s=k(e,"sha512",a);if(!y.xfs.existsSync(s)){const o=y.ppath.join(t.cwd,n),a=y.ppath.join(i,e);await y.xfs.copyFilePromise(o,a),r.push(a)}}try{const t=r.length;for(;0!==r.length;){const t=r.splice(0,100);await l.execUtils.execvp("nix-store",["--add-fixed","sha512",...t],{cwd:e.cwd,strict:!0})}0!==t&&n.reportInfo(0,`Preloaded ${t} packages into the Nix store`)}catch(e){if("ENOENT"!==e.code)throw e}})})(e,t.cache,t.report)}}}},966:t=>{t.exports=e("@yarnpkg/core")},688:t=>{t.exports=e("@yarnpkg/fslib")},798:t=>{t.exports=e("@yarnpkg/plugin-pnp")},42:t=>{t.exports=e("clipanion")},417:t=>{t.exports=e("crypto")}},n={};function i(e){if(n[e])return n[e].exports;var r=n[e]={exports:{}};return t[e](r,r.exports,i),r.exports}return i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(540)})()}}; \ No newline at end of file diff --git a/src/generate.ts b/src/generate.ts index f9b256a..616d5ee 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -34,6 +34,7 @@ export default async (project: Project, cache: Cache, report: Report) => { const yarnPathAbs = configuration.get(`yarnPath`); const cacheFolderAbs = configuration.get(`cacheFolder`); + // Sanity checks. let yarnPath = ppath.relative(cwd, yarnPathAbs); if (yarnPath.startsWith(`../`)) { yarnPath = yarnPathAbs;