PR-665639: Update webpack.config.ts, webpack.cy.config.ts,

.storybook/main.js, and package.json to add support to sass modules.
This commit is contained in:
Alejandro Lembke Barrientos 2023-11-22 15:23:48 +00:00
parent 7e1457cbf8
commit b1c9a66f23
5 changed files with 74 additions and 46 deletions

View File

@ -6,7 +6,21 @@ const deFaultValues = {
const prefixUrl = process.env.PREFIX_URL ? process.env.PREFIX_URL : deFaultValues.PREFIX_URL
module.exports = {
"stories": ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
"addons": ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions", "@storybook/preset-scss"],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
{
name: '@storybook/preset-scss',
options: {
cssLoaderOptions: {
modules: {
auto: /\.module\.\w+$/i,
}
}
}
}
],
"webpackFinal": async config => {
config.entry = config.entry.map(function(entry) {
if (entry.includes("webpack-hot-middleware")) {

74
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@aleleba/create-react-component-library",
"version": "1.2.17",
"version": "1.2.18",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@aleleba/create-react-component-library",
"version": "1.2.17",
"version": "1.2.18",
"license": "MIT",
"bin": {
"create-react-component-library": "bin/cli.js"
@ -32,16 +32,16 @@
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.2",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/jest": "^29.5.10",
"@types/node": "^20.9.4",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"@types/webpack": "^5.28.5",
"babel-loader": "^9.1.3",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"cypress": "^13.5.1",
"cypress": "^13.6.0",
"dotenv": "^16.3.1",
"eslint": "^8.54.0",
"eslint-plugin-react": "^7.33.2",
@ -6920,9 +6920,9 @@
}
},
"node_modules/@types/jest": {
"version": "29.5.8",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.8.tgz",
"integrity": "sha512-fXEFTxMV2Co8ZF5aYFJv+YeA08RTYJfhtN5c9JSv/mFEMe+xxjufCb+PHL+bJcMs/ebPUsBu+UNTEz+ydXrR6g==",
"version": "29.5.10",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.10.tgz",
"integrity": "sha512-tE4yxKEphEyxj9s4inideLHktW/x6DwesIwWZ9NN1FKf9zbJYsnhBoA9vrHA/IuIOKwPa5PcFBNV4lpMIOEzyQ==",
"dev": true,
"dependencies": {
"expect": "^29.0.0",
@ -7033,9 +7033,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.9.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.2.tgz",
"integrity": "sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==",
"version": "20.9.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.4.tgz",
"integrity": "sha512-wmyg8HUhcn6ACjsn8oKYjkN/zUzQeNtMy44weTJSM6p4MMzEOuKbA3OjJ267uPCOW7Xex9dyrNTful8XTQYoDA==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@ -7088,9 +7088,9 @@
"dev": true
},
"node_modules/@types/react": {
"version": "18.2.37",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz",
"integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==",
"version": "18.2.38",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.38.tgz",
"integrity": "sha512-cBBXHzuPtQK6wNthuVMV6IjHAFkdl/FOPFIlkd81/Cd1+IqkHu/A+w4g43kaQQoYHik/ruaQBDL72HyCy1vuMw==",
"dev": true,
"dependencies": {
"@types/prop-types": "*",
@ -7099,9 +7099,9 @@
}
},
"node_modules/@types/react-dom": {
"version": "18.2.15",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.15.tgz",
"integrity": "sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==",
"version": "18.2.17",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.17.tgz",
"integrity": "sha512-rvrT/M7Df5eykWFxn6MYt5Pem/Dbyc1N8Y0S9Mrkw2WFCRiqUgw9P7ul2NpwsXCSM1DVdENzdG9J5SreqfAIWg==",
"dev": true,
"dependencies": {
"@types/react": "*"
@ -9997,9 +9997,9 @@
"dev": true
},
"node_modules/cypress": {
"version": "13.5.1",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.5.1.tgz",
"integrity": "sha512-yqLViT0D/lPI8Kkm7ciF/x/DCK/H/DnogdGyiTnQgX4OVR2aM30PtK+kvklTOD1u3TuItiD9wUQAF8EYWtyZug==",
"version": "13.6.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.0.tgz",
"integrity": "sha512-quIsnFmtj4dBUEJYU4OH0H12bABJpSujvWexC24Ju1gTlKMJbeT6tTO0vh7WNfiBPPjoIXLN+OUqVtiKFs6SGw==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -25463,9 +25463,9 @@
}
},
"@types/jest": {
"version": "29.5.8",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.8.tgz",
"integrity": "sha512-fXEFTxMV2Co8ZF5aYFJv+YeA08RTYJfhtN5c9JSv/mFEMe+xxjufCb+PHL+bJcMs/ebPUsBu+UNTEz+ydXrR6g==",
"version": "29.5.10",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.10.tgz",
"integrity": "sha512-tE4yxKEphEyxj9s4inideLHktW/x6DwesIwWZ9NN1FKf9zbJYsnhBoA9vrHA/IuIOKwPa5PcFBNV4lpMIOEzyQ==",
"dev": true,
"requires": {
"expect": "^29.0.0",
@ -25562,9 +25562,9 @@
"dev": true
},
"@types/node": {
"version": "20.9.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.2.tgz",
"integrity": "sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==",
"version": "20.9.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.4.tgz",
"integrity": "sha512-wmyg8HUhcn6ACjsn8oKYjkN/zUzQeNtMy44weTJSM6p4MMzEOuKbA3OjJ267uPCOW7Xex9dyrNTful8XTQYoDA==",
"dev": true,
"requires": {
"undici-types": "~5.26.4"
@ -25617,9 +25617,9 @@
"dev": true
},
"@types/react": {
"version": "18.2.37",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz",
"integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==",
"version": "18.2.38",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.38.tgz",
"integrity": "sha512-cBBXHzuPtQK6wNthuVMV6IjHAFkdl/FOPFIlkd81/Cd1+IqkHu/A+w4g43kaQQoYHik/ruaQBDL72HyCy1vuMw==",
"dev": true,
"requires": {
"@types/prop-types": "*",
@ -25628,9 +25628,9 @@
}
},
"@types/react-dom": {
"version": "18.2.15",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.15.tgz",
"integrity": "sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==",
"version": "18.2.17",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.17.tgz",
"integrity": "sha512-rvrT/M7Df5eykWFxn6MYt5Pem/Dbyc1N8Y0S9Mrkw2WFCRiqUgw9P7ul2NpwsXCSM1DVdENzdG9J5SreqfAIWg==",
"dev": true,
"requires": {
"@types/react": "*"
@ -27818,9 +27818,9 @@
"dev": true
},
"cypress": {
"version": "13.5.1",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.5.1.tgz",
"integrity": "sha512-yqLViT0D/lPI8Kkm7ciF/x/DCK/H/DnogdGyiTnQgX4OVR2aM30PtK+kvklTOD1u3TuItiD9wUQAF8EYWtyZug==",
"version": "13.6.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.0.tgz",
"integrity": "sha512-quIsnFmtj4dBUEJYU4OH0H12bABJpSujvWexC24Ju1gTlKMJbeT6tTO0vh7WNfiBPPjoIXLN+OUqVtiKFs6SGw==",
"dev": true,
"requires": {
"@cypress/request": "^3.0.0",

View File

@ -1,6 +1,6 @@
{
"name": "@aleleba/create-react-component-library",
"version": "1.2.17",
"version": "1.2.18",
"description": "A starter kit for create a React component Library with storybook",
"bin": "./bin/cli.js",
"main": "dist/index.js",
@ -55,16 +55,16 @@
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.2",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/jest": "^29.5.10",
"@types/node": "^20.9.4",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"@types/webpack": "^5.28.5",
"babel-loader": "^9.1.3",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"cypress": "^13.5.1",
"cypress": "^13.6.0",
"dotenv": "^16.3.1",
"eslint": "^8.54.0",
"eslint-plugin-react": "^7.33.2",

View File

@ -55,7 +55,14 @@ export default {
test: /\.(css|sass|scss)$/,
use: [
externalCss === true ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader',
{
'loader': 'css-loader',
'options': {
modules: {
auto: /\.module\.\w+$/i,
}
},
},
'sass-loader',
],
},

View File

@ -56,7 +56,14 @@ export default {
test: /\.(css|sass|scss)$/,
use: [
externalCss === true ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader',
{
'loader': 'css-loader',
'options': {
modules: {
auto: /\.module\.\w+$/i,
}
},
},
'sass-loader',
],
},