Skip to content

feat(manifest): drop the line of an empty placeholder with omitLineIfEmpty - #25

Merged
kboshold merged 6 commits into
mainfrom
feat/omit-empty-placeholder-line
Oct 13, 2026
Merged

kboshold merged 6 commits into
mainfrom
feat/omit-empty-placeholder-line

Conversation

@kboshold

Copy link
Copy Markdown
Collaborator

What

Adds an opt-in omitLineIfEmpty flag to render placeholders. When it is set and the value resolves to "", a line that holds only the token (plus spaces, tabs or a trailing CR) is removed instead of rendering as a blank line. A token that shares its line with other text substitutes as before, and token lines brought in through another placeholder's value are caught too.

The flag needs manifest schemaVersion 4. Versions 2 and 3 still parse, so existing payloads render byte-identical. A payload that uses the flag under an older version fails with CONFIG_INVALID naming the placeholder, so a forgotten bump doesn't ship a payload that every older CLI rejects with a raw zod error.

Why

Optional hooks like the Dockerfile's docker.preInstall or docker.finalStageSetup default to "" and leave an empty line in every consumer's file when unused. Templates had to put each hook where a blank line would sit anyway, and a hook that didn't added stray blank lines that show up as whitespace-only diffs on upgrade.

Tried against base-config's payload with the flag on the four Dockerfile hooks: empty hooks drop exactly those four lines, set hooks land in place, and check stays clean.

…Empty

A placeholder on its own line that resolves to "" left an empty line behind.
Payload templates had to place each optional hook where a blank line would be,
and a hook that missed this added stray blank lines to every consumer's file,
showing up as whitespace-only diffs on upgrade.

With omitLineIfEmpty: true, a line holding only the token is removed when the
value is empty. Opt-in per placeholder, so existing renders stay byte-identical.
Needs manifest schemaVersion 4; 2 and 3 still parse, and the loader refuses the
key under an older version so a forgotten bump fails loud.
@kboshold
kboshold merged commit 68c8d08 into main Oct 13, 2026
8 checks passed
@kboshold
kboshold deleted the feat/omit-empty-placeholder-line branch October 13, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant