]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Add a script to prepare moment for npm publish
authorIskren Chernev <iskren.chernev@gmail.com>
Tue, 7 Oct 2014 05:42:13 +0000 (22:42 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 17 Nov 2014 07:37:03 +0000 (23:37 -0800)
scripts/npm_prepublish.sh [new file with mode: 0755]

diff --git a/scripts/npm_prepublish.sh b/scripts/npm_prepublish.sh
new file mode 100755 (executable)
index 0000000..0bf3b83
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+set -e
+
+if [ "$#" != 1 ]; then
+    echo "Please provide tag to checkout" >&2
+    exit 1
+fi
+tag="$1"
+
+while [ "$PWD" != '/' -a ! -f moment.js ]; do
+    cd ..
+done
+
+if [ ! -f moment.js ]; then
+    echo "Run me from the moment repo" >&2
+    exit 1
+fi
+
+basename=$(basename $PWD)
+
+cd ..
+
+rm -rf moment-npm
+
+git clone $basename moment-npm
+
+cd moment-npm
+git checkout $tag
+
+rm -f **/.??*
+rm -rf node_modules
+rm -rf bower_components
+rm -rf scripts
+rm -r benchmarks
+rm -r test
+rm -r tasks
+rm Gruntfile.js
+rm CHANGELOG.md
+rm CONTRIBUTING.md
+rm composer.json
+rm component.json
+rm bower.json
+rm .jscs.json
+rm .travis.yml
+rm -rf .git
+
+echo "Check out $PWD"