-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skips private packages and already published versions (ie, unchanged)
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd $(dirname $0)/.. | ||
set -e | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
# NPM pre publish | ||
|
||
# https://circleci.com/docs/npm-login/ | ||
echo -e "$NPM_USER\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
# NPM publish | ||
|
||
MODULES=$(ls packages) | ||
|
||
for module in $MODULES; do | ||
if [ -e "packages/$module/package.json" ]; then | ||
IS_PRIVATE=$(echo "console.log(require('./packages/$module/package.json').private)" | node) | ||
if [[ $IS_PRIVATE == "true" ]]; then | ||
echo "Skipping private package @blueprintjs/$module" | ||
continue | ||
fi | ||
|
||
TO_PUBLISH=$(echo "console.log(require('./packages/$module/package.json').version)" | node) | ||
VERSIONS=$(npm info @blueprintjs/$module versions || echo "new_package") | ||
|
||
# check for presence of this version in the list of all published versions | ||
if [[ $VERSIONS == *"'$TO_PUBLISH'"* ]]; then | ||
echo "Nothing to publish for @blueprintjs/$module@$TO_PUBLISH" | ||
else | ||
echo "Publishing @blueprintjs/$module@$TO_PUBLISH..." | ||
# must set public access for scoped packages | ||
npm publish packages/$module --access public | ||
fi | ||
fi | ||
done |
18870ea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npmPublish script (#80)
Preview: docs Coverage: core | datetime