Skip to content

Commit

Permalink
Merge pull request #24832 from storybookjs/revert-24676-experiment-ad…
Browse files Browse the repository at this point in the history
…don-peer-dep

Revert "Addons, core: Make `react` and Storybook packages `devDependencies` where possible"
  • Loading branch information
kasperpeulen authored Nov 13, 2023
2 parents b0052ad + 9c16b0f commit 92bb7e6
Show file tree
Hide file tree
Showing 87 changed files with 1,152 additions and 941 deletions.
73 changes: 13 additions & 60 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
const path = require('path');
const fs = require('fs');

const scriptPath = path.join(__dirname, '..', 'scripts');

const addonsPackages = fs
.readdirSync(path.join(__dirname, 'addons'))
.filter((p) => fs.statSync(path.join(__dirname, 'addons', p)).isDirectory());
const libPackages = fs
.readdirSync(path.join(__dirname, 'lib'))
.filter((p) => fs.statSync(path.join(__dirname, 'lib', p)).isDirectory());
const uiPackages = fs
.readdirSync(path.join(__dirname, 'ui'))
.filter((p) => fs.statSync(path.join(__dirname, 'ui', p)).isDirectory())
.filter((p) => !p.startsWith('.'));

module.exports = {
root: true,
extends: [path.join(scriptPath, '.eslintrc.js')],
Expand Down Expand Up @@ -65,6 +53,7 @@ module.exports = {
project: null,
},
rules: {
// '@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/no-throw-literal': 'off',
Expand All @@ -88,7 +77,15 @@ module.exports = {
},
{
// these packages use pre-bundling, dependencies will be bundled, and will be in devDepenencies
files: ['frameworks/**/*', 'builders/**/*', 'deprecated/**/*', 'renderers/**/*'],
files: [
'addons/**/*',
'frameworks/**/*',
'lib/**/*',
'builders/**/*',
'deprecated/**/*',
'renderers/**/*',
'ui/**/*',
],
excludedFiles: ['frameworks/angular/**/*', 'frameworks/ember/**/*', 'lib/core-server/**/*'],
rules: {
'import/no-extraneous-dependencies': [
Expand All @@ -98,47 +95,11 @@ module.exports = {
},
},
{
files: ['**/ui/.storybook/**'],
files: ['**/ui/*', '**/ui/.storybook/*'],
rules: {
'import/no-extraneous-dependencies': [
'error',
{ packageDir: [__dirname], devDependencies: true },
],
'import/no-extraneous-dependencies': ['error', { packageDir: __dirname }],
},
},
...addonsPackages.map((directory) => ({
files: [path.join('**', 'addons', directory, '**', '*.*')],
rules: {
'import/no-extraneous-dependencies': [
'error',
{
packageDir: [__dirname, path.join(__dirname, 'addons', directory)],
devDependencies: true,
},
],
},
})),
...uiPackages.map((directory) => ({
files: [path.join('**', 'ui', directory, '**', '*.*')],
rules: {
'import/no-extraneous-dependencies': [
'error',
{ packageDir: [__dirname, path.join(__dirname, 'ui', directory)], devDependencies: true },
],
},
})),
...libPackages.map((directory) => ({
files: [path.join('**', 'lib', directory, '**', '*.*')],
rules: {
'import/no-extraneous-dependencies': [
'error',
{
packageDir: [__dirname, path.join(__dirname, 'lib', directory)],
devDependencies: true,
},
],
},
})),
{
files: [
'**/__tests__/**',
Expand All @@ -160,24 +121,16 @@ module.exports = {
'react/require-default-props': 'off',
},
},
{ files: '**/.storybook/config.js', rules: { 'global-require': 'off' } },
{
files: ['**/*.stories.*'],
rules: {
'no-console': 'off',
},
},
{
files: ['**/renderers/preact/**/*'],
rules: {
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
},
},
{
files: ['**/*.tsx', '**/*.ts'],
rules: {
'no-shadow': 'off',
'@typescript-eslint/ban-types': 'warn', // should become error, in the future
'react/require-default-props': 'off',
'react/prop-types': 'off', // we should use types
'react/forbid-prop-types': 'off', // we should use types
Expand Down
55 changes: 37 additions & 18 deletions code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,21 @@
"require": "./dist/index.js",
"import": "./dist/index.mjs"
},
"./manager": "./dist/manager.js",
"./preview": "./dist/preview.js",
"./register": "./dist/manager.js",
"./manager": {
"types": "./dist/manager.d.ts",
"require": "./dist/manager.js",
"import": "./dist/manager.mjs"
},
"./preview": {
"types": "./dist/preview.d.ts",
"require": "./dist/preview.js",
"import": "./dist/preview.mjs"
},
"./register": {
"types": "./dist/manager.d.ts",
"require": "./dist/manager.js",
"import": "./dist/manager.mjs"
},
"./package.json": "./package.json"
},
"main": "dist/index.js",
Expand All @@ -49,40 +61,47 @@
],
"scripts": {
"check": "../../../scripts/prepare/check.ts",
"prep": "../../../scripts/prepare/addon-bundle.ts"
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addon-highlight": "workspace:*",
"axe-core": "^4.2.0"
},
"devDependencies": {
"@storybook/channels": "workspace:*",
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"@testing-library/react": "^11.2.2",
"axe-core": "^4.2.0",
"lodash": "^4.17.21",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-resize-detector": "^7.1.2",
"react-resize-detector": "^7.1.2"
},
"devDependencies": {
"@testing-library/react": "^11.2.2",
"resize-observer-polyfill": "^1.5.1",
"typescript": "~4.9.3"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
},
"publishConfig": {
"access": "public"
},
"bundler": {
"exportEntries": [
"./src/index.ts"
],
"managerEntries": [
"./src/manager.tsx"
],
"previewEntries": [
"entries": [
"./src/index.ts",
"./src/manager.tsx",
"./src/preview.tsx"
]
},
Expand Down
72 changes: 48 additions & 24 deletions code/addons/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,21 @@
"require": "./dist/decorator.js",
"import": "./dist/decorator.mjs"
},
"./manager": "./dist/manager.js",
"./preview": "./dist/preview.js",
"./register.js": "./dist/manager.js",
"./manager": {
"types": "./dist/manager.d.ts",
"require": "./dist/manager.js",
"import": "./dist/manager.mjs"
},
"./preview": {
"types": "./dist/preview.d.ts",
"require": "./dist/preview.js",
"import": "./dist/preview.mjs"
},
"./register.js": {
"types": "./dist/manager.d.ts",
"require": "./dist/manager.js",
"import": "./dist/manager.mjs"
},
"./package.json": "./package.json"
},
"main": "dist/index.js",
Expand All @@ -46,8 +58,14 @@
"*": [
"dist/index.d.ts"
],
"manager": [
"dist/manager.d.ts"
],
"decorator": [
"dist/decorator.d.ts"
],
"preview": [
"dist/preview.d.ts"
]
}
},
Expand All @@ -60,45 +78,51 @@
],
"scripts": {
"check": "../../../scripts/prepare/check.ts",
"prep": "../../../scripts/prepare/addon-bundle.ts"
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/global": "^5.0.0",
"@types/lodash": "^4.14.167",
"@types/uuid": "^9.0.1",
"dequal": "^2.0.2",
"lodash": "^4.17.21",
"polished": "^4.2.2",
"telejson": "^7.2.0",
"ts-dedent": "^2.0.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"dequal": "^2.0.2",
"lodash": "^4.17.21",
"polished": "^4.2.2",
"prop-types": "^15.7.2",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-inspector": "^6.0.0",
"telejson": "^7.2.0",
"ts-dedent": "^2.0.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@types/lodash": "^4.14.167",
"@types/uuid": "^9.0.1",
"typescript": "~4.9.3"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
},
"publishConfig": {
"access": "public"
},
"bundler": {
"exportEntries": [
"entries": [
"./src/index.ts",
"./src/decorator.ts",
"./src/index.ts"
],
"managerEntries": [
"./src/manager.tsx"
],
"previewEntries": [
"./src/manager.tsx",
"./src/preview.ts"
]
},
Expand Down
Loading

0 comments on commit 92bb7e6

Please sign in to comment.