tweak some variable names
This commit is contained in:
parent
a92b9a47d8
commit
c266bb6cbf
1 changed files with 7 additions and 7 deletions
14
npm2git.sh
14
npm2git.sh
|
@ -5,11 +5,11 @@ set -e
|
|||
cd $(git rev-parse --show-toplevel)
|
||||
|
||||
# get commit id
|
||||
COMMIT_ID="$(git rev-parse HEAD)"
|
||||
ORIG_COMMIT="$(git rev-parse HEAD)"
|
||||
|
||||
# extract package name and version from package.json, remove scripts.prepare
|
||||
ORIG_PKG="$(cat package.json)"
|
||||
read NAME VERSION < <(node -e '
|
||||
read PKG_NAME PKG_VERSION < <(node -e '
|
||||
const fs = require("fs");
|
||||
const pkg = JSON.parse(fs.readFileSync("package.json"));
|
||||
if (pkg.scripts && pkg.scripts.prepare) {
|
||||
|
@ -21,19 +21,19 @@ read NAME VERSION < <(node -e '
|
|||
|
||||
# determine current branch name, and create new temporary branch
|
||||
ORIG_BRANCH=$(git symbolic-ref --short HEAD)
|
||||
TEMP_BRANCH=RELEASE_${VERSION}_$(date +'%Y%m%d%H%M%S')
|
||||
TEMP_BRANCH=RELEASE_${PKG_VERSION}_$(date +'%Y%m%d%H%M%S')
|
||||
git add .
|
||||
git checkout --orphan=${TEMP_BRANCH}
|
||||
|
||||
# untrack all files, and track the files that should be included in the published package
|
||||
git rm --cached -r .
|
||||
npm pack
|
||||
git add -f $(tar tf ${NAME}-${VERSION}.tgz | cut -c 9-)
|
||||
rm ${NAME}-${VERSION}.tgz
|
||||
git add -f $(tar tf ${PKG_NAME}-${PKG_VERSION}.tgz | cut -c 9-)
|
||||
rm ${PKG_NAME}-${PKG_VERSION}.tgz
|
||||
|
||||
# commit and tag
|
||||
git commit -m "v${VERSION} @ ${COMMIT_ID}"
|
||||
git tag v${VERSION} -a -m "v${VERSION} @ ${COMMIT_ID}"
|
||||
git commit -m "v${PKG_VERSION} @ ${ORIG_COMMIT}"
|
||||
git tag v${PKG_VERSION} -a -m "v${PKG_VERSION} @ ${ORIG_COMMIT}"
|
||||
|
||||
# return to original state
|
||||
git reset ${ORIG_BRANCH}
|
||||
|
|
Loading…
Reference in a new issue