Created
February 25, 2022 12:56
-
-
Save TomEpsilon/69c1ed2bf432004396000a32860a1079 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node build.js [file] -o [output] | |
// install terser and minimist | |
import{minify}from"terser"; | |
import{readFile, writeFile}from"fs/promises"; | |
import m from "minimist"; | |
let p = m(process.argv.slice(2)); | |
let a = p._[0] | |
if (a){ | |
(async()=>{ | |
const i=await readFile(a,"utf8"), | |
s=await minify(i); | |
await writeFile(p.o || a,s.code) | |
console.log(`✅ Built ${a} ${p.o?("at "+p.o):""}`) | |
})(); | |
} else { | |
console.error("❎ No file specified"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment