-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Webpack/Jest to Vite/Vitest migration (#2716)
Co-authored-by: Brandon Lenz <[email protected]>
- Loading branch information
1 parent
b3e79f2
commit 17dde0a
Showing
141 changed files
with
152,356 additions
and
7,363 deletions.
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,5 +1,4 @@ | ||
# Supported browsers | ||
> 2% | ||
last 2 versions | ||
IE 11 | ||
not dead |
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
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
File renamed without changes.
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 @@ | ||
yarn run lint | ||
yarn run format:check | ||
yarn run test related --silent |
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,3 +1,4 @@ | ||
@forward '../src/styles/uswds-theme'; | ||
@use 'uswds-core' as *; | ||
|
||
// Add custom styles for storybook implementation | ||
|
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,114 +1,20 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5' | ||
|
||
const path = require('path') | ||
|
||
const uswdsIncludePaths = [ | ||
'./node_modules/@uswds', | ||
'./node_modules/@uswds/uswds/packages', | ||
] | ||
|
||
const webpackConfig = (config) => { | ||
config.resolve.alias.uswds = path.resolve( | ||
__dirname, | ||
'../node_modules/@uswds/uswds' | ||
) | ||
|
||
config.module.rules = config.module.rules.filter( | ||
(rule) => rule.test && rule.test.toString() !== '/\\.css$/' | ||
) | ||
config.module.rules.push({ | ||
test: /\.(sa|sc|c)ss$/, | ||
exclude: /\.module\.(sa|sc|c)ss$/i, | ||
use: [ | ||
'style-loader', | ||
'css-loader', | ||
{ | ||
loader: 'sass-loader', | ||
options: { | ||
sourceMap: true, | ||
sassOptions: { | ||
includePaths: uswdsIncludePaths, | ||
}, | ||
}, | ||
}, | ||
], | ||
include: path.resolve(__dirname, '../'), | ||
}) | ||
|
||
config.module.rules.push({ | ||
test: /\.module\.(sa|sc|c)ss$/i, | ||
include: path.resolve(__dirname, '../src'), | ||
use: [ | ||
'style-loader', | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
modules: { | ||
localIdentName: '[path][name]__[local]--[hash:base64:5]', | ||
}, | ||
}, | ||
}, | ||
{ | ||
loader: 'sass-loader', | ||
options: { | ||
sourceMap: true, | ||
sassOptions: { | ||
includePaths: uswdsIncludePaths, | ||
}, | ||
}, | ||
}, | ||
], | ||
}) | ||
|
||
const fileLoaderRule = config.module.rules.find( | ||
(rule) => rule.test && rule.test.test('.svg') | ||
) | ||
fileLoaderRule.exclude = /\.svg$/ | ||
|
||
config.module.rules.push({ | ||
test: /\.svg$/, | ||
oneOf: [ | ||
{ | ||
issuer: /\.[jt]sx?$/, | ||
resourceQuery: /svgr/, | ||
use: [ | ||
{ | ||
loader: '@svgr/webpack', | ||
options: { | ||
icon: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
type: 'asset', | ||
}, | ||
], | ||
}) | ||
|
||
return config | ||
} | ||
|
||
module.exports = { | ||
stories: ['../src/**/*.stories.@(ts|tsx)'], | ||
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y'], | ||
typescript: { | ||
check: false, | ||
checkOptions: {}, | ||
reactDocgen: 'react-docgen-typescript', | ||
reactDocgenTypescriptOptions: { | ||
tsconfigPath: path.resolve(__dirname, '../tsconfig.json'), | ||
}, | ||
}, | ||
webpackFinal: async (config) => { | ||
return webpackConfig(config) | ||
}, | ||
import type { StorybookConfig } from '@storybook/react-vite' | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-a11y', | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
], | ||
framework: { | ||
name: '@storybook/react-webpack5', | ||
options: { strictMode: false }, | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
staticDirs: ['./public'], | ||
} as StorybookConfig | ||
staticDirs: ['public'], | ||
} | ||
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
{ | ||
"plugins": ["stylelint-scss", "stylelint-prettier"], | ||
"plugins": ["stylelint-prettier"], | ||
"rules": { | ||
"at-rule-no-unknown": null, | ||
"scss/at-rule-no-unknown": true, | ||
"prettier/prettier": true, | ||
"selector-class-pattern": "" | ||
"selector-class-pattern": "", | ||
"scss/function-no-unknown": null, | ||
"at-rule-empty-line-before": null | ||
}, | ||
"extends": ["stylelint-config-recommended", "stylelint-prettier/recommended", "stylelint-config-sass-guidelines", "stylelint-config-css-modules"], | ||
"extends": ["stylelint-config-recommended", "stylelint-prettier/recommended", "stylelint-config-sass-guidelines", "stylelint-config-css-modules", "stylelint-config-standard-scss"] | ||
} |
Oops, something went wrong.