Skip to content

Commit

Permalink
chore(storybook): moved config
Browse files Browse the repository at this point in the history
  • Loading branch information
gearonix committed Sep 1, 2023
1 parent 4fb3637 commit b1c63c2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions libs/config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './consts/client'
export * from './consts/server'

export { createPreviewDefaults, createStorybookConfig } from './storybook'
8 changes: 4 additions & 4 deletions libs/config/src/jest/create-jest-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ interface CreateJestConfigPayload {
displayName: string
}

export const createJestConfig = (payload: CreateJestConfigPayload) => {
const rootPath = resolveRootPath(payload.layer)
export const createJestConfig = (options: CreateJestConfigPayload) => {
const rootPath = resolveRootPath(options.layer)

return {
displayName: payload.displayName,
displayName: options.displayName,
preset: `${rootPath}/jest.preset.js`,
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }]
},
moduleFileExtensions: ['ts', 'tsx'],
coverageDirectory: `${rootPath}/coverage/apps/server`
coverageDirectory: `${rootPath}/coverage/apps/${options.displayName}`
}
}
2 changes: 1 addition & 1 deletion libs/config/src/storybook/create-storybook-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const createStorybookConfig: CreateStorybookConfig = ({
viteConfigPath,
viteFinal
}) => ({
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
stories: ['../../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-interactions',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createStorybookConfig } from 'cg-config/src'
import { createStorybookConfig } from 'cg-config/src/storybook'
import type { StorybookConfig } from '@storybook/react-vite'
import { mergeConfig } from 'vite'
import viteTsConfigPaths from 'vite-tsconfig-paths'

const config: StorybookConfig = createStorybookConfig({
viteConfigPath: 'libs/web/ui/vite.config.ts',
viteConfigPath: 'libs/web/ui/.config/vite.ts',
viteFinal: (config: StorybookConfig): StorybookConfig => {
return mergeConfig(config, {
define: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StylesDecorator, ThemeDecorator } from '@code-gear/web/shared'
import { Preview } from '@storybook/react'
import { createPreviewDefaults } from '$/config'
import { createPreviewDefaults } from '@code-gear/config'

const preview: Preview = createPreviewDefaults({
decorators: [StylesDecorator, ThemeDecorator]
Expand Down
4 changes: 2 additions & 2 deletions libs/web/ui/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"executor": "@nx/storybook:storybook",
"options": {
"port": 4400,
"configDir": "libs/web/ui/.storybook"
"configDir": "libs/web/ui/.config/storybook"
},
"configurations": {
"ci": {
Expand All @@ -30,7 +30,7 @@
],
"options": {
"outputDir": "dist/storybook/ui",
"configDir": "libs/web/ui/.storybook"
"configDir": "libs/web/ui/.config/storybook"
},
"configurations": {
"ci": {
Expand Down

0 comments on commit b1c63c2

Please sign in to comment.