Skip to content

Commit

Permalink
chore: add script to run npm dist-tag (#3524)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Mar 7, 2022
1 parent cd40908 commit b1c4e53
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@ This will symlink the individual component packages into the `node_modules` fold

After that you can start / restart your application and it should use the source code from the monorepo.

### Fixing npm dist-tag

When maintaining two stable majors (e.g. 22.0.x and 23.0.x), it is important to maintain `latest` npm tag.
For example, we release 22.0.7 after 23.0.1 but we still want to keep `latest` pointing to 23.0.1.

Use the following script on `master` branch to run `npm dist-tag` for all packages:

```sh
./scripts/fixDistTag.sh
```

## LICENSE

For specific package(s), check the LICENSE file under the package folder.
23 changes: 23 additions & 0 deletions scripts/fixDistTag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# List all packages managed by Lerna
packages=$(./node_modules/.bin/lerna list)

# Get latest version of all packages
version=$(node -pe 'JSON.parse(process.argv[1]).version' "$(cat lerna.json)")

fixDistTag() {
package=$1
echo fixing $package

# List npm tags
npm dist-tag ls $package

# Update "latest" tag to correct version
npm dist-tag add $package@$version latest
}

for i in $packages
do
fixDistTag $i
done

0 comments on commit b1c4e53

Please sign in to comment.