Skip to content

Commit

Permalink
chore(build): simplify monorepo setup (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
basmasking authored Apr 5, 2024
1 parent 8f45694 commit 0990338
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejsci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- run: npm run review
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
50 changes: 50 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 0 additions & 12 deletions RELEASE.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/apps/contact-list/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "jitar-contact-list",
"name": "jitar-contact-list-example",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
37 changes: 8 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -59,4 +38,4 @@
"rollup-plugin-dts": "^6.1.0",
"vitest": "^1.4.0"
}
}
}

0 comments on commit 0990338

Please sign in to comment.