moon icon indicating copy to clipboard operation
moon copied to clipboard

[feature] Support YAML references (anchors/aliases) in config files

Open milesj opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

Nope

Describe the solution you'd like

YAML supports reusing values within a document through features known as anchors and aliases. It looks something like the following:

tasks:
    build: &webpack_shared
        command: webpack
        args: build
        inputs:
            - 'src/**/*'
    start:
        <<: *webpack_shared
        args: start

It would be nice if our config files supported this syntax.

Describe alternatives you've considered

Additional context

Work has started here https://github.com/moonrepo/moon/tree/05-yaml-ref but seems to be blocked by serde_yaml: https://github.com/dtolnay/serde-yaml/issues/245

milesj avatar Jun 25 '22 23:06 milesj

+1 would help to keep the yml config files DRY and make them easier to manage/ changing values

alexn-s avatar Jul 01 '22 22:07 alexn-s

Will be in the next version.

milesj avatar Oct 18 '22 05:10 milesj

@milesj - happy to see this works :) Would be great to include some info and an example in the docs

theoephraim avatar Apr 18 '23 15:04 theoephraim