Merge branch 'master' into ndelangen/upgrade-react

This commit is contained in:
Filipp Riabchun 2017-09-30 06:21:30 -07:00 committed by GitHub
commit f152c0dcb6
41 changed files with 21507 additions and 277 deletions

View File

@ -6,44 +6,28 @@ defaults: &defaults
version: 2 version: 2
dependencies: dependencies:
pre: pre:
- npm install -g npm - yarn global add npm
jobs: jobs:
validate:
<<: *defaults
steps:
- run:
name: "Checking Versions"
command: |
node --version
npm --version
yarn --version
build: build:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- root-dependencies-{{ checksum "package.json" }} - dependencies-{{ checksum "yarn.lock" }}
- root-dependencies- - dependencies-
- run: - run:
name: "Install root dependencies" name: "Install dependencies"
command: | command: |
yarn install yarn install
- save_cache:
key: root-dependencies-{{ checksum "package.json" }}
paths:
- node_modules
- restore_cache:
keys:
- package-dependencies-{{ checksum "package.json" }}
- package-dependencies-
- run: - run:
name: "Bootstrapping" name: "Bootstrapping"
command: | command: |
npm run bootstrap -- --all yarn bootstrap --core --docs --reactnative --reactnativeapp
- save_cache: - save_cache:
key: package-dependencies-{{ checksum "package.json" }} key: dependencies-{{ checksum "yarn.lock" }}
paths: paths:
- node_modules
- app/**/node_modules - app/**/node_modules
- docs/**/node_modules - docs/**/node_modules
- examples/**/node_modules - examples/**/node_modules
@ -54,111 +38,111 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- root-dependencies-{{ checksum "package.json" }} - dependencies-{{ checksum "yarn.lock" }}
- root-dependencies- - dependencies-
- run: - run:
name: "Install root dependencies" name: "Install dependencies"
command: | command: |
yarn install yarn install
- run: - run:
name: "Bootstrapping" name: "Bootstrapping"
command: | command: |
npm run bootstrap -- --core yarn bootstrap --core
- run: - run:
name: "Build react kitchen-sink" name: "Build react kitchen-sink"
command: | command: |
cd examples/cra-kitchen-sink cd examples/cra-kitchen-sink
yarn build-storybook yarn build-storybook
yarn storybook -- --smoke-test yarn storybook --smoke-test
- run: - run:
name: "Build vue kitchen-sink" name: "Build vue kitchen-sink"
command: | command: |
cd examples/vue-kitchen-sink cd examples/vue-kitchen-sink
yarn build-storybook yarn build-storybook
yarn storybook -- --smoke-test yarn storybook --smoke-test
example-react-native: example-react-native:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- root-dependencies-{{ checksum "package.json" }} - dependencies-{{ checksum "yarn.lock" }}
- root-dependencies- - dependencies-
- run: - run:
name: "Install root dependencies" name: "Install dependencies"
command: | command: |
yarn install yarn install
- run: - run:
name: "Bootstrapping packages" name: "Bootstrapping packages"
command: | command: |
npm run bootstrap -- --core --reactnative --reactnativeapp yarn bootstrap --core --reactnative --reactnativeapp
- run: - run:
name: "Running React-Native example" name: "Running React-Native example"
command: | command: |
cd examples/react-native-vanilla cd examples/react-native-vanilla
yarn storybook -- --smoke-test yarn storybook --smoke-test
- run: - run:
name: "Running React-Native-App example" name: "Running React-Native-App example"
command: | command: |
cd examples/crna-kitchen-sink cd examples/crna-kitchen-sink
yarn storybook -- --smoke-test yarn storybook --smoke-test
docs: docs:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- root-dependencies-{{ checksum "package.json" }} - dependencies-{{ checksum "yarn.lock" }}
- root-dependencies- - dependencies-
- run: - run:
name: "Install root dependencies" name: "Install dependencies"
command: | command: |
yarn install yarn install
- run: - run:
name: "Bootstrapping" name: "Bootstrapping"
command: | command: |
npm run bootstrap -- --docs yarn bootstrap --docs
- run: - run:
name: "Running docs" name: "Running docs"
command: | command: |
npm run docs:build yarn docs:build
lint: lint:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- root-dependencies-{{ checksum "package.json" }} - dependencies-{{ checksum "yarn.lock" }}
- root-dependencies- - dependencies-
- run: - run:
name: "Install root dependencies" name: "Install dependencies"
command: | command: |
yarn install yarn install
- run: - run:
name: "Linting" name: "Linting"
command: | command: |
npm run lint yarn lint
unit-test: unit-test:
<<: *defaults <<: *defaults
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- root-dependencies-{{ checksum "package.json" }} - dependencies-{{ checksum "yarn.lock" }}
- root-dependencies- - dependencies-
- run: - run:
name: "Install root dependencies" name: "Install dependencies"
command: | command: |
yarn install yarn install
- run: - run:
name: "Bootstrapping" name: "Bootstrapping"
command: | command: |
npm run bootstrap -- --core --reactnative yarn bootstrap --core --reactnative
- run: - run:
name: "Unit testing" name: "Unit testing"
command: | command: |
npm run test -- --coverage -i yarn test --coverage -i
npm run coverage yarn coverage
deploy: deploy:
<<: *defaults <<: *defaults
steps: steps:
@ -170,7 +154,6 @@ workflows:
version: 2 version: 2
build_accept_deploy: build_accept_deploy:
jobs: jobs:
- validate
- build - build
- example-kitchen-sinks - example-kitchen-sinks
- example-react-native - example-react-native

1
.gitignore vendored
View File

@ -12,7 +12,6 @@ coverage/
*.lerna_backup *.lerna_backup
build build
packages/examples/automated-* packages/examples/automated-*
yarn.lock
/**/LICENSE /**/LICENSE
docs/public docs/public
packs/*.tgz packs/*.tgz

View File

@ -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. Please review this document to help to streamline the process and save everyone's precious time.
This repo uses yarn workspaces, so you should `yarn@1.0.0` or higher as package manager. See [installation guide](https://yarnpkg.com/en/docs/install).
## Issues ## Issues
No software is bug free. So, if you got an issue, follow these steps: No software is bug free. So, if you got an issue, follow these steps:
@ -18,25 +20,25 @@ No software is bug free. So, if you got an issue, follow these steps:
### Testing against `master` ### 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: 1. Download the latest version of this project, and build it:
```sh ```sh
git clone https://github.com/storybooks/storybook.git git clone https://github.com/storybooks/storybook.git
cd storybook cd storybook
npm install yarn install
npm run bootstrap -- --core yarn bootstrap --core
``` ```
2. Link `storybook` and any other required dependencies: 2. Link `storybook` and any other required dependencies:
```sh ```sh
cd app/react cd app/react
npm link yarn link
cd <your-project> cd <your-project>
npm link @storybook/react yarn link @storybook/react
# repeat with whichever other parts of the monorepo you are using. # repeat with whichever other parts of the monorepo you are using.
``` ```
@ -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: # Download and build this repository:
git clone https://github.com/storybooks/storybook.git git clone https://github.com/storybooks/storybook.git
cd storybook cd storybook
npm install yarn install
npm run bootstrap -- --core yarn bootstrap --core
cd examples/cra-kitchen-sink cd examples/cra-kitchen-sink
# make changes to try and reproduce the problem, such as adding components + stories # 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: # see if you can see the problem, if so, commit it:
git checkout "branch-describing-issue" git checkout "branch-describing-issue"
@ -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. 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) ## Pull Requests (PRs)
@ -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). - 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)). - 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 ### Reviewing PRs
@ -136,7 +138,7 @@ This project written in ES2016+ syntax so, we need to transpile it before use.
So run the following command: So run the following command:
```sh ```sh
npm run dev yarn dev
``` ```
This will watch files and transpile in watch mode. This will watch files and transpile in watch mode.
@ -146,14 +148,14 @@ This will watch files and transpile in watch mode.
First of all link this repo with: First of all link this repo with:
```sh ```sh
npm link yarn link
``` ```
In order to test features you add, you may need to link the local copy of this repo. 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. For that we need a sample project. Let's create it.
```sh ```sh
npm install --global create-react-app getstorybook yarn global add create-react-app getstorybook
create-react-app my-demo-app create-react-app my-demo-app
cd my-demo-app cd my-demo-app
getstorybook getstorybook
@ -165,12 +167,12 @@ getstorybook
Then link storybook inside the sample project with: Then link storybook inside the sample project with:
```sh ```sh
npm link @storybook/react yarn link @storybook/react
``` ```
### Getting Changes ### 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 ## Release Guide
@ -212,7 +214,7 @@ yarn bootstrap --reset --core
```sh ```sh
# publish and tag the release # 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 # update the release page
open https://github.com/storybooks/storybook/releases open https://github.com/storybooks/storybook/releases
@ -236,7 +238,7 @@ git commit -m "Changelog for vX.Y"
yarn bootstrap --reset --core yarn bootstrap --reset --core
# publish and tag the release # publish and tag the release
npm run publish -- --concurrency 1 yarn run publish --concurrency 1
# update the release page # update the release page
open https://github.com/storybooks/storybook/releases open https://github.com/storybooks/storybook/releases

View File

@ -92,30 +92,30 @@ We welcome contributions to Storybook!
### Development scripts ### Development scripts
#### `npm run bootstrap` #### `yarn bootstrap`
> Installs package dependencies and links packages together - using lerna > Installs package dependencies and links packages together - using lerna
#### `npm run publish` #### `yarn run publish`
> Push a release to git and npm > Push a release to git and npm
> will ask for version in interactive mode - using lerna. > 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 > boolean check if code conforms to linting rules - uses remark & eslint
- `npm run lint:js` - will check js - `yarn lint:js` - will check js
- `npm run lint:md` - will check markdown + code samples - `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 lint:md -- -o` - will automatically fix markdown
#### `npm run test` #### `yarn test`
> boolean check if unit tests all pass - uses jest > 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 ### Backers

View File

@ -17,7 +17,7 @@
}, },
"scripts": { "scripts": {
"deploy-storybook": "storybook-to-ghpages", "deploy-storybook": "storybook-to-ghpages",
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 9001" "storybook": "start-storybook -p 9001"
}, },
"dependencies": { "dependencies": {

View File

@ -6,7 +6,7 @@
"author": "Muhammed Thanish <mnmtanish@gmail.com>", "author": "Muhammed Thanish <mnmtanish@gmail.com>",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"dependencies": { "dependencies": {
"global": "^4.3.2" "global": "^4.3.2"

View File

@ -16,7 +16,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh", "publish-storybook": "bash .scripts/publish_storybook.sh",
"storybook": "start-storybook -p 3006", "storybook": "start-storybook -p 3006",
"storybook-local": "STORYBOOK_CLOUD_SERVER='http://localhost:3003/graphql' start-storybook -p 9010", "storybook-local": "STORYBOOK_CLOUD_SERVER='http://localhost:3003/graphql' start-storybook -p 9010",

View File

@ -16,7 +16,7 @@
}, },
"scripts": { "scripts": {
"build-storybook": "build-storybook", "build-storybook": "build-storybook",
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 6006" "storybook": "start-storybook -p 6006"
}, },
"dependencies": { "dependencies": {

View File

@ -17,7 +17,7 @@
}, },
"scripts": { "scripts": {
"deploy-storybook": "storybook-to-ghpages", "deploy-storybook": "storybook-to-ghpages",
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 9001" "storybook": "start-storybook -p 9001"
}, },
"dependencies": { "dependencies": {

View File

@ -9,7 +9,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh", "publish-storybook": "bash .scripts/publish_storybook.sh",
"storybook": "start-storybook -p 9010" "storybook": "start-storybook -p 9010"
}, },

View File

@ -9,9 +9,8 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh", "publish-storybook": "bash .scripts/publish_storybook.sh",
"start": "./example/prepublish.sh",
"storybook": "start-storybook -p 9010" "storybook": "start-storybook -p 9010"
}, },
"dependencies": { "dependencies": {

View File

@ -17,7 +17,7 @@
}, },
"scripts": { "scripts": {
"deploy-storybook": "storybook-to-ghpages", "deploy-storybook": "storybook-to-ghpages",
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 9001" "storybook": "start-storybook -p 9001"
}, },
"dependencies": { "dependencies": {

View File

@ -14,7 +14,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash .scripts/publish_storybook.sh", "publish-storybook": "bash .scripts/publish_storybook.sh",
"storybook": "start-storybook -p 9010" "storybook": "start-storybook -p 9010"
}, },

View File

@ -16,7 +16,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 9001" "storybook": "start-storybook -p 9001"
}, },
"dependencies": { "dependencies": {

View File

@ -10,7 +10,7 @@
}, },
"scripts": { "scripts": {
"build-storybook": "build-storybook", "build-storybook": "build-storybook",
"prepublish": "babel ./src --out-dir ./dist", "prepare": "babel ./src --out-dir ./dist",
"storybook": "start-storybook -p 6006" "storybook": "start-storybook -p 6006"
}, },
"dependencies": { "dependencies": {

View File

@ -21,7 +21,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"dependencies": { "dependencies": {
"@storybook/addon-actions": "^3.2.11", "@storybook/addon-actions": "^3.2.11",

3
app/react/bin/build.js Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require('../dist/server/build');

3
app/react/bin/index.js Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require('../dist/server');

View File

@ -9,17 +9,17 @@
"license": "MIT", "license": "MIT",
"main": "dist/client/index.js", "main": "dist/client/index.js",
"bin": { "bin": {
"build-storybook": "./dist/server/build.js", "build-storybook": "./bin/build.js",
"start-storybook": "./dist/server/index.js", "start-storybook": "./bin/index.js",
"storybook-server": "./dist/server/index.js" "storybook-server": "./bin/index.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"dev": "DEV_BUILD=1 nodemon --watch ./src --exec 'npm run prepublish'", "dev": "DEV_BUILD=1 nodemon --watch ./src --exec 'yarn prepare'",
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"dependencies": { "dependencies": {
"@storybook/addon-actions": "^3.2.11", "@storybook/addon-actions": "^3.2.11",

View File

@ -1,5 +1,3 @@
#!/usr/bin/env node
import webpack from 'webpack'; import webpack from 'webpack';
import program from 'commander'; import program from 'commander';
import path from 'path'; import path from 'path';

View File

@ -1,5 +1,3 @@
#!/usr/bin/env node
import express from 'express'; import express from 'express';
import https from 'https'; import https from 'https';
import favicon from 'serve-favicon'; import favicon from 'serve-favicon';

3
app/vue/bin/build.js Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require('../dist/server/build');

3
app/vue/bin/index.js Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require('../dist/server');

View File

@ -9,17 +9,17 @@
"license": "MIT", "license": "MIT",
"main": "dist/client/index.js", "main": "dist/client/index.js",
"bin": { "bin": {
"build-storybook": "./dist/server/build.js", "build-storybook": "./bin/build.js",
"start-storybook": "./dist/server/index.js", "start-storybook": "./bin/index.js",
"storybook-server": "./dist/server/index.js" "storybook-server": "./bin/index.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"dev": "DEV_BUILD=1 nodemon --watch ./src --exec 'npm run prepublish'", "dev": "DEV_BUILD=1 nodemon --watch ./src --exec 'yarn prepare'",
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"dependencies": { "dependencies": {
"@storybook/addon-actions": "^3.2.11", "@storybook/addon-actions": "^3.2.11",

View File

@ -1,5 +1,3 @@
#!/usr/bin/env node
import webpack from 'webpack'; import webpack from 'webpack';
import program from 'commander'; import program from 'commander';
import path from 'path'; import path from 'path';

View File

@ -1,5 +1,3 @@
#!/usr/bin/env node
import express from 'express'; import express from 'express';
import https from 'https'; import https from 'https';
import favicon from 'serve-favicon'; import favicon from 'serve-favicon';

View File

@ -5,9 +5,9 @@ This is the source for [storybook.js.org](https://storybook.js.org). It document
### Usage ### Usage
```sh ```sh
npm i yarn
npm run develop yarn develop
npm run storybook yarn storybook
``` ```
### Edit Documentation ### Edit Documentation

8765
docs/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,15 @@
{ {
"lerna": "2.0.0", "lerna": "2.0.0",
"npmClient": "yarn",
"useWorkspaces": true,
"commands": { "commands": {
"bootstrap": {
"ignore": [
"crna-kitchen-sink",
"react-native-vanilla"
]
},
"publish": { "publish": {
"ignore": [ "ignore": [
"cra-kitchen-sink", "cra-kitchen-sink",
"crna-kitchen-sink", "vue-kitchen-sink"
"react-native-vanilla",
"vue-example"
] ]
} }
}, },
"packages": [
"addons/*",
"app/*",
"lib/*",
"examples/*"
],
"concurrency": 1, "concurrency": 1,
"version": "3.2.11" "version": "3.2.11"
} }

View File

@ -16,7 +16,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"devDependencies": { "devDependencies": {
"shelljs": "^0.7.8" "shelljs": "^0.7.8"

View File

@ -5,7 +5,7 @@
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"dependencies": { "dependencies": {
"@storybook/channels": "^3.2.10", "@storybook/channels": "^3.2.10",

View File

@ -5,7 +5,7 @@
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"dependencies": { "dependencies": {
"@storybook/channels": "^3.2.10", "@storybook/channels": "^3.2.10",

View File

@ -5,7 +5,7 @@
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"devDependencies": { "devDependencies": {
"shelljs": "^0.7.8" "shelljs": "^0.7.8"

View File

@ -9,7 +9,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js" "prepare": "node ../../scripts/prepare.js"
}, },
"dependencies": { "dependencies": {
"jscodeshift": "^0.3.30" "jscodeshift": "^0.3.30"

View File

@ -9,7 +9,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"storybook": "start-storybook -p 6006", "storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook" "build-storybook": "build-storybook"
}, },

View File

@ -9,7 +9,7 @@
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"scripts": { "scripts": {
"prepublish": "node ../../scripts/prepublish.js", "prepare": "node ../../scripts/prepare.js",
"publish-storybook": "bash ./.scripts/publish_storybook.sh", "publish-storybook": "bash ./.scripts/publish_storybook.sh",
"storybook": "start-storybook -p 9010" "storybook": "start-storybook -p 9010"
}, },

View File

@ -1,14 +1,21 @@
{ {
"private": true,
"name": "storybook", "name": "storybook",
"version": "3.0.0", "version": "3.0.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/storybooks/storybook.git" "url": "https://github.com/storybooks/storybook.git"
}, },
"workspaces": [
"addons/*",
"app/*",
"lib/*",
"examples/cra-kitchen-sink",
"examples/vue-kitchen-sink"
],
"scripts": { "scripts": {
"bootstrap": "./scripts/bootstrap.js", "bootstrap": "./scripts/bootstrap.js",
"bootstrap:core": "lerna bootstrap --concurrency 1 --npm-client=\"yarn\" --hoist && node ./scripts/hoist-internals.js", "bootstrap:docs": "yarn install --cwd docs",
"bootstrap:docs": "cd docs && yarn install",
"bootstrap:react-native-vanilla": "npm --prefix examples/react-native-vanilla install", "bootstrap:react-native-vanilla": "npm --prefix examples/react-native-vanilla install",
"bootstrap:crna-kitchen-sink": "npm --prefix examples/crna-kitchen-sink install", "bootstrap:crna-kitchen-sink": "npm --prefix examples/crna-kitchen-sink install",
"build-packs": "lerna exec --scope '@storybook/*' --parallel -- ../../scripts/build-pack.sh ../../packs", "build-packs": "lerna exec --scope '@storybook/*' --parallel -- ../../scripts/build-pack.sh ../../packs",
@ -18,12 +25,12 @@
"coverage": "codecov", "coverage": "codecov",
"danger": "danger", "danger": "danger",
"dev": "lerna exec --parallel -- babel src -d dist --ignore tests,__tests__,test.js,stories/,story.jsx --plugins \"transform-runtime\" --copy-files -w", "dev": "lerna exec --parallel -- babel src -d dist --ignore tests,__tests__,test.js,stories/,story.jsx --plugins \"transform-runtime\" --copy-files -w",
"docs:build": "cd docs && npm run build", "docs:build": "npm --prefix docs run build",
"docs:deploy:ci": "cd docs && npm run deploy:ci", "docs:deploy:ci": "npm --prefix docs run deploy:ci",
"docs:deploy:manual": "cd docs && npm run deploy:manual", "docs:deploy:manual": "npm --prefix docs run deploy:manual",
"docs:dev": "cd docs && npm run dev", "docs:dev": "npm --prefix docs run dev",
"github-release": "github-release-from-changelog", "github-release": "github-release-from-changelog",
"lint": "npm run lint:js . && npm run lint:md .", "lint": "yarn lint:js . && yarn lint:md .",
"lint:js": "eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json", "lint:js": "eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json",
"lint:md": "remark", "lint:md": "remark",
"publish": "lerna publish", "publish": "lerna publish",
@ -82,7 +89,8 @@
"symlink-dir": "^1.1.0" "symlink-dir": "^1.1.0"
}, },
"engines": { "engines": {
"node": ">=8.0.0" "node": ">=8.0.0",
"yarn": ">=1.0.0"
}, },
"collective": { "collective": {
"type": "opencollective", "type": "opencollective",
@ -91,11 +99,11 @@
"lint-staged": { "lint-staged": {
"linters": { "linters": {
"*.js": [ "*.js": [
"npm run lint:js -- --fix", "yarn lint:js --fix",
"git add" "git add"
], ],
"*.json": [ "*.json": [
"npm run lint:js -- --fix", "yarn lint:js --fix",
"git add" "git add"
], ],
"*.md": [ "*.md": [

21
scripts/bootstrap.js vendored
View File

@ -18,11 +18,17 @@ log.heading = 'storybook';
const prefix = 'bootstrap'; const prefix = 'bootstrap';
log.addLevel('aborted', 3001, { fg: 'red', bold: true }); log.addLevel('aborted', 3001, { fg: 'red', bold: true });
const spawn = command => { const spawn = (command, options = {}) => {
const out = childProcess.spawnSync(`${command}`, { const out = childProcess.spawnSync(
`${command}`,
Object.assign(
{
shell: true, shell: true,
stdio: 'inherit', stdio: 'inherit',
}); },
options
)
);
if (out.status !== 0) { if (out.status !== 0) {
process.exit(out.status); process.exit(out.status);
@ -56,14 +62,14 @@ const createTask = ({ defaultValue, option, name, check = () => true, command, p
const tasks = { const tasks = {
reset: createTask({ reset: createTask({
name: `Clean and re-install root dependencies ${chalk.red('(reset)')}`, name: `Clean and re-install dependencies ${chalk.red('(reset)')}`,
defaultValue: false, defaultValue: false,
option: '--reset', option: '--reset',
command: () => { command: () => {
log.info(prefix, 'git clean'); log.info(prefix, 'git clean');
spawn('git clean -fdx --exclude=".vscode" --exclude=".idea"'); spawn('git clean -fdx --exclude=".vscode" --exclude=".idea"');
log.info(prefix, 'yarn install'); log.info(prefix, 'yarn install');
spawn('yarn install --no-lockfile'); spawn('yarn install');
}, },
}), }),
core: createTask({ core: createTask({
@ -71,7 +77,10 @@ const tasks = {
defaultValue: true, defaultValue: true,
option: '--core', option: '--core',
command: () => { command: () => {
spawn('yarn bootstrap:core'); log.info(prefix, 'yarn workspace');
spawn('yarn install');
log.info(prefix, 'prepare');
spawn('lerna run prepare -- --silent');
}, },
}), }),
docs: createTask({ docs: createTask({

View File

@ -1,114 +0,0 @@
const path = require('path');
const fs = require('fs-extra');
const fse = require('fs-extra');
const shell = require('shelljs');
const glob = require('glob');
const symlink = require('symlink-dir');
const log = require('npmlog');
const targetPath = path.join(__dirname, '..', 'node_modules', '@storybook');
const prefix = 'hoist-internals';
const cwd = path.join(__dirname, '..');
log.heading = 'lerna+';
log.addLevel('success', 3001, { fg: 'green', bold: true });
log.info(prefix, 'Hoisting internal packages');
const getLernaPackages = () =>
fse.readJson(path.join(__dirname, '..', 'lerna.json')).then(json => json.packages);
const passingLog = fn => i => {
fn(i);
return i;
};
const getPackageOfFolder = sourcePath => fse.readJsonSync(path.join(sourcePath, 'package.json'));
const task = getLernaPackages()
.then(
passingLog(packages => {
log.verbose(prefix, 'working dir paths: %j', cwd);
log.verbose(prefix, 'source paths: %j', packages);
log.verbose(prefix, 'target paths: %j', targetPath);
})
)
.then(packages => `@(${packages.map(s => s.replace('/*', '')).join('|')})/*/`)
.then(
passingLog(pattern => {
log.silly(prefix, 'pattern to look for packages: %j', pattern);
})
)
.then(
pattern =>
new Promise((resolve, reject) => {
glob(pattern, { cwd }, (error, results) => (error ? reject(error) : resolve(results)));
})
)
.then(results =>
Promise.all(
results
.map(sourcePath => path.resolve(fs.realpathSync(sourcePath)))
.reduce((acc, item) => {
if (!acc.includes(item)) {
acc.push(item);
}
return acc;
}, [])
.map(
passingLog(item => {
log.silly(prefix, 'found package path', item);
})
)
.map(sourcePath => ({
sourcePath,
packageJson: getPackageOfFolder(sourcePath),
}))
.filter(({ packageJson }) => !packageJson.private)
.map(({ sourcePath, packageJson }) =>
Promise.resolve(packageJson.name.replace('@storybook/', ''))
.then(packageName => {
log.silly(prefix, 'found package name', packageName);
return path.join(targetPath, packageName);
})
.then(localTargetPath =>
fse
.remove(localTargetPath)
.then(() => symlink(sourcePath, localTargetPath))
.then(
passingLog(() => {
log.silly(prefix, 'symlinked ', [sourcePath, localTargetPath]);
})
)
.then(() => localTargetPath)
.catch(error => {
log.error(prefix, 'symlink', error, [sourcePath, localTargetPath]);
throw new Error('failed symlink');
})
)
)
)
)
.then(locations =>
Promise.all(
locations
.map(location => path.join(location, 'node_modules', '@storybook'))
.map(
passingLog(removePath => {
log.verbose(prefix, 'removing ', removePath);
})
)
.map(removePath => shell.rm('-rf', removePath))
.map(
(item, index) =>
item.code === 0 ? Promise.resolve(locations[index]) : Promise.reject(item)
)
)
);
task
.then(packages => {
log.verbose(prefix, packages.map(dir => dir.replace(cwd, '')).join(',\n'));
log.success(prefix, `Hoisted ${packages.length} packages`);
})
.catch(error => {
log.error(prefix, 'failed', error);
shell.exit(1);
});

View File

@ -1,12 +1,12 @@
const path = require('path'); const path = require('path');
const shell = require('shelljs'); const shell = require('shelljs');
const chalk = require('chalk'); const chalk = require('chalk');
const log = require('npmlog');
const packageJson = require('../package.json'); const modulePath = path.resolve('./');
// eslint-disable-next-line import/no-dynamic-require
const packageJson = require(path.join(modulePath, 'package.json'));
shell.echo(chalk.bold(`${packageJson.name}@${packageJson.version}`));
shell.echo(chalk.gray('\n=> Clean dist.'));
shell.rm('-rf', 'dist'); shell.rm('-rf', 'dist');
const babel = path.join(__dirname, '..', 'node_modules', '.bin', 'babel'); const babel = path.join(__dirname, '..', 'node_modules', '.bin', 'babel');
@ -18,16 +18,14 @@ const args = [
].join(' '); ].join(' ');
const command = `${babel} ${args}`; const command = `${babel} ${args}`;
shell.echo(chalk.gray('\n=> Transpiling "src" into ES5 ...\n')); const code = shell.exec(command, { silent: true }).code;
shell.echo(chalk.gray(command));
shell.echo(''); if (code !== 0) {
const code = shell.exec(command).code; log.error(`FAILED: ${chalk.bold(`${packageJson.name}@${packageJson.version}`)}`);
if (code === 0) {
shell.echo(chalk.gray('\n=> Transpiling completed.'));
} else {
shell.exit(code); shell.exit(code);
} }
const licence = path.join(__dirname, '..', 'LICENSE'); const licence = path.join(__dirname, '..', 'LICENSE');
shell.echo(chalk.gray('\n=> Copy LICENSE.'));
shell.cp(licence, './'); shell.cp(licence, './');
console.log(chalk.gray(`Built: ${chalk.bold(`${packageJson.name}@${packageJson.version}`)}`));

12589
yarn.lock Normal file

File diff suppressed because it is too large Load Diff