@jlbyte/js
v1.0.2
Published
JS build command line tool
Maintainers
Readme
JS
JS build command line tool.
Usage
Dialog
js◆ Do:
│ ● Build (Bundle scripts for production)
│ ○ Transpile
│ ↑/↓ to navigate • Enter: confirm
└CLI
js --help
js build --helpjs
Usage:
$ js build <input> <output>
Options:
-f, --format [list] output format: es,cjs,iife (default: es,cjs)
-n, --name [name] optional output namespace, (default: index)
-e, --exclude [path-list] comma separated exclude import names (default: false)
-p, --package [path] path to package.json (default: false)
-a, --asset [path-list] comma separated file assets tobe copied (default: false)
-h, --help Display this message Build
- Bundle JS module using rollup
- Create file
d.tsautomatically - help publish exports in
package.json - copy assets to output directory
Basic
js build ./src/index.mjs ./distdist/
index.mjs
index.cjs
index.d.mtsNamespace
Use -n or --name
js build ./src/index.mjs ./dist -n nsdist/
ns.mjs
ns.cjs
ns.d.mtsFormat
Use -f or --format (comma separated list)
js build ./src/index.mjs ./dist -f es,cjs,iifedist/
index.mjs
index.cjs
index.js
index.d.mtsPackage
Use -p or --package
js build ./src/index.mjs ./dist -p ./package.json -f es,cjs,iife{
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"jsdelivr": "dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./src/index.mjs",
"require": "./dist/index.cjs"
}
}
}Asset
Use -a or --asset (comma separated list)
js build ./src/index.mjs ./dist -a ./src/style.cssdist/
index.mjs
index.cjs
index.d.mts
style.css