diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9879227d40ed8..c31faaa69874a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -73,18 +73,15 @@ it can be useful to publish to a local registry. Check out [this video for a live walkthrough](https://youtu.be/Tx257WpNsxc) or follow the instructions below: -- Run `pnpm local-registry start` in Terminal 1 (keep it running) +- Run `pnpm local-registry` in Terminal 1 (keep it running) - Run `npm adduser --registry http://localhost:4873` in Terminal 2 (real credentials are not required, you just need to be logged in. You can use test/test/test@test.io.) -- Run `pnpm local-registry enable` in Terminal 2 - Run `pnpm nx-release 16.0.0 --local` in Terminal 2 - you can choose any nonexistent version number here, but it's recommended to use the next major - Run `cd ./tmp` in Terminal 2 -- Run `npx create-nx-workspace@16.0.0` in Terminal 2 +- Run `npx create-nx-workspace@17.0.0` in Terminal 2 If you have problems publishing, make sure you use Node 18 and NPM 8. -**NOTE:** After you finish with local testing don't forget to stop the local registry (e.g. closing the Terminal 1) and disabling the local registy using `pnpm local-registry disable`. Keeping local registry enabled will change your lock file resolutions to `localhost:4873` on the next `pnpm i`. You can also run `pnpm local-registry clear` to clean all packages in that local registry. - **NOTE:** To use this newly published local version, you need to make a new workspace or change all of your target packages to this new version, eg: `"nx": "^16.0.0",` and re-run `pnpm i` in your testing project. ### Publishing for Yarn 2+ (Berry) @@ -101,7 +98,7 @@ Yarn Berry operates slightly differently than Yarn Classic. In order to publish - localhost ``` -- Run `pnpm local-registry start` in Terminal 1 (keep it running) +- Run `pnpm local-registry` in Terminal 1 (keep it running) - If you are creating nx workspace outside of your nx repo, make sure to add npm registry info to your root yarnrc ( usually in ~/.yarnrc.yml). The file should look something like this: diff --git a/package.json b/package.json index b283d25b5f101..7fb45e3547ba6 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "prepublishOnly": "node ./scripts/update-package-group.js", "version": "pnpm prettier lerna.json --write", "depcheck": "ts-node -P ./scripts/tsconfig.scripts.json ./scripts/depcheck", - "local-registry": "./scripts/local-registry.sh", + "local-registry": "nx local-registry @nx/nx-source", "documentation": "ts-node -P scripts/tsconfig.scripts.json ./scripts/documentation/generators/main.ts && pnpm check-documentation-map", "submit-plugin": "node ./scripts/submit-plugin.js", "prepare": "is-ci || husky install", diff --git a/project.json b/project.json new file mode 100644 index 0000000000000..037817a6ca979 --- /dev/null +++ b/project.json @@ -0,0 +1,14 @@ +{ + "name": "@nx/nx-source", + "$schema": "node_modules/nx/schemas/project-schema.json", + "targets": { + "local-registry": { + "executor": "@nx/js:verdaccio", + "options": { + "port": 4873, + "config": ".verdaccio/config.yml", + "storage": "build/local-registry/storage" + } + } + } +} diff --git a/scripts/local-registry.sh b/scripts/local-registry.sh deleted file mode 100755 index 4d634e15a74c9..0000000000000 --- a/scripts/local-registry.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -COMMAND=$1 - -if [[ $COMMAND == "enable" ]]; then - echo "Setting registry to local registry" - echo "To Disable: pnpm local-registry disable" - npm config set registry http://localhost:4873/ --location user - yarn config set registry http://localhost:4873/ -fi - -if [[ $COMMAND == "disable" ]]; then - npm config delete registry --location user - yarn config delete registry - CURRENT_NPM_REGISTRY=$(npm config get registry --location user) - CURRENT_YARN_REGISTRY=$(yarn config get registry) - - echo "Reverting registries" - echo " > NPM: $CURRENT_NPM_REGISTRY" - echo " > YARN: $CURRENT_YARN_REIGSTRY" -fi - -if [[ $COMMAND == "clear" ]]; then - echo "Clearing Local Registry" - rm -rf ./build/local-registry/storage -fi - -if [[ $COMMAND == "start" ]]; then - echo "Starting Local Registry" - VERDACCIO_HANDLE_KILL_SIGNALS=true - pnpm verdaccio --config ./.verdaccio/config.yml -fi