From 97189905ea2ad194be5ebbf2b228fa6acef2a1c0 Mon Sep 17 00:00:00 2001 From: Steve Storey Date: Wed, 12 Jun 2024 22:06:00 +0100 Subject: [PATCH] Update the README with the details of how to use corepack. --- README.md | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/README.md b/README.md index 51cfba12..cec10f28 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,11 @@ to see how it should be set up: https://github.com/eirslett/frontend-maven-plugi - [Installing node and npm](#installing-node-and-npm) - [Installing node and yarn](#installing-node-and-yarn) + - [Installing node and corepack](#installing-node-and-corepack) - Running - [npm](#running-npm) - [yarn](#running-yarn) + - [corepack](#running-corepack) - [bower](#running-bower) - [grunt](#running-grunt) - [gulp](#running-gulp) @@ -171,6 +173,45 @@ https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plu ``` +### Installing node and corepack + +You can choose to let corepack manage the package manager version in use. Node is +downloaded from `https://nodejs.org/dist`, and corepack currently comes from +`https://repository.npmjs.org`, extracted and put into a `node` folder created +in your installation directory. + +Node/corepack and any package managers will only be "installed" locally to your project. +It will not be installed globally on the whole system (and it will not interfere with any +Node/corepack installations already present). + +Have a look at the example `POM` to see how it should be set up with corepack: +https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plugin/src/it/corepack-integration/pom.xml + + +```xml + + ... + + + install-node-and-corepack + + install-node-and-corepack + + + generate-resources + + + v20.12.2 + v0.25.2 + + + http://myproxy.example.org/nodejs/ + + http://myproxy.example.org/corepack/ + + +``` + ### Running npm All node packaged modules will be installed in the `node_modules` folder in your [working directory](#working-directory). @@ -274,6 +315,55 @@ Also you can set a registry using a tag `npmRegistryURL` ``` +### Running corepack + +If your `packageManager` specifies `yarn`, then you'll want to have something like: + + +```xml + + install + + corepack + + + yarn install + + + + build + + corepack + + + yarn build + + +``` + +and if you're using `pnpm` instead, you'll want something like + +```xml + + install + + corepack + + + pnpm install + + + + build + + corepack + + + pnpm build + + +``` + ### Running bower All bower dependencies will be installed in the `bower_components` folder in your working directory.