|
1 | | -.PHONY: startVerdaccio stopVerdaccio publishVerdaccio addUser login build graph publish |
| 1 | +# Define the targets and the commands to be executed |
| 2 | +.PHONY: startVerdaccio stopVerdaccio publishVerdaccio addUser login build graph publish update |
2 | 3 |
|
| 4 | +# Start Verdaccio Docker container (local NPM registry) |
| 5 | +# This will install 'expect', pull the latest Verdaccio image, and run it. |
3 | 6 | startVerdaccio: |
| 7 | +# Install the 'expect' package needed for some automation scripts |
4 | 8 | sudo apt-get update && sudo apt-get install expect |
| 9 | +# Pull the latest nightly version of the Verdaccio image |
5 | 10 | docker pull verdaccio/verdaccio:nightly-master |
| 11 | +# Run Verdaccio in detached mode with port 4873 exposed |
6 | 12 | docker run -it -d --rm --name lib_verdaccio -p 4873:4873 verdaccio/verdaccio:nightly-master |
| 13 | +# Clear any existing NPM configuration |
7 | 14 | echo "" > ./.npmrc |
| 15 | +# Set the registry to the local Verdaccio instance for project-specific use |
8 | 16 | npm config set registry http://localhost:4873/ --location project |
9 | 17 |
|
| 18 | +# Stop the running Verdaccio Docker container |
10 | 19 | stopVerdaccio: |
| 20 | +# Stop the Verdaccio container with the name 'lib_verdaccio' |
11 | 21 | docker stop lib_verdaccio |
12 | 22 |
|
| 23 | +# Add a new user to the local NPM registry (Verdaccio) |
| 24 | +# This will execute the script that interacts with the registry to add a user |
13 | 25 | addUser: |
14 | 26 | ./scripts/make-user.sh |
15 | 27 |
|
| 28 | +# Log in to the local NPM registry (Verdaccio) |
| 29 | +# This will execute the login script to authenticate the user with Verdaccio |
16 | 30 | login: |
17 | 31 | ./scripts/login.sh |
18 | 32 |
|
| 33 | +# Build the project and its dependencies using npm |
| 34 | +# This includes running the general build process and the Lerna build process |
19 | 35 | build: |
20 | 36 | npm run build && npm run build:lerna |
21 | 37 |
|
| 38 | +# Build and publish packages to the local Verdaccio registry |
| 39 | +# This builds all packages using Yarn and Lerna and publishes them to the local registry |
22 | 40 | publishVerdaccio: |
23 | 41 | yarn build |
24 | 42 | yarn build:lerna |
25 | 43 | yarn lerna exec "npm publish --registry http://localhost:4873" |
26 | 44 |
|
| 45 | +# Generate and visualize the dependency graph of the project using Nx |
| 46 | +# This will show a graphical representation of the dependencies in the monorepo |
27 | 47 | graph: |
28 | 48 | yarn nx graph |
29 | 49 |
|
| 50 | +# Publish packages using Lerna |
| 51 | +# This command publishes packages to the specified registry using Lerna |
30 | 52 | publish: |
31 | 53 | yarn lerna publish |
| 54 | + |
| 55 | +# Update a specific peer dependency across all packages in the monorepo |
| 56 | +# Example usage: make update lib=rich-domain v=1.1.0 |
| 57 | +# This will update the specified peer dependency (e.g., 'rich-domain') to the given version (e.g., '1.1.0') in all package.json files in the ./packages directory |
| 58 | +# update peer dependency in all packages once |
| 59 | +update: |
| 60 | + ./update-peer-dependency.sh $(lib) $(v) |
0 commit comments