Skip to content

Commit

Permalink
fix(pipeline): ~ generating dts files
Browse files Browse the repository at this point in the history
  • Loading branch information
dark-kitt committed May 13, 2024
1 parent dfcd809 commit ac99ac3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/yarn-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
run: npm install
- name: Ensure the integrity of packages from the public npm registry
run: npm audit signatures
- name: Bundle Vue 3 library
run: npm run build
- name: Bundle Storybook
run: npm run build-storybook
- name: Bundle Vue 3 library
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GTHB_TOKEN }}
Expand Down
14 changes: 14 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { StorybookConfig } from '@storybook/vue3-vite';
import { join, dirname } from 'path';
import { UserConfig, PluginOption } from 'vite';

/**
* This function is used to resolve the absolute path of a package.
Expand All @@ -22,6 +23,19 @@ const config: StorybookConfig = {
},
docs: {
autodocs: 'tag'
},
viteFinal: (config: UserConfig) => {
/**
* Remove the vite-plugin-dts to prevent
* that Storybook creates TS types. Otherwise
* the dts plugin runs twice with two different
* configurations in the GitHub CI/CD pipeline.
*/
config.plugins = (config.plugins as PluginOption[])?.filter(
(plugin: PluginOption) => (plugin as any)?.name !== 'vite:dts'
);

return config;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/@types/components/Button/Button.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ButtonHTMLAttributes, DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from '../../../vue/dist/vue.esm-bundler.js';
import { ButtonHTMLAttributes, DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';

export interface Props {
primary?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/@types/components/Button/Button.stories.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StoryObj } from '@storybook/vue3';
import { DefineComponent, PropType, ButtonHTMLAttributes, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from '../../../vue/dist/vue.esm-bundler.js';
import { DefineComponent, PropType, ButtonHTMLAttributes, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';

declare const meta: {
title: string;
Expand Down
3 changes: 1 addition & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export default defineConfig({
dts({
outDir: ['dist', 'src/@types'],
cleanVueFileName: true,
staticImport: true,
tsconfigPath: './tsconfig.json'
staticImport: true
})
],
resolve: {
Expand Down

0 comments on commit ac99ac3

Please sign in to comment.