dargstack_rgen 0.9.31 → 0.9.32
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/.dockerignore +137 -9
- package/.github/workflows/ci.yml +30 -2
- package/.vscode/extensions.json +8 -0
- package/.vscode/settings.json +26 -0
- package/CHANGELOG.md +7 -0
- package/Dockerfile +5 -15
- package/eslint.config.js +26 -0
- package/package.json +13 -9
- package/src/{generator.cjs → generator.js} +27 -31
- package/.eslintrc.json +0 -10
package/.dockerignore
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
|
-
# Created by https://www.toptal.com/developers/gitignore/api/node
|
|
2
|
-
# Edit at https://www.toptal.com/developers/gitignore?templates=node
|
|
1
|
+
# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,node,windows
|
|
2
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,node,windows
|
|
3
|
+
|
|
4
|
+
### Linux ###
|
|
5
|
+
*~
|
|
6
|
+
|
|
7
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
8
|
+
.fuse_hidden*
|
|
9
|
+
|
|
10
|
+
# KDE directory preferences
|
|
11
|
+
.directory
|
|
12
|
+
|
|
13
|
+
# Linux trash folder which might appear on any partition or disk
|
|
14
|
+
.Trash-*
|
|
15
|
+
|
|
16
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
|
17
|
+
.nfs*
|
|
18
|
+
|
|
19
|
+
### macOS ###
|
|
20
|
+
# General
|
|
21
|
+
.DS_Store
|
|
22
|
+
.AppleDouble
|
|
23
|
+
.LSOverride
|
|
24
|
+
|
|
25
|
+
# Icon must end with two \r
|
|
26
|
+
Icon
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Thumbnails
|
|
30
|
+
._*
|
|
31
|
+
|
|
32
|
+
# Files that might appear in the root of a volume
|
|
33
|
+
.DocumentRevisions-V100
|
|
34
|
+
.fseventsd
|
|
35
|
+
.Spotlight-V100
|
|
36
|
+
.TemporaryItems
|
|
37
|
+
.Trashes
|
|
38
|
+
.VolumeIcon.icns
|
|
39
|
+
.com.apple.timemachine.donotpresent
|
|
40
|
+
|
|
41
|
+
# Directories potentially created on remote AFP share
|
|
42
|
+
.AppleDB
|
|
43
|
+
.AppleDesktop
|
|
44
|
+
Network Trash Folder
|
|
45
|
+
Temporary Items
|
|
46
|
+
.apdisk
|
|
47
|
+
|
|
48
|
+
### macOS Patch ###
|
|
49
|
+
# iCloud generated files
|
|
50
|
+
*.icloud
|
|
3
51
|
|
|
4
52
|
### Node ###
|
|
5
53
|
# Logs
|
|
@@ -9,6 +57,7 @@ npm-debug.log*
|
|
|
9
57
|
yarn-debug.log*
|
|
10
58
|
yarn-error.log*
|
|
11
59
|
lerna-debug.log*
|
|
60
|
+
.pnpm-debug.log*
|
|
12
61
|
|
|
13
62
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
14
63
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
@@ -24,6 +73,7 @@ lib-cov
|
|
|
24
73
|
|
|
25
74
|
# Coverage directory used by tools like istanbul
|
|
26
75
|
coverage
|
|
76
|
+
*.lcov
|
|
27
77
|
|
|
28
78
|
# nyc test coverage
|
|
29
79
|
.nyc_output
|
|
@@ -44,8 +94,11 @@ build/Release
|
|
|
44
94
|
node_modules/
|
|
45
95
|
jspm_packages/
|
|
46
96
|
|
|
47
|
-
#
|
|
48
|
-
|
|
97
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
98
|
+
web_modules/
|
|
99
|
+
|
|
100
|
+
# TypeScript cache
|
|
101
|
+
*.tsbuildinfo
|
|
49
102
|
|
|
50
103
|
# Optional npm cache directory
|
|
51
104
|
.npm
|
|
@@ -53,6 +106,15 @@ typings/
|
|
|
53
106
|
# Optional eslint cache
|
|
54
107
|
.eslintcache
|
|
55
108
|
|
|
109
|
+
# Optional stylelint cache
|
|
110
|
+
.stylelintcache
|
|
111
|
+
|
|
112
|
+
# Microbundle cache
|
|
113
|
+
.rpt2_cache/
|
|
114
|
+
.rts2_cache_cjs/
|
|
115
|
+
.rts2_cache_es/
|
|
116
|
+
.rts2_cache_umd/
|
|
117
|
+
|
|
56
118
|
# Optional REPL history
|
|
57
119
|
.node_repl_history
|
|
58
120
|
|
|
@@ -62,22 +124,40 @@ typings/
|
|
|
62
124
|
# Yarn Integrity file
|
|
63
125
|
.yarn-integrity
|
|
64
126
|
|
|
65
|
-
# dotenv environment
|
|
127
|
+
# dotenv environment variable files
|
|
66
128
|
.env
|
|
67
|
-
.env.
|
|
129
|
+
.env.development.local
|
|
130
|
+
.env.test.local
|
|
131
|
+
.env.production.local
|
|
132
|
+
.env.local
|
|
68
133
|
|
|
69
134
|
# parcel-bundler cache (https://parceljs.org/)
|
|
70
135
|
.cache
|
|
136
|
+
.parcel-cache
|
|
71
137
|
|
|
72
|
-
#
|
|
138
|
+
# Next.js build output
|
|
73
139
|
.next
|
|
140
|
+
out
|
|
74
141
|
|
|
75
|
-
#
|
|
142
|
+
# Nuxt.js build / generate output
|
|
76
143
|
.nuxt
|
|
144
|
+
dist
|
|
145
|
+
|
|
146
|
+
# Gatsby files
|
|
147
|
+
.cache/
|
|
148
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
149
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
150
|
+
# public
|
|
77
151
|
|
|
78
152
|
# vuepress build output
|
|
79
153
|
.vuepress/dist
|
|
80
154
|
|
|
155
|
+
# vuepress v2.x temp and cache directory
|
|
156
|
+
.temp
|
|
157
|
+
|
|
158
|
+
# Docusaurus cache and generated files
|
|
159
|
+
.docusaurus
|
|
160
|
+
|
|
81
161
|
# Serverless directories
|
|
82
162
|
.serverless/
|
|
83
163
|
|
|
@@ -87,4 +167,52 @@ typings/
|
|
|
87
167
|
# DynamoDB Local files
|
|
88
168
|
.dynamodb/
|
|
89
169
|
|
|
90
|
-
#
|
|
170
|
+
# TernJS port file
|
|
171
|
+
.tern-port
|
|
172
|
+
|
|
173
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
174
|
+
.vscode-test
|
|
175
|
+
|
|
176
|
+
# yarn v2
|
|
177
|
+
.yarn/cache
|
|
178
|
+
.yarn/unplugged
|
|
179
|
+
.yarn/build-state.yml
|
|
180
|
+
.yarn/install-state.gz
|
|
181
|
+
.pnp.*
|
|
182
|
+
|
|
183
|
+
### Node Patch ###
|
|
184
|
+
# Serverless Webpack directories
|
|
185
|
+
.webpack/
|
|
186
|
+
|
|
187
|
+
# Optional stylelint cache
|
|
188
|
+
|
|
189
|
+
# SvelteKit build / generate output
|
|
190
|
+
.svelte-kit
|
|
191
|
+
|
|
192
|
+
### Windows ###
|
|
193
|
+
# Windows thumbnail cache files
|
|
194
|
+
Thumbs.db
|
|
195
|
+
Thumbs.db:encryptable
|
|
196
|
+
ehthumbs.db
|
|
197
|
+
ehthumbs_vista.db
|
|
198
|
+
|
|
199
|
+
# Dump file
|
|
200
|
+
*.stackdump
|
|
201
|
+
|
|
202
|
+
# Folder config file
|
|
203
|
+
[Dd]esktop.ini
|
|
204
|
+
|
|
205
|
+
# Recycle Bin used on file shares
|
|
206
|
+
$RECYCLE.BIN/
|
|
207
|
+
|
|
208
|
+
# Windows Installer files
|
|
209
|
+
*.cab
|
|
210
|
+
*.msi
|
|
211
|
+
*.msix
|
|
212
|
+
*.msm
|
|
213
|
+
*.msp
|
|
214
|
+
|
|
215
|
+
# Windows shortcuts
|
|
216
|
+
*.lnk
|
|
217
|
+
|
|
218
|
+
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,node,windows
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -3,13 +3,41 @@ name: CI
|
|
|
3
3
|
on:
|
|
4
4
|
pull_request:
|
|
5
5
|
push:
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
branches:
|
|
7
|
+
- alpha
|
|
8
|
+
- beta
|
|
9
|
+
- master
|
|
10
|
+
- renovate/**
|
|
8
11
|
|
|
9
12
|
jobs:
|
|
13
|
+
prepare_jobs:
|
|
14
|
+
name: "Prepare: job optimization"
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
outputs:
|
|
17
|
+
pr_found: ${{ steps.pr.outputs.pr_found }}
|
|
18
|
+
steps:
|
|
19
|
+
- name: Get current PR
|
|
20
|
+
id: pr
|
|
21
|
+
uses: 8BitJonny/gh-get-current-pr@3.0.0
|
|
22
|
+
with:
|
|
23
|
+
filterOutClosed: true
|
|
24
|
+
sha: ${{ github.event.pull_request.head.sha }}
|
|
25
|
+
release_semantic_dry:
|
|
26
|
+
needs: prepare_jobs
|
|
27
|
+
name: Release (semantic, dry)
|
|
28
|
+
uses: dargmuesli/github-actions/.github/workflows/release-semantic.yml@1.7.7
|
|
29
|
+
if: needs.prepare_jobs.outputs.pr_found == 'false' || github.event_name == 'pull_request'
|
|
30
|
+
permissions:
|
|
31
|
+
contents: write
|
|
32
|
+
secrets:
|
|
33
|
+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
|
34
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
35
|
+
with:
|
|
36
|
+
DRY_RUN: true
|
|
10
37
|
build:
|
|
11
38
|
name: Build
|
|
12
39
|
uses: dargmuesli/github-actions/.github/workflows/docker.yml@1.7.7
|
|
40
|
+
needs: release_semantic_dry
|
|
13
41
|
permissions:
|
|
14
42
|
packages: write
|
|
15
43
|
release-semantic:
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"[javascript]": {
|
|
3
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
4
|
+
},
|
|
5
|
+
"[json]": {
|
|
6
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
7
|
+
},
|
|
8
|
+
"[jsonc]": {
|
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
|
+
},
|
|
11
|
+
"[typescript]": {
|
|
12
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
13
|
+
},
|
|
14
|
+
"[yaml]": {
|
|
15
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
16
|
+
},
|
|
17
|
+
"eslint.workingDirectories": [
|
|
18
|
+
{
|
|
19
|
+
"directory": "./src/"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"directory": "./test/"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"shellcheck.customArgs": ["-x"]
|
|
26
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [0.9.32](https://github.com/dargstack/dargstack_rgen/compare/0.9.31...0.9.32) (2024-04-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* correct imports ([2db545d](https://github.com/dargstack/dargstack_rgen/commit/2db545d9e1d5b122a4c2ae4a019b0f35df7deb98))
|
|
7
|
+
|
|
1
8
|
## [0.9.31](https://github.com/dargstack/dargstack_rgen/compare/0.9.30...0.9.31) (2024-04-16)
|
|
2
9
|
|
|
3
10
|
|
package/Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@ WORKDIR /srv/app/
|
|
|
4
4
|
|
|
5
5
|
VOLUME /srv/app
|
|
6
6
|
|
|
7
|
-
ENTRYPOINT ["node", "./src/generator.
|
|
7
|
+
ENTRYPOINT ["node", "./src/generator.js"]
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
FROM node:20.12.2-alpine@sha256:ec0c413b1d84f3f7f67ec986ba885930c57b5318d2eb3abc6960ee05d4f2eb28 AS prepare
|
|
@@ -21,11 +21,7 @@ COPY ./ ./
|
|
|
21
21
|
RUN pnpm install --offline
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
FROM
|
|
25
|
-
|
|
26
|
-
WORKDIR /srv/app/
|
|
27
|
-
|
|
28
|
-
COPY --from=prepare /srv/app/ ./
|
|
24
|
+
FROM prepare AS build
|
|
29
25
|
|
|
30
26
|
ENV NODE_ENV=production
|
|
31
27
|
|
|
@@ -33,19 +29,13 @@ RUN corepack enable && \
|
|
|
33
29
|
pnpm install --offline --ignore-scripts
|
|
34
30
|
|
|
35
31
|
|
|
36
|
-
FROM
|
|
37
|
-
|
|
38
|
-
WORKDIR /srv/app/
|
|
39
|
-
|
|
40
|
-
COPY --from=prepare /srv/app/ ./
|
|
32
|
+
FROM prepare AS test
|
|
41
33
|
|
|
42
34
|
RUN corepack enable && \
|
|
43
35
|
pnpm run test
|
|
44
36
|
|
|
45
37
|
|
|
46
|
-
FROM
|
|
47
|
-
|
|
48
|
-
WORKDIR /srv/app/
|
|
38
|
+
FROM prepare AS collect
|
|
49
39
|
|
|
50
40
|
COPY --from=build /srv/app/ /srv/app/
|
|
51
41
|
COPY --from=test /srv/app/package.json /tmp/package.json
|
|
@@ -57,4 +47,4 @@ WORKDIR /srv/app/
|
|
|
57
47
|
|
|
58
48
|
COPY --from=collect /srv/app/ ./
|
|
59
49
|
|
|
60
|
-
ENTRYPOINT ["node", "./src/generator.
|
|
50
|
+
ENTRYPOINT ["node", "./src/generator.js"]
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import eslint from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import prettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
4
|
+
import tseslint from 'typescript-eslint'
|
|
5
|
+
|
|
6
|
+
export default tseslint.config(
|
|
7
|
+
eslint.configs.recommended,
|
|
8
|
+
...tseslint.configs.recommended,
|
|
9
|
+
prettierRecommended, // must be last
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/no-unused-vars': [
|
|
13
|
+
'error',
|
|
14
|
+
{
|
|
15
|
+
argsIgnorePattern: '^_',
|
|
16
|
+
varsIgnorePattern: '^_',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
languageOptions: {
|
|
21
|
+
globals: {
|
|
22
|
+
...globals.node,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Jonas Thelemann <e-mail+dargstack/dargstack_rgen@jonas-thelemann.de>",
|
|
3
3
|
"bin": {
|
|
4
|
-
"dargstack_rgen": "./src/generator.
|
|
4
|
+
"dargstack_rgen": "./src/generator.js"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"deepmerge": "4.3.1",
|
|
@@ -14,26 +14,30 @@
|
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@commitlint/cli": "19.2.2",
|
|
16
16
|
"@commitlint/config-conventional": "19.2.2",
|
|
17
|
-
"
|
|
17
|
+
"@types/diff": "5.0.9",
|
|
18
|
+
"@types/json2md": "1.5.4",
|
|
19
|
+
"@types/yargs": "17.0.32",
|
|
20
|
+
"eslint": "9.0.0",
|
|
18
21
|
"eslint-config-prettier": "9.1.0",
|
|
19
|
-
"eslint-plugin-n": "17.2.1",
|
|
20
22
|
"eslint-plugin-prettier": "5.1.3",
|
|
23
|
+
"globals": "15.0.0",
|
|
21
24
|
"husky": "9.0.11",
|
|
22
|
-
"prettier": "3.2.5"
|
|
25
|
+
"prettier": "3.2.5",
|
|
26
|
+
"typescript-eslint": "7.5.0"
|
|
23
27
|
},
|
|
24
28
|
"engines": {
|
|
25
29
|
"node": "20"
|
|
26
30
|
},
|
|
27
31
|
"license": "GPL-3.0-only",
|
|
28
|
-
"main": "src/generator.
|
|
32
|
+
"main": "src/generator.js",
|
|
29
33
|
"name": "dargstack_rgen",
|
|
30
|
-
"packageManager": "pnpm@
|
|
34
|
+
"packageManager": "pnpm@9.0.1",
|
|
31
35
|
"repository": "https://github.com/dargstack/dargstack_rgen.git",
|
|
32
36
|
"scripts": {
|
|
33
|
-
"lint": "eslint --
|
|
37
|
+
"lint": "eslint --cache",
|
|
34
38
|
"prepare": "husky",
|
|
35
|
-
"test": "node src/generator.
|
|
39
|
+
"test": "node src/generator.js -p test/example_stack -v"
|
|
36
40
|
},
|
|
37
41
|
"type": "module",
|
|
38
|
-
"version": "0.9.
|
|
42
|
+
"version": "0.9.32"
|
|
39
43
|
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const yaml = require('yaml')
|
|
10
|
-
const yargs = require('yargs')
|
|
4
|
+
import deepMerge from 'deepmerge'
|
|
5
|
+
import { diffLines } from 'diff'
|
|
6
|
+
import json2md from 'json2md'
|
|
7
|
+
import yaml from 'yaml'
|
|
8
|
+
import yargs from 'yargs'
|
|
9
|
+
import { hideBin } from 'yargs/helpers'
|
|
11
10
|
|
|
12
11
|
const DEVELOPMENT_ONLY_REGEX = /^\s*DARGSTACK-REMOVE\s*$/
|
|
13
12
|
|
|
14
|
-
json2md.converters.vanilla = function (input,
|
|
13
|
+
json2md.converters.vanilla = function (input, _json2md) {
|
|
15
14
|
return input
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
const argv = yargs
|
|
17
|
+
const argv = yargs(hideBin(process.argv))
|
|
19
18
|
.option('path', {
|
|
20
19
|
alias: 'p',
|
|
21
20
|
description: 'Path to a DargStack stack project',
|
|
@@ -27,7 +26,8 @@ const argv = yargs
|
|
|
27
26
|
type: 'boolean',
|
|
28
27
|
})
|
|
29
28
|
.help()
|
|
30
|
-
.alias('help', 'h')
|
|
29
|
+
.alias('help', 'h')
|
|
30
|
+
.parse()
|
|
31
31
|
|
|
32
32
|
const projectPath = argv.path || process.cwd()
|
|
33
33
|
const validate = argv.validate || false
|
|
@@ -36,13 +36,13 @@ const stackDevelopmentPath = path.join(
|
|
|
36
36
|
projectPath,
|
|
37
37
|
'src',
|
|
38
38
|
'development',
|
|
39
|
-
'stack.yml'
|
|
39
|
+
'stack.yml',
|
|
40
40
|
)
|
|
41
41
|
const stackProductionPath = path.join(
|
|
42
42
|
projectPath,
|
|
43
43
|
'src',
|
|
44
44
|
'production',
|
|
45
|
-
'production.yml'
|
|
45
|
+
'production.yml',
|
|
46
46
|
)
|
|
47
47
|
|
|
48
48
|
// Read YAMLs.
|
|
@@ -52,31 +52,28 @@ let productionYaml
|
|
|
52
52
|
|
|
53
53
|
if (fs.existsSync(stackDevelopmentPath)) {
|
|
54
54
|
developmentYaml = yaml.parseDocument(
|
|
55
|
-
fs.readFileSync(stackDevelopmentPath, 'utf8')
|
|
55
|
+
fs.readFileSync(stackDevelopmentPath, 'utf8'),
|
|
56
56
|
)
|
|
57
57
|
} else {
|
|
58
|
-
|
|
59
|
-
process.exit(1)
|
|
58
|
+
throw new Error('Development stack file not found!')
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
if (fs.existsSync(stackProductionPath)) {
|
|
63
62
|
productionYaml = yaml.parseDocument(
|
|
64
|
-
fs.readFileSync(stackProductionPath, 'utf8')
|
|
63
|
+
fs.readFileSync(stackProductionPath, 'utf8'),
|
|
65
64
|
)
|
|
66
65
|
} else {
|
|
67
66
|
console.info('Production stack file not found!')
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
if (developmentYaml.commentBefore === null) {
|
|
71
|
-
|
|
72
|
-
process.exit(1)
|
|
70
|
+
throw new Error('YAML is missing metadata!')
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
const metadata = developmentYaml.commentBefore.split('\n')
|
|
76
74
|
|
|
77
75
|
if (metadata.length !== 4) {
|
|
78
|
-
|
|
79
|
-
process.exit(1)
|
|
76
|
+
throw new Error('YAML metadata is missing keys!')
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
const webName = metadata[0].trim()
|
|
@@ -110,7 +107,7 @@ for (let i = 0; i < documentItems.length; i++) {
|
|
|
110
107
|
if (elementItem.value.commentBefore === undefined) {
|
|
111
108
|
if (!process.argv.includes('--no-comments')) {
|
|
112
109
|
console.error(
|
|
113
|
-
`${documentItem.key.value}: ${elementItem.key.value} is missing a comment
|
|
110
|
+
`${documentItem.key.value}: ${elementItem.key.value} is missing a comment!`,
|
|
114
111
|
)
|
|
115
112
|
commentMissing = true
|
|
116
113
|
}
|
|
@@ -158,7 +155,7 @@ for (let i = 0; i < documentItems.length; i++) {
|
|
|
158
155
|
!(elementItem.key.value in content[documentItem.key.value])
|
|
159
156
|
) {
|
|
160
157
|
console.error(
|
|
161
|
-
`${documentItem.key.value}: ${elementItem.key.value} is missing a comment
|
|
158
|
+
`${documentItem.key.value}: ${elementItem.key.value} is missing a comment!`,
|
|
162
159
|
)
|
|
163
160
|
commentMissing = true
|
|
164
161
|
}
|
|
@@ -178,12 +175,12 @@ for (let i = 0; i < documentItems.length; i++) {
|
|
|
178
175
|
|
|
179
176
|
content[documentItem.key.value] = deepMerge(
|
|
180
177
|
content[documentItem.key.value],
|
|
181
|
-
contentElementItems
|
|
178
|
+
contentElementItems,
|
|
182
179
|
)
|
|
183
180
|
}
|
|
184
181
|
|
|
185
182
|
if (commentMissing) {
|
|
186
|
-
|
|
183
|
+
throw new Error('Comment is missing!')
|
|
187
184
|
}
|
|
188
185
|
|
|
189
186
|
const mdjson = [
|
|
@@ -254,16 +251,15 @@ if (validate) {
|
|
|
254
251
|
if (fs.existsSync(readmePath)) {
|
|
255
252
|
readme = fs.readFileSync(readmePath, 'utf8')
|
|
256
253
|
} else {
|
|
257
|
-
|
|
258
|
-
process.exit(1)
|
|
254
|
+
throw new Error('README.md file not found!')
|
|
259
255
|
}
|
|
260
256
|
|
|
261
|
-
const difference =
|
|
257
|
+
const difference = diffLines(md + '\n', readme)
|
|
262
258
|
|
|
263
259
|
if (difference.length > 1) {
|
|
264
260
|
console.error(
|
|
265
261
|
'The README is not up-2-date!\n' +
|
|
266
|
-
"Remember that newline diffs aren't visibly highlighted."
|
|
262
|
+
"Remember that newline diffs aren't visibly highlighted.",
|
|
267
263
|
)
|
|
268
264
|
|
|
269
265
|
difference.forEach((part) => {
|
|
@@ -285,7 +281,7 @@ if (validate) {
|
|
|
285
281
|
}
|
|
286
282
|
})
|
|
287
283
|
|
|
288
|
-
|
|
284
|
+
throw new Error(difference.length)
|
|
289
285
|
}
|
|
290
286
|
} else {
|
|
291
287
|
console.log(md)
|