1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-01 12:22:15 +02:00

Bundle DTS files

This commit is contained in:
2023-10-19 15:01:54 +02:00
parent 19fd857dac
commit 97da5441ee
8 changed files with 489 additions and 5 deletions

View File

@ -1,11 +1,13 @@
#!/usr/bin/env -S npx nodejsscript
const files= [ "index.js", "index-with-signals.js" ];
import { bundle as bundleDTS } from "dts-bundler";
const files= [ "index", "index-with-signals" ];
const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark);
$.api("", true)
.option("--minify", "Level of minification [ full (default), partial ]")
.action(function main({ minify= "full" }){
for(const file of files){
for(const file_root of files){
const file= file_root+".js";
const out= filesOut(file);
s.run([
"npx esbuild '::file::'",
@ -20,6 +22,8 @@ $.api("", true)
f=> f.replace(/^ +/gm, m=> "\t".repeat(m.length/2)),
f=> s.echo(f).to(out)
)(s.cat(out));
const file_dts= file_root+".d.ts";
s.echo(bundleDTS(file_dts)).to(filesOut(file_dts));
toDDE(out, filesOut(file, "dde"));
}
$.exit(0);