Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
ci(Build And Deploy): Uses danger to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
brad-decker committed Jun 4, 2018
1 parent b8f8f9a commit 8972604
Show file tree
Hide file tree
Showing 6 changed files with 460 additions and 35 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ jobs:
- checkout
- restore_cache:
keys:
- styled-material-components-{{ .Branch }}-{{ checksum "yarn.lock" }}
- styled-material-components-{{ checksum "yarn.lock" }}-{{ .Branch }}
- styled-material-components-{{ checksum "yarn.lock" }}
- run: yarn install
- save_cache:
key: styled-material-components-{{ .Branch }}-{{ checksum "yarn.lock" }}
key: styled-material-components-{{ checksum "yarn.lock" }}-{{ .Branch }}
paths:
- "~/.yarn-cache"
- "/node_modules"
- run: yarn run lint
- run: yarn danger ci

31 changes: 14 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Welcome to Styled Material Components! We're so glad you're here. Please read th
0. [Resources and Terminology]

## Issues and Contributions
The easiest way to start contributing is to check out our current open [Issues](https://github.com/ConciergeAuctions/styled-material-components/issues). Here you will find open issues that need to be implemented including but not limited to: features, enhancements, bug fixes, discussions, and questions. Issues we've identified as possible good places to start for first time contributors are labeled as "good first issue." Feel free to assign yourself to issues you are interested in tackling and open a PR when you feel like your code satisfies the open issue.
The easiest way to start contributing is to check out our current open [Issues](https://github.com/ConciergeAuctions/styled-material-components/issues). Here you will find open issues that need to be implemented including but not limited to: features, enhancements, bug fixes, discussions, and questions. Issues we've identified as possible good places to start for first time contributors are labeled as "good first issue." Feel free to assign yourself to issues you are interested in tackling and open a PR when you feel like your code satisfies the open issue.

Additionally, there are also many ways you can directly contribute, such as:
Additionally, there are also many ways you can directly contribute, such as:

* Fix typos, inconsistencies, or inaccuracies in the documentation
* Comment and join discussions on existing Issues and Pull Requests
Expand All @@ -29,12 +29,9 @@ Additionally, there are also many ways you can directly contribute, such as:
0. Open http://localhost:8081 in your web browser
0. Make changes to components in src/
0. Add the components to pages in /pages (Pages are mapped to routes for our documentation)
0. Add a link to your new component page in index.js
0. Install [now](https://zeit.co/now#whats-now) if you do not already have it installed.
0. Run `yarn now-build` to get a shareable link to the updated docs copied to your
clipboard.
0. Open a PR, making sure to include the link to the updated docs so others can
see your wonderful changes.
0. Add a link to your new component page in index.js
0. Open a PR
0. Our danger script will build your application and post a link as a comment to view your work!
0. Profit :D

## Contribution review process
Expand All @@ -43,11 +40,11 @@ This repo is currently maintained by the engineering team at Merlin Labs. If you

## Community

Discussions about Styled Material Components take place on this repository's [Issues](https://github.com/ConciergeAuctions/styled-material-components/issues) and [Pull Requests](https://github.com/ConciergeAuctions/styled-material-components/pulls) sections.
Discussions about Styled Material Components take place on this repository's [Issues](https://github.com/ConciergeAuctions/styled-material-components/issues) and [Pull Requests](https://github.com/ConciergeAuctions/styled-material-components/pulls) sections.

We also have an active [#smc Slack Channel](https://merlin-labs.slack.com/messages/C8SU9KJTG/details/), and would love for you to join the discussion there. If you are having trouble accessing the channel please reach out to @ashwoodall to request access.
We also have an active [#smc Slack Channel](https://merlin-labs.slack.com/messages/C8SU9KJTG/details/), and would love for you to join the discussion there. If you are having trouble accessing the channel please reach out to @ashwoodall to request access.

Anyone is welcome to join these conversations.
Anyone is welcome to join these conversations.

Wherever possible, do not take these conversations to private channels, including contacting the maintainers directly. Keeping communication public means everybody can benefit and learn from the conversation. Please read more about conversation guidelines at our [Code of Conduct](https://github.com/ConciergeAuctions/styled-material-components/blob/master/CODE_OF_CONDUCT.md)

Expand All @@ -64,15 +61,15 @@ Inspired by the component-based architecture of React, Max Stoiber and Glenn Mad
* **[design language / design vocabulary](https://en.wikipedia.org/wiki/Design_language)**: a set of design guidelines or principles that allow designers to create thematically consistent user interfaces.
* **[Material Design](https://material.io/)**
is the name of a design language created by Google. Many of the Google applications you probably use (Gmail, YouTube, Inbox, Google Maps and many others) have implemented the Material Design guidelines.
* **[material.io](https://material.io/)**
* **[material.io](https://material.io/)**
is the home page for Google's Material Design system.
* **[Material Components](https://material.io/components/)**
* **[Material Components](https://material.io/components/)**
is the name of Google's own UI implementation of their Material Design spec.
* **[material.io/components](https://material.io/components/)**
is the home page for Google's Material Components.
is the home page for Google's Material Components.
* **[Material UI](http://www.material-ui.com/#/)**
is a library that implements Google's Material Design, crafted in React components. If you want to create a React project using the popular Material Design guidelines, Material UI provides a component-based library that is designed to be used in a React application.
is a library that implements Google's Material Design, crafted in React components. If you want to create a React project using the popular Material Design guidelines, Material UI provides a component-based library that is designed to be used in a React application.
* **[Styled Material Components](https://github.com/ConciergeAuctions/styled-material-components)**
(this library) creates a fresh implementation of Material Components, using Styled Components.
(this library) creates a fresh implementation of Material Components, using Styled Components.
* **[styled-material-components](https://www.npmjs.com/package/styled-material-components)**
is the npm package for Styled Material Components.
is the npm package for Styled Material Components.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Styled Material Components
# [Styled Material Components](https://styled-material-components.com/)

[Styled Components](https://www.styled-components.com) inspired library that implements Material Design for stress free React Application scaffolding.

Expand All @@ -20,7 +20,7 @@

## Getting Started
* Fork the repo
* Run:
* Run:
```
yarn install
yarn run dev
Expand All @@ -37,7 +37,7 @@ The components in this library are Styled Components and have full access to the
### Theme Provider
Similar to the Styled Components ThemeProvider (its a thin wrapper around it) except that it provides a default theme that matches material design's default theme. You can provide a custom theme here with any option from src/theme/defaultTheme.js overwritten. You can nest ThemeProviers just like with StyledComponents to overwrite portions of the theme for sections of your application

### Component Example
### Component Example
#### Button
This component is for creating a material design button. It has props that match the documentation from [Material Components](https://github.com/material-components/material-components-web)

Expand Down
65 changes: 65 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const { message, danger } = require('danger');
const { exec } = require('shelljs');
const R = require('ramda');

const STDOUT = R.lensProp('stdout');
const NAME = 'styled-material-components';
const PR_URL = /https:\/\/styled-material-components-(?:[^-]*)-([^.]+)\.now\.sh/;

const getDeployUrl = R.compose(
R.head,
R.match(PR_URL),
R.view(STDOUT),
targetApp => exec(`yarn now -n ${targetApp} -d docs/ -t ${process.env.NOW_TOKEN}`),
);

const branch = process.env.CIRCLE_BRANCH || danger.github.pr.head.label;
const appName = branch === 'master' ? NAME : `${NAME}-pr-${danger.github.pr.number || 0}`;

// Get the modified components in the PR
const getModifiedComponents = R.compose(
R.uniq,
R.map(
R.compose(
R.replace('.js', ''),
R.nth(1),
R.match(/\/components\/([^/]+)/)
),
),
R.filter(R.test(/\/components\//))
);

const modifiedComponents = getModifiedComponents(danger.git.modified_files);

// Build the app
exec('yarn export');

// Deploy the app
const deployURL = getDeployUrl(appName);

let link = `https://${appName}.now.sh`;

// Alias the link
if (branch === 'master') {
exec(`yarn now alias ${deployURL} styled-material-components.com -t ${process.env.NOW_TOKEN}`);
link = 'https://styled-material-components.com';
} else {
exec(`yarn now alias ${deployURL} ${appName} -t ${process.env.NOW_TOKEN}`);
}

let markdown = '';

if (modifiedComponents.length > 0) {
markdown += `
### Modified Components
* ${modifiedComponents.join('\n * ')}
`;
}

markdown += `
### PR Application
* [${appName}](${link})
`;

message(markdown);
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"prepublish": "yarn test && yarn build",
"now-build": "yarn export && cd docs && now",
"prepush": "yarn lint",
"start": "next -p 8081",
"postcommit": "bash ./scripts/update-authors.sh"
},
"repository": {
Expand All @@ -32,6 +33,7 @@
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.0",
"platform": "^1.3.5",
"ramda": "^0.25.0",
"react-tunnels": "^1.0.2",
"recompose": "^0.26.0",
"respondable": "^1.0.1",
Expand All @@ -49,6 +51,7 @@
"babel-plugin-inline-dotenv": "^1.1.2",
"babel-plugin-relay": "^1.6.0",
"babel-plugin-styled-components": "^1.5.1",
"danger": "^3.7.15",
"eslint": "^4.19.1",
"eslint-config-concierge-auctions-react": "^0.0.7",
"eslint-import-resolver-webpack": "^0.9.0",
Expand All @@ -62,9 +65,10 @@
"flow-typed": "^2.2.3",
"husky": "^0.14.3",
"next": "^6.0.3",
"now": "^11.1.16",
"now": "^11.2.1",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"shelljs": "^0.8.2",
"stylelint": "^9.1.1",
"stylelint-config-standard": "^18.1.0",
"stylelint-config-styled-components": "^0.1.1",
Expand Down
Loading

0 comments on commit 8972604

Please sign in to comment.