Skip to content

Commit ff291eb

Browse files
committed
docs: updated pakk readme
1 parent 138f1dc commit ff291eb

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

packages/pakk-vite-plugin/readme.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,48 @@
55
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6863e4f702e34f4ea54dc05d71acfe7b)](https://www.codacy.com/gh/AlexAegis/js-tooling/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AlexAegis/js-tooling&utm_campaign=Badge_Grade)
66
[![codecov](https://codecov.io/github/AlexAegis/js-tooling/branch/master/graph/badge.svg?token=OUxofr6zE8)](https://codecov.io/github/AlexAegis/js-tooling)
77

8-
A vite plugin to fill out your `package.json` files for library development.
8+
A vite plugin to fill out your `package.json` files for its local and published
9+
variants.
10+
11+
## Usage
12+
13+
Add it to the `plugins` array in your `vite.config.ts` file!
14+
15+
> It is also wrapping
16+
> [vite-plugin-dts](https://github.com/qmhc/vite-plugin-dts)!
17+
18+
```ts
19+
import { defineConfig } from 'vite';
20+
import { pakk } from 'vite-plugin-pakk';
21+
22+
export default defineConfig({
23+
plugins: [pakk()],
24+
});
25+
```
26+
27+
## Features
28+
29+
- Sets up exports automatically from the top level files in your library.
30+
`index.ts` will be treated as the default export, and any additional files
31+
will be treated as other entry points. This means you have to put every other
32+
internal file in a directory!
33+
- Sets up exports for both ES Modules and CommonJS!
34+
- It fills your local `package.json` file too! For `types` it will point to
35+
your internal typescript file (`./src/index.ts`) but for the actual code, it
36+
will point to your `outDir` (`./dist/index.js`). This ensures that you build
37+
and test with the actual build artifact, but let's you see changes
38+
immediately! (It assumes your build and test tools build dependencies before
39+
building or testing any package!)
40+
- It adjusts the distributed `package.json` file so it points to the correct
41+
paths for both types (`./index.d.ts`) and ESM/CJS files (`./index.js`,
42+
`./index.cjs`)
43+
- Files in a folder called `bin` will be treated as bins for the package. Shims
44+
and bin entries will automatically be created to allow them to be used locally
45+
too, not to disturb package managers like `pnpm` when they create symlinks.
46+
- You can set up a `static` folder next to `src` too to export non-js files like
47+
the docs or images.
48+
- Opinionated, but highly configurable! It works out-of-the box using these
49+
conventional locations, but almost every aspect of it is configurable.
50+
Directories can be adjusted, file globs can be added
51+
- This plugin **does not generate type definition files!** It assumes you have a
52+
`dts` generator plugin present!

0 commit comments

Comments
 (0)