-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: store version only in root package.json
Store the current repo version only in the root pacakge.json in order to avoid the need to specify the version number everywhere in the codebase. In order to achieve that, I changed all package.json files to use a version marker 999.999.999 to indicate it's a local dependency. This marker is better than 0.0.0.0 since it will make sure cache is invalidated for various languages (for example, Maven will only bring in a new version if the local cache has an older version). Then, we needed to change a couple of other things: - The bump script is now very simple. It merely updates the root package.json and creates the CHANGELOG. That's it. - Before running a CI build (buildspec.yml), we run `scripts/set-version.sh` which uses lerna to update the version in all package.json files. This means that build artifacts that are produced in CI builds get the actual repo version, and dev builds all use 999.999.999.
- Loading branch information
Elad Ben-Israel
committed
Feb 23, 2020
1 parent
0f8acbf
commit 6d32117
Showing
7 changed files
with
331 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
#------------------------------------------------------------------------ | ||
# updates all package.json files to the version defined in lerna.json | ||
# this is called when building inside our ci/cd system | ||
#------------------------------------------------------------------------ | ||
set -euo pipefail | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
|
||
# go to repo root | ||
cd ${scriptdir}/.. | ||
|
||
# extract version from the root package.json which is the source of truth | ||
version="$(node -p "require('./package.json').version")" | ||
|
||
# align all package.json files | ||
npx lerna version ${version} --yes --exact --force-publish=* --no-git-tag-version --no-push | ||
|
||
# align all peer-deps based on deps | ||
find . -name package.json | grep -v node_modules | xargs node ${scriptdir}/sync-peer-deps.js | ||
|
||
# validation | ||
if find . -name package.json | grep -v node_modules | xargs grep "999.999.999"; then | ||
echo "ERROR: unexpected version marker 999.999.999 in a package.json file" | ||
exit 1 | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.