Docs, and rebuild dist
This commit is contained in:
@@ -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/<name>`, 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 <nixpkgs> { } }:
|
||||
@@ -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.)
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user