@zokugun/tsc-leda
v0.1.4
Published
CLI utility compiling (with `tsc`) and preparing TS projects for dual ESM/CJS distribution
Readme
@zokugun/tsc-leda
CLI utility which compile (using tsc) and prepare TypeScript projects for dual ESM/CJS distribution.
Features
- Compile TypeScript outputs for ESM and CommonJS (uses the TypeScript compiler
tscvianpx tsc) - Rename generated JS/TS declaration files for Node-style extensions (
.mjs,.cjs,.d.mts,.d.cts) - Update
package.jsonexports and types mappings to reflect generated outputs - Small, focused CLI commands for simple automation
Requirement
- Node.js v18.20+
Installation
Install locally or run with npx:
npm add -D @zokugun/tsc-leda
# or
npx @zokugun/tsc-leda <command>Quick Start
Typical workflow:
- Add a configuration file at your project root (
.tscledarc.yml,.tscledarc.yaml,.tscledarc.jsonor.tscledarc). - Run the generator to emit
dist(or your configuredoutDir). - Update your
package.jsonto export the generated entry points.
Examples:
# Generate compiled files (ESM/CJS depending on config)
# Note: this runs `npx tsc -p <tsconfig>` under the hood to compile your TypeScript sources.
npx tsc-leda generate-files
# Update package.json exports/types after generation
npx tsc-leda update-packageConfiguration
Create one of the supported config files at your repository root. Example .tscledarc.yml:
srcDir: src
outDir: dist
entry:
.: src/index.ts
cli: src/cli.ts
format:
- cjs
- esmsrcDir: source directory (defaultsrc)outDir: output directory (defaultdist)entry: single entry (string) or a mapping of exports -> source filesformat:cjs,esm, or both
The CLI will look for .tscledarc.yml, .tscledarc.yaml, .tscledarc.json or .tscledarc in the current working directory.
Commands
generate-files— compile TypeScript and produce ESM/CJS outputs under the configuredoutDir.update-package— updatepackage.jsonexports,module,main, andtypesVersionsto reference compiled outputs.
Run command help via npx tsc-leda --help.
Contributions
Contributions are most welcome. Please:
- Open issues and feature requests under the repository discussions.
- Follow the
CONTRIBUTING.md.
Donations
Support this project by becoming a financial contributor.
License
Copyright © 2026-present Baptiste Augrain
Licensed under the MIT license.
