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

Vite: Add builder-vite, react-vite, and vue3-vite #19007

Merged
merged 74 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
b3c1f81
Move builder-vite files into monorepo
IanVS Aug 13, 2022
f80ef5f
Add storybook dependencies
IanVS Aug 13, 2022
bc4828a
Update package.json
IanVS Aug 13, 2022
ecfc444
Fix (most) linting errors
IanVS Aug 13, 2022
fe4c852
Add builder-vite to nx and workspace
IanVS Aug 13, 2022
01e3663
Vite core, react, and example app (WIP)
shilman Aug 14, 2022
aef0330
Use monorepo version of builder-vite in example
IanVS Aug 15, 2022
1f3c1f8
Move input files out of src
IanVS Aug 15, 2022
67456fd
Fix linting / typescript errors
IanVS Aug 15, 2022
aaedc2a
Remove plugins that moved to react-vite
IanVS Aug 15, 2022
b6908f7
Remove @vitejs/plugin-react, it's added in every framework
IanVS Aug 15, 2022
099771b
[hack] remove exports from package.json
IanVS Aug 15, 2022
c4f456d
Disable source loader plugin
IanVS Aug 15, 2022
49a3f87
Disable docs
IanVS Aug 15, 2022
da507a2
Merge branch 'next' into vite-frameworks
shilman Aug 15, 2022
2a9f89a
Fix react-vite builder dependency
shilman Aug 15, 2022
441a5c1
Add vite packages to CLI versions
shilman Aug 15, 2022
fd0de66
Merge branch 'next' into vite-frameworks
shilman Aug 17, 2022
7389a38
Add react-vite repros
shilman Aug 17, 2022
60819ff
Fix exports map for ESM
shilman Aug 17, 2022
1859ad6
CLI: Fix vite preview-head hack for SB7
shilman Aug 17, 2022
5e7299d
Fix react-vite preset
shilman Aug 17, 2022
47e39a2
Force repro generator to use yarn
shilman Aug 17, 2022
3a991b4
Add vue3-vite framework and repro template
shilman Aug 17, 2022
ef5917b
Clean up legacy typescript annotations
shilman Aug 18, 2022
ca839d0
clean up unused bin files
shilman Aug 18, 2022
a3cec55
Remove vue-specific code from vite builder
shilman Aug 18, 2022
1eb6339
Vue3-vite: Fix bad config merge
shilman Aug 22, 2022
a3b53da
CLI: Fix local repro publishing
shilman Aug 22, 2022
00465ba
Remove unnecessary file
shilman Aug 22, 2022
8a0029d
Merge branch 'next' into vite-frameworks
shilman Aug 22, 2022
0b9123b
Merge branch 'next' into vite-frameworks
shilman Aug 22, 2022
1671b46
Merge branch 'next' into vite-frameworks
shilman Aug 22, 2022
c9cffa0
Merge branch 'next' into vite-frameworks
shilman Aug 22, 2022
07f8ad4
Fix build errors
shilman Aug 22, 2022
69d62e4
Fix linting errors, take two
shilman Aug 22, 2022
eb24506
Fix parallelism
shilman Aug 22, 2022
71d7ee7
add missing core-vite ref in package.json
ndelangen Aug 22, 2022
495b75f
Merge branch 'vite-frameworks' of github.com:storybookjs/storybook in…
ndelangen Aug 22, 2022
6a4a0bd
Core: Fix null stats.toJson() for vite builder
shilman Aug 22, 2022
e53d6b2
Merge branch 'vite-frameworks' of github.com:storybookjs/storybook in…
shilman Aug 22, 2022
f194030
Trigger an update of the repro-templates-temp repo
shilman Aug 22, 2022
627a8cf
Merge branch 'next' into vite-frameworks
shilman Aug 23, 2022
fba2eec
Build: Run generate-repros-next on node14
shilman Aug 23, 2022
0c6c05e
Merge branch 'next' into vite-frameworks-clean
shilman Aug 23, 2022
27b6d3c
Test the generate-repros-publishing
shilman Aug 23, 2022
7f4d3f0
Stop running generate-repros-next on every vite commit
shilman Aug 23, 2022
674961a
Vue3: Add template components to renderer
shilman Aug 23, 2022
2bb5210
Get rid of failing example test
shilman Aug 23, 2022
d5417d1
Merge branch 'next' into vite-frameworks-clean
shilman Aug 23, 2022
46ba568
Builder-vite: Add support for V7 story root
shilman Aug 24, 2022
f1481d1
Builder-vite: Add support for previewEntries preset
shilman Aug 24, 2022
53fd0bb
Vue: Align button component's inputs with React
shilman Aug 24, 2022
0170415
Vue3: Unpin renderer vue devDep
shilman Aug 24, 2022
b049235
Merge branch 'next' into vite-frameworks-clean
shilman Aug 24, 2022
de738d4
Remove vue3-vite
IanVS Aug 24, 2022
49e21de
Cleanup unused variables
IanVS Aug 24, 2022
bf80064
Remove vite example
IanVS Aug 24, 2022
4563673
Fix parallelism
IanVS Aug 24, 2022
c64c27f
Build storyshots
IanVS Aug 24, 2022
26b55d5
Update tsup for better error messages
IanVS Aug 24, 2022
e4248b0
Remove unmount parameter
IanVS Aug 24, 2022
183e2c2
CI: use playwright on cra_bench
yannbf Aug 17, 2022
ed8813d
Avoid exit code 0 when tsup fails
IanVS Aug 24, 2022
d4fae09
Log smoke test target
IanVS Aug 24, 2022
d484151
[debug] remove quiet flag to see what's going on
IanVS Aug 24, 2022
25169ab
Wait for page to finish loading in e2e tests
IanVS Aug 25, 2022
abf5c99
Revert "Remove vue3-vite"
IanVS Aug 25, 2022
79f93bd
Revert "Fix parallelism"
IanVS Aug 25, 2022
149342f
Fix DeepScan issues
IanVS Aug 25, 2022
8b85f97
Revert "Build storyshots"
shilman Aug 25, 2022
1e20308
Vite: Delete core-vite and cursory first cut at types
shilman Aug 25, 2022
dcc9f08
Merge branch 'next' into vite-frameworks-react
shilman Aug 25, 2022
3a22d4c
Builder-vite: Tighten up tsconfig.json
shilman Aug 25, 2022
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
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ jobs:
# executor:
# class: large
# name: sb_cypress_8_node_14
# parallelism: 2
# parallelism: 8
# steps:
# - git-shallow-clone/checkout_advanced:
# clone_options: '--depth 1 --verbose'
Expand Down Expand Up @@ -470,7 +470,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 6
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -490,7 +490,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 6
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -506,7 +506,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 6
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -526,7 +526,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 6
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -542,7 +542,7 @@ jobs:
executor:
class: medium+
name: sb_node_14_browsers
parallelism: 2
parallelism: 6
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand All @@ -558,7 +558,7 @@ jobs:
executor:
class: medium+
name: sb_playwright
parallelism: 2
parallelism: 6
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/generate-repros-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ on:
# To remove when the branch will be merged
push:
branches:
- shilman/add-angular-repro-template
- vite-frameworks-xyz

jobs:
generate:
runs-on: ubuntu-latest
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
steps:
- uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/checkout@v2
- name: Setup git user
run: |
Expand Down
6 changes: 6 additions & 0 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,11 @@ module.exports = {
'jest/no-test-callback': 'off', // These aren't jest tests
},
},
{
files: ['**/builder-vite/input/iframe.html'],
rules: {
'no-undef': 'off', // ignore "window" undef errors
},
},
],
};
3 changes: 3 additions & 0 deletions code/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
4 changes: 2 additions & 2 deletions code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
},
"./preview": {
"./preview.js": {
"require": "./dist/preview.js",
"import": "./dist/preview.mjs",
"types": "./dist/preview.d.ts"
Expand Down
4 changes: 2 additions & 2 deletions code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
},
"./preview": {
"./preview.js": {
"require": "./dist/preview.js",
"import": "./dist/preview.mjs",
"types": "./dist/preview.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
Expand Down
4 changes: 2 additions & 2 deletions code/addons/links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
},
"./preview": {
"./preview.js": {
"require": "./dist/preview.js",
"import": "./dist/preview.mjs",
"types": "./dist/preview.d.ts"
Expand Down
4 changes: 2 additions & 2 deletions code/addons/measure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
},
"./preview": {
"./preview.js": {
"require": "./dist/preview.js",
"import": "./dist/preview.mjs",
"types": "./dist/preview.d.ts"
Expand Down
4 changes: 2 additions & 2 deletions code/addons/outline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
},
"./preview": {
"./preview.js": {
"require": "./dist/preset/preview.js",
"import": "./dist/preset/preview.mjs",
"types": "./dist/preview.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/toolbars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./manager": {
"./manager.js": {
"require": "./dist/manager.js",
"import": "./dist/manager.mjs",
"types": "./dist/manager.d.ts"
Expand Down
1 change: 1 addition & 0 deletions code/e2e-tests/addon-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
test.describe('addon-actions', () => {
test.beforeEach(async ({ page }) => {
await page.goto(storybookUrl);
await new SbPage(page).waitUntilLoaded();
});

test('should trigger an action', async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions code/e2e-tests/addon-backgrounds.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
test.describe('addon-backgrounds', () => {
test.beforeEach(async ({ page }) => {
await page.goto(storybookUrl);
await new SbPage(page).waitUntilLoaded();
});

test('should have a dark background', async ({ page }) => {
Expand Down
2 changes: 2 additions & 0 deletions code/e2e-tests/addon-controls.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ test.describe('addon-controls', () => {
test('should change component when changing controls', async ({ page }) => {
await page.goto(storybookUrl);
const sbPage = new SbPage(page);
await sbPage.waitUntilLoaded();

await sbPage.navigateToStory('example-button', 'primary');
await sbPage.viewAddonPanel('Controls');
Expand Down Expand Up @@ -62,6 +63,7 @@ test.describe('addon-controls', () => {
await page.goto(`${storybookUrl}?path=/story/example-button--primary&args=label:Hello+world`);

const sbPage = new SbPage(page);
await sbPage.waitUntilLoaded();
await expect(sbPage.previewRoot().locator('button')).toContainText('Hello world');

await sbPage.viewAddonPanel('Controls');
Expand Down
1 change: 1 addition & 0 deletions code/e2e-tests/addon-docs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const templateName = process.env.STORYBOOK_TEMPLATE_NAME || '';
test.describe('addon-docs', () => {
test.beforeEach(async ({ page }) => {
await page.goto(storybookUrl);
await new SbPage(page).waitUntilLoaded();
});

test('should provide source snippet', async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions code/e2e-tests/addon-interactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
test.describe('addon-interactions', () => {
test.beforeEach(async ({ page }) => {
await page.goto(storybookUrl);
await new SbPage(page).waitUntilLoaded();
});

// FIXME: skip xxx
Expand Down
1 change: 1 addition & 0 deletions code/e2e-tests/addon-viewport.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001';
test.describe('addon-viewport', () => {
test.beforeEach(async ({ page }) => {
await page.goto(storybookUrl);
await new SbPage(page).waitUntilLoaded();
});

test('should have viewport button in the toolbar', async ({ page }) => {
Expand Down
14 changes: 0 additions & 14 deletions code/e2e-tests/example.spec.ts

This file was deleted.

8 changes: 8 additions & 0 deletions code/e2e-tests/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export class SbPage {
await expect(selected).toBe('true');
}

async waitUntilLoaded() {
const root = this.previewRoot();
const docsLoadingPage = root.locator('.sb-preparing-docs');
const storyLoadingPage = root.locator('.sb-preparing-story');
await docsLoadingPage.waitFor({ state: 'hidden' });
await storyLoadingPage.waitFor({ state: 'hidden' });
}

previewIframe() {
return this.page.frameLocator('#storybook-preview-iframe');
}
Expand Down
1 change: 1 addition & 0 deletions code/frameworks/react-vite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Storybook for React
98 changes: 98 additions & 0 deletions code/frameworks/react-vite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"name": "@storybook/react-vite",
"version": "7.0.0-alpha.24",
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
],
"homepage": "https://github.com/storybookjs/storybook/tree/main/frameworks/react-vite",
"bugs": {
"url": "https://github.com/storybookjs/storybook/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/storybookjs/storybook.git",
"directory": "frameworks/react-vite"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/storybook"
},
"license": "MIT",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./preset": {
"require": "./dist/preset.js",
"import": "./dist/preset.mjs",
"types": "./dist/preset.d.ts"
},
"./package.json": {
"require": "./package.json",
"import": "./package.json",
"types": "./package.json"
}
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"types/**/*",
"README.md",
"*.js",
"*.d.ts"
],
"scripts": {
"check": "tsc --noEmit",
"prepare": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@joshwooding/vite-plugin-react-docgen-typescript": "0.0.4",
"@rollup/pluginutils": "^4.2.0",
"@storybook/builder-vite": "7.0.0-alpha.24",
"@storybook/core-server": "7.0.0-alpha.24",
"@storybook/react": "7.0.0-alpha.24",
"@types/node": "^14.14.20 || ^16.0.0",
"@vitejs/plugin-react": "^1.0.8",
"ast-types": "^0.14.2",
"core-js": "^3.8.2",
"magic-string": "^0.26.1",
"react-docgen": "6.0.0-alpha.1",
"regenerator-runtime": "^0.13.7"
},
"devDependencies": {
"jest-specific-snapshot": "^4.0.0",
"typescript": "~4.6.3"
},
"peerDependencies": {
"@babel/core": "^7.11.5",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@babel/core": {
"optional": true
},
"typescript": {
"optional": true
}
},
"engines": {
"node": ">=10.13.0"
},
"publishConfig": {
"access": "public"
},
"bundler": {
"entries": [
"./src/index.ts",
"./src/preset.ts"
],
"platform": "node"
},
"gitHead": "55247a8e36da7061bfced80c588a539d3fda3f04"
}
1 change: 1 addition & 0 deletions code/frameworks/react-vite/preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist/preset');
2 changes: 2 additions & 0 deletions code/frameworks/react-vite/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from '@storybook/react';
export type { StorybookConfig } from '@storybook/builder-vite';
Loading