guybedford / chomp

'JS Make' - parallel task runner for the frontend ecosystem with a JS extension system.
https://chompbuild.com
Apache License 2.0
138 stars 7 forks source link

feat: chomp --eject and chomp --format #45

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

This implements a chomp --format and a chomp --eject commmand.

Format will reformat the chompfile.toml (serialize + deserialize)

--eject will expand all the templates into exact tasks so that no templates remain in use.

Example with an SWC task:

version = 0.1

[[task]]
  target = "lib/#.js"
  deps = ["src/#.jsx"]
  template = "swc"
  [task.template-options]
    auto-install = true
  [task.template-options.config]
    "jsc.parser.jsx" = true

when running chomp --eject the chompfile is rewritten into:

version = 0.1

[[task]]
target = 'lib/#.js'
dep = 'src/#.jsx'
run = 'node ./node_modules/@swc/cli/bin/swc.js $DEP -o $TARGET --source-maps -C jsc.parser.jsx=true'