-
Notifications
You must be signed in to change notification settings - Fork 918
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 node/yarn/storybook #2736
Merged
Merged
Changes from all commits
Commits
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 |
---|---|---|
@@ -1 +1 @@ | ||
16.17.0 | ||
18 |
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,54 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5'; | ||
import path from 'path'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../packages/core/**/*.stories.tsx', '../packages/react/**/*.stories.tsx'], | ||
addons: [ | ||
getAbsolutePath('@storybook/addon-essentials'), | ||
getAbsolutePath('@storybook/addon-storysource'), | ||
], | ||
framework: { | ||
name: getAbsolutePath('@storybook/react-webpack5'), | ||
options: { | ||
builder: { | ||
useSWC: true, | ||
}, | ||
// enable React strict mode | ||
strictMode: true, | ||
}, | ||
}, | ||
|
||
// we need to add aliases to webpack so it knows how to follow | ||
// to the source of the packages rather than the built version (dist) | ||
webpackFinal: async (config) => ({ | ||
...config, | ||
resolve: { | ||
...config.resolve, | ||
alias: { | ||
...config.resolve.alias, | ||
...convertTsConfigPathsToWebpackAliases(), | ||
}, | ||
}, | ||
}), | ||
}; | ||
|
||
export default config; | ||
|
||
/** | ||
* This function is used to resolve the absolute path of a package. | ||
* It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
*/ | ||
function getAbsolutePath(value: string): any { | ||
return path.dirname(require.resolve(path.join(value, 'package.json'))); | ||
} | ||
|
||
function convertTsConfigPathsToWebpackAliases() { | ||
const rootDir = path.resolve(__dirname, '../'); | ||
const tsconfig = require('../tsconfig.json'); | ||
const tsconfigPaths: Array<string | string[]> = Object.entries(tsconfig.compilerOptions.paths); | ||
|
||
return tsconfigPaths.reduce((aliases, [realPath, mappedPath]) => { | ||
aliases[realPath] = path.join(rootDir, mappedPath[0]); | ||
return aliases; | ||
}, {}); | ||
} |
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,7 @@ | ||
import { addons } from '@storybook/manager-api'; | ||
import { themes } from '@storybook/theming'; | ||
|
||
addons.setConfig({ | ||
enableShortcuts: false, | ||
theme: themes.light, | ||
}); |
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,19 @@ | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
// This should work after upgrading to Storybook 7.6 but doesn't. | ||
// I am leaving it commented out here so we can fix it one day. | ||
// | ||
// options: { | ||
// storySort: { | ||
// order: ['Components', 'Utilities'], | ||
// }, | ||
// }, | ||
|
||
// disables Chromatic on a global level | ||
chromatic: { disable: true }, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
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,2 @@ | ||
declined: | ||
- primitives |
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 |
---|---|---|
|
@@ -12,12 +12,12 @@ | |
"types:check": "tsc --skipLibCheck --noEmit", | ||
"test": "jest", | ||
"test:ci": "yarn types:check && jest --ci && yarn cypress:ci", | ||
"storybook": "start-storybook -p 9009 --ci", | ||
"storybook": "BROWSER=none storybook dev -p 9009", | ||
"cypress:ci": "start-server-and-test storybook http://localhost:9009 cypress:run", | ||
"cypress:run": "cypress run", | ||
"cypress:dev": "cypress open", | ||
"dev": "yarn storybook", | ||
"build-storybook": "build-storybook", | ||
"build-storybook": "storybook build", | ||
"// build": "For context on tsconfig replacements in build scripts, see https://github.com/radix-ui/primitives/pull/361#discussion_r555004944", | ||
"build": "yarn build:config && yarn build:packages && yarn build:cleanup", | ||
"build:config": "mv tsconfig.json tsconfig.tmp.json && mv tsconfig.production.json tsconfig.json", | ||
|
@@ -46,8 +46,11 @@ | |
"@parcel/packager-ts": "2.4.1", | ||
"@parcel/transformer-typescript-types": "2.4.1", | ||
"@stitches/core": "^1.2.8", | ||
"@storybook/addon-storysource": "^6.5.0-alpha.63", | ||
"@storybook/react": "^6.5.0-alpha.63", | ||
"@storybook/addon-essentials": "^7.6.17", | ||
"@storybook/addon-storysource": "^7.6.17", | ||
"@storybook/react": "^7.6.17", | ||
"@storybook/react-webpack5": "^7.6.17", | ||
"@storybook/test": "^7.6.17", | ||
"@testing-library/cypress": "^7.0.6", | ||
"@testing-library/jest-dom": "^5.16.4", | ||
"@testing-library/react": "^13.0.1", | ||
|
@@ -74,6 +77,7 @@ | |
"eslint-plugin-jsx-a11y": "^6.3.1", | ||
"eslint-plugin-react": "^7.24.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"fs-extra": "^11.1.1", | ||
"glob": "^10.2.2", | ||
"husky": "^4.3.6", | ||
|
@@ -87,6 +91,7 @@ | |
"react-test-renderer": "^18.0.0", | ||
"replace-in-files": "^3.0.0", | ||
"start-server-and-test": "^1.12.5", | ||
"storybook": "^7.6.17", | ||
"ts-jest": "^27.1.4", | ||
"typescript": "^4.6.3" | ||
}, | ||
|
@@ -128,7 +133,8 @@ | |
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"plugin:jsx-a11y/recommended" | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:storybook/recommended" | ||
], | ||
"plugins": [ | ||
"jsx-a11y" | ||
|
@@ -182,5 +188,6 @@ | |
}, | ||
"lint-staged": { | ||
"*.{js,ts,tsx}": "eslint --quiet --fix --cache" | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
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.
Does this change anything with versioning or publishing?
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.
I don't think think so, it just got added automatically when I upgraded yarn with
yarn set version latest
.