Skip to content

Commit

Permalink
Merge pull request #1916 from storybooks/yarn-master
Browse files Browse the repository at this point in the history
 Use yarn workspaces on master
  • Loading branch information
Hypnosphi authored Sep 30, 2017
2 parents 6ecd78a + 57fbf45 commit 8e84ec8
Show file tree
Hide file tree
Showing 41 changed files with 21,507 additions and 277 deletions.
85 changes: 34 additions & 51 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,28 @@ defaults: &defaults
version: 2
dependencies:
pre:
- npm install -g npm
- yarn global add npm
jobs:
validate:
<<: *defaults
steps:
- run:
name: "Checking Versions"
command: |
node --version
npm --version
yarn --version
build:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- save_cache:
key: root-dependencies-{{ checksum "package.json" }}
paths:
- node_modules
- restore_cache:
keys:
- package-dependencies-{{ checksum "package.json" }}
- package-dependencies-
- run:
name: "Bootstrapping"
command: |
npm run bootstrap -- --all
yarn bootstrap --core --docs --reactnative --reactnativeapp
- save_cache:
key: package-dependencies-{{ checksum "package.json" }}
key: dependencies-{{ checksum "yarn.lock" }}
paths:
- node_modules
- app/**/node_modules
- docs/**/node_modules
- examples/**/node_modules
Expand All @@ -54,111 +38,111 @@ jobs:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
npm run bootstrap -- --core
yarn bootstrap --core
- run:
name: "Build react kitchen-sink"
command: |
cd examples/cra-kitchen-sink
yarn build-storybook
yarn storybook -- --smoke-test
yarn storybook --smoke-test
- run:
name: "Build vue kitchen-sink"
command: |
cd examples/vue-kitchen-sink
yarn build-storybook
yarn storybook -- --smoke-test
yarn storybook --smoke-test
example-react-native:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping packages"
command: |
npm run bootstrap -- --core --reactnative --reactnativeapp
yarn bootstrap --core --reactnative --reactnativeapp
- run:
name: "Running React-Native example"
command: |
cd examples/react-native-vanilla
yarn storybook -- --smoke-test
yarn storybook --smoke-test
- run:
name: "Running React-Native-App example"
command: |
cd examples/crna-kitchen-sink
yarn storybook -- --smoke-test
yarn storybook --smoke-test
docs:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
npm run bootstrap -- --docs
yarn bootstrap --docs
- run:
name: "Running docs"
command: |
npm run docs:build
yarn docs:build
lint:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
name: "Linting"
command: |
npm run lint
yarn lint
unit-test:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
npm run bootstrap -- --core --reactnative
yarn bootstrap --core --reactnative
- run:
name: "Unit testing"
command: |
npm run test -- --coverage -i
npm run coverage
yarn test --coverage -i
yarn coverage
deploy:
<<: *defaults
steps:
Expand All @@ -170,7 +154,6 @@ workflows:
version: 2
build_accept_deploy:
jobs:
- validate
- build
- example-kitchen-sinks
- example-react-native
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ coverage/
*.lerna_backup
build
packages/examples/automated-*
yarn.lock
/**/LICENSE
docs/public
packs/*.tgz
Expand Down
36 changes: 19 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Thanks for your interest in improving Storybook! We are a community-driven proje

Please review this document to help to streamline the process and save everyone's precious time.

This repo uses yarn workspaces, so you should `[email protected]` or higher as package manager. See [installation guide](https://yarnpkg.com/en/docs/install).

## Issues

No software is bug free. So, if you got an issue, follow these steps:
Expand All @@ -18,25 +20,25 @@ No software is bug free. So, if you got an issue, follow these steps:

### Testing against `master`

To test your project against the current latest version of storybook, you can clone the repository and link it with `npm`. Try following these steps:
To test your project against the current latest version of storybook, you can clone the repository and link it with `yarn`. Try following these steps:

1. Download the latest version of this project, and build it:

```sh
git clone https://github.com/storybooks/storybook.git
cd storybook
npm install
npm run bootstrap -- --core
yarn install
yarn bootstrap --core
```

2. Link `storybook` and any other required dependencies:

```sh
cd app/react
npm link
yarn link

cd <your-project>
npm link @storybook/react
yarn link @storybook/react

# repeat with whichever other parts of the monorepo you are using.
```
Expand All @@ -51,13 +53,13 @@ A good way to do that is using the example `cra-kitchen-sink` app embedded in th
# Download and build this repository:
git clone https://github.com/storybooks/storybook.git
cd storybook
npm install
npm run bootstrap -- --core
yarn install
yarn bootstrap --core

cd examples/cra-kitchen-sink

# make changes to try and reproduce the problem, such as adding components + stories
npm start storybook
yarn start storybook

# see if you can see the problem, if so, commit it:
git checkout "branch-describing-issue"
Expand All @@ -71,7 +73,7 @@ git push -u <your-username> master

If you follow that process, you can then link to the github repository in the issue. See <https://github.com/storybooks/storybook/issues/708#issuecomment-290589886> for an example.

**NOTE**: If your issue involves a webpack config, create-react-app will prevent you from modifying the _app's_ webpack config, however you can still modify storybook's to mirror your app's version of storybook. Alternatively, use `npm run eject` in the CRA app to get a modifiable webpack config.
**NOTE**: If your issue involves a webpack config, create-react-app will prevent you from modifying the _app's_ webpack config, however you can still modify storybook's to mirror your app's version of storybook. Alternatively, use `yarn eject` in the CRA app to get a modifiable webpack config.

## Pull Requests (PRs)

Expand All @@ -82,7 +84,7 @@ We welcome your contributions. There are many ways you can help us. This is few
- Work on [API](https://github.com/storybooks/storybook/labels/enhancement%3A%20api), [Addons](https://github.com/storybooks/storybook/labels/enhancement%3A%20addons), [UI](https://github.com/storybooks/storybook/labels/enhancement%3A%20ui) or [Webpack](https://github.com/storybooks/storybook/labels/enhancement%3A%20webpack) use enhancements and new [features](https://github.com/storybooks/storybook/labels/feature%20request).
- Add more [tests](https://codecov.io/gh/storybooks/storybook/tree/master/packages) (specially for the [UI](https://codecov.io/gh/storybooks/storybook/tree/master/packages/storybook-ui/src)).

Before you submit a new PR, make you to run `npm test`. Do not submit a PR if tests are failing. If you need any help, create an issue and ask.
Before you submit a new PR, make you to run `yarn test`. Do not submit a PR if tests are failing. If you need any help, create an issue and ask.

### Reviewing PRs

Expand Down Expand Up @@ -136,7 +138,7 @@ This project written in ES2016+ syntax so, we need to transpile it before use.
So run the following command:

```sh
npm run dev
yarn dev
```

This will watch files and transpile in watch mode.
Expand All @@ -146,14 +148,14 @@ This will watch files and transpile in watch mode.
First of all link this repo with:

```sh
npm link
yarn link
```

In order to test features you add, you may need to link the local copy of this repo.
For that we need a sample project. Let's create it.

```sh
npm install --global create-react-app getstorybook
yarn global add create-react-app getstorybook
create-react-app my-demo-app
cd my-demo-app
getstorybook
Expand All @@ -165,12 +167,12 @@ getstorybook
Then link storybook inside the sample project with:

```sh
npm link @storybook/react
yarn link @storybook/react
```

### Getting Changes

After you've done any change, you need to run the `npm run storybook` command every time to see those changes.
After you've done any change, you need to run the `yarn storybook` command every time to see those changes.

## Release Guide

Expand Down Expand Up @@ -212,7 +214,7 @@ yarn bootstrap --reset --core
```sh
# publish and tag the release
npm run publish -- --concurrency 1 --npm-tag=alpha
yarn run publish --concurrency 1 --npm-tag=alpha

# update the release page
open https://github.com/storybooks/storybook/releases
Expand All @@ -236,7 +238,7 @@ git commit -m "Changelog for vX.Y"
yarn bootstrap --reset --core

# publish and tag the release
npm run publish -- --concurrency 1
yarn run publish --concurrency 1

# update the release page
open https://github.com/storybooks/storybook/releases
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,30 @@ We welcome contributions to Storybook!

### Development scripts

#### `npm run bootstrap`
#### `yarn bootstrap`

> Installs package dependencies and links packages together - using lerna
#### `npm run publish`
#### `yarn run publish`

> Push a release to git and npm
> will ask for version in interactive mode - using lerna.
#### `npm run lint`
#### `yarn lint`

> boolean check if code conforms to linting rules - uses remark & eslint
- `npm run lint:js` - will check js
- `npm run lint:md` - will check markdown + code samples
- `yarn lint:js` - will check js
- `yarn lint:md` - will check markdown + code samples

- `npm run lint:js -- --fix` - will automatically fix js
- `yarn lint:js --fix` - will automatically fix js
- `npm run lint:md -- -o` - will automatically fix markdown

#### `npm run test`
#### `yarn test`

> boolean check if unit tests all pass - uses jest
- `npm run test:watch` - will run tests in watch-mode
- `yarn test:watch` - will run tests in watch-mode

### Backers

Expand Down
2 changes: 1 addition & 1 deletion addons/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"scripts": {
"deploy-storybook": "storybook-to-ghpages",
"prepublish": "node ../../scripts/prepublish.js",
"prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 9001"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion addons/centered/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Muhammed Thanish <[email protected]>",
"main": "dist/index.js",
"scripts": {
"prepublish": "node ../../scripts/prepublish.js"
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"global": "^4.3.2"
Expand Down
Loading

0 comments on commit 8e84ec8

Please sign in to comment.