-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Upgrade Storybook to v7, move builder to Vite #37331
Changes from all commits
1c81e4b
106cca6
d5cd6f0
7944ea2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. @avatus Regarding your question as to what work is left to in this PR, here's what I see:
I just quickly ran |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Teleport | ||
* Copyright (C) 2023 Gravitational, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import path, { dirname, join, resolve } from 'path'; | ||
import { Plugin, UserConfig } from 'vite'; | ||
import type { StorybookConfig } from '@storybook/react-vite'; | ||
import fs from 'fs'; | ||
|
||
const enterpriseTeleportExists = fs.existsSync( | ||
path.join(__dirname, '/../../e/web') | ||
); | ||
|
||
function getAbsolutePath(value: string): any { | ||
return dirname(require.resolve(join(value, 'package.json'))); | ||
} | ||
|
||
function createStoriesPaths() { | ||
const stories = ['../packages/**/*.story.@(ts|tsx)']; | ||
|
||
// include enterprise stories if available (**/* pattern ignores dot dir names) | ||
if (enterpriseTeleportExists) { | ||
stories.unshift('../../e/web/**/*.story.@(ts|tsx)'); | ||
} | ||
|
||
return stories; | ||
} | ||
|
||
const rootDirectory = path.resolve(__dirname, '..', '..'); | ||
const webDirectory = path.resolve(rootDirectory, 'web'); | ||
|
||
const config: StorybookConfig = { | ||
stories: createStoriesPaths(), | ||
addons: [getAbsolutePath('@storybook/addon-toolbars')], | ||
framework: { | ||
name: getAbsolutePath('@storybook/react-vite'), | ||
options: { | ||
builder: { | ||
viteConfigPath: resolve( | ||
__dirname, | ||
'../../web/packages/teleport/vite.config.mts' | ||
), | ||
}, | ||
}, | ||
}, | ||
staticDirs: ['public'], | ||
async viteFinal(config: UserConfig) { | ||
config.plugins = config.plugins.filter( | ||
(plugin: Plugin) => | ||
plugin.name !== 'teleport-html-plugin' && | ||
plugin.name !== 'teleport-transform-html-plugin' | ||
); | ||
|
||
return config; | ||
}, | ||
}; | ||
|
||
export default config; |
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. As I mentioned in #34450, msw-storybook-addon has some problems with resetting the handlers between stories when using For example, if you open the Access List story and then open "Empty with Igs", which uses Now, the Access List story doesn't need to use |
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.
The stories for
DocumentCluster
in teleterm fail with "ambiguous import: FileTransferDirection" and I didn't have time to investigate this. Maybe it's a matter of updating this branch with master?