Recipes
Add an entry point to a package
- Create the source file in
packages/<pkg>/src/. - Add it to
pack.entryinpackages/<pkg>/vite.config.ts. - Add the matching
exportskey inpackages/<pkg>/package.json. vp run @mrmt/<pkg>#build, and check that thedist/path matches the export.
Add a package
- Create
packages/<name>/with:package.json:name, aversionequal to the other packages,type: "module",workspace:^for@mrmt/*dependencies (including a devDependency on@mrmt/tsconfig),files: ["dist", "!dist/**/*.map"], explicitexports, andpublishConfig.access: "public"for scoped names;tsconfig.jsonextending@mrmt/tsconfig/tsconfig.node-lib.json;vite.config.tsusingpackageConfig.
packages/*inpnpm-workspace.yamlpicks it up. If the site should depend on its build, add<name>#buildtodocsDependenciesin the rootvite.config.ts.- Give it a
docs/folder if it has anything to document (Documentation). Only add a generated API reference if people will look its types up (Build system). vp install, thenvp run build.
Add a Vite plugin
- Create
packages/vite/src/<name>.tsexportingfunction MyPlugin(options): Plugin | Plugin[]. Plugins that need Vue or Vuetify go in@mrmt/vite-ui. - Use
DefaultVitePluginContextfor path resolution if needed. - Add the entry and the
exportskey (see above). - Write
packages/vite/src/<name>.test.ts. - Document it in
packages/vite/docs/.