mrm icon indicating copy to clipboard operation
mrm copied to clipboard

Yaml anchors not preserved

Open ext opened this issue 3 years ago • 1 comments

When using the builtin yaml helpers the anchors are not preserved.

Steps to reproduce

Given a task such as:

const { yaml } = require("mrm-core");

module.exports = function myFancyTask() {
    const file = yaml('my-file.yml');
    file.unset('my-key');
    file.save();
}

module.exports.description = "My awesome task";

and an input file (my-file.yml) using anchoes/aliaes simliar to this:

my-key: true

.base: &base
  foo: bar
  spam: ham

sub:
  <<: *base

Actual results

After running the task the anchors are changed into this:

.base:
  foo: bar
  spam: &ref_0
    - 1
    - 2
    - 3
sub:
  foo: bar
  spam: *ref_0

Expected results

.base: &base
  foo: bar
  spam: ham

sub:
  <<: *base

ext avatar Jun 20 '21 16:06 ext

I should add that I use mrm@2 because I cannot get mrm@3 to work at all due to #160 / #178.

ext avatar Jun 20 '21 16:06 ext