Skip to content

Commit

Permalink
chore: enhanced scripting workflow (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzempel authored Apr 24, 2020
1 parent 8ff7359 commit 4b17136
Show file tree
Hide file tree
Showing 12 changed files with 1,085 additions and 257 deletions.
10 changes: 2 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ jobs:
<<: *executor
steps:
- *attach_workspace
- run: yarn lint
- run: yarn format:all
- run: yarn tsc
- run: yarn test:all --coverage --runInBand
- run: yarn test:ci --runInBand
- run: '[ $COVERALLS_REPO_TOKEN ] && yarn coveralls < demo/coverage/lcov.info || true'
- *persist_to_workspace

Expand All @@ -50,7 +47,7 @@ jobs:
steps:
- *attach_workspace
- run: yarn lerna run build:demo --concurrency=2 # prevent out-of-memory
- run: utils/scripts/gh-pages.js
- run: utils/scripts/deploy.js

publish:
<<: *executor
Expand All @@ -70,9 +67,6 @@ workflows:
requires:
- test
context: maintainer
filters:
branches:
only: master
- publish:
requires:
- test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_modules
.changelog
.vscode
.netlify
.env

# Package specific
packages/**/dist
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
"lint:css": "stylelint '{packages,utils}/**/*.{js,ts,tsx}' '!packages/**/*.spec.{js,ts,tsx}' '!packages/**/dist/**'",
"lint:js": "eslint packages/*/src/ utils/ --ext js,ts,tsx --max-warnings 0",
"lint:md": "markdownlint README.md docs/*.md packages/*/examples/*.md packages/*/src/**/*.md packages/*/README.md",
"new": "utils/scripts/create-package.js",
"new": "utils/scripts/new.js",
"prepare": "yarn build",
"start": "utils/scripts/scoped-npm-command.js --script start",
"start:demo": "yarn build:demo && live-server demo",
"tag": "utils/scripts/version.sh",
"tag": "utils/scripts/tag.js",
"test": "yarn test:all --watch",
"test:all": "jest --config=utils/test/jest.config.js",
"test:ci": "yarn lint && yarn format:all && yarn tsc && yarn test:all --coverage",
"preversion": "yarn test:ci",
"version": "yarn run build && git add -A"
},
"devDependencies": {
Expand Down Expand Up @@ -52,6 +54,7 @@
"@typescript-eslint/parser": "2.27.0",
"@zendeskgarden/css-bedrock": "7.0.35",
"@zendeskgarden/eslint-config": "11.0.3",
"@zendeskgarden/scripts": "0.1.5",
"@zendeskgarden/stylelint-config": "12.0.1",
"@zendeskgarden/svg-icons": "6.15.0",
"acorn-jsx": "5.2.0",
Expand All @@ -66,6 +69,7 @@
"core-js": "3.6.5",
"coveralls": "3.0.11",
"enhanced-resolve": "4.1.1",
"envalid": "6.0.1",
"eslint": "6.8.0",
"eslint-config-prettier": "6.10.1",
"eslint-loader": "4.0.0",
Expand All @@ -76,10 +80,8 @@
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-react": "7.19.0",
"eslint-plugin-react-hooks": "3.0.0",
"fs-extra": "9.0.0",
"execa": "4.0.0",
"fuzzy": "0.1.3",
"get-stdin": "7.0.0",
"gh-pages": "2.2.0",
"github-markdown-css": "4.0.0",
"glob": "7.1.6",
"handlebars": "4.7.6",
Expand All @@ -92,14 +94,13 @@
"jest": "25.3.0",
"jest-styled-components": "6.3.4",
"lerna": "3.20.2",
"lerna-changelog": "1.0.1",
"lint-staged": "10.1.3",
"live-server": "1.2.1",
"markdown-loader": "5.1.0",
"markdownlint-cli": "0.22.0",
"micromatch": "4.0.2",
"mockdate": "2.0.5",
"node-fetch": "2.6.0",
"ora": "4.0.3",
"prettier": "2.0.4",
"prettier-package-json": "2.1.3",
"react": "16.13.1",
Expand All @@ -117,12 +118,12 @@
"rollup-plugin-license": "2.0.0",
"rollup-plugin-size-snapshot": "0.11.0",
"rollup-plugin-typescript2": "0.27.0",
"simple-git": "1.132.0",
"styled-components": "4.4.1",
"stylelint": "13.3.1",
"stylelint-config-styled-components": "0.1.1",
"stylelint-order": "4.0.0",
"stylelint-processor-styled-components": "1.10.0",
"temp": "0.9.1",
"ts-jest": "25.3.1",
"ts-loader": "6.2.2",
"typescript": "3.8.3",
Expand Down
45 changes: 45 additions & 0 deletions utils/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env node

/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/

const envalid = require('envalid');
const garden = require('@zendeskgarden/scripts');
const path = require('path');

envalid.cleanEnv(process.env, {
GITHUB_TOKEN: envalid.str(),
NETLIFY_SITE_ID: envalid.str(),
NETLIFY_TOKEN: envalid.str()
});

(async () => {
const branch = await garden.githubBranch();
const dir = path.resolve(__dirname, '..', '..', 'demo');
let url;

if (branch === 'master') {
url = await garden.githubPages({ dir });
} else {
const repository = await garden.githubRepository();
const commit = await garden.githubCommit();
const message = `https://github.com/${repository.owner}/${repository.repo}/commit/${commit}`;
const command = async () => {
const result = await garden.netlifyDeploy({
dir,
message
});

return result;
};

url = await garden.githubDeploy({ command });
}

/* eslint-disable-next-line no-console */
console.log(`Deployed to ${url}`);
})();
38 changes: 0 additions & 38 deletions utils/scripts/get-cids.sh

This file was deleted.

20 changes: 0 additions & 20 deletions utils/scripts/gh-pages.js

This file was deleted.

48 changes: 0 additions & 48 deletions utils/scripts/github-release.js

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 4b17136

Please sign in to comment.