mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-24 01:29:36 +01:00
♻️ Update build script to support minification levels
Full minification by default
This commit is contained in:
parent
46869736d5
commit
19fd857dac
12
bs/build.js
12
bs/build.js
@ -2,14 +2,16 @@
|
|||||||
const files= [ "index.js", "index-with-signals.js" ];
|
const files= [ "index.js", "index-with-signals.js" ];
|
||||||
const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark);
|
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 of files){
|
||||||
const out= filesOut(file);
|
const out= filesOut(file);
|
||||||
s.run([
|
s.run([
|
||||||
"npx esbuild '::file::'",
|
"npx esbuild '::file::'",
|
||||||
"--platform=neutral",
|
"--platform=neutral",
|
||||||
"--bundle",
|
"--bundle",
|
||||||
//"--minify",
|
minify==="full" ? "--minify" : "--minify-syntax --minify-identifiers",
|
||||||
"--minify-syntax --minify-identifiers",
|
|
||||||
"--legal-comments=inline",
|
"--legal-comments=inline",
|
||||||
"--packages=external",
|
"--packages=external",
|
||||||
"--outfile='::out::'"
|
"--outfile='::out::'"
|
||||||
@ -28,13 +30,15 @@ function toDDE(file, out){
|
|||||||
|
|
||||||
let content= s.cat(file).toString().split(/export ?{/);
|
let content= s.cat(file).toString().split(/export ?{/);
|
||||||
content.splice(1, 0, `\nglobalThis.${name}= {`);
|
content.splice(1, 0, `\nglobalThis.${name}= {`);
|
||||||
content[2]= content[2].replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4");
|
content[2]= content[2].replace(/,(?!\n)/g, ",\n").replace(/(?<!\n)}/, "\n}").replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4");
|
||||||
s.echo([
|
s.echo([
|
||||||
`//deka-dom-el library is available via global namespace \`${name}\``,
|
`//deka-dom-el library is available via global namespace \`${name}\``,
|
||||||
"(()=> {",
|
"(()=> {",
|
||||||
"\t"+content.join("").split("\n").join("\n "),
|
content.join(""),
|
||||||
"})();"
|
"})();"
|
||||||
].join("\n")).to(out);
|
].join("\n")).to(out);
|
||||||
|
|
||||||
echo("⚡ Done\n");
|
echo("⚡ Done\n");
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.parse();
|
||||||
|
517
dist/dde-with-signals.js
vendored
517
dist/dde-with-signals.js
vendored
File diff suppressed because one or more lines are too long
331
dist/dde.js
vendored
331
dist/dde.js
vendored
File diff suppressed because one or more lines are too long
527
dist/esm-with-signals.js
vendored
527
dist/esm-with-signals.js
vendored
File diff suppressed because one or more lines are too long
339
dist/esm.js
vendored
339
dist/esm.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user