fix(generator): fix leading newline in generated json files

This commit is contained in:
technofab 2025-11-16 20:56:57 +01:00
parent e04b71c074
commit 078034b01e
No known key found for this signature in database
3 changed files with 15 additions and 5 deletions

1
.gitignore vendored
View file

@ -3,4 +3,5 @@ result
# soonix
/test.yaml
/test.json
# end soonix

View file

@ -17,10 +17,10 @@
autogeneratedMessage =
{
yaml = "# Generated by soonix, DO NOT EDIT";
toml = "# Generated by soonix, DO NOT EDIT";
lua = "--- Generated by soonix, DO NOT EDIT";
xml = "<!-- Generated by soonix, DO NOT EDIT -->";
yaml = "# Generated by soonix, DO NOT EDIT\n";
toml = "# Generated by soonix, DO NOT EDIT\n";
lua = "--- Generated by soonix, DO NOT EDIT\n";
xml = "<!-- Generated by soonix, DO NOT EDIT -->\n";
}.${
format
} or "";
@ -31,7 +31,7 @@
''
${pre.buildCommand}
cp $out tmp
cat <(echo "${autogeneratedMessage}") tmp > $out
cat <(echo -n "${autogeneratedMessage}") tmp > $out
'';
});

View file

@ -22,5 +22,14 @@ in
gitignore = true;
};
};
testJson = {
output = "test.json";
data.hello = "world";
opts.format = "json";
hook = {
mode = "copy";
gitignore = true;
};
};
};
}).config