Skip to content

Commit

Permalink
Merge pull request #107 from buggregator/issue/#38-update-storybook-v…
Browse files Browse the repository at this point in the history
…ersion

Issue/#38 update storybook version
  • Loading branch information
Kreezag authored Dec 17, 2023
2 parents 2e63006 + c378431 commit 4e0207c
Show file tree
Hide file tree
Showing 81 changed files with 4,532 additions and 7,480 deletions.
10 changes: 8 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"plugin:@typescript-eslint/eslint-recommended",
"prettier",
"plugin:nuxt/recommended",
"plugin:@conarti/feature-sliced/recommended"
"plugin:@conarti/feature-sliced/recommended",
"plugin:storybook/recommended"
],
"parser": "vue-eslint-parser",
"plugins": ["@typescript-eslint"],
Expand All @@ -31,7 +32,12 @@
},
"rules": {
"import/prefer-default-export": "off",
"no-console": ["error", { "allow": ["info", "warn", "error"] }],
"no-console": [
"error",
{
"allow": ["info", "warn", "error"]
}
],
"vue/component-name-in-template-casing": [
"error",
"PascalCase",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
- run: yarn install
- run: yarn lint
- run: yarn test
- run: yarn build
- run: yarn generate
58 changes: 9 additions & 49 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const fs = require("fs");
const path = require('path');
const postcss = require('postcss');

//storybook-tailwind-dark-mode
module.exports = {
const config = {
stories: [
"../stories/**/*.stories.mdx",
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
Expand All @@ -12,61 +11,19 @@ module.exports = {
"../pages/**/*.stories.@(js|jsx|ts|tsx)",
"../src/**/**/**/*.stories.@(js|jsx|ts|tsx)",
],

addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"storybook-addon-themes",
{
name: "@storybook/addon-postcss",
options: {
cssLoaderOptions: {
importLoaders: 1,
},
postcssLoaderOptions: {
implementation: postcss,
},
},
},
],
core: {
builder: "@storybook/builder-vite",
},
framework: "@storybook/vue3",
async viteFinal(config) {
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, "../"),
'~': path.resolve(__dirname, "../"),
'#app': path.resolve(
__dirname,
'../node_modules/nuxt/dist/app'
),
'#head': path.resolve(
__dirname,
'../node_modules/nuxt/dist/head/runtime'
),
'#build': path.resolve(
__dirname,
'../.nuxt'
),
"#imports": [
".nuxt/imports"
],
"#components": path.resolve(
__dirname,
'../.nuxt/components'
),
};

return {
...config,
define: {
...config.define,
global: "window",
},
};
framework: {
name: "@storybook-vue/nuxt",
options: {}
},

env: (config) => {
const iconComponentFolder = path.resolve(__dirname, '../src/shared/ui/icon-svg/icon-svg-originals');
const allIconNamesList = !fs.existsSync(iconComponentFolder)
Expand All @@ -83,4 +40,7 @@ module.exports = {
...config,
STORYBOOK_ICON_SVG_NAMES: allIconNamesList,
}},

};

export default config;
17 changes: 10 additions & 7 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {createPinia} from 'pinia';
import {addParameters, app} from '@storybook/vue3';
import { setup } from '@storybook/vue3';
import "../assets/index.css";
import "../assets/index";
import "../assets/vendor";
import "./stories.css"
import SfdumpWrap from "~/src/shared/lib/vendor/dumper";
import SfdumpWrap from "../src/shared/lib/vendor/dumper";
import 'tailwindcss/tailwind.css'

addParameters({
export const parameters = {
actions: {argTypesRegex: "^on[A-Z].*"},
controls: {
matchers: {
Expand All @@ -29,13 +30,15 @@ addParameters({
color: '#333333'
}
]
}
})
},
};


const pinia = createPinia();

app.use(pinia);
setup((app) => {
app.use(pinia)
})

declare global {
interface Window {
Expand Down
19 changes: 17 additions & 2 deletions .storybook/stories.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
.sb-show-main.sb-main-padded {
padding: 0;
html {
position: relative;
}

html:before {
display: block;
content: "";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAK0lEQVQ4y2P8//8/A25w7949PLJMDBSAUc0jQzML/jSkpKQ0GmCjminRDADJNQjBr5nbigAAAABJRU5ErkJggg==");
background-repeat: repeat;
background-position: 0 0;
opacity: 0.2;
z-index: -1;
}
4 changes: 2 additions & 2 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export default defineComponent({
? `v${apiVersion}`
: `@${apiVersion}`,
clientVersion:
!$config?.version || $config.version === "0.0.1"
!$config?.public?.version || $config.public.version === "0.0.1"
? "@dev"
: `v${$config.version}`,
: `v${$config.public.version}`,
};
}
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default defineNuxtConfig({
],
modules: [
'@nuxtjs/tailwindcss',
'@pinia/nuxt'
'@pinia/nuxt',
],
typescript: {
strict: true,
Expand Down
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"sb": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
"sb": "storybook dev -p 6006",
"generate": "nuxi generate",
"preview": "nuxi preview",
"postinstall": "nuxi prepare",
Expand Down Expand Up @@ -33,11 +33,11 @@
"@conarti/eslint-plugin-feature-sliced": "^1.0.5",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@nuxtjs/tailwindcss": "^6.2.0",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/addon-interactions": "^6.5.15",
"@storybook/addon-links": "^6.5.15",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/builder-vite": "^0.3.0",
"@storybook-vue/nuxt": "^0.2.0",
"@storybook/addon-essentials": "^7.6.5",
"@storybook/addon-interactions": "^7.6.5",
"@storybook/addon-links": "^7.6.5",
"@storybook/vue3-vite": "^7.6.5",
"@types/cytoscape-dagre": "^2.3.1",
"@types/downloadjs": "^1.4.3",
"@types/lodash.debounce": "^4.0.7",
Expand All @@ -51,13 +51,18 @@
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-nuxt": "^4.0.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-vue": "^9.9.0",
"husky": "^8.0.3",
"lint-staged": "^13.1.0",
"nuxi": "^3.3.1",
"postcss": "^8.3.11",
"prettier": "^2.8.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.57.1",
"storybook": "^7.6.5",
"storybook-addon-nuxt": "^1.3.3",
"storybook-addon-themes": "^6.1.0",
"typescript": "^5.1.6",
"vitest": "^0.34.2",
Expand All @@ -68,8 +73,8 @@
"@hpcc-js/wasm": "^2.8.0",
"@pinia/nuxt": "^0.4.6",
"@sentry/types": "^7.80.0",
"@storybook/addon-actions": "^6.5.15",
"@storybook/vue3": "^6.5.16",
"@storybook/addon-actions": "^7.6.5",
"@storybook/vue3": "^7.6.5",
"@types/lodash": "^4.14.200",
"@vue/shared": "^3.2.45",
"centrifuge": "^3.1.0",
Expand Down
4 changes: 2 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
:disabled="visibleEvents.length === 0"
:is-paused="isEventsPaused"
:total-new-events-count="hiddenEventsCount"
@toggleUpdate="toggleUpdate"
@toggle-update="toggleUpdate"
/>
</template>
</PageHeader>
Expand All @@ -44,7 +44,7 @@ import { useNuxtApp } from "#app"; // eslint-disable-line @conarti/feature-slice
import { PageHeader, EventCard, PagePlaceholder } from "~/src/widgets/ui";
import { PAGE_TYPES } from "~/src/shared/constants";
import type { EventType } from "~/src/shared/types";
import { PauseButton } from "~/src/screens/events/ui/pause-button";
import { PauseButton } from "~/src/shared/ui/pause-button";
export default defineComponent({
components: {
Expand Down
21 changes: 6 additions & 15 deletions src/entities/http-dump/ui/preview-card/preview-card.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, Story } from "@storybook/vue3";
import type { Meta, StoryObj } from "@storybook/vue3";
import { useHttpDump } from "../../lib";
import { httpDumpMock } from '../../mocks';
import PreviewCard from './preview-card.vue';
Expand All @@ -10,18 +10,9 @@ export default {
component: PreviewCard
} as Meta<typeof PreviewCard>;

const Template: Story = (args) => ({
components: { PreviewCard },
setup() {
return {
args,
};
},
template: `<PreviewCard v-bind="args" />`,
});
export const Default: StoryObj<typeof PreviewCard> = {
args: {
event: normalizeHttpDumpEvent(httpDumpMock),
}
}

export const Event = Template.bind({});

Event.args = {
event: normalizeHttpDumpEvent(httpDumpMock),
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, Story } from "@storybook/vue3";
import type { Meta, StoryObj } from "@storybook/vue3";
import { useInspector } from "../../lib";
import { inspectorMock } from '../../mocks'
import InspectorStatBoard from './inspector-stat-board.vue';
Expand All @@ -10,18 +10,8 @@ export default {
component: InspectorStatBoard
} as Meta<typeof InspectorStatBoard>;

const Template: Story = (args) => ({
components: {InspectorStatBoard},
setup() {
return {
args,
};
},
template: `<InspectorStatBoard v-bind="args"/>`,
});

export const StatBoardStories = Template.bind({});

StatBoardStories.args = {
transaction: normalizeInspectorEvent(inspectorMock).payload[0]
};
export const Default: StoryObj<typeof InspectorStatBoard> = {
args: {
transaction: normalizeInspectorEvent(inspectorMock).payload[0]
}
}
21 changes: 6 additions & 15 deletions src/entities/inspector/ui/preview-card/preview-card.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Meta, Story } from "@storybook/vue3";
import type { Meta, StoryObj } from "@storybook/vue3";
import { useInspector } from "../../lib";
import { inspectorMock } from '../../mocks';
import PreviewCard from './preview-card.vue';
Expand All @@ -10,18 +10,9 @@ export default {
component: PreviewCard
} as Meta<typeof PreviewCard>;

const Template: Story = (args) => ({
components: { PreviewCard },
setup() {
return {
args,
};
},
template: `<PreviewCard v-bind="args" />`,
});
export const Default: StoryObj<typeof PreviewCard> = {
args: {
event: normalizeInspectorEvent(inspectorMock),
}
}

export const Event = Template.bind({});

Event.args = {
event: normalizeInspectorEvent(inspectorMock),
};
Loading

0 comments on commit 4e0207c

Please sign in to comment.