Skip to content

Commit

Permalink
feat(releases): update scripts to automate build and publishing to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschussheim committed Oct 17, 2017
1 parent c5c453b commit 05889cf
Show file tree
Hide file tree
Showing 10 changed files with 858 additions and 53 deletions.
9 changes: 0 additions & 9 deletions .flowconfig

This file was deleted.

7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
sudo: false
language: node_js
cache: yarn
notifications:
email: false
branches:
only: master
node_js:
- '8'
install: yarn install
script:
- npm run build
after_success:
- npm run semantic-release
branches:
only: master
43 changes: 26 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
# prop-styles

[![Build Status](https://travis-ci.org/peterschussheim/prop-styles.svg?branch=master)](https://travis-ci.org/peterschussheim/prop-styles)
[![Travis](https://img.shields.io/travis/peterschussheim/prop-styles.svg?style=flat-square)](https://travis-ci.org/peterschussheim/prop-styles)

Utility to make it easier to create a glamorous component which accepts props to enable/disable certain styles.

---

- [prop-styles](#prop-styles)
- [Why](#why)
- [This Solution](#this-solution)
- [Installation](#installation)
- [Usage](#usage)
- [Installation](#installation)
- [Example demonstrating a component that accepts prop 'flags'](#example-demonstrating-a-component-that-accepts-prop-flags)
- [Contributing](#contributing)
- [Notes](#notes)
- [Example](#example)
- [Inspiration](#inspiration)
- [License](#license)

## Why

// TODO
I like implementing and using React components using a code style where during component usage, a prop can be added as a 'flag', rather than relying on ternaries to handle the logic. In my opinion, this leads to improved legibility and has the potential to reduce typos.

## Usage
Credit for the original source goes to [Kent C. Dodds](https://twitter.com/kentcdodds) who [was kind enough to post a snippet](https://codesandbox.io/s/AGRRMl63) to easily enable developers to use this style with [💄`glamorous`💄](https://glamorous.rocks).

## This Solution

Exposes a function, `propStyles` that accepts an object where the key is a prop and the value
are the styles that should be applied if that prop is
passed. Returns a **function** which you pass to a
`glamorousComponentFactory`.

### Installation
## Installation

This package is distributed via [npm](https://www.npmjs.com/) which is bundled with [node](https://nodejs.org/en/) and should be installed as one of your project's `dependencies`:

`yarn add prop-styles` or `npm install -s prop-styles`

### Example demonstrating a component that accepts prop 'flags'
## Usage

### Example

[Live demo](https://codesandbox.io/s/92m6q0krqr)

```javascript
import React from "react";
import { render } from "react-dom";
import glamorous, { ThemeProvider } from "glamorous";
import { propStyles } from "prop-styles";
import propStyles from "prop-styles";

const heading = {
display: "block",
Expand Down Expand Up @@ -91,14 +103,11 @@ function App() {
render(<App />, document.getElementById("root"));
```

## Contributing

// TODO

## Notes
## Inspiration

- For the sake of simplicity, the data is contained in a JSON file.
- This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
- [Kent C. Dodds](https://twitter.com/kentcdodds) who [was kind enough to post this snippet](https://codesandbox.io/s/AGRRMl63)
- [Ryan Florence](https://twitter.com/ryanflorence)
- [reactpatterns.com](http://reactpatterns.com/#style-component)

## License

Expand Down
8 changes: 4 additions & 4 deletions TODOS.tasks
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
☐ add tests
☐ Automate releases using `semantic-release`
☐ exclude /src from npm package
☐ add explaination in README of why I like this style
☐ add inspiration sources
✔ Automate releases using `semantic-release` @done (10/17/2017, 2:32:27 PM)
✔ exclude /src from npm package @done (10/17/2017, 2:32:24 PM)
✔ Setup continuous integration @done (10/17/2017, 1:46:37 PM)
✔ Use `babel` for build process @done (10/17/2017, 1:46:30 PM)
✔ export a `default` module @done (2017-10-17 10:36:48)
✔ use `commitizen` @done (2017-10-17 10:37:05)
☐ add explaination in README of why I like this style
☐ add inspiration sources
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
"name": "prop-styles",
"version": "0.0.0-semantically-released",
"description": "Utility to create a glamorous component which accepts props to enable/disable certain styles.",
"author": "Peter Schussheim <peter@schussheim.com> (https://peterschussheim.com/)",
"license": "AGPL-3.0",
"main": "lib/index.js",
"scripts": {
"build": "babel src -d lib",
"prebuild": "rimraf lib",
"build": "babel --copy-files --out-dir lib src",
"start": "yarn build",
"commit": "git-cz",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
Expand All @@ -19,8 +22,6 @@
"keywords": [
"styles"
],
"author": "Peter Schussheim <peter@schussheim.com> (https://peterschussheim.com/)",
"license": "AGPL-3.0",
"bugs": {
"url": "https://github.com/peterschussheim/prop-styles/issues"
},
Expand All @@ -32,7 +33,7 @@
"babel-register": "6.26.0",
"commitizen": "2.9.6",
"cz-conventional-changelog": "2.0.0",
"flow-bin": "0.57.3",
"rimraf": "2.6.2",
"semantic-release": "^8.2.0"
},
"czConfig": {
Expand Down

0 comments on commit 05889cf

Please sign in to comment.