@yors/vite-plugin-make-type
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@yors/vite-plugin-make-type

a library package, as a Vite plug-in, used in the yors package to generate d.ts files

Workflow

  • Call npm run types to generate d.ts
  • Copy d.ts to the JS output file directory
  • Delete d.ts generated by npm-script

Demo

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,
});

Custom

  • 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: "",
};

License

MIT

Package Sidebar

Install

npm i @yors/vite-plugin-make-type

Weekly Downloads

59

Version

1.1.0

License

MIT

Unpacked Size

15.6 kB

Total Files

11

Last publish

Collaborators

  • hualei