a library package, as a Vite plug-in, used in the yors package to generate d.ts files
- Call
npm run types
to generate d.ts - Copy d.ts to the JS output file directory
- Delete d.ts generated by npm-script
npm i @yors/vite-plugin-make-type --save-dev
yarn add @yors/vite-plugin-make-type -D
pnpm add @yors/vite-plugin-make-type -D
import { defineConfig } from "vite";
import { viteplugify as maketypetodist } from "@yors/vite-plugin-make-type";
let plugins = [maketypetodist()];
export default defineConfig({
plugins: plugins,
});
- support set npm-script-name
- Support custom plug-in name
- Support custom JS input file directory
- Support custom JS output file directory
- Support custom d.ts output file directory
export interface BundTypeOption {
name: string;
tsTypeOutDir: string;
jsfileSrcDir: string;
jsfileOutDir: string;
npmScriptName: string;
root: string;
}
export type BundTypeOptionLike = Partial<BundTypeOption>;
export const builtinBundTypeOption = {
tsTypeOutDir: "types",
jsfileSrcDir: "lib",
jsfileOutDir: "dist",
npmScriptName: "types",
name: "generate-types",
// root: process.cwd(),
root: "",
};
MIT