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

Global template options #27

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

Global environment passing to templates was recently added. This works as a sort of global template configuration space.

But for a feature like autoInstall which is an option on every template, it could be useful to explicitly treat this as global template configuration instead of an environment variable.

The suggestion would be to not pass env into templates, but instead pass globalTemplateConfig, where this is configured like:

[global_config]
  pkgManager = 'yarn'
  autoInstall = true
canadaduane commented 2 years ago

Perhaps [defaults] would make sense here? Implying that if not set at the top-level, the individual task args can override.

On Sun, Jan 9, 2022 at 11:22 AM Guy Bedford @.***> wrote:

Global environment passing to templates was recently added. This works as a sort of global template configuration space.

But for a feature like autoInstall which is an option on every template, it could be useful to explicitly treat this as global template configuration instead of an environment variable.

The suggestion would be to not pass env into templates, but instead pass globalTemplateConfig, where this is configured like:

[global_config] pkgManager = 'yarn' autoInstall = true

— Reply to this email directly, view it on GitHub https://github.com/guybedford/chomp/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAABAJ6L2GGGIKBO2CDRI3UVHG75ANCNFSM5LSEF5AQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

guybedford commented 2 years ago

One issue with that is that template arguments are like function arguments - specific to each template, so I was kind of thinking more of a global config dictionary that plugins could hook into. Of course the problem of name confusions still arises, but is perhaps more clear in this framing.

guybedford commented 2 years ago

This was implemented in https://github.com/guybedford/chomp/pull/31 as being a double map for default options by template name.

So:

[default-template-opts.npm]
  auto-install = true