mirror of
https://github.com/jaandrle/deka-dom-el
synced 2025-07-01 12:22:15 +02:00
1
bs/.lint.toml
Normal file
1
bs/.lint.toml
Normal file
@ -0,0 +1 @@
|
||||
info= "Lint size of lib and jshint"
|
1
bs/README.md
Normal file
1
bs/README.md
Normal file
@ -0,0 +1 @@
|
||||
[jaandrle/bs: The simplest possible build system using executables](https://github.com/jaandrle/bs/)
|
39
bs/build.js
Executable file
39
bs/build.js
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env -S npx nodejsscript
|
||||
const files= [ "index.js", "index-with-signals.js" ];
|
||||
const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark);
|
||||
|
||||
for(const file of files){
|
||||
const out= filesOut(file);
|
||||
s.run([
|
||||
"npx esbuild '::file::'",
|
||||
"--platform=neutral",
|
||||
"--bundle",
|
||||
//"--minify",
|
||||
"--minify-syntax --minify-identifiers",
|
||||
"--packages=external",
|
||||
"--outfile='::out::'"
|
||||
].join(" "), { file, out });
|
||||
pipe(
|
||||
f=> f.replace(/^ +/gm, m=> "\t".repeat(m.length/2)),
|
||||
f=> s.echo(f).to(out)
|
||||
)(s.cat(out));
|
||||
toDDE(out, filesOut(file, "dde"));
|
||||
}
|
||||
$.exit(0);
|
||||
|
||||
function toDDE(file, out){
|
||||
const name= "dde";
|
||||
echo(`\n ${out} (${file} → globalThis.${name})\n`);
|
||||
|
||||
let content= s.cat(file).toString().split("export {");
|
||||
content.splice(1, 0, `\nglobalThis.${name}= {`);
|
||||
content[2]= content[2].replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4");
|
||||
s.echo([
|
||||
`//deka-dom-el library is available via global namespace \`${name}\``,
|
||||
"(()=> {",
|
||||
"\t"+content.join("").split("\n").join("\n "),
|
||||
"})();"
|
||||
].join("\n")).to(out);
|
||||
|
||||
echo("⚡ Done\n");
|
||||
}
|
2
bs/lint.sh
Executable file
2
bs/lint.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
npx size-limit
|
Reference in New Issue
Block a user