8000 GitHub - alexghr/corepack.nix
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

alexghr/corepack.nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

corepack.nix

Corepack is a tool to manage Node.js package managers. This repo provide a list of Nix expressions to use it.

Enable all package managers

Install the corepack package will enable all of the Node.js package managers that Corepack knows about. These will be their respective latest version when the package was last built.

$ nix shell github:alexghr/corepack.nix
$ command -v yarn
/nix/store/2h6r0rj0rqqcpsw1zad5hm7f4fz5y075-corepack/bin/yarn
$ command -v pnpm
/nix/store/2h6r0rj0rqqcpsw1zad5hm7f4fz5y075-corepack/bin/pnpm
$ command -v pnpx
/nix/store/2h6r0rj0rqqcpsw1zad5hm7f4fz5y075-corepack/bin/pnpx

Running one-off package manager commands

This repo exports each Node.js package manager as a derivation:

$ nix run github:alexghr/corepack.nix#pnpm -- --version
8.0.0
$ nix run github:alexghr/corepack.nix#yarn -- --version
1.22.19

Use these for one-off commands that you might need to run. These are fixed versions of package managers and won't respect the packageManager field in package.json.

Update versions in gen-src.bash.

pnpx

This repo also exports the pnpx tool. You can use it to run one-off download-and-execute scripts through pnpm:

$ nix run github:alexghr/corepack.nix#pnpx -- create-react-app ./todo-mvc
Creating a new React app in ...

package.json version management

The default package observes version management through the packageManager field in package.json:

$ nix shell github:alexghr/corepack.nix
$ cat package.json
{
  "name": "test",
  "version": "1.0.0",
  "packageManager": "pnpm@7.30.3"
}
$ pnpm --version
7.30.3

These versioned package managers are stored in $COREPACK_HOME. It defaults to ~/.cache/node/corepack.

Releases

No releases published

Packages

No packages published
0