This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SSTONE1/master
Add initial Lerna and Travis files
- Loading branch information
Showing
5 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: node_js | ||
node_js: | ||
- '4' | ||
- '6' | ||
dist: trusty | ||
before_install: | | ||
set -ev | ||
npm install -g npm | ||
npm config set @ibm:registry https://npm-registry.whitewater.ibm.com | ||
npm config set //npm-registry.whitewater.ibm.com/:_authToken ${NPM_TOKEN} | ||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | ||
sudo dpkg -i google-chrome*.deb | ||
install: | | ||
set -ev | ||
npm install 2>&1 | tee | ||
script: | | ||
set -ev | ||
export DISPLAY=:99.0 | ||
sh -e /etc/init.d/xvfb start | ||
npm test 2>&1 | tee | ||
deploy: | ||
provider: script | ||
script: npm run deploy 2>&1 | tee | ||
skip_cleanup: true | ||
on: | ||
all_branches: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"lerna": "2.0.0-beta.32", | ||
"packages": [ | ||
"packages/@ibm/*" | ||
], | ||
"version": "independent" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"devDependencies": { | ||
"lerna": "2.0.0-beta.32", | ||
"moment": "^2.17.1" | ||
}, | ||
"name": "@ibm/concerto", | ||
"description": "You must install [Lerna](https://lernajs.io) to build this multi-package repository.", | ||
"version": "0.2.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"postinstall": "npm run bootstrap", | ||
"bootstrap": "lerna bootstrap", | ||
"test": "lerna run test", | ||
"deploy": "./scripts/deploy.sh" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:Blockchain-WW-Labs/Concerto.git" | ||
}, | ||
"keywords": [ | ||
"blockchain", | ||
"hyperledger", | ||
"solutions" | ||
], | ||
"author": "IBM", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# Exit on first error, print all commands. | ||
set -ev | ||
|
||
# Grab the Concerto directory. | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" | ||
|
||
# Check that this is the right node.js version. | ||
if [ "${TRAVIS_NODE_VERSION}" != "" -a "${TRAVIS_NODE_VERSION}" != "4" ]; then | ||
echo Not executing as not running primary node.js version. | ||
exit 0 | ||
fi | ||
|
||
# Check that this is the main repository. | ||
if [[ "${TRAVIS_REPO_SLUG}" != Blockchain-WW-Labs* ]]; then | ||
echo "Skipping deploy; wrong repository slug." | ||
exit 0 | ||
fi | ||
|
||
# If this is not for a tagged (release) build, set the prerelease version. | ||
if [ -z "${TRAVIS_TAG}" ]; then | ||
lerna exec -- ${DIR}/scripts/timestamp.js package.json | ||
fi | ||
|
||
# Push the code to npm. | ||
if [ "${TRAVIS_BRANCH}" = "develop" ]; then | ||
|
||
# Publish with unstable tag. These are development builds. | ||
echo "Pushing with tag unstable" | ||
lerna exec -- npm publish --scope=@ibm --tag=unstable | ||
|
||
else | ||
|
||
# Publish with latest tag (default). These are release builds. | ||
echo "Pushing with tag develop" | ||
lerna exec -- npm publish --scope=@ibm | ||
|
||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env node | ||
/* | ||
* IBM Confidential | ||
* OCO Source Materials | ||
* IBM Concerto - Blockchain Solution Framework | ||
* Copyright IBM Corp. 2016 | ||
* The source code for this program is not published or otherwise | ||
* divested of its trade secrets, irrespective of what has | ||
* been deposited with the U.S. Copyright Office. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const moment = require('moment'); | ||
|
||
if (process.argv.length !== 3) { | ||
console.error('Usage: timestamp.js <package.json>'); | ||
process.exit(1); | ||
} | ||
|
||
let fileName = process.argv[2]; | ||
let fileContents = fs.readFileSync(fileName, 'utf8'); | ||
let file = JSON.parse(fileContents); | ||
|
||
let timestamp = moment().format('YYYYMMDDHHmmss'); | ||
|
||
file.version = file.version.replace(/-.*/, ''); | ||
file.version += '-' + timestamp; | ||
|
||
fileContents = JSON.stringify(file, null, 2); | ||
fs.writeFileSync(fileName, fileContents, 'utf8'); |