@itcase/storybook-config 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # ITCase Storybook Config
2
+
3
+
@@ -0,0 +1,29 @@
1
+ const ADDONS_REACT = [
2
+ "@storybook/addon-webpack5-compiler-swc",
3
+ "@storybook/addon-essentials",
4
+ "@storybook/addon-themes",
5
+ "@storybook/addon-interactions",
6
+ {
7
+ name: "@storybook/addon-styling-webpack",
8
+ options: {
9
+ rules: [
10
+ {
11
+ test: /\.css$/,
12
+ use: [
13
+ "style-loader",
14
+ {
15
+ loader: "css-loader",
16
+ options: { importLoaders: 1 },
17
+ },
18
+ {
19
+ loader: "postcss-loader",
20
+ options: { implementation: require.resolve("postcss") },
21
+ },
22
+ ],
23
+ },
24
+ ],
25
+ },
26
+ },
27
+ ];
28
+
29
+ export { ADDONS_REACT }
@@ -0,0 +1,8 @@
1
+ const ADDONS_NEXTJS = [
2
+ '@storybook/addon-links',
3
+ '@storybook/addon-essentials',
4
+ '@storybook/addon-interactions',
5
+ '@itcase/storybook-addon-auth',
6
+ ]
7
+
8
+ export { ADDONS_NEXTJS }
@@ -0,0 +1 @@
1
+ import '../../src/config/appearance'
@@ -0,0 +1,9 @@
1
+ import { USERS } from './users'
2
+
3
+ const AUTHORIZATION = {
4
+ values: USERS,
5
+ signInUrl: `${process.env.REST_BASE_URL}/rest/sign-in/`,
6
+ profileUrl: `${process.env.REST_BASE_URL}/rest/profile/`,
7
+ }
8
+
9
+ export { AUTHORIZATION }
@@ -0,0 +1,16 @@
1
+ const BACKGROUNDS = {
2
+ default: {
3
+ name: 'Default',
4
+ value: '#fff',
5
+ },
6
+ light: {
7
+ name: 'Light',
8
+ value: '#fff',
9
+ },
10
+ dark: {
11
+ name: 'Dark',
12
+ value: '#000000',
13
+ },
14
+ }
15
+
16
+ export { BACKGROUNDS }
@@ -0,0 +1,5 @@
1
+ const FRAMEWORK_NEXTJS = {
2
+ framework: "@storybook/nextjs",
3
+ };
4
+
5
+ export { FRAMEWORK_NEXTJS };
@@ -0,0 +1,21 @@
1
+ const FRAMEWORK_REACT = {
2
+ framework: {
3
+ name: '@storybook/react-webpack5',
4
+ options: {
5
+ builder: {
6
+ useSWC: true,
7
+ },
8
+ },
9
+ },
10
+ swc: () => ({
11
+ jsc: {
12
+ transform: {
13
+ react: {
14
+ runtime: 'automatic',
15
+ },
16
+ },
17
+ },
18
+ }),
19
+ }
20
+
21
+ export { FRAMEWORK_REACT }
@@ -0,0 +1,13 @@
1
+ import { AUTHORIZATION } from './authorization'
2
+ import { ADDONS_NEXTJS } from './addonsNextJs'
3
+ import { ADDONS_REACT } from './addonReact'
4
+ import { FRAMEWORK_NEXTJS } from './frameworkNextJs'
5
+ import { FRAMEWORK_REACT } from './frameworkReact'
6
+ import { BACKGROUNDS } from './backgrounds'
7
+ import { MAIN_CONFIG } from './mainConfig'
8
+ import { REFS } from './refs'
9
+ import { STATIC_DIRS_REACT } from './staticDirsReact'
10
+ import { STATIC_DIRS_NEXTJS } from './staticDirsNextJs'
11
+ import { VIEWPORTS } from './viewports'
12
+
13
+ export { AUTHORIZATION, ADDONS_NEXTJS, STATIC_DIRS_REACT, STATIC_DIRS_NEXTJS, FRAMEWORK_NEXTJS, FRAMEWORK_REACT, ADDONS_REACT, BACKGROUNDS, MAIN_CONFIG, REFS, VIEWPORTS }
@@ -0,0 +1,28 @@
1
+ const MAIN_CONFIG = {
2
+ core: {
3
+ disableTelemetry: true,
4
+ },
5
+ features: {
6
+ backgroundsStoryGlobals: true,
7
+ viewportStoryGlobals: true,
8
+ },
9
+ webpackFinal: async (config) => {
10
+ const imageRule = config.module?.rules?.find((rule) => {
11
+ const test = rule.test
12
+ if (!test) {
13
+ return false
14
+ }
15
+ return test.test('.svg')
16
+ })
17
+
18
+ imageRule.exclude = /\.svg$/
19
+
20
+ config.module?.rules?.push({
21
+ test: /\.svg$/,
22
+ use: ['@svgr/webpack'],
23
+ })
24
+ return config
25
+ },
26
+ }
27
+
28
+ export { MAIN_CONFIG }
@@ -0,0 +1,23 @@
1
+ .sb-main-centered {
2
+ & #storybook-root {
3
+ min-height: 100%;
4
+ align-items: center;
5
+ }
6
+ }
7
+
8
+ .sb-main-fullscreen {
9
+ height: auto;
10
+ }
11
+
12
+ #storybook-root {
13
+ width: 100%;
14
+ min-height: 100%;
15
+ display: flex;
16
+ justify-content: center;
17
+ }
18
+
19
+ .docs-story {
20
+ padding: 40px;
21
+ display: flex;
22
+ justify-content: center;
23
+ }
package/config/refs.js ADDED
@@ -0,0 +1,14 @@
1
+ const REFS = {
2
+ 'itcase-storybook': {
3
+ expanded: false,
4
+ title: 'Introduction',
5
+ url: 'https://itcase.pro/storybook/',
6
+ },
7
+ 'itcase-ui': {
8
+ expanded: false,
9
+ title: 'ITCase UI',
10
+ url: 'https://itcase.pro/ui/',
11
+ },
12
+ }
13
+
14
+ export { REFS }
@@ -0,0 +1,6 @@
1
+ const STATIC_DIRS_NEXTJS = [
2
+ '../public',
3
+ // { from: '../src/appearance/', to: 'src/appearance/' },
4
+ // { from: '../public/img', to: 'img/' },
5
+ ]
6
+ export { STATIC_DIRS_NEXTJS }
@@ -0,0 +1,4 @@
1
+ const STATIC_DIRS_REACT = [
2
+ '../public'
3
+ ]
4
+ export { STATIC_DIRS_REACT }
@@ -0,0 +1,10 @@
1
+ import { DEFAULT_USERS } from '@itcase/storybook-addon-auth/defaults'
2
+
3
+ const USERS = {
4
+ user: { name: 'User', token: process.env.USER_AUTH_TOKEN, color: '#777777' },
5
+ manager: { name: 'Manager', token: process.env.MANAGER_AUTH_TOKEN, color: '#D80E4F' },
6
+ admin: { name: 'Admin', token: process.env.ADMIN_AUTH_TOKEN, color: '#1EA5FC' },
7
+ ...DEFAULT_USERS,
8
+ }
9
+
10
+ export { USERS }
@@ -0,0 +1,22 @@
1
+ import { INITIAL_VIEWPORTS, MINIMAL_VIEWPORTS } from '@storybook/addon-viewport'
2
+
3
+ const VIEWPORTS = {
4
+ desktop: {
5
+ name: 'Desktop',
6
+ styles: {
7
+ width: '1440px',
8
+ height: '100%',
9
+ },
10
+ },
11
+ mobile: {
12
+ name: 'Mobile',
13
+ styles: {
14
+ width: '375px',
15
+ height: '667px',
16
+ },
17
+ },
18
+ ...INITIAL_VIEWPORTS,
19
+ ...MINIMAL_VIEWPORTS,
20
+ }
21
+
22
+ export { VIEWPORTS }
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@itcase/storybook-config",
3
+ "version": "1.0.0",
4
+ "author": "ITCase",
5
+ "description": "Code style linter configuration presets",
6
+ "engines": {
7
+ "node": ">=20.12.0"
8
+ },
9
+ "scripts": {
10
+ "prepare": "husky",
11
+ "storybook-react": "storybook dev -p 6006 --config-dir .storybook-react",
12
+ "storybook-next-js": "storybook dev -p 6006 -c .storybook-next-js",
13
+ "semantic-release": "semantic-release"
14
+ },
15
+ "type": "module",
16
+ "license": "MIT",
17
+ "private": false,
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/ITCase/itcase-storybook-config.git"
21
+ },
22
+ "main": "config/index.js",
23
+ "files": [
24
+ "README.md",
25
+ "config"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public",
29
+ "registry": "https://registry.npmjs.org/"
30
+ },
31
+ "msw": {
32
+ "workerDirectory": "public"
33
+ },
34
+ "dependencies": {
35
+ "@itcase/storybook-addon-auth": "^1.0.3",
36
+ "@storybook/addon-actions": "^8.4.7",
37
+ "@storybook/addon-controls": "^8.4.7",
38
+ "@storybook/addon-essentials": "^8.4.7",
39
+ "@storybook/addon-interactions": "^8.4.7",
40
+ "@storybook/addon-links": "^8.4.7",
41
+ "@storybook/addon-styling-webpack": "^1.0.1",
42
+ "@storybook/addon-themes": "^8.4.7",
43
+ "@storybook/addon-viewport": "^8.4.7",
44
+ "@storybook/addon-webpack5-compiler-swc": "^2.0.0",
45
+ "@storybook/blocks": "^8.4.7",
46
+ "@storybook/manager-api": "^8.4.7",
47
+ "@storybook/nextjs": "^8.4.7",
48
+ "@storybook/preview-api": "^8.4.7",
49
+ "@storybook/react": "^8.4.7",
50
+ "@storybook/react-webpack5": "^8.4.7",
51
+ "@storybook/theming": "^8.4.7",
52
+ "http-proxy-middleware": "^3.0.3",
53
+ "msw": "^2.7.0",
54
+ "msw-storybook-addon": "^2.0.4"
55
+ },
56
+ "devDependencies": {
57
+ "@commitlint/cli": "^19.6.1",
58
+ "@commitlint/config-conventional": "^19.6.0",
59
+ "@itcase/common": "^1.2.17",
60
+ "@itcase/lint": "^1.0.35",
61
+ "@itcase/ui": "^1.3.12",
62
+ "@semantic-release/changelog": "^6.0.3",
63
+ "@semantic-release/git": "^10.0.1",
64
+ "@semantic-release/release-notes-generator": "14.0.3",
65
+ "conventional-changelog-conventionalcommits": "^8.0.0",
66
+ "eslint": "9.17.0",
67
+ "husky": "^9.1.7",
68
+ "lint-staged": "^15.3.0",
69
+ "msw-storybook-addon": "^2.0.4",
70
+ "prettier": "^3.4.2",
71
+ "semantic-release": "^24.2.1",
72
+ "storybook": "^8.4.7",
73
+ "stylelint": "^16.12.0",
74
+ "typescript": "^5.7.3"
75
+ }
76
+ }