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

Rename template-opts -> options #35

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

This renames the template-opts option to just options, per discussion in https://github.com/guybedford/chomp/issues/32.

It might make it simpler to just think of this as global default options and task options. The fact that they are applying to and keyed by templates is perhaps less important to highlight than ensuring users just appreciate template tasks take options.

Before:

[default-template-opts.npm]
  pkg-manager = 'pnpm'

[[task]]
  template = 'svelte'
  [task.template-opts]
    auto-install = true

After:

[default-options.npm]
  package-manager = 'pnpm'

[[task]]
  template = 'svelte'
  [task.options]
    auto-install = true
guybedford commented 2 years ago

I've also updated this PR to permit auto-install as an option for all templates individually. I've kept package-manager as a global option though, but renamed it from pkg-manager to package-manager - no need for unnecessary shortening I think,

canadaduane commented 2 years ago

Can it be [template.options] (instead of [task.options]) when within the [[task]] group?

e.g.

[default-options.npm]
  package-manager = 'pnpm'

[[task]]
  template = 'svelte'
  [template.options]
    auto-install = true
guybedford commented 2 years ago

Yeah I get that would be intuitive, but the way TOML works, every [] object specifier must be the full path from the root. So it would have to be [task.template-options] or [task.template.name] and [task.template.options] if template were an object.

canadaduane commented 2 years ago

Hmm. Maybe we could use the TOML inline object in short sample configs, unless the options are many:

[[task]]
  template = 'svelte'
  template-options = { auto-install = true }

FWIW I think "task.options" borders on confusing once again, because the question that would come to mind is, "Aren't the other things under [[task]] options also? How do they differ?"

guybedford commented 2 years ago

Sure, I can get behind renaming back to template-options too.

guybedford commented 2 years ago

Reverted back in https://github.com/guybedford/chomp/pull/36.