Merge pull request #18759 from storybookjs/future/move-code-into-directory

Future - Move all code into a `code` directory
This commit is contained in:
Norbert de Langen 2022-07-26 09:08:17 +02:00 committed by GitHub
commit 441338a6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3199 changed files with 25669 additions and 4055 deletions

View File

@ -7,7 +7,7 @@ const flatten = require('lodash/flatten');
const intersection = require('lodash/intersection');
const isEmpty = require('lodash/isEmpty');
const pkg = require('../../package.json'); // eslint-disable-line import/newline-after-import
const pkg = require('../../code/package.json'); // eslint-disable-line import/newline-after-import
const prLogConfig = pkg['pr-log'];
const Versions = {

View File

@ -86,30 +86,40 @@ jobs:
- restore_cache:
name: Restore Yarn cache
keys:
- build-yarn-2-cache-v3--{{ checksum "yarn.lock" }}
- build-yarn-2-cache-v3--{{ checksum "code/yarn.lock" }}
- run:
name: Install dependencies
command: yarn install --immutable
command: |
cd code
yarn install --immutable
- run:
name: Install script dependencies
command: |
cd scripts
yarn install --immutable
- run:
name: Bootstrap
command: |
cd code
yarn bootstrap --build
git diff --exit-code
- save_cache:
name: Save Yarn cache
key: build-yarn-2-cache-v3--{{ checksum "yarn.lock" }}
key: build-yarn-2-cache-v3--{{ checksum "code/yarn.lock" }}
paths:
- ~/.yarn/berry/cache
- persist_to_workspace:
root: .
paths:
- examples
- node_modules
- addons
- frameworks
- lib
- renderers
- presets
- code/node_modules
- scripts/node_modules
- code/examples
- code/node_modules
- code/addons
- code/frameworks
- code/lib
- code/renderers
- code/presets
chromatic:
executor: sb_node_14_browsers
parallelism: 15
@ -121,6 +131,7 @@ jobs:
- run:
name: chromatic
command: |
cd code
yarn run-chromatics
examples:
executor:
@ -135,11 +146,12 @@ jobs:
- run:
name: examples
command: |
cd code
yarn build-storybooks --all
- persist_to_workspace:
root: .
paths:
- built-storybooks
- code/built-storybooks
publish:
executor:
class: medium
@ -151,7 +163,9 @@ jobs:
at: .
- run:
name: running local registry
command: yarn local-registry --publish
command: |
cd code
yarn local-registry --publish
- persist_to_workspace:
root: .
paths:
@ -178,14 +192,20 @@ jobs:
at: .
- run:
name: running local registry
command: yarn local-registry --port 6000 --open
command: |
cd code
yarn local-registry --port 6000 --open
background: true
- run:
name: Wait for registry
command: yarn wait-on http://localhost:6000
command: |
cd code
yarn wait-on http://localhost:6000
- run:
name: Run E2E (extended) tests
command: yarn test:e2e-framework --clean --all --skip angular --skip angular12 --skip vue3 --skip web_components_typescript --skip cra --skip react
command: |
cd code
yarn test:e2e-framework --clean --all --skip angular --skip angular12 --skip vue3 --skip web_components_typescript --skip cra --skip react
no_output_timeout: 5m
- store_artifacts:
path: /tmp/cypress-record
@ -202,16 +222,22 @@ jobs:
at: .
- run:
name: Running local registry
command: yarn local-registry --port 6000 --open
command: |
cd code
yarn local-registry --port 6000 --open
background: true
- run:
name: Wait for registry
command: yarn wait-on http://localhost:6000
command: |
cd code
yarn wait-on http://localhost:6000
- run:
name: Run E2E (core) tests
# Do not test CRA here because it's done in PnP part
# TODO: Remove `web_components_typescript` as soon as Lit 2 stable is released
command: yarn test:e2e-framework vue3 angular130 angular13 angular12 web_components_typescript web_components_lit2 react react_legacy_root_api
command: |
cd code
yarn test:e2e-framework vue3 angular130 angular13 angular12 web_components_typescript web_components_lit2 react react_legacy_root_api
no_output_timeout: 5m
- run:
name: prep artifacts
@ -259,21 +285,29 @@ jobs:
at: .
- run:
name: install playright
command: npx playwright install
command: |
cd code
npx playwright install
- run:
name: Running local registry
command: yarn local-registry --port 6000 --open
command: |
cd code
yarn local-registry --port 6000 --open
background: true
- run:
name: Wait for registry
command: yarn wait-on http://localhost:6000
command: |
cd code
yarn wait-on http://localhost:6000
- run:
name: set up cra repro, skip tests
command: node ./lib/cli/bin/index.js repro -t cra --e2e ../cra-bench
command: |
cd code
node ./lib/cli/bin/index.js repro -t cra --e2e ../cra-bench
- run:
name: Run @storybook/bench on repro
command: |
cd ../cra-bench
cd ./cra-bench
npx @storybook/bench@1.0.0--canary.11.52d1ee7.1 'echo noop' --label cra
e2e-tests-pnp:
executor:
@ -287,14 +321,20 @@ jobs:
at: .
- run:
name: Running local registry
command: yarn local-registry --port 6000 --open
command: |
cd code
yarn local-registry --port 6000 --open
background: true
- run:
name: Wait for registry
command: yarn wait-on http://localhost:6000
command: |
cd code
yarn wait-on http://localhost:6000
- run:
name: run e2e tests cra
command: yarn test:e2e-framework --pnp cra
command: |
cd code
yarn test:e2e-framework --pnp cra
# - run:
# name: run e2e tests vue
# command: yarn test:e2e-framework --pnp sfcVue
@ -319,14 +359,20 @@ jobs:
at: .
- run:
name: running example
command: yarn serve-storybooks
command: |
cd code
yarn serve-storybooks
background: true
- run:
name: await running examples
command: yarn await-serve-storybooks
command: |
cd code
yarn await-serve-storybooks
- run:
name: cypress run
command: yarn test:e2e-examples
command: |
cd code
yarn test:e2e-examples
- store_artifacts:
path: /tmp/cypress-record
destination: cypress
@ -347,6 +393,7 @@ jobs:
- run:
name: smoke tests
command: |
cd code
yarn smoketest-storybooks --all
lint:
executor:
@ -359,7 +406,9 @@ jobs:
at: .
- run:
name: Lint
command: yarn lint
command: |
cd code
yarn lint
unit-tests:
executor: sb_node_14_browsers
steps:
@ -369,13 +418,15 @@ jobs:
at: .
- run:
name: Test
command: yarn test --coverage --runInBand --ci
command: |
cd code
yarn test --coverage --runInBand --ci
- store_test_results:
path: junit.xml
path: code/junit.xml
- persist_to_workspace:
root: .
paths:
- coverage
- code/coverage
coverage:
executor:
class: small
@ -387,7 +438,9 @@ jobs:
at: .
- run:
name: Upload coverage
command: yarn coverage
command: |
cd code
yarn coverage
workflows:
test:

2
.gitattributes vendored
View File

@ -1 +1 @@
/.yarn/** linguist-generated
/**/.yarn/** linguist-generated

View File

@ -20,6 +20,8 @@ jobs:
run: |
git config --global user.name "Storybook Bot"
git config --global user.email "bot@storybook.js.org"
- name: Change directory
run: cd code
- name: Install dependencies
run: yarn install
- name: Generate repros with Latest Storybook CLI

View File

@ -31,8 +31,10 @@ jobs:
cache: yarn
- name: install, bootstrap
run: |
cd code
yarn install --immutable
yarn bootstrap --core
- name: test
run: |
cd code
yarn test --runInBand --ci

29
.gitignore vendored
View File

@ -3,38 +3,10 @@ node_modules
.idea
*.iml
*.sw*
npm-shrinkwrap.json
dist
.tern-port
*.DS_Store
.cache
.parcel-cache
coverage/
*.lerna_backup
build
packages/examples/automated-*
/**/LICENSE
docs/public
packs/*.tgz
package-lock.json
.nvmrc
storybook-static
integration/__image_snapshots__/__diff_output__
.jest-test-results.json
/examples/cra-kitchen-sink/src/__image_snapshots__/__diff_output__/
lib/*.jar
lib/**/dll
/false
/addons/docs/common/config-*
built-storybooks
cypress/videos
cypress/screenshots
examples/ember-cli/ember-output
.verdaccio-cache
tsconfig.tsbuildinfo
examples/angular-cli/addon-jest.testresults.json
junit.xml
.next
# Yarn stuff
/**/.yarn/*
@ -43,3 +15,4 @@ junit.xml
!/**/.yarn/sdks
!/**/.yarn/versions
/**/.pnp.*
/yarn.lock

57
.vscode/launch.json vendored
View File

@ -3,31 +3,36 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "official-storybook",
"runtimeExecutable": "npm",
"cwd": "${workspaceFolder}/examples/official-storybook",
"runtimeArgs": ["run-script", "debug"],
"port": 9229,
"skipFiles": ["<node_internals>/**"]
},
{
"type": "node",
"request": "launch",
"name": "cli html",
"cwd": "${workspaceFolder}/lib/cli/stories",
"runtimeArgs": [
"--inspect-brk",
"${workspaceFolder}/lib/cli/bin/index.js",
"init",
"--type",
"html"
],
"port": 9229,
"skipFiles": ["<node_internals>/**"]
}
"configurations": [{
"type": "node",
"request": "launch",
"name": "official-storybook",
"runtimeExecutable": "npm",
"cwd": "${workspaceFolder}/code/examples/official-storybook",
"runtimeArgs": [
"run-script",
"debug"
],
"port": 9229,
"skipFiles": [
"<node_internals>/**"
]
}, {
"type": "node",
"request": "launch",
"name": "cli html",
"cwd": "${workspaceFolder}/code/lib/cli/stories",
"runtimeArgs": [
"--inspect-brk",
"${workspaceFolder}/code/lib/cli/bin/index.js",
"init",
"--type",
"html"
],
"port": 9229,
"skipFiles": [
"<node_internals>/**"
]
}
]
}

View File

@ -1,5 +1,10 @@
<h1>Contributing to Storybook</h1>
# Getting started
Please refer to our [NEW contributing guide on the Storybook website](https://storybook.js.org/docs/react/contribute/how-to-contribute).
- Ensure you have node version 14 installed (suggestion: v14.18.1).
- Ensure if you are using Windows to use the Windows Subsystem for Linux (WSL).
- Run `./bootstrap.sh` to install the dependencies, and get the repo ready to be developed on.
- Run `yarn start` inside of the `code` directory to start the development server.
During the transition, we're also preserving our [OLD, out of date contributing guide](./CONTRIBUTING.old.md) in parallel.
# Contributing to Storybook
For further advice on how to contribute, please refer to our [NEW contributing guide on the Storybook website](https://storybook.js.org/docs/react/contribute/how-to-contribute).

3
bootstrap.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./scripts/check-dependencies.js && cd ./code && yarn bootstrap $1

View File

@ -1,14 +1,10 @@
const path = require('path');
const scriptPath = path.join(__dirname, '..', 'scripts');
module.exports = {
root: true,
extends: ['@storybook/eslint-config-storybook', 'plugin:storybook/recommended'],
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'jest/no-standalone-expect': [
'error',
{ additionalTestBlockFunctions: ['it.skipWindows', 'it.onWindows'] },
],
'no-use-before-define': 'off',
},
extends: [path.join(scriptPath, '.eslintrc.js')],
overrides: [
{
// this package depends on a lot of peerDependencies we don't want to specify, because npm would install them
@ -40,7 +36,6 @@ module.exports = {
{
files: [
'**/__tests__/**',
'scripts/**',
'**/__testfixtures__/**',
'**/*.test.*',
'**/*.stories.*',

45
code/.gitignore vendored Normal file
View File

@ -0,0 +1,45 @@
node_modules
*.log
.idea
*.iml
*.sw*
npm-shrinkwrap.json
dist
.tern-port
*.DS_Store
.cache
.parcel-cache
coverage/
*.lerna_backup
build
packages/examples/automated-*
/**/LICENSE
docs/public
packs/*.tgz
package-lock.json
.nvmrc
storybook-static
integration/__image_snapshots__/__diff_output__
.jest-test-results.json
/examples/cra-kitchen-sink/src/__image_snapshots__/__diff_output__/
lib/*.jar
lib/**/dll
/false
/addons/docs/common/config-*
built-storybooks
cypress/videos
cypress/screenshots
examples/ember-cli/ember-output
.verdaccio-cache
tsconfig.tsbuildinfo
examples/angular-cli/addon-jest.testresults.json
junit.xml
.next
# Yarn stuff
/**/.yarn/*
!/**/.yarn/releases
!/**/.yarn/plugins
!/**/.yarn/sdks
!/**/.yarn/versions
/**/.pnp.*

View File

@ -1,2 +1 @@
/* eslint-disable import/no-extraneous-dependencies */
module.exports = require('@storybook/linter-config/remark.config');

View File

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 175 KiB

View File

@ -59,10 +59,9 @@
],
"scripts": {
"check": "tsc --noEmit",
"prepare": "esrun ../../scripts/prepare/bundle.ts"
"prepare": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@digitak/esrun": "^3.2.2",
"@storybook/addon-highlight": "7.0.0-alpha.16",
"@storybook/addons": "7.0.0-alpha.16",
"@storybook/api": "7.0.0-alpha.16",

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -32,7 +32,7 @@
],
"scripts": {
"check": "tsc --noEmit",
"prepare": "node ../../scripts/prepare.js"
"prepare": "node ../../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "7.0.0-alpha.16",

Some files were not shown because too many files have changed in this diff Show More