@intentius/chant-lexicon-docker 0.44.14 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen/docs.d.ts +8 -4
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/package.json +2 -2
- package/src/codegen/docs.ts +139 -25
package/dist/codegen/docs.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Docker lexicon docs generation.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Uses the shared docsPipeline/writeDocsSite flow like every other lexicon
|
|
5
|
+
* (chant #1731, #1755). Hand-written prose lives under docs/pages/, each
|
|
6
|
+
* page tagged with a Diátaxis quadrant; index.mdx and serialization.mdx are
|
|
7
|
+
* generated from the overview/outputFormat strings below, and rules.mdx is
|
|
8
|
+
* generated from the rule sources under src/lint/ the same way it always
|
|
9
|
+
* was — this used to be the one lexicon whose rules table could drift from
|
|
10
|
+
* source without anything catching it (#1312), and the shared pipeline
|
|
11
|
+
* keeps that guarantee.
|
|
8
12
|
*/
|
|
9
13
|
export declare function generateDocs(opts?: {
|
|
10
14
|
verbose?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA4HH,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB9E"}
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "12e7f3764dde0c5390f2f5fd2dae6dd0b592f47d2a371cdc0790a28f2692f291",
|
|
5
5
|
"meta.json": "ae27dc809e705d37a645ee83b9789c50051282f7891d21d6b9e6ce8d111624ff",
|
|
6
6
|
"types/index.d.ts": "758f989ff86af54284d7f841a2db2259038d51ce1f3ed839a5d8e83fa20d95b8",
|
|
7
7
|
"rules/no-latest-tag.ts": "efd060453d8ca3d5b85c3972906c6650b6f63eb5f67cb6cdb0f16a41cad91228",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"skills/chant-docker.md": "3ff0708e3c76e245f202948949c768464563af2b60cc9aa2ca52f494ef8357f1",
|
|
16
16
|
"skills/chant-docker-patterns.md": "ad1b0196d8150b2df579a699ff107f604340c799c04f3460ebf65003e287b12a"
|
|
17
17
|
},
|
|
18
|
-
"composite": "
|
|
18
|
+
"composite": "9b352afd31df9bbe579f1d8cb3b283922757de207585a9885cb1c96ffe888eeb"
|
|
19
19
|
}
|
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-docker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "Docker lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typescript": "^5.9.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@intentius/chant": "^0.
|
|
70
|
+
"@intentius/chant": "^0.46.0",
|
|
71
71
|
"typescript": "^5.9.3"
|
|
72
72
|
}
|
|
73
73
|
}
|
package/src/codegen/docs.ts
CHANGED
|
@@ -1,42 +1,156 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Docker lexicon docs generation.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Uses the shared docsPipeline/writeDocsSite flow like every other lexicon
|
|
5
|
+
* (chant #1731, #1755). Hand-written prose lives under docs/pages/, each
|
|
6
|
+
* page tagged with a Diátaxis quadrant; index.mdx and serialization.mdx are
|
|
7
|
+
* generated from the overview/outputFormat strings below, and rules.mdx is
|
|
8
|
+
* generated from the rule sources under src/lint/ the same way it always
|
|
9
|
+
* was — this used to be the one lexicon whose rules table could drift from
|
|
10
|
+
* source without anything catching it (#1312), and the shared pipeline
|
|
11
|
+
* keeps that guarantee.
|
|
8
12
|
*/
|
|
9
13
|
|
|
10
14
|
import { dirname, join } from "path";
|
|
11
15
|
import { fileURLToPath } from "url";
|
|
12
|
-
import {
|
|
13
|
-
|
|
16
|
+
import { docsPipeline, writeDocsSite, type DocsConfig } from "@intentius/chant/codegen/docs";
|
|
17
|
+
|
|
18
|
+
const overview = `
|
|
19
|
+
The **Docker** lexicon provides typed constructors for Docker Compose services
|
|
20
|
+
and Dockerfile build instructions — services, volumes, networks, configs, secrets,
|
|
21
|
+
and multi-stage Dockerfiles.
|
|
22
|
+
|
|
23
|
+
\`\`\`bash
|
|
24
|
+
npm install --save-dev @intentius/chant-lexicon-docker
|
|
25
|
+
\`\`\`
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
\`\`\`typescript
|
|
30
|
+
import { Service, Volume, Dockerfile, env } from "@intentius/chant-lexicon-docker";
|
|
31
|
+
|
|
32
|
+
export const db = new Service({
|
|
33
|
+
image: "postgres:16-alpine",
|
|
34
|
+
environment: {
|
|
35
|
+
POSTGRES_DB: "myapp",
|
|
36
|
+
POSTGRES_PASSWORD: env("DB_PASSWORD", { required: true }),
|
|
37
|
+
},
|
|
38
|
+
volumes: ["pgdata:/var/lib/postgresql/data"],
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const pgdata = new Volume({});
|
|
42
|
+
|
|
43
|
+
export const api = new Service({
|
|
44
|
+
image: "myapp:1.0",
|
|
45
|
+
ports: ["8080:8080"],
|
|
46
|
+
depends_on: ["db"],
|
|
47
|
+
});
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
Build:
|
|
51
|
+
|
|
52
|
+
\`\`\`bash
|
|
53
|
+
chant build src --lexicon docker -o docker-compose.yml
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
## Output Domains
|
|
57
|
+
|
|
58
|
+
| Entity | Output file | Section |
|
|
59
|
+
|--------|-------------|---------|
|
|
60
|
+
| \`Service\` | \`docker-compose.yml\` | \`services:\` |
|
|
61
|
+
| \`Volume\` | \`docker-compose.yml\` | \`volumes:\` |
|
|
62
|
+
| \`Network\` | \`docker-compose.yml\` | \`networks:\` |
|
|
63
|
+
| \`Config\` | \`docker-compose.yml\` | \`configs:\` |
|
|
64
|
+
| \`Secret\` | \`docker-compose.yml\` | \`secrets:\` |
|
|
65
|
+
| \`Dockerfile\` | \`Dockerfile.{name}\` | — |`;
|
|
66
|
+
|
|
67
|
+
const outputFormat = `
|
|
68
|
+
The Docker lexicon serializes to two output formats.
|
|
69
|
+
|
|
70
|
+
## docker-compose.yml
|
|
71
|
+
|
|
72
|
+
\`\`\`bash
|
|
73
|
+
chant build src --lexicon docker -o docker-compose.yml
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
Each entity type maps to a top-level Compose section. The TypeScript export name becomes the key within that section.
|
|
77
|
+
|
|
78
|
+
\`\`\`typescript
|
|
79
|
+
export const db = new Service({ image: "postgres:16-alpine" });
|
|
80
|
+
export const pgdata = new Volume({});
|
|
81
|
+
export const backend = new Network({ driver: "bridge" });
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
Produces:
|
|
85
|
+
|
|
86
|
+
\`\`\`yaml
|
|
87
|
+
services:
|
|
88
|
+
db:
|
|
89
|
+
image: postgres:16-alpine
|
|
90
|
+
|
|
91
|
+
volumes:
|
|
92
|
+
pgdata: null
|
|
93
|
+
|
|
94
|
+
networks:
|
|
95
|
+
backend:
|
|
96
|
+
driver: bridge
|
|
97
|
+
\`\`\`
|
|
98
|
+
|
|
99
|
+
\`defaultLabels()\` entities are not emitted as separate keys — their labels are merged into each service.
|
|
100
|
+
|
|
101
|
+
## Dockerfile.\\{name\\}
|
|
102
|
+
|
|
103
|
+
\`\`\`bash
|
|
104
|
+
chant build src --lexicon docker
|
|
105
|
+
# Writes Dockerfile.app, Dockerfile.builder, etc.
|
|
106
|
+
\`\`\`
|
|
107
|
+
|
|
108
|
+
Each \`Dockerfile\` entity produces a separate file. The export name is the suffix.
|
|
109
|
+
|
|
110
|
+
\`\`\`typescript
|
|
111
|
+
export const builder = new Dockerfile({ from: "node:20-alpine", ... });
|
|
112
|
+
// → Dockerfile.builder
|
|
113
|
+
\`\`\`
|
|
114
|
+
|
|
115
|
+
## Field mapping
|
|
116
|
+
|
|
117
|
+
| TypeScript | docker-compose.yml | Notes |
|
|
118
|
+
|-----------|-------------------|-------|
|
|
119
|
+
| \`env("X", { required: true })\` | \`\${X:?X is required}\` | Compose interpolation |
|
|
120
|
+
| \`env("X", { default: "v" })\` | \`\${X:-v}\` | Compose interpolation |
|
|
121
|
+
| \`env("X")\` | \`\${X}\` | Compose interpolation |
|
|
122
|
+
| \`external: true\` | \`external: true\` | Volume/Network |
|
|
123
|
+
|
|
124
|
+
## Specifying lexicon at build time
|
|
125
|
+
|
|
126
|
+
The \`--lexicon docker\` flag restricts output to Docker entities only — useful in mixed-lexicon projects:
|
|
127
|
+
|
|
128
|
+
\`\`\`bash
|
|
129
|
+
# Only Docker output
|
|
130
|
+
chant build src --lexicon docker -o docker-compose.yml
|
|
131
|
+
|
|
132
|
+
# Other lexicons still get their own outputs
|
|
133
|
+
chant build src --lexicon aws -o template.json
|
|
134
|
+
\`\`\``;
|
|
14
135
|
|
|
15
136
|
export async function generateDocs(opts?: { verbose?: boolean }): Promise<void> {
|
|
16
137
|
const pkgDir = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
17
138
|
|
|
18
|
-
|
|
19
|
-
console.error("Generating Docker lexicon docs...");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const config = {
|
|
139
|
+
const config: DocsConfig = {
|
|
23
140
|
name: "docker",
|
|
24
141
|
displayName: "Docker",
|
|
25
|
-
description: "Typed constructors for Docker Compose
|
|
142
|
+
description: "Typed constructors for Docker Compose and Dockerfile configuration",
|
|
26
143
|
distDir: join(pkgDir, "dist"),
|
|
27
144
|
outDir: join(pkgDir, "docs"),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console.error(`Wrote ${out}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
145
|
+
basePath: "/chant/lexicons/docker/",
|
|
146
|
+
overview,
|
|
147
|
+
outputFormat,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const result = docsPipeline(config);
|
|
151
|
+
writeDocsSite(config, result);
|
|
38
152
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
153
|
+
if (opts?.verbose) {
|
|
154
|
+
console.error("Documentation generated");
|
|
155
|
+
}
|
|
42
156
|
}
|