[/][m]: add storybook to core package
This commit is contained in:
21
nx.json
21
nx.json
@@ -5,7 +5,13 @@
|
|||||||
"default": {
|
"default": {
|
||||||
"runner": "nx/tasks-runners/default",
|
"runner": "nx/tasks-runners/default",
|
||||||
"options": {
|
"options": {
|
||||||
"cacheableOperations": ["build", "lint", "test", "e2e"]
|
"cacheableOperations": [
|
||||||
|
"build",
|
||||||
|
"lint",
|
||||||
|
"test",
|
||||||
|
"e2e",
|
||||||
|
"build-storybook"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -30,6 +36,14 @@
|
|||||||
"{workspaceRoot}/.eslintrc.json",
|
"{workspaceRoot}/.eslintrc.json",
|
||||||
"{workspaceRoot}/.eslintignore"
|
"{workspaceRoot}/.eslintignore"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"build-storybook": {
|
||||||
|
"inputs": [
|
||||||
|
"default",
|
||||||
|
"^production",
|
||||||
|
"{projectRoot}/.storybook/**/*",
|
||||||
|
"{projectRoot}/tsconfig.storybook.json"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"namedInputs": {
|
"namedInputs": {
|
||||||
@@ -39,7 +53,10 @@
|
|||||||
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
|
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
|
||||||
"!{projectRoot}/tsconfig.spec.json",
|
"!{projectRoot}/tsconfig.spec.json",
|
||||||
"!{projectRoot}/jest.config.[jt]s",
|
"!{projectRoot}/jest.config.[jt]s",
|
||||||
"!{projectRoot}/.eslintrc.json"
|
"!{projectRoot}/.eslintrc.json",
|
||||||
|
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
|
||||||
|
"!{projectRoot}/.storybook/**/*",
|
||||||
|
"!{projectRoot}/tsconfig.storybook.json"
|
||||||
],
|
],
|
||||||
"sharedGlobals": ["{workspaceRoot}/babel.config.json"]
|
"sharedGlobals": ["{workspaceRoot}/babel.config.json"]
|
||||||
},
|
},
|
||||||
|
|||||||
12324
package-lock.json
generated
12324
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "portaljs",
|
"name": "portaljs",
|
||||||
"workspaces": [
|
"workspaces": ["./packages/*"],
|
||||||
"./packages/*"
|
|
||||||
],
|
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -23,7 +21,16 @@
|
|||||||
"@nrwl/react": "15.9.2",
|
"@nrwl/react": "15.9.2",
|
||||||
"@nrwl/rollup": "15.9.2",
|
"@nrwl/rollup": "15.9.2",
|
||||||
"@nrwl/workspace": "15.9.2",
|
"@nrwl/workspace": "15.9.2",
|
||||||
|
"@nx/js": "16.6.0",
|
||||||
|
"@nx/storybook": "16.6.0",
|
||||||
"@rollup/plugin-url": "^7.0.0",
|
"@rollup/plugin-url": "^7.0.0",
|
||||||
|
"@storybook/addon-essentials": "7.0.18",
|
||||||
|
"@storybook/addon-interactions": "7.0.18",
|
||||||
|
"@storybook/core-server": "7.0.18",
|
||||||
|
"@storybook/jest": "~0.1.0",
|
||||||
|
"@storybook/react-webpack5": "^7.0.18",
|
||||||
|
"@storybook/test-runner": "^0.11.0",
|
||||||
|
"@storybook/testing-library": "~0.2.0",
|
||||||
"@svgr/rollup": "^6.1.2",
|
"@svgr/rollup": "^6.1.2",
|
||||||
"@swc/core": "^1.2.173",
|
"@swc/core": "^1.2.173",
|
||||||
"@swc/helpers": "~0.5.0",
|
"@swc/helpers": "~0.5.0",
|
||||||
@@ -39,6 +46,7 @@
|
|||||||
"@typescript-eslint/parser": "^5.36.1",
|
"@typescript-eslint/parser": "^5.36.1",
|
||||||
"babel-jest": "^29.4.1",
|
"babel-jest": "^29.4.1",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
|
"core-js": "^3.6.5",
|
||||||
"cypress": "^12.2.0",
|
"cypress": "^12.2.0",
|
||||||
"eslint": "~8.15.0",
|
"eslint": "~8.15.0",
|
||||||
"eslint-config-next": "13.1.1",
|
"eslint-config-next": "13.1.1",
|
||||||
@@ -64,5 +72,9 @@
|
|||||||
"typescript": "~4.9.5",
|
"typescript": "~4.9.5",
|
||||||
"unist-util-select": "^4.0.3",
|
"unist-util-select": "^4.0.3",
|
||||||
"unist-util-visit": "^4.1.2"
|
"unist-util-visit": "^4.1.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
packages/core/.storybook/main.ts
Normal file
20
packages/core/.storybook/main.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import type { StorybookConfig } from '@storybook/react-webpack5';
|
||||||
|
|
||||||
|
const config: StorybookConfig = {
|
||||||
|
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
|
||||||
|
addons: [
|
||||||
|
'@storybook/addon-essentials',
|
||||||
|
'@storybook/addon-interactions',
|
||||||
|
'@nx/react/plugins/storybook',
|
||||||
|
],
|
||||||
|
framework: {
|
||||||
|
name: '@storybook/react-webpack5',
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
|
||||||
|
// To customize your webpack configuration you can use the webpackFinal field.
|
||||||
|
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
|
||||||
|
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
||||||
0
packages/core/.storybook/preview.ts
Normal file
0
packages/core/.storybook/preview.ts
Normal file
@@ -34,6 +34,37 @@
|
|||||||
"jestConfig": "packages/core/jest.config.ts",
|
"jestConfig": "packages/core/jest.config.ts",
|
||||||
"passWithNoTests": true
|
"passWithNoTests": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"storybook": {
|
||||||
|
"executor": "@nx/storybook:storybook",
|
||||||
|
"options": {
|
||||||
|
"port": 4400,
|
||||||
|
"configDir": "packages/core/.storybook"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"quiet": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"build-storybook": {
|
||||||
|
"executor": "@nx/storybook:build",
|
||||||
|
"outputs": ["{options.outputDir}"],
|
||||||
|
"options": {
|
||||||
|
"outputDir": "dist/storybook/core",
|
||||||
|
"configDir": "packages/core/.storybook"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"quiet": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test-storybook": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"command": "test-storybook -c packages/core/.storybook --url=http://localhost:4400"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "./tsconfig.spec.json"
|
"path": "./tsconfig.spec.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.storybook.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,11 @@
|
|||||||
"**/*.spec.js",
|
"**/*.spec.js",
|
||||||
"**/*.test.js",
|
"**/*.test.js",
|
||||||
"**/*.spec.jsx",
|
"**/*.spec.jsx",
|
||||||
"**/*.test.jsx"
|
"**/*.test.jsx",
|
||||||
|
"**/*.stories.ts",
|
||||||
|
"**/*.stories.js",
|
||||||
|
"**/*.stories.jsx",
|
||||||
|
"**/*.stories.tsx"
|
||||||
],
|
],
|
||||||
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
||||||
}
|
}
|
||||||
|
|||||||
31
packages/core/tsconfig.storybook.json
Normal file
31
packages/core/tsconfig.storybook.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"outDir": ""
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"../../node_modules/@nx/react/typings/styled-jsx.d.ts",
|
||||||
|
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
||||||
|
"../../node_modules/@nx/react/typings/image.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.js",
|
||||||
|
"src/**/*.test.js",
|
||||||
|
"src/**/*.spec.tsx",
|
||||||
|
"src/**/*.test.tsx",
|
||||||
|
"src/**/*.spec.jsx",
|
||||||
|
"src/**/*.test.js"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.stories.ts",
|
||||||
|
"src/**/*.stories.js",
|
||||||
|
"src/**/*.stories.jsx",
|
||||||
|
"src/**/*.stories.tsx",
|
||||||
|
"src/**/*.stories.mdx",
|
||||||
|
".storybook/*.js",
|
||||||
|
".storybook/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
"skipDefaultLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
"@portaljs/core": ["packages/core/src/index.ts"],
|
||||||
"@portaljs/portaljs-components": [
|
"@portaljs/portaljs-components": [
|
||||||
"packages/portaljs-components/src/index.ts"
|
"packages/portaljs-components/src/index.ts"
|
||||||
],
|
]
|
||||||
"@portaljs/core": ["packages/core/src/index.ts"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "tmp"]
|
"exclude": ["node_modules", "tmp"]
|
||||||
|
|||||||
Reference in New Issue
Block a user