From f476e30fa2a16776d10ab04e5297f758ee381b5a Mon Sep 17 00:00:00 2001 From: Steven Nance Date: Tue, 10 Sep 2024 23:09:20 +0200 Subject: [PATCH 1/2] chore: switch to nx-release for publishing --- .github/CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++ libs/nx-react-workshop/package.json | 2 +- libs/nx-react-workshop/project.json | 10 ++------- nx.json | 15 +++++++++++++ package.json | 3 +-- scripts/local-release.ts | 15 ------------- scripts/tsconfig.release.json | 9 -------- 7 files changed, 52 insertions(+), 35 deletions(-) create mode 100644 .github/CONTRIBUTING.md delete mode 100644 scripts/local-release.ts delete mode 100644 scripts/tsconfig.release.json diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..39851ee --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# Contributing + +`TODO` + +## Local Package Publishing + +When iterating on the `@nrwl/nx-workshop-e2e` package, it's often helpful to test out a published +version of the package locally. This can be done by starting the local registry, `verdaccio`, and using the `nx release` command. + +To start the local registry, run the `local-registry` target for the root workspace project: + +```bash +nx local-registry +``` + +In another terminal, you can then trigger deployment to that registry by running the `release` target for the `nx-workshop-e2e` project: + +```bash +nx release version prerelease && nx release publish + +# alternatively +nx release-dev nx-react-workshop +``` + +Once your dev version has been published, you can then update the `nx-workshop-e2e` package in your consuming project to the version you just published. + +Since verdaccio configures itself in the `~/.npmrc` file, you can simply install using your standard package manager commands: + +```bash +npm add --save-dev @nrwl/nx-react-workshop@latest +# or alternatively with yarn +yarn add -D @nrwl/nx-react-workshop@latest +``` diff --git a/libs/nx-react-workshop/package.json b/libs/nx-react-workshop/package.json index 1efa574..26d1d1b 100644 --- a/libs/nx-react-workshop/package.json +++ b/libs/nx-react-workshop/package.json @@ -1,6 +1,6 @@ { "name": "@nrwl/nx-react-workshop", - "version": "0.2.1", + "version": "0.0.0", "main": "src/index.js", "generators": "./generators.json", "executors": "./executors.json", diff --git a/libs/nx-react-workshop/project.json b/libs/nx-react-workshop/project.json index d7e5d99..8cf0b6c 100644 --- a/libs/nx-react-workshop/project.json +++ b/libs/nx-react-workshop/project.json @@ -54,14 +54,8 @@ "updateBuildableProjectDepsInPackageJson": true } }, - "publish": { - "executor": "nx:run-commands", - "options": { - "commands": [ - "yarn nx build nx-react-workshop", - "yarn publish dist/libs/nx-react-workshop" - ] - } + "release-dev": { + "command": "nx release version prerelease && nx release publish" } } } diff --git a/nx.json b/nx.json index 4451a95..244f105 100644 --- a/nx.json +++ b/nx.json @@ -21,6 +21,11 @@ "@nx/eslint:lint": { "inputs": ["default", "{workspaceRoot}/.eslintrc.json"], "cache": true + }, + "nx-release-publish": { + "options": { + "packageRoot": "dist/libs/{projectName}" + } } }, "namedInputs": { @@ -38,6 +43,16 @@ "!{projectRoot}/tsconfig.storybook.json" ] }, + "release": { + "projects": ["nx-react-workshop"], + "version": { + "preVersionCommand": "nx build nx-react-workshop", + "generatorOptions": { + "packageRoot": "dist/libs/{projectName}", + "currentVersionResolver": "registry" + } + } + }, "nxCloudAccessToken": "NzdhYTRjNmQtNGYwMC00MGE0LTk2YzEtNWFlNGU1MDk3OTczfHJlYWQtd3JpdGU=", "nxCloudUrl": "https://staging.nx.app", "useInferencePlugins": false, diff --git a/package.json b/package.json index 7111ac3..0e0cb76 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,7 @@ "version": "0.0.0", "license": "MIT", "scripts": { - "nx": "nx", - "local-release": "ts-node -P ./scripts/tsconfig.release.json ./scripts/local-release" + "nx": "nx" }, "private": true, "dependencies": { diff --git a/scripts/local-release.ts b/scripts/local-release.ts deleted file mode 100644 index 799e6e5..0000000 --- a/scripts/local-release.ts +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env node -import { execSync } from 'child_process'; - -const LARGE_BUFFER = 1024 * 1000000; - -(async () => { - execSync(`yarn nx build nx-react-workshop`, { - stdio: [0, 1, 2], - maxBuffer: LARGE_BUFFER, - }); -})(); - -function getRegistry() { - return new URL(execSync('npm config get registry').toString().trim()); -} diff --git a/scripts/tsconfig.release.json b/scripts/tsconfig.release.json deleted file mode 100644 index 522adc8..0000000 --- a/scripts/tsconfig.release.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "outDir": "../scripts/tools-out", - "module": "commonjs", - "types": ["node"] - }, - "include": ["**/*.ts"] -} From 174de5191970b66b627a566caa490830c5a745d6 Mon Sep 17 00:00:00 2001 From: Steven Nance Date: Wed, 11 Sep 2024 12:15:13 +0200 Subject: [PATCH 2/2] chore: revert unnecessary eslint changes added by migration --- .eslintrc.json | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e41eaa8..9ca2e83 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,18 +24,12 @@ { "files": ["*.ts", "*.tsx"], "extends": ["plugin:@nx/typescript"], - "rules": { - "@typescript-eslint/no-extra-semi": "error", - "no-extra-semi": "off" - } + "rules": {} }, { "files": ["*.js", "*.jsx"], "extends": ["plugin:@nx/javascript"], - "rules": { - "@typescript-eslint/no-extra-semi": "error", - "no-extra-semi": "off" - } + "rules": {} } ] }