Skip to content

Commit

Permalink
build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vlandham authored and kanitw committed Jun 8, 2017
1 parent cc384fa commit 1b97740
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 10 deletions.
11 changes: 11 additions & 0 deletions .npmignore
@@ -0,0 +1,11 @@
/coverage
/scripts
/test
/.*

build/test
codecov.yml
tsconfig.json
tsconfig.*.json
tslint.json
yarn.lock
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -29,7 +29,9 @@
"test:logic": "jest --no-cache --coverage",
"test:ui": "NODE_ENV=test node scripts/jest.js",
"posttest": "npm run lint",
"codecov": "jest --no-cache --coverage && codecov"
"codecov": "jest --no-cache --coverage && codecov",
"publish": "npm run clean && npm run lint && npm run test && scripts/publish.sh",
"deploy": "npm run clean && npm run lint && npm run test && npm run build && node scripts/deploy.js"
},
"dependencies": {
"compassql": "0.12.1",
Expand Down Expand Up @@ -80,6 +82,7 @@
"fetch-mock": "^5.11.0",
"file-loader": "^0.10.1",
"fs-extra": "^3.0.1",
"gh-pages": "^1.0.0",
"html-webpack-plugin": "^2.28.0",
"jest": "~18",
"node-sass": "^4.5.0",
Expand Down
8 changes: 8 additions & 0 deletions scripts/deploy.js
@@ -0,0 +1,8 @@
var ghpages = require('gh-pages');
var path = require('path');

function onPublish(err) {

}

ghpages.publish('dist', function(err) {});
58 changes: 58 additions & 0 deletions scripts/publish.sh
@@ -0,0 +1,58 @@
set -e

# define color
RED='\033[0;31m'
NC='\033[0m' # No Color


# 0.1 Check if jq has been installed
type jq >/dev/null 2>&1 || { echo >&2 "I require jq but it's not installed. Aborting."; exit 1; }

# 0.2 check if on master
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
echo "${RED}Not on master, please checkout master branch before running this script${NC}"
exit 1
fi

# 0.3 Check if all files are committed
if [ -z "$(git status --porcelain)" ]; then
echo "All tracked files are committed. Publishing on npm and bower. \n"
else
echo "${RED}There are uncommitted files. Please commit or stash first!${NC} \n\n"
git status
exit 1
fi

# 1. BOWER PUBLISH

# read version
gitsha=$(git rev-parse HEAD)
version=$(cat package.json | jq .version | sed -e 's/^"//' -e 's/"$//')

# swap to head so we don't commit compiled file to master along with tags
git checkout head
npm run build
npm run build:lib

# add the compiled files, commit and tag!
git add build/ -f

git commit -m "release $version $gitsha"
git tag -am "Release v$version." "v$version"

# now swap back to the clean master and push the new tag
git checkout master
git push --tags
npm run build # rebuild -- so compiled files are back for linked bower
npm run build:lib

# 2. NPM PUBLISH

#npm publish

# exit if npm publish failed
rc=$?
if [[ $rc != 0 ]]; then
echo "${RED} npm publish failed. Publishing cancelled. ${NC} \n\n"
exit $rc;
fi
50 changes: 41 additions & 9 deletions yarn.lock
Expand Up @@ -242,7 +242,13 @@ array-flatten@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"

array-uniq@^1.0.2:
array-union@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
dependencies:
array-uniq "^1.0.1"

array-uniq@^1.0.1, array-uniq@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"

Expand Down Expand Up @@ -296,16 +302,16 @@ async@1.x, async@^1.4.0, async@^1.4.2, async@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"

async@^0.9.0:
version "0.9.2"
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"

async@^2.0.1, async@^2.1.2, async@^2.1.4:
async@2.1.4, async@^2.0.1, async@^2.1.2, async@^2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/async/-/async-2.1.4.tgz#2d2160c7788032e4dd6cbe2502f1f9a2c8f6cde4"
dependencies:
lodash "^4.14.0"

async@^0.9.0:
version "0.9.2"
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"

asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
Expand Down Expand Up @@ -478,6 +484,10 @@ base64-js@^1.0.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.0.tgz#a39992d723584811982be5e290bb6a53d86700f1"

base64url@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/base64url/-/base64url-2.0.0.tgz#eac16e03ea1438eff9423d69baa36262ed1f70bb"

batch@0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/batch/-/batch-0.5.3.tgz#3f3414f380321743bfc1042f9a83ff1d5824d464"
Expand Down Expand Up @@ -927,7 +937,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5:
dependencies:
delayed-stream "~1.0.0"

commander@2, commander@2.9.x, commander@^2.9.0, commander@~2.9.0:
commander@2, commander@2.9.0, commander@2.9.x, commander@^2.9.0, commander@~2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
dependencies:
Expand Down Expand Up @@ -2186,6 +2196,18 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"

gh-pages@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/gh-pages/-/gh-pages-1.0.0.tgz#4a46f4c25439f7a2b7e6835504d4a49e949f04ca"
dependencies:
async "2.1.4"
base64url "^2.0.0"
commander "2.9.0"
fs-extra "^3.0.1"
globby "^6.1.0"
graceful-fs "4.1.11"
rimraf "^2.5.4"

glob-all@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/glob-all/-/glob-all-3.1.0.tgz#8913ddfb5ee1ac7812656241b03d5217c64b02ab"
Expand Down Expand Up @@ -2235,6 +2257,16 @@ globals@^9.0.0:
version "9.16.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80"

globby@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c"
dependencies:
array-union "^1.0.1"
glob "^7.0.3"
object-assign "^4.0.1"
pify "^2.0.0"
pinkie-promise "^2.0.0"

globule@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/globule/-/globule-1.1.0.tgz#c49352e4dc183d85893ee825385eb994bb6df45f"
Expand Down Expand Up @@ -2265,7 +2297,7 @@ got@^6.7.1:
unzip-response "^2.0.1"
url-parse-lax "^1.0.0"

graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
graceful-fs@4.1.11, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

Expand Down Expand Up @@ -5030,7 +5062,7 @@ right-align@^0.1.1:
dependencies:
align-text "^0.1.1"

rimraf@2, rimraf@^2.2.8, rimraf@^2.4.3, rimraf@^2.4.4:
rimraf@2, rimraf@^2.2.8, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4:
version "2.6.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d"
dependencies:
Expand Down

0 comments on commit 1b97740

Please sign in to comment.