Skip to content

Commit

Permalink
Upgrade to storybook v8
Browse files Browse the repository at this point in the history
  • Loading branch information
avatus committed Jul 23, 2024
1 parent 71f7d42 commit f0ac6fa
Show file tree
Hide file tree
Showing 84 changed files with 4,062 additions and 5,733 deletions.
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ module.exports = {
transformIgnorePatterns: [`node_modules/(?!.pnpm|${esModules})`],
coverageReporters: ['text-summary', 'lcov'],
testPathIgnorePatterns: ['e2e'],
testEnvironmentOptions: {
customExportConditions: [''],
},
setupFilesAfterEnv: [
'<rootDir>/web/packages/build/jest/setupTests.ts',
'<rootDir>/web/packages/build/jest/customMatchers.ts',
Expand Down
24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"build-term": "pnpm --filter=@gravitational/teleterm build",
"start-term": "pnpm --filter=@gravitational/teleterm start",
"package-term": "pnpm --filter=@gravitational/teleterm package",
"storybook": "start-storybook -p 9002 -c web/.storybook -s web/.storybook/public",
"storybook-smoke-test": "pnpm storybook --ci --smoke-test",
"storybook": "storybook dev -p 9002 -c web/.storybook --https --ssl-cert=web/certs/server.crt --ssl-key=web/certs/server.key",
"storybook-smoke-test": "storybook dev -p 9002 -c web/.storybook --ci --smoke-test",
"test": "jest",
"test-coverage": "jest --coverage && web/scripts/print-coverage-link.sh",
"test-update-snapshot": "pnpm run test --updateSnapshot",
Expand All @@ -36,12 +36,16 @@
}
},
"devDependencies": {
"@storybook/react": "^6.5.16",
"@gravitational/build": "workspace:*",
"@storybook/components": "^8.2.5",
"@storybook/addon-toolbars": "^8.2.5",
"@storybook/react": "^8.2.5",
"@storybook/react-vite": "^8.2.5",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^15.0.7",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.9",
"@types/node": "^20.14.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-highlight": "^0.12.8",
Expand All @@ -50,9 +54,10 @@
"@types/wicg-file-system-access": "^2023.10.5",
"jest": "^29.7.0",
"jsdom-testing-mocks": "^1.13.0",
"msw": "^0.47.4",
"msw-storybook-addon": "^1.8.0",
"msw": "^2.3.1",
"msw-storybook-addon": "^2.0.3",
"prettier": "^3.3.2",
"storybook": "^8.2.5",
"typescript": "^5.5.2",
"vite": "^5.3.2"
},
Expand Down Expand Up @@ -87,5 +92,10 @@
"tslib": "^2.6.3",
"whatwg-fetch": "^3.6.20"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"msw": {
"workerDirectory": [
"web/.storybook/public"
]
}
}
5,397 changes: 1,455 additions & 3,942 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

130 changes: 0 additions & 130 deletions web/.storybook/main.js

This file was deleted.

49 changes: 49 additions & 0 deletions web/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 fs from 'node:fs';
import path from 'node:path';

import type { StorybookConfig } from '@storybook/react-vite';

const enterpriseTeleportExists = fs.existsSync(
path.join(__dirname, '/../../e/web')
);

function createStoriesPaths() {
const stories = ['../packages/**/*.story.@(ts|tsx|js|jsx)'];

// include enterprise stories if available (**/* pattern ignores dot dir names)
if (enterpriseTeleportExists) {
stories.unshift('../../e/web/**/*.story.@(ts|tsx|js|jsx)');
}

return stories;
}

const config: StorybookConfig = {
stories: createStoriesPaths(),
framework: {
name: '@storybook/react-vite',
options: { builder: { viteConfigPath: 'web/.storybook/vite.config.mts' } },
},
staticDirs: ['public'],
addons: ['@storybook/addon-toolbars'],
};

export default config;
124 changes: 0 additions & 124 deletions web/.storybook/preview.js

This file was deleted.

Loading

0 comments on commit f0ac6fa

Please sign in to comment.