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

Yarn workspaces #1810

Merged
merged 27 commits into from
Sep 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4d10a55
Introduce yarn workspaces
Hypnosphi Sep 6, 2017
adb20c6
Add export PATH
Hypnosphi Sep 6, 2017
dc0bd90
Merge remote-tracking branch 'upstream/release/3.3' into yarn-workspaces
Hypnosphi Sep 6, 2017
2486947
update lockfile
Hypnosphi Sep 6, 2017
b4d9ee0
add BASH_ENV
Hypnosphi Sep 6, 2017
d22f209
add BASH_ENV
Hypnosphi Sep 6, 2017
cd7472a
CI: Temporarily disable all steps but lint
Hypnosphi Sep 6, 2017
51363c2
Enable all the steps back, extract environment into defaults
Hypnosphi Sep 6, 2017
78a42a8
Use --cwd flag for bootstrapping docs
Hypnosphi Sep 6, 2017
2308e98
Use yarn scripts where possible, omitting extra `--` because now we can
Hypnosphi Sep 6, 2017
fee27b5
Update documentation
Hypnosphi Sep 6, 2017
6d37521
Fix lerna.json
Hypnosphi Sep 6, 2017
d846b0c
Merge branch 'release/3.3' into yarn-workspaces
Hypnosphi Sep 6, 2017
5d8e07e
CI: Remove "Install root dependencies" phase where possible, as it's …
Hypnosphi Sep 6, 2017
75b0076
Merge branch 'release/3.3' into yarn-workspaces
Hypnosphi Sep 6, 2017
181878d
CI: use yarn nightly in docs task
Hypnosphi Sep 6, 2017
cc9ab25
Merge branch 'release/3.3' into yarn-workspaces
Hypnosphi Sep 7, 2017
5382fcb
IMPROVE yarn workspaces setup
ndelangen Sep 7, 2017
8df6f4d
CHANGE package.json.engines
ndelangen Sep 7, 2017
fe9ee4e
CI: use latest yarn instead of nightly. Cache all the dependencies to…
Hypnosphi Sep 7, 2017
38011e8
CI: bring back install phase, as it's needed for bootstrap script
Hypnosphi Sep 8, 2017
f343861
bootstrap: use `yarn install` directly
Hypnosphi Sep 8, 2017
f3046d5
CI: bootstrap --core isn't needed for react-native examples, `npm pac…
Hypnosphi Sep 8, 2017
824bbd6
Replace the deprecated `prepublish` script with `prepare`
Hypnosphi Sep 8, 2017
11298bf
Revert "CI: bootstrap --core isn't needed for react-native examples, …
Hypnosphi Sep 8, 2017
088c5f8
Merge branch 'release/3.3' into yarn-workspaces
Hypnosphi Sep 8, 2017
bd31e8b
Merge remote-tracking branch 'upstream/release/3.3' into yarn-workspaces
Hypnosphi Sep 8, 2017
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
105 changes: 57 additions & 48 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,38 @@ defaults: &defaults
working_directory: /tmp/storybook
docker:
- image: node:8
environment:
BASH_ENV: ~/.bashrc

version: 2
dependencies:
pre:
- yarn global add npm
jobs:
validate:
<<: *defaults
steps:
- run:
name: "Checking Versions"
command: |
node --version
npm --version
yarn --version
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn version won't print the correct version anymore, This script isn't providing value really.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe comment it instead? To reenable once docker image gets updated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, it's really not useful the info is in the logs anyway.

build:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install latest yarn version"
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s
- 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: |
yarn bootstrap -- --all
yarn bootstrap --core --docs --reactnative --reactnativeapp
Copy link
Member Author

@Hypnosphi Hypnosphi Sep 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was wrong with --all?
Oh I see, the reset step would remove the cache

- 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,70 +44,82 @@ jobs:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install latest yarn version"
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
yarn 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 latest yarn version"
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s
- run:
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping packages"
command: |
yarn 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 latest yarn version"
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s
- run:
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
yarn bootstrap -- --docs
yarn bootstrap --docs
- run:
name: "Running docs"
command: |
Expand All @@ -128,10 +130,14 @@ jobs:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install latest yarn version"
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
Expand All @@ -144,20 +150,24 @@ jobs:
- checkout
- restore_cache:
keys:
- root-dependencies-{{ checksum "package.json" }}
- root-dependencies-
- dependencies-{{ checksum "yarn.lock" }}
- dependencies-
- run:
name: "Install latest yarn version"
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s
- run:
name: "Install root dependencies"
name: "Install dependencies"
command: |
yarn install
- run:
name: "Bootstrapping"
command: |
yarn bootstrap -- --core --reactnative
yarn bootstrap --core --reactnative
- run:
name: "Unit testing"
command: |
yarn test -- --all --coverage --runInBand
yarn test --all --coverage --runInBand
yarn coverage
deploy:
<<: *defaults
Expand All @@ -170,7 +180,6 @@ workflows:
version: 2
build_accept_deploy:
jobs:
- validate
- build
- example-kitchen-sinks
- example-react-native
Expand All @@ -182,4 +191,4 @@ workflows:
# requires:
# - lint
# - unit-test
# - docs
# - docs
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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 guide assumes you're using `yarn` as package manager. You may have some success using `npm` as well, but there are chances you'll get wrong versions of root dependencies in that case (we only commit `yarn.lock` to the repo).
This repo uses yarn workspaces, so you should `[email protected]` or higher as package manager. See [installation guide](<>).

## Issues

Expand Down Expand Up @@ -35,7 +35,7 @@ The bootstrap command will ask which sections of the codebase you want to bootst

You can also pick directly from CLI:

yarn bootstrap -- --core
yarn bootstrap --core

#### 2a. Run unit tests

Expand All @@ -52,7 +52,7 @@ _Note that in order to run the tests fro ReactNative, you must have bootstrapped
You can also pick suites from CLI:

```sh
yarn test -- --core
yarn test --core
```

In order to run ALL unit tests, you must have bootstrapped the react-native
Expand Down Expand Up @@ -224,7 +224,7 @@ git status

# clean out extra files & build all the packages
# WARNING: destructive if you have extra files lying around!
yarn bootstrap -- --reset --all
yarn bootstrap --reset --all
```

From here there are different procedures for prerelease (e.g. alpha/beta/rc) and proper release.
Expand All @@ -235,7 +235,7 @@ From here there are different procedures for prerelease (e.g. alpha/beta/rc) and

```sh
# publish and tag the release
yarn run publish -- --concurrency 1 --npm-tag=alpha
yarn run publish --concurrency 1 --npm-tag=alpha

# push the tags
git push --tags
Expand All @@ -245,7 +245,7 @@ git push --tags

```sh
# publish but don't commit to git
yarn publish -- --concurrency 1 --skip-git
yarn run publish --concurrency 1 --skip-git

# Update `CHANGELOG.md`
# - Edit PR titles/labels on github until output is good
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ We welcome contributions to Storybook!
- `yarn lint:js` - will check js
- `yarn lint:md` - will check markdown + code samples

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

#### `yarn test`

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
2 changes: 1 addition & 1 deletion addons/comments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://github.com/storybooks/storybook.git"
},
"scripts": {
"prepublish": "node ../../scripts/prepublish.js",
"prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh",
"storybook": "start-storybook -p 3006",
"storybook-local": "STORYBOOK_CLOUD_SERVER='http://localhost:3003/graphql' start-storybook -p 9010",
Expand Down
2 changes: 1 addition & 1 deletion addons/events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"scripts": {
"build-storybook": "build-storybook",
"prepublish": "node ../../scripts/prepublish.js",
"prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 6006"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion addons/graphql/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/info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/storybooks/storybook.git"
},
"scripts": {
"prepublish": "node ../../scripts/prepublish.js",
"prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh",
"storybook": "start-storybook -p 9010"
},
Expand Down
4 changes: 2 additions & 2 deletions addons/knobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"url": "https://github.com/storybooks/storybook.git"
},
"scripts": {
"prepublish": "node ../../scripts/prepublish.js",
"prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh",
"start": "./example/prepublish.sh",
"start": "./example/prepare.sh",
"storybook": "start-storybook -p 9010"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion addons/links/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/notes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "https://github.com/storybooks/storybook.git"
},
"scripts": {
"prepublish": "node ../../scripts/prepublish.js",
"prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh",
"storybook": "start-storybook -p 9010"
},
Expand Down
2 changes: 1 addition & 1 deletion addons/options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://github.com/storybooks/storybook.git"
},
"scripts": {
"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/storyshots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"build-storybook": "build-storybook",
"prepublish": "babel ./src --out-dir ./dist",
"prepare": "babel ./src --out-dir ./dist",
"storybook": "start-storybook -p 6006",
"example": "jest storyshot.test"
},
Expand Down
2 changes: 1 addition & 1 deletion addons/viewport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"storybook"
],
"scripts": {
"prepublish": "node ../../scripts/prepublish.js"
"prepare": "node ../../scripts/prepare.js"
},
"license": "MIT",
"dependencies": {
Expand Down
Loading