dargstack_rgen 0.6.55 → 0.7.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/.github/workflows/docker.yml +3 -3
- package/.github/workflows/release-schedule.yml +1 -1
- package/.prettierrc +4 -0
- package/CHANGELOG.md +7 -0
- package/package.json +3 -3
- package/src/generator.js +97 -38
- package/test/example_stack/README.md +1 -1
- package/test/example_stack/src/development/stack.yml +2 -2
|
@@ -22,20 +22,20 @@ jobs:
|
|
|
22
22
|
docker:
|
|
23
23
|
needs: test
|
|
24
24
|
name: Docker
|
|
25
|
-
uses: dargmuesli/github-actions/.github/workflows/docker.yml@0.11.
|
|
25
|
+
uses: dargmuesli/github-actions/.github/workflows/docker.yml@0.11.7
|
|
26
26
|
secrets:
|
|
27
27
|
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
28
28
|
DOCKER_HUB_USER_NAME: ${{ secrets.DOCKER_HUB_USER_NAME }}
|
|
29
29
|
release-semantic:
|
|
30
30
|
needs: docker
|
|
31
31
|
name: Semantic Release
|
|
32
|
-
uses: dargmuesli/github-actions/.github/workflows/release-semantic.yml@0.11.
|
|
32
|
+
uses: dargmuesli/github-actions/.github/workflows/release-semantic.yml@0.11.7
|
|
33
33
|
secrets:
|
|
34
34
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
35
35
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
36
36
|
release-assets:
|
|
37
37
|
needs: release-semantic
|
|
38
38
|
name: Release Assets
|
|
39
|
-
uses: dargmuesli/github-actions/.github/workflows/release-assets.yml@0.11.
|
|
39
|
+
uses: dargmuesli/github-actions/.github/workflows/release-assets.yml@0.11.7
|
|
40
40
|
with:
|
|
41
41
|
TARGET: development
|
|
@@ -7,6 +7,6 @@ on:
|
|
|
7
7
|
jobs:
|
|
8
8
|
release-schedule:
|
|
9
9
|
name: 'Release: Scheduled'
|
|
10
|
-
uses: dargmuesli/github-actions/.github/workflows/release-schedule.yml@0.11.
|
|
10
|
+
uses: dargmuesli/github-actions/.github/workflows/release-schedule.yml@0.11.7
|
|
11
11
|
secrets:
|
|
12
12
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
package/.prettierrc
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [0.7.0](https://github.com/dargmuesli/dargstack_rgen/compare/0.6.55...0.7.0) (2022-05-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* support development only properties ([79f093d](https://github.com/dargmuesli/dargstack_rgen/commit/79f093d160424affa2bea3c360397004a5cbd4eb))
|
|
7
|
+
|
|
1
8
|
## [0.6.55](https://github.com/dargmuesli/dargstack_rgen/compare/0.6.54...0.6.55) (2022-05-23)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dargstack_rgen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"scheduleVersion": "0.6.55",
|
|
5
5
|
"description": "Generates a DargStack stack project readme.",
|
|
6
6
|
"main": "src/generator.js",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"deepmerge": "4.2.2",
|
|
15
|
-
"diff": "5.
|
|
15
|
+
"diff": "5.1.0",
|
|
16
16
|
"json2md": "1.12.0",
|
|
17
17
|
"yaml": "2.1.0",
|
|
18
18
|
"yargs": "17.5.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@commitlint/cli": "17.0.
|
|
21
|
+
"@commitlint/cli": "17.0.1",
|
|
22
22
|
"@commitlint/config-conventional": "17.0.0",
|
|
23
23
|
"eslint": "8.16.0",
|
|
24
24
|
"eslint-config-standard": "17.0.0",
|
package/src/generator.js
CHANGED
|
@@ -9,6 +9,8 @@ const json2md = require('json2md')
|
|
|
9
9
|
const yaml = require('yaml')
|
|
10
10
|
const yargs = require('yargs')
|
|
11
11
|
|
|
12
|
+
const DEVELOPMENT_ONLY_REGEX = /^\s*DARGSTACK-REMOVE\s*$/
|
|
13
|
+
|
|
12
14
|
json2md.converters.vanilla = function (input, json2md) {
|
|
13
15
|
return input
|
|
14
16
|
}
|
|
@@ -17,22 +19,31 @@ const argv = yargs
|
|
|
17
19
|
.option('path', {
|
|
18
20
|
alias: 'p',
|
|
19
21
|
description: 'Path to a DargStack stack project',
|
|
20
|
-
type: 'string'
|
|
22
|
+
type: 'string',
|
|
21
23
|
})
|
|
22
24
|
.option('validate', {
|
|
23
25
|
alias: 'v',
|
|
24
26
|
description: 'Flag that enabled validation only',
|
|
25
|
-
type: 'boolean'
|
|
27
|
+
type: 'boolean',
|
|
26
28
|
})
|
|
27
29
|
.help()
|
|
28
|
-
.alias('help', 'h')
|
|
29
|
-
.argv
|
|
30
|
+
.alias('help', 'h').argv
|
|
30
31
|
|
|
31
32
|
const projectPath = argv.path || process.cwd()
|
|
32
33
|
const validate = argv.validate || false
|
|
33
34
|
|
|
34
|
-
const stackDevelopmentPath = path.join(
|
|
35
|
-
|
|
35
|
+
const stackDevelopmentPath = path.join(
|
|
36
|
+
projectPath,
|
|
37
|
+
'src',
|
|
38
|
+
'development',
|
|
39
|
+
'stack.yml'
|
|
40
|
+
)
|
|
41
|
+
const stackProductionPath = path.join(
|
|
42
|
+
projectPath,
|
|
43
|
+
'src',
|
|
44
|
+
'production',
|
|
45
|
+
'production.yml'
|
|
46
|
+
)
|
|
36
47
|
|
|
37
48
|
// Read YAMLs.
|
|
38
49
|
|
|
@@ -40,14 +51,18 @@ let developmentYaml
|
|
|
40
51
|
let productionYaml
|
|
41
52
|
|
|
42
53
|
if (fs.existsSync(stackDevelopmentPath)) {
|
|
43
|
-
developmentYaml = yaml.parseDocument(
|
|
54
|
+
developmentYaml = yaml.parseDocument(
|
|
55
|
+
fs.readFileSync(stackDevelopmentPath, 'utf8')
|
|
56
|
+
)
|
|
44
57
|
} else {
|
|
45
58
|
console.error('Development stack file not found!')
|
|
46
59
|
process.exit(1)
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
if (fs.existsSync(stackProductionPath)) {
|
|
50
|
-
productionYaml = yaml.parseDocument(
|
|
63
|
+
productionYaml = yaml.parseDocument(
|
|
64
|
+
fs.readFileSync(stackProductionPath, 'utf8')
|
|
65
|
+
)
|
|
51
66
|
} else {
|
|
52
67
|
console.info('Production stack file not found!')
|
|
53
68
|
}
|
|
@@ -94,11 +109,16 @@ for (let i = 0; i < documentItems.length; i++) {
|
|
|
94
109
|
|
|
95
110
|
if (elementItem.value.commentBefore === undefined) {
|
|
96
111
|
if (!process.argv.includes('--no-comments')) {
|
|
97
|
-
console.error(
|
|
112
|
+
console.error(
|
|
113
|
+
`${documentItem.key.value}: ${elementItem.key.value} is missing a comment!`
|
|
114
|
+
)
|
|
98
115
|
commentMissing = true
|
|
99
116
|
}
|
|
100
117
|
} else {
|
|
101
|
-
contentElementItem.comment = elementItem.value.commentBefore
|
|
118
|
+
contentElementItem.comment = elementItem.value.commentBefore
|
|
119
|
+
.split('\n')
|
|
120
|
+
.map((element) => element.trim())
|
|
121
|
+
.join('\n')
|
|
102
122
|
}
|
|
103
123
|
|
|
104
124
|
contentElementItems[elementItem.key.value] = contentElementItem
|
|
@@ -128,15 +148,25 @@ for (let i = 0; i < documentItems.length; i++) {
|
|
|
128
148
|
|
|
129
149
|
for (let j = 0; j < elementItems.length; j++) {
|
|
130
150
|
const elementItem = elementItems[j]
|
|
131
|
-
const contentElementItem = {
|
|
151
|
+
const contentElementItem = {
|
|
152
|
+
production: !(elementItem.key.value in content[documentItem.key.value]),
|
|
153
|
+
}
|
|
132
154
|
|
|
133
155
|
if (elementItem.value.commentBefore === undefined) {
|
|
134
|
-
if (
|
|
135
|
-
|
|
156
|
+
if (
|
|
157
|
+
!process.argv.includes('--no-comments') &&
|
|
158
|
+
!(elementItem.key.value in content[documentItem.key.value])
|
|
159
|
+
) {
|
|
160
|
+
console.error(
|
|
161
|
+
`${documentItem.key.value}: ${elementItem.key.value} is missing a comment!`
|
|
162
|
+
)
|
|
136
163
|
commentMissing = true
|
|
137
164
|
}
|
|
138
165
|
} else {
|
|
139
|
-
contentElementItem.comment = elementItem.value.commentBefore
|
|
166
|
+
contentElementItem.comment = elementItem.value.commentBefore
|
|
167
|
+
.split('\n')
|
|
168
|
+
.map((element) => element.trim())
|
|
169
|
+
.join('\n')
|
|
140
170
|
}
|
|
141
171
|
|
|
142
172
|
contentElementItems[elementItem.key.value] = contentElementItem
|
|
@@ -146,7 +176,10 @@ for (let i = 0; i < documentItems.length; i++) {
|
|
|
146
176
|
toc.push(documentItem.key.value)
|
|
147
177
|
}
|
|
148
178
|
|
|
149
|
-
content[documentItem.key.value] = deepMerge(
|
|
179
|
+
content[documentItem.key.value] = deepMerge(
|
|
180
|
+
content[documentItem.key.value],
|
|
181
|
+
contentElementItems
|
|
182
|
+
)
|
|
150
183
|
}
|
|
151
184
|
|
|
152
185
|
if (commentMissing) {
|
|
@@ -158,32 +191,58 @@ const mdjson = [
|
|
|
158
191
|
{
|
|
159
192
|
p: [
|
|
160
193
|
`The Docker stack configuration for [${webName}](${webUrl}).`,
|
|
161
|
-
`This project is deployed in accordance to the [DargStack template](https://github.com/dargmuesli/dargstack_template/) to make deployment a breeze. It is closely related to [${sourceName}'s source code](${sourceUrl})
|
|
162
|
-
]
|
|
194
|
+
`This project is deployed in accordance to the [DargStack template](https://github.com/dargmuesli/dargstack_template/) to make deployment a breeze. It is closely related to [${sourceName}'s source code](${sourceUrl}).`,
|
|
195
|
+
],
|
|
163
196
|
},
|
|
164
197
|
{ h2: 'Table of Contents' },
|
|
165
198
|
{
|
|
166
|
-
ol: toc.map(element => {
|
|
199
|
+
ol: toc.map((element) => {
|
|
200
|
+
return { link: { title: element, source: '#' + element } }
|
|
201
|
+
}),
|
|
167
202
|
},
|
|
168
|
-
Object.entries(content).map(contentElement => {
|
|
203
|
+
Object.entries(content).map((contentElement) => {
|
|
169
204
|
return [
|
|
170
205
|
{ h2: contentElement[0] },
|
|
171
206
|
{
|
|
172
207
|
ul: [
|
|
173
|
-
...Object.entries(contentElement[1])
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
208
|
+
...Object.entries(contentElement[1])
|
|
209
|
+
.sort()
|
|
210
|
+
.map((itemElement) => {
|
|
211
|
+
const itemElementMarkdown = [
|
|
212
|
+
{
|
|
213
|
+
h3: `\`${itemElement[0]}\`${
|
|
214
|
+
'production' in itemElement[1] && itemElement[1].production
|
|
215
|
+
? ' '
|
|
216
|
+
: ''
|
|
217
|
+
}${
|
|
218
|
+
'comment' in itemElement[1] &&
|
|
219
|
+
itemElement[1].comment &&
|
|
220
|
+
itemElement[1].comment
|
|
221
|
+
.split('\n')
|
|
222
|
+
.filter((element) => DEVELOPMENT_ONLY_REGEX.test(element))
|
|
223
|
+
.length > 0
|
|
224
|
+
? ' '
|
|
225
|
+
: ''
|
|
226
|
+
}`,
|
|
227
|
+
},
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
if ('comment' in itemElement[1] && itemElement[1].comment) {
|
|
231
|
+
itemElementMarkdown.push({
|
|
232
|
+
vanilla: itemElement[1].comment
|
|
233
|
+
.split('\n')
|
|
234
|
+
.filter((element) => !DEVELOPMENT_ONLY_REGEX.test(element))
|
|
235
|
+
.map((comment) => comment.trim())
|
|
236
|
+
.join('\n'),
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return itemElementMarkdown
|
|
241
|
+
}),
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
]
|
|
245
|
+
}),
|
|
187
246
|
]
|
|
188
247
|
|
|
189
248
|
const md = json2md(mdjson)
|
|
@@ -202,13 +261,13 @@ if (validate) {
|
|
|
202
261
|
const difference = diff.diffLines(md + '\n', readme)
|
|
203
262
|
|
|
204
263
|
if (difference.length > 1) {
|
|
205
|
-
console.error(
|
|
206
|
-
'
|
|
264
|
+
console.error(
|
|
265
|
+
'The README is not up-2-date!\n' +
|
|
266
|
+
"Remember that newline diffs aren't visibly highlighted."
|
|
267
|
+
)
|
|
207
268
|
|
|
208
269
|
difference.forEach((part) => {
|
|
209
|
-
let color = part.added
|
|
210
|
-
? 'green'
|
|
211
|
-
: part.removed ? 'red' : 'grey'
|
|
270
|
+
let color = part.added ? 'green' : part.removed ? 'red' : 'grey'
|
|
212
271
|
|
|
213
272
|
switch (color) {
|
|
214
273
|
case 'green':
|
|
@@ -87,7 +87,7 @@ This project is deployed in accordance to the [DargStack template](https://githu
|
|
|
87
87
|
|
|
88
88
|
The reverse proxy's certificate data.
|
|
89
89
|
|
|
90
|
-
- ### `portainer_data`
|
|
90
|
+
- ### `portainer_data` 
|
|
91
91
|
|
|
92
92
|
The container manager's data.
|
|
93
93
|
|
|
@@ -47,9 +47,9 @@ services:
|
|
|
47
47
|
- postgres_data:/var/lib/postgresql/data/
|
|
48
48
|
version: "3.6"
|
|
49
49
|
volumes:
|
|
50
|
-
portainer_data:
|
|
50
|
+
portainer_data: #DARGSTACK-REMOVE
|
|
51
51
|
# The container manager's data.
|
|
52
|
-
{}
|
|
52
|
+
{} #DARGSTACK-REMOVE
|
|
53
53
|
postgres_data:
|
|
54
54
|
# The database's data.
|
|
55
55
|
{}
|