From f34a49474db5a7b4a73cd31b5daf56b1d4186b83 Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Thu, 30 May 2019 18:27:18 +1000 Subject: [PATCH 1/5] Add --dir arg to support building pakages that are not in the root of the repository --- npm-publish-git | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/npm-publish-git b/npm-publish-git index 56619d9..bb896d8 100755 --- a/npm-publish-git +++ b/npm-publish-git @@ -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 @@ -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 @@ -99,7 +104,12 @@ function on_exit() { trap on_exit EXIT -TARBALL=$(npm pack | tail -1) +TARBALL=$(if [ -n "$CUSTOM_DIR" ]; then cd "$CUSTOM_DIR"; fi; npm pack | tail -1) +if [ -n "$CUSTOM_DIR" ] +then + mv "$CUSTOM_DIR/$TARBALL" "$TARBALL" +fi + ${DIR}/package.json-publish > published.package.json ls -A | grep -v -e "^${TARBALL}\$" -e "^.git$" -e "^published.package.json$" | xargs rm -rf From c6ebdd98043ad0b014e537d95a00004ec0951486 Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Thu, 30 May 2019 19:26:19 +1000 Subject: [PATCH 2/5] Also handle package.json being in a sub directory --- npm-publish-git | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/npm-publish-git b/npm-publish-git index bb896d8..08147e0 100755 --- a/npm-publish-git +++ b/npm-publish-git @@ -108,10 +108,14 @@ 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 -${DIR}/package.json-publish > published.package.json - ls -A | grep -v -e "^${TARBALL}\$" -e "^.git$" -e "^published.package.json$" | xargs rm -rf tar -xf ${TARBALL} ls -A package | xargs -I {} mv package/{} ./ From 00c5555579c5b6aaff186d8a3d07c1b8758f9563 Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Sat, 21 Dec 2019 15:08:46 +1100 Subject: [PATCH 3/5] Rename package to @hedgepigdaniel/npm-publish-git --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ac730a6..91e0b0e 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "npm-publish-git", + "name": "@hedgepigdaniel/npm-publish-git", "version": "0.0.10", "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", From 4bd96b95ed20cfffd3331f54f237159770c539f2 Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Sat, 21 Dec 2019 15:09:33 +1100 Subject: [PATCH 4/5] chore: bump to 0.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 91e0b0e..17ab090 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hedgepigdaniel/npm-publish-git", - "version": "0.0.10", + "version": "0.1.0", "repository": { "type": "git", "url": "git://github.com/hedgepigdaniel/npm-publish-git.git" From ec4334df8ddc695712eb5af4f4b1744c36d18f12 Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Sat, 21 Dec 2019 15:12:17 +1100 Subject: [PATCH 5/5] chore: change publish configuration to public --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 17ab090..517e88b 100644 --- a/package.json +++ b/package.json @@ -9,5 +9,8 @@ "license": "Apache-2.0", "bin": { "npm-publish-git": "./npm-publish-git" + }, + "publishConfig": { + "access": "public" } }