From 0990338dee6e743873dc42d2006455826cb92b4c Mon Sep 17 00:00:00 2001 From: Bas Meeuwissen Date: Fri, 5 Apr 2024 09:55:24 +0200 Subject: [PATCH] chore(build): simplify monorepo setup (#519) --- .github/workflows/nodejsci.yml | 2 +- CONTRIBUTING.md | 2 +- DEVELOPMENT.md | 50 +++++++++++++++++++++++++ RELEASE.md | 12 ------ examples/apps/contact-list/package.json | 2 +- lerna.json | 4 ++ package.json | 37 ++++-------------- 7 files changed, 65 insertions(+), 44 deletions(-) create mode 100644 DEVELOPMENT.md delete mode 100644 RELEASE.md diff --git a/.github/workflows/nodejsci.yml b/.github/workflows/nodejsci.yml index ca1345b9..60d8e4cb 100644 --- a/.github/workflows/nodejsci.yml +++ b/.github/workflows/nodejsci.yml @@ -31,4 +31,4 @@ jobs: - run: npm ci - run: npm install @nrwl/nx-linux-x64-gnu - - run: npx lerna run lint,test --scope=@jitar/reflection --scope=@jitar/serialization --scope=@jitar/runtime --scope=@jitar/caching --scope=@jitar/server-nodejs --scope=jitar --scope=create-jitar --scope=@jitar/plugin-vite \ No newline at end of file + - run: npm run review \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf361231..9b63c4eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ # Contributing to Jitar We want to make contributing to this project as easy and transparent as -possible. +possible. For our development workflow, see [DEVELOPMENT.md](./DEVELOPMENT.md). ## Pull Requests diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 00000000..76d751f7 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,50 @@ +# Workflow for development + +This document describes the workflow we use for the development of Jitar. + +## Environment + +To work on Jitar, you need the following tools: + +- Node.js 20.x or higher +- npm 10.x or higher +- Visual Studio Code +- Docker (optional) for running the full stack example + +Note: Jitar is managed as a monorepo with Lerna. You don't need specific knowledge about Lerna to work on Jitar. + +## Installation + +1. Clone the repository. +1. Run `npm install` to install all dependencies. + +## Development + +1. Run `npm run build` to build all packages. +1. Run `npm run test` to run all tests. +1. Run `npm run lint` to lint all packages. + +## Creating a pull request + +1. Create a new issue and branch. +1. Make your changes. +1. Update the [documentation](./documentation/README.md) if necessary. +1. Run `npm run build` to build all packages. +1. Run `npm run review` to run all tests and linting. +1. Commit and push the changes. +1. Create a pull request. + +## Publishing + +To do consistent releases, we use the following steps: + +1. Create a new issue and branch. +1. Update the version number for the mono repo in the `package.json` file. +1. Update the version number for all packages in the packages directory. +1. Execute command `npm run changelog` to generate a changelog. +1. Commit and push the changes. +1. Execute command `npm run publish` to publish the packages. +1. Commit and push the changes. +1. Create pull request. +1. Merge the pull request. +1. Create a new tag with the version number. diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index 23c10ebe..00000000 --- a/RELEASE.md +++ /dev/null @@ -1,12 +0,0 @@ -To do consistent releases, we use the following steps: - -1. Create a new issue and branch. -1. Update the version number for the mono repo in the `package.json` file. -1. Update the version number for all packages in the packages directory. -1. Execute command `npm run changelog` to generate a changelog. -1. Commit and push the changes. -1. Execute command `npx lerna publish --no-git-tag-version --no-private` to publish the packages. -1. Commit and push the changes. -1. Create pull request. -1. Merge the pull request. -1. Create a new tag with the version number. diff --git a/examples/apps/contact-list/package.json b/examples/apps/contact-list/package.json index 8a8dccfb..a4a06cb2 100644 --- a/examples/apps/contact-list/package.json +++ b/examples/apps/contact-list/package.json @@ -1,5 +1,5 @@ { - "name": "jitar-contact-list", + "name": "jitar-contact-list-example", "private": true, "version": "0.0.0", "type": "module", diff --git a/lerna.json b/lerna.json index d8117235..78e5737e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,10 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "version": "0.7.4", + "packages": [ + "packages/*", + "examples/**/*" + ], "command": { "version": { "message": "chore(release): publish %s" diff --git a/package.json b/package.json index 1193002f..16b3840a 100644 --- a/package.json +++ b/package.json @@ -4,35 +4,14 @@ "private": true, "license": "MIT", "type": "module", - "workspaces": [ - "packages/caching", - "packages/create-jitar", - "packages/jitar", - "packages/plugin-vite", - "packages/reflection", - "packages/runtime", - "packages/serialization", - "packages/server-nodejs", - "tools/eslint-plugin", - "examples/concepts/access-protection", - "examples/concepts/construction", - "examples/concepts/cors", - "examples/concepts/data-transportation", - "examples/concepts/error-handling", - "examples/concepts/health-checks", - "examples/concepts/hello-world", - "examples/concepts/load-balancing", - "examples/concepts/middleware", - "examples/concepts/multi-version", - "examples/concepts/node-client", - "examples/concepts/overrides", - "examples/concepts/segmentation", - "examples/apps/contact-list" - ], "scripts": { - "build": "npm run build --workspace=packages/reflection --workspace=packages/serialization --workspace=packages/runtime --workspace=packages/caching --workspace=packages/server-nodejs --workspace=packages/jitar --workspace=packages/create-jitar --workspace=packages/plugin-vite --if-present", - "lint": "npm run lint --workspace=packages/reflection --workspace=packages/serialization --workspace=packages/runtime --workspace=packages/caching --workspace=packages/server-nodejs --workspace=packages/jitar --workspace=packages/create-jitar --workspace=packages/plugin-vite --if-present", - "test": "npm run test --workspace=packages/reflection --workspace=packages/serialization --workspace=packages/runtime --workspace=packages/caching --workspace=packages/server-nodejs --workspace=packages/jitar --workspace=packages/create-jitar --workspace=packages/plugin-vite --if-present", + "build": "lerna run build --scope=jitar --scope=create-jitar --scope=@jitar/plugin*", + "build:examples": "lerna run build --scope=*-example", + "build:all": "lerna run build", + "lint": "lerna run lint", + "test": "lerna run test", + "review": "lerna run test,lint", + "publish": "npx lerna publish --no-git-tag-version --no-private", "changelog": "auto-changelog --template changelog.hbs -p -u --commit-limit false --hide-empty-releases true", "changelog-debug": "auto-changelog --template changelog.hbs -p --template json --output changelog-data.json" }, @@ -59,4 +38,4 @@ "rollup-plugin-dts": "^6.1.0", "vitest": "^1.4.0" } -} +} \ No newline at end of file