Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions npm-publish-git
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -euo pipefail
## Publish an NPM package to git tag.
##
## --tag TAG Use specific dist tag. "X.Y.Z" will be replaced with the current version
## --dir DIR Publish the package in the specified subdirectory
##
## -h, --help Display this help and exit
## -v, --version Output version information and exit
Expand Down Expand Up @@ -48,6 +49,10 @@ while [[ $# -gt 0 ]]; do
VSN_DIST_TAG="${2/X.Y.Z/${VSN}}"
shift 2
;;
--dir)
CUSTOM_DIR=$2
shift 2
;;
-h|--help)
grep "^##" "$0" | cut -c 4-
exit 1
Expand Down Expand Up @@ -99,8 +104,17 @@ function on_exit() {

trap on_exit EXIT

TARBALL=$(npm pack | tail -1)
${DIR}/package.json-publish > published.package.json
TARBALL=$(if [ -n "$CUSTOM_DIR" ]; then cd "$CUSTOM_DIR"; fi; npm pack | tail -1)
if [ -n "$CUSTOM_DIR" ]
then
mv "$CUSTOM_DIR/$TARBALL" "$TARBALL"
(
cd "$CUSTOM_DIR"
${DIR}/package.json-publish
) > published.package.json
else
${DIR}/package.json-publish > published.package.json
fi

ls -A | grep -v -e "^${TARBALL}\$" -e "^.git$" -e "^published.package.json$" | xargs rm -rf
tar -xf ${TARBALL}
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"name": "npm-publish-git",
"version": "0.0.10",
"name": "@hedgepigdaniel/npm-publish-git",
"version": "0.1.0",
"repository": {
"type": "git",
"url": "git://github.com/andreineculau/npm-publish-git.git"
"url": "git://github.com/hedgepigdaniel/npm-publish-git.git"
},
"author": "Andrei Neculau",
"license": "Apache-2.0",
"bin": {
"npm-publish-git": "./npm-publish-git"
},
"publishConfig": {
"access": "public"
}
}