Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): refactor deploy and update package.jsons #223

Merged
merged 3 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 0 additions & 37 deletions .travis/after_success.sh

This file was deleted.

9 changes: 3 additions & 6 deletions .travis/before_install.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
5 changes: 3 additions & 2 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 2 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
15 changes: 5 additions & 10 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
18 changes: 6 additions & 12 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,26 @@
"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",
"storybook": "start-storybook -p 6006",
"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",
"vue": "2.5.21"
},
"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",
Expand Down
22 changes: 22 additions & 0 deletions scripts/build-demos.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions scripts/netlify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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