guybedford / chomp

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

env property of tasks dropped when ejecting #128

Closed zachsa closed 2 years ago

zachsa commented 2 years ago

Ejecting this task:

[[task]]
name = 'server'
env = { TZ='UTC', NODE_LOADER_CONFIG='loaders/config.js' }
serial = true
deps = [
  'rollup:ssr',
  'node.importmap',
  'server/**/*.js',
]
run = """
prettier \
  --loglevel warn \
  --cache \
  --cache-strategy metadata \
  --ignore-path ../.prettierignore \
  --write "ssr/**/*.@(js|json|geojson|cjs|mjs|graphql|ts|tsx|jsx)" \
  --write "server/**/*.@(js|json|geojson|cjs|mjs|graphql|ts|tsx|jsx)" \
  --write "loaders/**/*.js" && \
    node \
      --trace-warnings \
      --loader @node-loader/core \
      server
"""

(chomp --eject)

I lost the env. The output was

[[task]]
name = 'server'
deps = [
    'rollup:ssr',
    'node.importmap',
    'server/**/*.js',
]
serial = true
run = '''
prettier --loglevel warn --cache --cache-strategy metadata --ignore-path ../.prettierignore --write "ssr/**/*.@(js|json|geojson|cjs|mjs|graphql|ts|tsx|jsx)" --write "server/**/*.@(js|json|geojson|cjs|mjs|graphql|ts|tsx|jsx)" --write "loaders/**/*.js" && node --trace-warnings --loader @node-loader/core server
'''
zachsa commented 2 years ago

ah never mind. I found it

[task.env]
TZ = 'UTC'
NODE_LOADER_CONFIG = 'loaders/config.js'

would be better if it didn't change the task as i wrote it

zachsa commented 2 years ago

I think it would also be better if comments aren't dropped

guybedford commented 2 years ago

We currently use https://crates.io/crates/toml as it has full serde compatibility, but ideally we would use a TOML parser that did preserve as much rich formatting as possible. Unfortunately, I'm unaware of a good one to use here, but it shouldn't be hard to implement any suggestion from https://crates.io/crates/toml.

It's just not on my list to write a custom TOML parser...

zachsa commented 2 years ago

Okay. I mentioned just in case it was a decision that could be changed. I don't think it's worth effort