Skip to content

Commit

Permalink
feat: support development only properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed May 29, 2022
1 parent 8d9c13a commit 79f093d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const json2md = require('json2md')
const yaml = require('yaml')
const yargs = require('yargs')

const DEVELOPMENT_ONLY_REGEX = /^\s*DARGSTACK-REMOVE\s*$/

json2md.converters.vanilla = function (input, json2md) {
return input
}
Expand Down Expand Up @@ -212,6 +214,15 @@ const mdjson = [
'production' in itemElement[1] && itemElement[1].production
? ' ![production](https://img.shields.io/badge/-production-informational.svg?style=flat-square)'
: ''
}${
'comment' in itemElement[1] &&
itemElement[1].comment &&
itemElement[1].comment
.split('\n')
.filter((element) => DEVELOPMENT_ONLY_REGEX.test(element))
.length > 0
? ' ![development](https://img.shields.io/badge/-development-informational.svg?style=flat-square)'
: ''
}`,
},
]
Expand All @@ -220,6 +231,7 @@ const mdjson = [
itemElementMarkdown.push({
vanilla: itemElement[1].comment
.split('\n')
.filter((element) => !DEVELOPMENT_ONLY_REGEX.test(element))
.map((comment) => comment.trim())
.join('\n'),
})
Expand Down
2 changes: 1 addition & 1 deletion test/example_stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ This project is deployed in accordance to the [DargStack template](https://githu

The reverse proxy's certificate data.

- ### `portainer_data`
- ### `portainer_data` ![development](https://img.shields.io/badge/-development-informational.svg?style=flat-square)

The container manager's data.

Expand Down
4 changes: 2 additions & 2 deletions test/example_stack/src/development/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ services:
- postgres_data:/var/lib/postgresql/data/
version: "3.6"
volumes:
portainer_data:
portainer_data: #DARGSTACK-REMOVE
# The container manager's data.
{}
{} #DARGSTACK-REMOVE
postgres_data:
# The database's data.
{}

0 comments on commit 79f093d

Please sign in to comment.