This repository has been archived by the owner on Jul 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Use Vite for speed and simplicity #609
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
eca7b5d
feat: use Vite for test page + storybook
mxdvl 6ca72a4
refactor: remove `typescript` from peer deps
mxdvl fd39949
refactor: rename deps job
mxdvl 8b5637e
chore(deps): bump storybook to v6.5.13
mxdvl 204780a
fix(vite): assign global to window
mxdvl 4f241c4
chore: ignore storybook static build
mxdvl 62e25d5
feat(lib): use Vite for bundling the lib
mxdvl dc842ca
chore(deps): remove unused babel packages
mxdvl 25b84b2
feat: bump package for testing release
mxdvl 9679bb7
docs(build): link package.json and output
mxdvl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@guardian/discussion-rendering': patch | ||
--- | ||
|
||
Use Vite’s library mode for bundling the package. No expected change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
name: 🕵♀ | ||
name: 📦 | ||
on: [push] | ||
|
||
jobs: | ||
typescript: | ||
deps: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
|
||
# production | ||
/build | ||
/test-page/dist | ||
/storybook-static | ||
|
||
# misc | ||
.DS_Store | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { mergeConfig } from 'vite'; | ||
import type { StorybookViteConfig } from '@storybook/builder-vite'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
const config: StorybookViteConfig = { | ||
stories: [ | ||
"../src/**/*.stories.mdx", | ||
"../src/**/*.stories.@(js|jsx|ts|tsx)" | ||
], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials" | ||
], | ||
core: { | ||
builder: '@storybook/builder-vite', | ||
}, | ||
async viteFinal(config) { | ||
config.plugins = config.plugins?.filter( | ||
(plugin) => | ||
//@ts-expect-error -- https://github.com/storybookjs/builder-vite/issues/210 | ||
!(Array.isArray(plugin) && plugin[0]?.name.includes("vite:react")) | ||
); | ||
|
||
return mergeConfig(config, { | ||
plugins: [react({ | ||
jsxImportSource: "@emotion/react", | ||
})], | ||
}) | ||
} | ||
} | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script> | ||
window.global = window; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>discussion-rendering</title> | ||
|
||
<style> | ||
body { | ||
padding: 0 10px; | ||
font-family: monospace; | ||
max-width: 1300px; | ||
margin: auto; | ||
} | ||
|
||
.options { | ||
display: flex; | ||
gap: 20px | ||
} | ||
|
||
main { | ||
margin-block: 10px | ||
} | ||
|
||
hr { | ||
border: solid 1px | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
</body> | ||
|
||
<script type="module" src="/src/test-page.tsx"></script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This enables IntelliSense for TypeScript |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed for some of the Storybook addons and the fix is suggested in storybookjs/storybook#18399 and https://github.com/storybookjs/builder-vite/blob/main/packages/builder-vite/README.md#migration-from-webpack--cra