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

Build: move builders #22751

Merged
merged 5 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ jobs:
- code/addons
- code/frameworks
- code/lib
- code/builders
- code/ui
- code/renderers
- code/presets
Expand Down
9 changes: 8 additions & 1 deletion code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ module.exports = {
},
{
// these packages use pre-bundling, dependencies will be bundled, and will be in devDepenencies
files: ['addons/**/*', 'frameworks/**/*', 'lib/**/*', 'renderers/**/*', 'ui/**/*'],
files: [
'addons/**/*',
'frameworks/**/*',
'lib/**/*',
'builders/**/*',
'renderers/**/*',
'ui/**/*',
],
excludedFiles: ['frameworks/angular/**/*', 'frameworks/ember/**/*', 'lib/core-server/**/*'],
rules: {
'import/no-extraneous-dependencies': [
Expand Down
2 changes: 1 addition & 1 deletion code/addons/storyshots-core/src/frameworks/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function configure<TRenderer extends Renderer>(
}));

if (preview) {
// This is essentially the same code as lib/builder-webpack5/templates/virtualModuleEntry.template
// This is essentially the same code as builders/builder-webpack5/templates/virtualModuleEntry.template
const {
parameters,
decorators,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"keywords": [
"storybook"
],
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/builder-manager",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-manager",
"bugs": {
"url": "https://github.com/storybookjs/storybook/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/storybookjs/storybook.git",
"directory": "code/lib/builder-manager"
"directory": "code/builders/builder-manager"
},
"funding": {
"type": "opencollective",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "@storybook/builder-vite",
"version": "7.1.0-alpha.25",
"description": "A plugin to run and build Storybooks with Vite",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/builder-vite/#readme",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-vite/#readme",
"bugs": {
"url": "https://github.com/storybookjs/storybook/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/storybookjs/storybook.git",
"directory": "code/lib/builder-vite"
"directory": "code/builders/builder-vite"
},
"funding": {
"type": "opencollective",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function generateModernIframeScriptCode(options: Options, projectRo
};

/**
* This code is largely taken from https://github.com/storybookjs/storybook/blob/d1195cbd0c61687f1720fefdb772e2f490a46584/lib/builder-webpack4/src/preview/virtualModuleModernEntry.js.handlebars
* This code is largely taken from https://github.com/storybookjs/storybook/blob/d1195cbd0c61687f1720fefdb772e2f490a46584/builders/builder-webpack4/src/preview/virtualModuleModernEntry.js.handlebars
* Some small tweaks were made to `getProjectAnnotations` (since `import()` needs to be resolved asynchronously)
* and the HMR implementation has been tweaked to work with Vite.
* @todo Inline variable and remove `noinspection`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"keywords": [
"storybook"
],
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/lib/builder-webpack5",
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/builders/builder-webpack5",
"bugs": {
"url": "https://github.com/storybookjs/storybook/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/storybookjs/storybook.git",
"directory": "code/lib/builder-webpack5"
"directory": "code/builders/builder-webpack5"
},
"funding": {
"type": "opencollective",
Expand Down
1 change: 1 addition & 0 deletions code/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
'<rootDir>/addons/*',
'<rootDir>/frameworks/*',
'<rootDir>/lib/*',
'<rootDir>/builders/*',
'<rootDir>/renderers/*',
'<rootDir>/ui/!(node_modules)*',
],
Expand Down
1 change: 1 addition & 0 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"addons/*",
"frameworks/*",
"lib/*",
"builders/*",
"ui/*",
"presets/*",
"renderers/*"
Expand Down
2 changes: 1 addition & 1 deletion code/presets/create-react-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const webpack = async (
: [];

// NOTE: This is code replicated from
// https://github.com/storybookjs/storybook/blob/89830ad76384faeaeb0c19df3cb44232cdde261b/lib/builder-webpack5/src/preview/base-webpack.config.ts#L45-L53
// https://github.com/storybookjs/storybook/blob/89830ad76384faeaeb0c19df3cb44232cdde261b/builders/builder-webpack5/src/preview/base-webpack.config.ts#L45-L53
// as we are not applying SB's default webpack config here.
// We need to figure out a better way to apply various layers of webpack config; perhaps
// these options need to be in a separate preset.
Expand Down
2 changes: 1 addition & 1 deletion code/presets/react-webpack/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type TypescriptOptions = TypescriptOptionsBase & {
* Configures `react-docgen-typescript-plugin`
*
* @default
* @see https://github.com/storybookjs/storybook/blob/next/code/lib/builder-webpack5/src/config/defaults.js#L4-L6
* @see https://github.com/storybookjs/storybook/blob/next/code/builders/builder-webpack5/src/config/defaults.js#L4-L6
*/
reactDocgenTypescriptOptions: ReactDocgenTypescriptOptions;
};
Expand Down
12 changes: 6 additions & 6 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5615,9 +5615,9 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/[email protected], @storybook/builder-manager@workspace:*, @storybook/builder-manager@workspace:lib/builder-manager":
"@storybook/[email protected], @storybook/builder-manager@workspace:*, @storybook/builder-manager@workspace:builders/builder-manager":
version: 0.0.0-use.local
resolution: "@storybook/builder-manager@workspace:lib/builder-manager"
resolution: "@storybook/builder-manager@workspace:builders/builder-manager"
dependencies:
"@fal-works/esbuild-plugin-global-externals": ^2.1.2
"@storybook/core-common": 7.1.0-alpha.25
Expand All @@ -5640,9 +5640,9 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/[email protected], @storybook/builder-vite@workspace:*, @storybook/builder-vite@workspace:lib/builder-vite":
"@storybook/[email protected], @storybook/builder-vite@workspace:*, @storybook/builder-vite@workspace:builders/builder-vite":
version: 0.0.0-use.local
resolution: "@storybook/builder-vite@workspace:lib/builder-vite"
resolution: "@storybook/builder-vite@workspace:builders/builder-vite"
dependencies:
"@storybook/channel-postmessage": 7.1.0-alpha.25
"@storybook/channel-websocket": 7.1.0-alpha.25
Expand Down Expand Up @@ -5683,9 +5683,9 @@ __metadata:
languageName: unknown
linkType: soft

"@storybook/[email protected], @storybook/builder-webpack5@workspace:*, @storybook/builder-webpack5@workspace:lib/builder-webpack5":
"@storybook/[email protected], @storybook/builder-webpack5@workspace:*, @storybook/builder-webpack5@workspace:builders/builder-webpack5":
version: 0.0.0-use.local
resolution: "@storybook/builder-webpack5@workspace:lib/builder-webpack5"
resolution: "@storybook/builder-webpack5@workspace:builders/builder-webpack5"
dependencies:
"@babel/core": ^7.12.10
"@storybook/addons": 7.1.0-alpha.25
Expand Down
2 changes: 1 addition & 1 deletion docs/builders/builder-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ While running in development mode, the builder's development server must be able

### More information

This area is under rapid development, so the documented is still in progress and subject to change. If you are interested in writing your builder, we encourage you to check [webpack](https://github.com/storybookjs/storybook/tree/next/code/lib/builder-webpack5), [Vite](https://github.com/storybookjs/builder-vite), and Modern Web's [dev-server-storybook](https://github.com/modernweb-dev/web/blob/master/packages/dev-server-storybook/src/serve/storybookPlugin.ts) source code. In addition, we have a wonderful contributor community on [Storybook Discord](https://discord.gg/storybook) if you have questions. Ping us in the [#contributing](https://discord.com/channels/486522875931656193/839297503446695956) channel.
This area is under rapid development, so the documented is still in progress and subject to change. If you are interested in writing your builder, we encourage you to check [webpack](https://github.com/storybookjs/storybook/tree/next/code/builders/builder-webpack5), [Vite](https://github.com/storybookjs/storybook/tree/next/code/builders/builder-vite), and Modern Web's [dev-server-storybook](https://github.com/modernweb-dev/web/blob/master/packages/dev-server-storybook/src/serve/storybookPlugin.ts) source code. In addition, we have a wonderful contributor community on [Storybook Discord](https://discord.gg/storybook) if you have questions. Ping us in the [#contributing](https://discord.com/channels/486522875931656193/839297503446695956) channel.

#### Learn more about builders

Expand Down
34 changes: 17 additions & 17 deletions test-storybooks/ember-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-example",
"version": "7.0.0-alpha.43",
"version": "7.1.0-alpha.24",
"private": true,
"scripts": {
"--build-storybook": "yarn storybook-prebuild && NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" storybook build",
Expand All @@ -17,19 +17,19 @@
"devDependencies": {
"@babel/core": "^7.12.10",
"@ember/optional-features": "^2.0.0",
"@storybook/addon-a11y": "7.0.0-alpha.43",
"@storybook/addon-actions": "7.0.0-alpha.43",
"@storybook/addon-backgrounds": "7.0.0-alpha.43",
"@storybook/addon-controls": "7.0.0-alpha.43",
"@storybook/addon-docs": "7.0.0-alpha.43",
"@storybook/addon-highlight": "7.0.0-alpha.43",
"@storybook/addon-links": "7.0.0-alpha.43",
"@storybook/addon-storysource": "7.0.0-alpha.43",
"@storybook/addon-viewport": "7.0.0-alpha.43",
"@storybook/addons": "7.0.0-alpha.43",
"@storybook/ember": "7.0.0-alpha.43",
"@storybook/addon-a11y": "7.1.0-alpha.24",
"@storybook/addon-actions": "7.1.0-alpha.24",
"@storybook/addon-backgrounds": "7.1.0-alpha.24",
"@storybook/addon-controls": "7.1.0-alpha.24",
"@storybook/addon-docs": "7.1.0-alpha.24",
"@storybook/addon-highlight": "7.1.0-alpha.24",
"@storybook/addon-links": "7.1.0-alpha.24",
"@storybook/addon-storysource": "7.1.0-alpha.24",
"@storybook/addon-viewport": "7.1.0-alpha.24",
"@storybook/addons": "7.1.0-alpha.24",
"@storybook/ember": "7.1.0-alpha.24",
"@storybook/ember-cli-storybook": "^0.2.1",
"@storybook/source-loader": "7.0.0-alpha.43",
"@storybook/source-loader": "7.1.0-alpha.24",
"babel-loader": "^8.2.5",
"broccoli-asset-rev": "^3.0.0",
"browserify-zlib": "^0.2.0",
Expand All @@ -49,7 +49,7 @@
"loader.js": "^4.7.0",
"os-browserify": "^0.3.0",
"shx": "^0.3.2",
"storybook": "7.0.0-alpha.43",
"storybook": "7.1.0-alpha.24",
"stream-browserify": "^3.0.0",
"vm-browserify": "^1.1.2",
"webpack": "5",
Expand Down Expand Up @@ -100,9 +100,9 @@
"@storybook/addons": "portal:../../code/lib/addons",
"@storybook/api": "portal:../../code/lib/api",
"@storybook/blocks": "portal:../../code/lib/blocks",
"@storybook/builder-manager": "portal:../../code/lib/builder-manager",
"@storybook/builder-vite": "portal:../../code/lib/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/lib/builder-webpack5",
"@storybook/builder-manager": "portal:../../code/builders/builder-manager",
"@storybook/builder-vite": "portal:../../code/builders/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/builders/builder-webpack5",
"@storybook/channel-postmessage": "portal:../../code/lib/channel-postmessage",
"@storybook/channel-websocket": "portal:../../code/lib/channel-websocket",
"@storybook/channels": "portal:../../code/lib/channels",
Expand Down
26 changes: 13 additions & 13 deletions test-storybooks/external-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/external-docs",
"version": "7.0.0-alpha.43",
"version": "7.1.0-alpha.24",
"private": true,
"scripts": {
"build": "next build",
Expand All @@ -11,14 +11,14 @@
"storybook": "cross-env STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" storybook dev -p 9011 -c .storybook"
},
"dependencies": {
"@storybook/addon-docs": "7.0.0-alpha.43",
"@storybook/addon-essentials": "7.0.0-alpha.43",
"@storybook/blocks": "7.0.0-alpha.43",
"@storybook/components": "7.0.0-alpha.43",
"@storybook/preview-web": "7.0.0-alpha.43",
"@storybook/react": "7.0.0-alpha.43",
"@storybook/react-webpack5": "7.0.0-alpha.43",
"@storybook/theming": "7.0.0-alpha.43",
"@storybook/addon-docs": "7.1.0-alpha.24",
"@storybook/addon-essentials": "7.1.0-alpha.24",
"@storybook/blocks": "7.1.0-alpha.24",
"@storybook/components": "7.1.0-alpha.24",
"@storybook/preview-web": "7.1.0-alpha.24",
"@storybook/react": "7.1.0-alpha.24",
"@storybook/react-webpack5": "7.1.0-alpha.24",
"@storybook/theming": "7.1.0-alpha.24",
"formik": "^2.2.9",
"next": "^12.1.0",
"nextra": "^1.1.0",
Expand All @@ -37,7 +37,7 @@
"cross-env": "^7.0.3",
"eslint": "8.7.0",
"eslint-config-next": "12.0.8",
"storybook": "7.0.0-alpha.43",
"storybook": "7.1.0-alpha.24",
"typescript": "~4.9.3",
"webpack": "5"
},
Expand Down Expand Up @@ -78,9 +78,9 @@
"@storybook/addons": "portal:../../code/lib/addons",
"@storybook/manager-api": "portal:../../code/lib/manager-api",
"@storybook/blocks": "portal:../../code/ui/blocks",
"@storybook/builder-manager": "portal:../../code/lib/builder-manager",
"@storybook/builder-vite": "portal:../../code/lib/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/lib/builder-webpack5",
"@storybook/builder-manager": "portal:../../code/builders/builder-manager",
"@storybook/builder-vite": "portal:../../code/builders/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/builders/builder-webpack5",
"@storybook/channel-postmessage": "portal:../../code/lib/channel-postmessage",
"@storybook/channel-websocket": "portal:../../code/lib/channel-websocket",
"@storybook/channels": "portal:../../code/lib/channels",
Expand Down
28 changes: 14 additions & 14 deletions test-storybooks/server-kitchen-sink/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server-kitchen-sink",
"version": "7.0.0-alpha.43",
"version": "7.1.0-alpha.24",
"private": true,
"description": "",
"keywords": [],
Expand All @@ -14,23 +14,23 @@
"storybook": "SERVER_PORT=1137 NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" storybook dev -p 9006 --quiet"
},
"devDependencies": {
"@storybook/addon-a11y": "7.0.0-alpha.43",
"@storybook/addon-actions": "7.0.0-alpha.43",
"@storybook/addon-backgrounds": "7.0.0-alpha.43",
"@storybook/addon-controls": "7.0.0-alpha.43",
"@storybook/addon-highlight": "7.0.0-alpha.43",
"@storybook/addon-links": "7.0.0-alpha.43",
"@storybook/node-logger": "7.0.0-alpha.43",
"@storybook/server": "7.0.0-alpha.43",
"@storybook/server-webpack5": "7.0.0-alpha.43",
"@storybook/addon-a11y": "7.1.0-alpha.24",
"@storybook/addon-actions": "7.1.0-alpha.24",
"@storybook/addon-backgrounds": "7.1.0-alpha.24",
"@storybook/addon-controls": "7.1.0-alpha.24",
"@storybook/addon-highlight": "7.1.0-alpha.24",
"@storybook/addon-links": "7.1.0-alpha.24",
"@storybook/node-logger": "7.1.0-alpha.24",
"@storybook/server": "7.1.0-alpha.24",
"@storybook/server-webpack5": "7.1.0-alpha.24",
"concurrently": "^5.3.0",
"cors": "^2.8.5",
"express": "^4.17.3",
"morgan": "^1.10.0",
"nodemon": "^2.0.7",
"pug": "^3.0.0",
"safe-identifier": "^0.4.1",
"storybook": "7.0.0-alpha.43"
"storybook": "7.1.0-alpha.24"
},
"resolutions": {
"@storybook/addon-a11y": "portal:../../code/addons/a11y",
Expand Down Expand Up @@ -69,9 +69,9 @@
"@storybook/addons": "portal:../../code/lib/addons",
"@storybook/api": "portal:../../code/lib/api",
"@storybook/blocks": "portal:../../code/lib/blocks",
"@storybook/builder-manager": "portal:../../code/lib/builder-manager",
"@storybook/builder-vite": "portal:../../code/lib/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/lib/builder-webpack5",
"@storybook/builder-manager": "portal:../../code/builders/builder-manager",
"@storybook/builder-vite": "portal:../../code/builders/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/builders/builder-webpack5",
"@storybook/channel-postmessage": "portal:../../code/lib/channel-postmessage",
"@storybook/channel-websocket": "portal:../../code/lib/channel-websocket",
"@storybook/channels": "portal:../../code/lib/channels",
Expand Down
18 changes: 9 additions & 9 deletions test-storybooks/standalone-preview/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "standalone-preview",
"version": "7.0.0-alpha.43",
"version": "7.1.0-alpha.24",
"private": true,
"scripts": {
"storybook": "cross-env STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" storybook dev -p 9011 -c ../official-storybook --preview-url=http://localhost:1337/external-iframe.html",
"storybook-preview": "cross-env PREVIEW_URL=external-iframe.html NODE_OPTIONS=\"--preserve-symlinks --preserve-symlinks-main\" parcel ./storybook.html --port 1337"
},
"devDependencies": {
"@storybook/addon-docs": "7.0.0-alpha.43",
"@storybook/cli": "7.0.0-alpha.43",
"@storybook/react": "7.0.0-alpha.43",
"@storybook/react-webpack5": "7.0.0-alpha.43",
"@storybook/addon-docs": "7.1.0-alpha.24",
"@storybook/cli": "7.1.0-alpha.24",
"@storybook/react": "7.1.0-alpha.24",
"@storybook/react-webpack5": "7.1.0-alpha.24",
"cross-env": "^7.0.3",
"parcel": "2.0.1",
"react": "16.14.0",
"react-dom": "16.14.0",
"storybook": "7.0.0-alpha.43"
"storybook": "7.1.0-alpha.24"
},
"resolutions": {
"@storybook/addon-a11y": "portal:../../code/addons/a11y",
Expand Down Expand Up @@ -54,9 +54,9 @@
"@storybook/addons": "portal:../../code/lib/addons",
"@storybook/api": "portal:../../code/lib/api",
"@storybook/blocks": "portal:../../code/lib/blocks",
"@storybook/builder-manager": "portal:../../code/lib/builder-manager",
"@storybook/builder-vite": "portal:../../code/lib/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/lib/builder-webpack5",
"@storybook/builder-manager": "portal:../../code/builders/builder-manager",
"@storybook/builder-vite": "portal:../../code/builders/builder-vite",
"@storybook/builder-webpack5": "portal:../../code/builders/builder-webpack5",
"@storybook/channel-postmessage": "portal:../../code/lib/channel-postmessage",
"@storybook/channel-websocket": "portal:../../code/lib/channel-websocket",
"@storybook/channels": "portal:../../code/lib/channels",
Expand Down