-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: script to help with publishing
next
Tact versions on NPM (#554)
- Loading branch information
1 parent
a159f6b
commit 99c3063
Showing
3 changed files
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
"maxint", | ||
"minmax", | ||
"mintable", | ||
"mktemp", | ||
"multiformats", | ||
"Korshakov", | ||
"nocheck", | ||
|
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,31 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Call the script with a new dev version as its argument. | ||
# If the argument is not provided a new version will be | ||
# automatically generated from package.json and current date, | ||
# plus a gitHead field with the current Git commit hash | ||
# will be added to package.json. | ||
# | ||
# The version format should be as follows: | ||
# <MAJOR>.<MINOR>.<PATCH>-dev.<ISO-8601-DATE-WITHOUT-DELIMITERS> | ||
# e.g. something like 1.4.0-dev.20240711 | ||
|
||
FILE=package.json | ||
COMMIT=$(git rev-parse HEAD) | ||
|
||
if [ ! -f "$FILE" ]; then | ||
echo "Error: $FILE not found!" | ||
exit 1 | ||
fi | ||
|
||
VERSION=$1 | ||
if [ -z "$VERSION" ]; then | ||
VERSION=$(jq -r '.version' $FILE)-dev.$(date +"%Y%m%d") | ||
fi | ||
|
||
TMP=$(mktemp) | ||
jq ".version = \"$VERSION\" | .gitHead = \"$COMMIT\"" "$FILE" > "$TMP" | ||
mv "$TMP" "$FILE" | ||
rm "$TMP" | ||
yarn prettier -w "$FILE" | ||
|