Feature 57 (config and provisioning): modules declare config and provisions, their files rendered from templates; synced with main (issues of feature 57, 874)

This commit is contained in:
2026-10-16 07:37:43 +00:00
parent 1a2c917abf
commit 9652b2d5ce
771 changed files with 52063 additions and 1774 deletions
+3
View File
@@ -0,0 +1,3 @@
# The prompt: powerlevel10k v1.20.0, pinned in this module (novox/hq ADR 0205), and its configuration.
[[ ! -f ~/.local/share/powerlevel10k/powerlevel10k.zsh-theme ]] || source ~/.local/share/powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.config/powerlevel10k/p10k.zsh ]] || source ~/.config/powerlevel10k/p10k.zsh
+12 -7
View File
@@ -1,13 +1,7 @@
{
"module": "powerlevel10k",
"version": "1",
"shell": [
{
"for": "zsh",
"slot": "normal",
"code": "# The prompt: powerlevel10k v1.20.0, pinned in this module (novox/hq ADR 0205), and its configuration.\n[[ ! -f ~/.local/share/powerlevel10k/powerlevel10k.zsh-theme ]] || source ~/.local/share/powerlevel10k/powerlevel10k.zsh-theme\n[[ ! -f ~/.config/powerlevel10k/p10k.zsh ]] || source ~/.config/powerlevel10k/p10k.zsh\n"
}
],
"moved": true,
"resources": [
{
"id": "theme",
@@ -24,6 +18,12 @@
"artifact": "configuration"
}
],
"items": [
{
"collection": "shell:zsh:normal",
"template": "files/zsh-normal"
}
],
"build": {
"artifacts": [
{
@@ -35,6 +35,11 @@
"name": "configuration",
"kind": "archive",
"from": "config"
},
{
"name": "files",
"kind": "archive",
"from": "files"
}
]
}
+13 -7
View File
@@ -26,14 +26,20 @@ test("both are unpacked under the account's home, owned by the account", () => {
assert.deepEqual(byId.configuration, { id: "configuration", type: "archive", path: "${machine:account-home}/.config/powerlevel10k", owner: "${machine:account}", artifact: "configuration" });
});
// The zsh code is an item of the collection shell:zsh:normal, its text a template in files/ (ADR 0348, 0349).
const shellCode = (): string => {
const items = m.items.filter((i: { collection: string }) => i.collection.startsWith("shell:"));
assert.equal(items.length, 1);
assert.equal(items[0].collection, "shell:zsh:normal", "for zsh, in the normal slot");
return readFileSync(at(items[0].template), "utf8");
};
test("the zsh code in the normal slot sources the theme, then the configuration, and turns on no instant prompt", () => {
assert.equal(m.shell.length, 1);
const [c] = m.shell;
assert.equal(c.for, "zsh");
assert.equal(c.slot, "normal");
const sourced = [...(c.code as string).matchAll(/\|\| source (\S+)/g)].map((x) => x[1]);
assert.equal(m.shell, undefined);
const code = shellCode();
const sourced = [...code.matchAll(/\|\| source (\S+)/g)].map((x) => x[1]);
assert.deepEqual(sourced, ["~/.local/share/powerlevel10k/powerlevel10k.zsh-theme", "~/.config/powerlevel10k/p10k.zsh"]);
assert.doesNotMatch(c.code, /instant/);
assert.doesNotMatch(code, /instant/);
});
test("the README names the upstream, the version and the licence", () => {
@@ -41,5 +47,5 @@ test("the README names the upstream, the version and the licence", () => {
assert.match(readme, /github\.com\/romkatv\/powerlevel10k/);
assert.match(readme, /v1\.20\.0/);
assert.match(readme, /MIT/);
assert.match(m.shell[0].code, /v1\.20\.0/, "the version in the shell code's comment matches");
assert.match(shellCode(), /v1\.20\.0/, "the version in the shell code's comment matches");
});