jiek v2.3.3
Jiek
| English | 简体中文 | 繁体中文 | 日本語 | Français
A lightweight toolkit for compiling and managing libraries based on
package.jsonmetadata 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 considercjsandesmcompatibility issuesdependencies,peerDependencies,optionalDependencies: Automatically mark dependencies that meet the rules asexternaldevDependencies: 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
esbuildswctypescript
- 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.jsonand 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->patchfeat!: xxx->minorfeat!!: xxx->major
Installation
npm i -D jiek
# or
pnpm i -D jiek
# or
yarn add -D jiekQuick 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/utilsin the workspace, then you can runjk -f utils buildto build this package.When you need to publish the current package, you can first run
jk -f utils prepublishto prepare the publishing content, then runjk -f utils publishto publish, and finally runjk -f utils postpublishto clean up the publishing content.Of course, you may find the above operations a bit cumbersome, you can simplify the operations by adding
scriptsin 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
prepublishsubcommand to generate the relevantpackage.jsonfile 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,./barWhen your project is a non-monorepo project, you can directly build through jb [entries].
jb .
jb ./foo
jb ./foo,./barFilters
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 utilsWhen your project is a monorepo project, you can directly build through jb [filters].
jb @monorepo/*
jb @monorepo/utils
jb utilsCustom 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,
esbuildwill be used by default
jb --type swcIf 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.minsuffix before outputting.
jb --minType terser
jb --onlyMinifyExclude Specific Build Content
You can disable the build of js through --noJs, and disable the build of dts through --noDts.
jb --noJs
jb --noDtsCustom Output Directory
You can specify the output directory through --outdir.
jb --outdir libWatch Mode
You can enable watch mode through --watch.
jb --watchExternal 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-domDisable Automatic Cleanup of Products
You can disable the automatic cleanup of products through --noClean.
jb --noCleanCustom tsconfig Path
You can specify the path of tsconfig through --tsconfig.
jb --tsconfig ./tsconfig.custom-build.jsonYou 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.jsonPublish 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-checksWhy 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
monoreposupport, 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 Referenceintsconfig.json - Unable to fully utilize
conditionalfeatures - 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.
12 months ago
11 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
10 months ago
10 months ago
10 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 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
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago