diff --git a/.travis.yml b/.travis.yml index 2af189eac5..5e6851241a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,18 +2,19 @@ dist: trusty language: node_js node_js: - '8' -# addons: -# chrome: stable -# before_install: -# - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & before_install: .travis/before_install.sh install: - npm install -after_success: .travis/after_success.sh -# script: lerna run lint && lerna run test +after_success: "npm run build-all" script: lerna run lint sudo: false deploy: + - + provider: script + script: "bash ./scripts/deploy.sh" + skip_cleanup: true + true: + branch: master - allow-empty-commit: true email: carbon@us.ibm.com diff --git a/.travis/after_success.sh b/.travis/after_success.sh deleted file mode 100755 index ad107421a9..0000000000 --- a/.travis/after_success.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -set -e - -npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN -q - -# This script builds all package bundles (for NPM) & demos (for gh-pages) -npm run build-all - -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - echo "We are in a pull request, not releasing" - exit 0 -fi - -if [[ $TRAVIS_BRANCH == 'master' ]]; then - # Should remove once lerna stops mistakenly - # adding package-lock.json to every package after npm install - git status - git stash - git checkout master - - # Git user info configs - git config --global user.email "carbon@us.ibm.com" - git config --global user.name "carbon-bot" - - # Add github token to git credentials - git config credential.helper "store --file=.git/credentials" - echo "https://${GH_TOKEN}:@github.com" > .git/credentials 2>/dev/null - - # Perform git & npm publish - git update-index --assume-unchanged `git diff --name-only` - - lerna publish --conventional-commits --yes --contents dist -fi - -if [[ echo $TRAVIS_BRANCH | grep "^v[0-9]\+\.[0-9]\+\.[0-9]\+\$" ]]; then - lerna publish from-git --contents dist -fi diff --git a/.travis/before_install.sh b/.travis/before_install.sh index 17bae7c1c0..f3ca6dd516 100755 --- a/.travis/before_install.sh +++ b/.travis/before_install.sh @@ -1,8 +1,5 @@ -#!/bin/bash -set -e -#!/bin/bash +#!/usr/bin/env bash -# Note: do not do set -x or the passwords will leak! +set -e -# @angular/cli should be removed when the angular dmeo project has been removed -npm install -g lerna@3.2.1 @storybook/cli @angular/cli rollup@0.67.3 +npm install -g lerna@3.2.1 diff --git a/package.json b/package.json index b4d2d57950..a5beb460cd 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,14 @@ "license": "Apache-2.0", "scripts": { "postinstall": "lerna bootstrap --hoist --no-ci", - "clean": "lerna clean", + "clean": "lerna clean && lerna run clean && rm -rf node_modules", "commit": "git-cz", "test": "lerna run test", "lint": "lerna run lint", "contributors:add": "all-contributors add", "contributors:generate": "all-contributors generate", - "build-all": "bash scripts/build-packages-and-demos.sh" + "build-all": "bash scripts/build-packages-and-demos.sh", + "build-all-demos": "bash scripts/build-demos.sh" }, "husky": { "hooks": { diff --git a/packages/angular/package.json b/packages/angular/package.json index a1780829f8..711aa981b9 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -7,7 +7,8 @@ "scripts": { "build": "ng-packagr -p package.json", "storybook": "start-storybook -p 9005 -c .storybook -s ./.storybook/assets", - "demo:build": "build-storybook -o demo/bundle/angular" + "demo:build": "build-storybook -o demo/bundle/angular", + "clean": "rm -rf dist demo/bundle" }, "repository": { "type": "git", @@ -36,7 +37,7 @@ "@angular/platform-browser": "6.1.0", "@angular/platform-browser-dynamic": "6.1.0", "@babel/core": "7.3.4", - "@storybook/angular": "5.0.3", + "@storybook/angular": "5.0.5", "@types/node": "8.5.2", "babel-loader": "8.0.5", "core-js": "2.6.5", diff --git a/packages/core/package.json b/packages/core/package.json index 60527850b6..cc41ace28b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,12 +2,6 @@ "name": "@carbon/charts", "version": "0.11.4", "description": "Carbon charting components", - "files": [ - "dist", - "index.js", - "CHANGELOG.md", - "README.md" - ], "scripts": { "demo:server": "webpack-dev-server --config webpack.config.js --watch", "demo:build": "webpack --config webpack.config.js && typedoc --out ./demo/bundle/documentation ./src/index.ts", @@ -16,7 +10,8 @@ "bundle:analyzer": "rm -rf dist && webpack --config webpack.build.js --env.bundleAnalyzer", "lint": "tslint -p tsconfig.json -c tslint.json", "test": "karma start --single-run", - "test:watch": "karma start --no-single-run" + "test:watch": "karma start --no-single-run", + "clean": "rm -rf dist demo/bundle" }, "repository": { "type": "git", diff --git a/packages/react/package.json b/packages/react/package.json index d9519e6637..7dbcb50fbc 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -3,18 +3,13 @@ "version": "0.11.4", "description": "Carbon charting components for React", "main": "index.js", - "files": [ - "bundle", - "index.js", - "CHANGELOG.md", - "README.md" - ], "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "npm run storybook", "build": "bash build.sh", "storybook": "start-storybook -p 9006 -c .storybook -s ./assets", - "demo:build": "build-storybook -o demo/bundle/react" + "demo:build": "build-storybook -o demo/bundle/react", + "clean": "rm -rf dist demo/bundle" }, "repository": { "type": "git", @@ -34,9 +29,9 @@ "react-dom": "^16.6.3" }, "devDependencies": { - "@storybook/addon-options": "4.0.7", - "@storybook/react": "4.0.7", - "@storybook/storybook-deployer": "2.3.0", + "@storybook/addon-options": "5.0.5", + "@storybook/react": "5.0.5", + "@storybook/storybook-deployer": "2.8.1", "babel-cli": "6.26.0", "babel-core": "6.26.0", "babel-loader": "7.1.2", diff --git a/packages/vue/package.json b/packages/vue/package.json index 518c7a1ef9..69b608e148 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -3,13 +3,6 @@ "version": "0.11.4", "description": "Carbon charting components for Vue", "main": "index.js", - "files": [ - "charts-vue.common.js", - "charts-vue.umd.js", - "charts-vue.umd.min.js", - "CHANGELOG.md", - "README.md" - ], "scripts": { "build": "bash build.sh", "lint": "vue-cli-service lint ./src/index.js", @@ -17,7 +10,8 @@ "demo:build": "build-storybook -o demo/bundle/vue", "ci-check": "yarn format:diff", "format": "prettier --write \"**/*.{scss,css,js,md,vue}\"", - "format:diff": "prettier --list-different \"**/*.{scss,css,js,md,vue}\"" + "format:diff": "prettier --list-different \"**/*.{scss,css,js,md,vue}\"", + "clean": "rm -rf dist demo/bundle" }, "dependencies": { "@carbon/charts": "^0.11.4", @@ -25,10 +19,10 @@ }, "devDependencies": { "@babel/core": "7.3.4", - "@storybook/addon-actions": "4.0.7", - "@storybook/addon-links": "4.0.7", - "@storybook/addons": "4.0.7", - "@storybook/vue": "4.0.7", + "@storybook/addon-actions": "5.0.5", + "@storybook/addon-links": "5.0.5", + "@storybook/addons": "5.0.5", + "@storybook/vue": "5.0.5", "@vue/cli-plugin-babel": "3.4.0", "@vue/cli-plugin-eslint": "3.4.0", "@vue/cli-service": "3.4.0", diff --git a/scripts/build-demos.sh b/scripts/build-demos.sh new file mode 100644 index 0000000000..d3c240cfa4 --- /dev/null +++ b/scripts/build-demos.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +# README: +# each package should build a dist folder that contains everything needed to publish that package +# including: +# - package.json +# - .js files and .d.ts files (no raw .ts files!) +# - README.md +# - and any specialty files + +# Generate all assets needed for push to gh-pages +mkdir -p pages +touch pages/.nojekyll +# echo "charts.carbondesignsystem.com" > pages/CNAME + + +# run the demo:build script in all packages +lerna run --parallel demo:build +# copy all the demos/{package name here} folders to the pages deploy directory +lerna exec -- cp -a demo/bundle/. \$LERNA_ROOT_PATH/pages diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 0000000000..1d8d2e9dd7 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e # exit with nonzero exit code if anything fails + +npm run build-all + +# Should remove once lerna stops mistakenly +# adding package-lock.json to every package after npm install +rm -rf **/package-lock.json + +lerna publish --conventional-commits --yes --github-release --contents dist diff --git a/scripts/netlify.sh b/scripts/netlify.sh index 99c70db3cb..dac015cf52 100755 --- a/scripts/netlify.sh +++ b/scripts/netlify.sh @@ -3,5 +3,5 @@ npm i ./.travis/before_install.sh -# This script builds all package bundles (for NPM) & demos (for gh-pages) -npm run build-all +# This script builds all demos for netlify +npm run build-all-demos