google / closure-compiler-js

Package for the JS version of closure-compiler for use via NPM
https://github.com/google/closure-compiler
Apache License 2.0
1.84k stars 64 forks source link

[Please] Add "js_output_file" flag #89

Closed DazWilkin closed 6 years ago

DazWilkin commented 6 years ago

The JavaScript implement does not currently support designating an output file.

There is a flag with the Java implementation: js_output_file

I believe (!?) a limitation without this is that I'm unable to effectively containerize the compiler by deriving its image from a baseline npm image.

Dockerfile:

FROM gcr.io/cloud-builders/npm
RUN npm install -g google-closure-compiler-js
ENTRYPOINT ["google-closure-compiler-js"]
CMD ["--help"]

I'd like to be able to:

docker run closure:npm -- --js_output_file helloworld.optimized.js helloworld.js

But the default to stdout requires file redirection (I think!?) requires me to expose a shell and then wrap the command:

E.g FROM ubuntu

and then:

docker run closure:big \
  /bin/bash -c "google-closure-compiler-js helloworld.js > helloworld.optimized.js"
ChadKillingsworth commented 6 years ago

The JS version currently does not support any filesystem operations. Adding them is non-trivial, but something I'm looking at.

ChadKillingsworth commented 6 years ago

The cli script used to support npx at https://github.com/google/closure-compiler-npm now supports the js_output_file flag.