jiek v2.3.3
Jiek
| English | 简体中文 | 繁体中文 | 日本語 | Français
A lightweight toolkit for compiling and managing libraries based on
package.json
metadata and suitable forMonorepo
.
- Automatic inference: Automatically infer build rules based on relevant fields in
package.json
, reducing the need for configuration files, making it more lightweight and standard-compliantexports
: Infer build targets and types based on entry filesimports
: Define path aliases and automatically bundle them during the buildtype: module
: Intelligently decide the output file suffix based on options, eliminating the need to considercjs
andesm
compatibility issuesdependencies
,peerDependencies
,optionalDependencies
: Automatically mark dependencies that meet the rules asexternal
devDependencies
: Bundle dependencies marked as development dependencies into the corresponding final product
- Build tools: Support multiple build tools, no need to struggle with using swc, esbuild, or tsc
esbuild
swc
typescript
- Workspace-friendly: Support development paradigms in pnpm workspaces
- Support more PMs
- Better workspace task flow
- Type definition files: Support aggregated generation of type definition files
- Watch mode: Adapt to rollup's watch mode
- Publish adaptation: Support isomorphic generation of
package.json
and other related fields- Automatically replace relative path links in README.md with corresponding network links based on paths in
package.json
- Automatically generate common fields such as
license
,author
,homepage
,repository
, etc. based on the repository and project
- Automatically replace relative path links in README.md with corresponding network links based on paths in
- CommonJS: Compatible with users who are still using cjs
- Plugin system
- Dotenv: Support dotenv configuration files
- Replacer: Support replacing file content
- Hooks: prepublish, postpublish
- Automatically generate changelog
- Automatically decide the next version number
feat: xxx
->patch
feat!: xxx
->minor
feat!!: xxx
->major
Installation
npm i -D jiek
# or
pnpm i -D jiek
# or
yarn add -D jiek
Quick Start
Generate the required products quickly and easily through some simple methods.
Add entry files in
package.json
, here you need to set the original file path.You can see more about exports in the Node.js documentation.
{
...
"exports": "./src/index.ts",
...
}
Suppose you have a package named
@monorepo/utils
in the workspace, then you can runjk -f utils build
to build this package.When you need to publish the current package, you can first run
jk -f utils prepublish
to prepare the publishing content, then runjk -f utils publish
to publish, and finally runjk -f utils postpublish
to clean up the publishing content.Of course, you may find the above operations a bit cumbersome, you can simplify the operations by adding
scripts
in the corresponding package'spackage.json
.
{
...
"scripts": {
"prepublish": "jb && jk",
"postpublish": "jk"
},
...
}
If you need to check the content to be published before publishing, you can use the
prepublish
subcommand to generate the relevantpackage.json
file in your dist product directory (configurable), and you can review the generated files.
- After configuring the above hooks, you can complete the build and publish actions with one command
jk publish
.
CLI
jk/jiek [options] [command]
jb/jiek-build [options] [filters/entries]
Custom Build Entry
You can specify the build entry through --entries
, the entry definition here is based on the exports
field in package.json
.
jb -e .
jb --entries .
jb --entries ./foo
jb --entries ./foo,./bar
When your project is a non-monorepo
project, you can directly build through jb [entries]
.
jb .
jb ./foo
jb ./foo,./bar
Filters
You can filter the packages to be built through --filter
, we use the same filter rules as pnpm, so you can check the pnpm filter rules here.
jb --filter @monorepo/*
jb --filter @monorepo/utils
jb -f utils
When your project is a monorepo
project, you can directly build through jb [filters]
.
jb @monorepo/*
jb @monorepo/utils
jb utils
Custom Build Tools
We support multiple build tools, you can specify the build tool through --type <type: esbuild | swc>
.
- By default,
esbuild
(rollup-plugin-esbuild
) will be used - If the
swc
(rollup-plugin-swc3
) dependency exists in your dependency space, we will automatically switch toswc
- If both exist,
esbuild
will be used by default
jb --type swc
If the build tool dependency is not installed, we will prompt you to install the corresponding dependency.
Minification
We provide multiple ways to support minified builds, which are enabled by default, and we will use the build tool's built-in minification plugin for minification by default.
- You can choose to use
terser
(rollup-plugin-terser
) for minification through--minType
, if you have not installedterser
, we will prompt you to install it. - You can disable the generation of minified products through
--noMin
. - You can generate only minified products through
--onlyMinify
, in this case, we will directly replace the original product path instead of adding a.min
suffix before outputting.
jb --minType terser
jb --onlyMinify
Exclude Specific Build Content
You can disable the build of js
through --noJs
, and disable the build of dts
through --noDts
.
jb --noJs
jb --noDts
Custom Output Directory
You can specify the output directory through --outdir
.
jb --outdir lib
Watch Mode
You can enable watch mode through --watch
.
jb --watch
External Modules
In addition to automatically marking external modules through dependencies
, peerDependencies
, optionalDependencies
in package.json
, you can also manually mark external modules through --external
.
jb --external react
jb --external react,react-dom
Disable Automatic Cleanup of Products
You can disable the automatic cleanup of products through --noClean
.
jb --noClean
Custom tsconfig Path
You can specify the path of tsconfig
through --tsconfig
.
jb --tsconfig ./tsconfig.custom-build.json
You can also specify the path of dtsconfig
used by the dts
plugin through --dtsconfig
(although I don't recommend doing this).
jb --dtsconfig ./tsconfig.custom-dts.json
Publish Command
The publish
command allows you to publish the current package to the npm registry. It also automatically generates the exports
field and other fields in the published package.json
.
jk publish [options]
Options
-b, --bumper <bumper>
: Bump version (default:patch
)-no-b, --no-bumper
: No bump version-o, --outdir <OUTDIR>
: Specify the output directory (default:dist
)
Pass-through Options
If you want to pass options to the pnpm publish
command, you can pass the options after --
.
jk publish -- --access public --no-git-checks
Why not use X?
Similar tools to jiek
include: tsup, unbuild, bunchee, pkgroll, tsdown. However, they all have some common issues that have not been resolved, such as:
- There are certain issues with
monorepo
support, and dependencies on other packages in the workspace must be recompiled - The rules for writing entry files are too cumbersome and not natural enough
- Unable to handle issues related to
Project Reference
intsconfig.json
- Unable to fully utilize
conditional
features - Unable to choose the required builder, can only replace the entire toolchain
Who is using Jiek?
About this README
This README is generated by copilot workspace and originates from the zh-Hans/README.md file.
7 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
5 months ago
5 months ago
5 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago