Sfoglia il codice sorgente

improve publish system

Adam Shaw 7 anni fa
parent
commit
22e78376ab
2 ha cambiato i file con 29 aggiunte e 11 eliminazioni
  1. 3 0
      .gitignore
  2. 26 11
      bin/publish-release.sh

+ 3 - 0
.gitignore

@@ -8,3 +8,6 @@ tmp
 node_modules
 npm-debug.log
 package-lock.json
+
+# temporary
+bin/publish-release-all.sh

+ 26 - 11
bin/publish-release.sh

@@ -8,9 +8,10 @@ cd "`dirname $0`/.."
 
 ./bin/require-clean-working-tree.sh
 
-package="$1"
+package="$1" # a short name like 'core'
 version="$2"
-scope="$3"
+release_tag="$3"
+production_str="$4"
 
 if [[ ! "$package" ]]
 then
@@ -24,16 +25,31 @@ then
   exit 1
 fi
 
-if [[ "$scope" != "latest" ]] && [[ "$scope" != "beta" ]] && [[ "$scope" != "alpha" ]]
+if [[ "$release_tag" != "latest" ]] && [[ "$release_tag" != "beta" ]] && [[ "$release_tag" != "alpha" ]]
 then
-  echo "Invalid third argument scope '$scope'. Aborting."
+  echo "Invalid third argument scope '$release_tag'. Aborting."
   exit 1
 fi
 
-# # push the current branch (assumes tracking is set up) and the tag
-# git push --recurse-submodules=on-demand
-# git push origin "v$version"
-echo "REENABLE BRANCH PUSHING"
+if [[ "$production_str" == "" ]]
+then
+  is_production="0"
+  npm_registry_str="--registry http://localhost:4873"
+elif [[ "$production_str" == "--production" ]]
+then
+  is_production="1"
+  npm_registry_str=""
+else
+  echo "Invalid flag $production_str. Aborting"
+  exit 1
+fi
+
+if [[ "$is_production" == "1" ]]
+then
+  # push the current branch (assumes tracking is set up) and the tag
+  git push --recurse-submodules=on-demand
+  git push origin "v$version"
+fi
 
 if {
   # check out dist files for tag but don't stage them
@@ -42,11 +58,10 @@ if {
 
   cd "dist/$package" &&
 
-  # npm publish --tag "$scope"
-  echo "FAKE NPM PUBLISH ($PWD)" &&
-  ls -al
+  npm publish --tag "$release_tag" "$npm_registry_str"
 }
 then
+  ls -al
   echo 'Success.'
 else
   echo 'Failure.'