Closed esfalsa closed 1 year ago
Interesting! I haven't tested this on a POSIX system, but on Windows at least, this doesn't build, presumably because it's assuming bash as a shell rather than, say, Powershell or cmd.exe. I'm not entirely sure what the standard process here is for node packages; I'm sure there are idiomatic approaches for handling this.
PS C:\source\GitHub\gauntlet> npm run build
> gauntlet@1.0.0 build
> npm run build:compile && npm run build:minify
> gauntlet@1.0.0 build:compile
> npx tsc
> gauntlet@1.0.0 build:minify
> run-for-every-file --src ./build/scripts/ --dest ./build/scripts/ --file '*.js' --run 'terser {{src-file}} --compress --mangle -o {{src-file}}'
No one file has been found! Command didn't run.
I think I found the cause of the error — cmd.exe doesn't support single quotes.
I'm not too familiar with the idiomatic way to handle this situation more generally but I feel like things generally just work. To be fair, this one's mostly down to me not reading the documentation too carefully. If it still doesn't work, we could also use a build script that calls Terser's JavaScript API.
I can confirm it works on Windows now.
I think (but am unsure) that the idiomatic approach is in fact writing some .js invoked there that handles things accordingly. I'm seeing several Typescript Chromium-extension projects that use webpack to handle this. I think the current approach is fine, though, so long as we don't need to add extra steps at some point.
I guess my only suggestion is that a dev
script which does a build without minification for debugging purposes is going to be helpful/needed.
I've added a dev
script that just runs tsc --watch
to hopefully make things a little easier. In this setup, to run tsc
without watching input files, we can use npm run build:compile
.
Tested and confirmed working.
This uses Terser to compress and mangle the compiled JavaScript.