@jonloucks/badges-ts 1.1.0 → 1.3.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/README.md +60 -193
- package/api/Variances.d.ts +16 -0
- package/api/Variances.d.ts.map +1 -1
- package/api/Variances.js +78 -1
- package/api/Variances.js.map +1 -1
- package/data/badge-template.svg.dat +16 -1
- package/impl/Command.impl.d.ts.map +1 -1
- package/impl/Command.impl.js +47 -7
- package/impl/Command.impl.js.map +1 -1
- package/impl/Internal.impl.d.ts +7 -2
- package/impl/Internal.impl.d.ts.map +1 -1
- package/impl/Internal.impl.js +53 -11
- package/impl/Internal.impl.js.map +1 -1
- package/impl/apply-version-command.js +2 -3
- package/impl/apply-version-command.js.map +1 -1
- package/impl/generate-command.d.ts.map +1 -1
- package/impl/generate-command.js +86 -17
- package/impl/generate-command.js.map +1 -1
- package/package.json +2 -2
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -6,18 +6,7 @@
|
|
|
6
6
|
[](https://jonloucks.github.io/badges-ts/lcov-report/)
|
|
7
7
|
[](https://jonloucks.github.io/badges-ts/typedoc/)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
Typescript badge maker
|
|
11
|
-
|
|
12
|
-
## Documentation
|
|
13
|
-
* [License](LICENSE.md)
|
|
14
|
-
* [Contributing](CONTRIBUTING.md)
|
|
15
|
-
* [Code of conduct](CODE_OF_CONDUCT.md)
|
|
16
|
-
* [Coding standards](CODING_STANDARDS.md)
|
|
17
|
-
* [Security policy](SECURITY.md)
|
|
18
|
-
* [Pull request template](PULL_REQUEST_TEMPLATE.md)
|
|
19
|
-
* [How to use API](https://jonloucks.github.io/badges-ts/typedoc/)
|
|
20
|
-
* [Test coverage report](https://jonloucks.github.io/badges-ts/lcov-report)
|
|
9
|
+
`badges-ts` is a TypeScript/Node.js CLI for generating SVG project badges (npm version, coverage, and typedoc) with configurable colors, file paths, and templates.
|
|
21
10
|
|
|
22
11
|
## Installation
|
|
23
12
|
|
|
@@ -25,221 +14,99 @@ Typescript badge maker
|
|
|
25
14
|
npm install @jonloucks/badges-ts
|
|
26
15
|
```
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<details markdown="1"><summary>Importing the Package</summary>
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
import {
|
|
34
|
-
createBadge,
|
|
35
|
-
BadgeConfig
|
|
36
|
-
} from '@jonloucks/badges-ts';
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
</details>
|
|
40
|
-
|
|
41
|
-
<details markdown="1"><summary>Importing the Convenience Package</summary>
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
import {
|
|
45
|
-
createBadge,
|
|
46
|
-
BadgeConfig
|
|
47
|
-
} from "@jonloucks/badges-ts/api/Convenience";
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
</details>
|
|
51
|
-
|
|
52
|
-
<details markdown="1"><summary>Creating a Contract</summary>
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
</details>
|
|
17
|
+
For one-off usage, you can also run with `npx`.
|
|
58
18
|
|
|
59
|
-
|
|
19
|
+
## Quick Start
|
|
60
20
|
|
|
61
|
-
|
|
21
|
+
### 1) Discover project metadata
|
|
62
22
|
|
|
23
|
+
```bash
|
|
24
|
+
npx badges-ts discover
|
|
63
25
|
```
|
|
64
|
-
</details>
|
|
65
26
|
|
|
66
|
-
|
|
27
|
+
### 2) Generate badges
|
|
67
28
|
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
logger.log("Using the service in the test.");
|
|
29
|
+
```bash
|
|
30
|
+
npx badges-ts generate --verbose
|
|
71
31
|
```
|
|
72
|
-
</details>
|
|
73
32
|
|
|
74
|
-
|
|
33
|
+
By default this creates:
|
|
34
|
+
- `npm-badge.svg`
|
|
35
|
+
- `coverage-summary.svg`
|
|
36
|
+
- `typedoc-badge.svg`
|
|
75
37
|
|
|
76
|
-
|
|
38
|
+
### 3) Apply version artifacts
|
|
77
39
|
|
|
78
40
|
```bash
|
|
79
|
-
|
|
41
|
+
npx badges-ts apply-version
|
|
80
42
|
```
|
|
81
|
-
</details>
|
|
82
43
|
|
|
83
|
-
|
|
44
|
+
This updates `src/version.ts` and creates release notes for the current package version if a release notes file does not already exist.
|
|
84
45
|
|
|
85
|
-
|
|
86
|
-
npm run build
|
|
87
|
-
```
|
|
88
|
-
</details>
|
|
46
|
+
## CLI Commands
|
|
89
47
|
|
|
90
|
-
|
|
48
|
+
- `badges-ts discover` — Reads project metadata from `package.json`.
|
|
49
|
+
- `badges-ts generate` — Generates npm, coverage, and typedoc badges.
|
|
50
|
+
- `badges-ts apply-version` — Writes `src/version.ts` and creates release-notes file from template.
|
|
51
|
+
- `badges-ts version` — Prints CLI version.
|
|
52
|
+
- `badges-ts help` — Prints usage.
|
|
91
53
|
|
|
92
|
-
|
|
93
|
-
npm test
|
|
94
|
-
```
|
|
95
|
-
</details>
|
|
54
|
+
### Common flags
|
|
96
55
|
|
|
97
|
-
|
|
56
|
+
- `--dry-run`, `-d` — Preview writes without writing files.
|
|
57
|
+
- `--quiet`, `-q` — Suppress standard output.
|
|
58
|
+
- `--trace`, `-t` — Enable trace logs.
|
|
59
|
+
- `--warn`, `-w` — Enable warning logs.
|
|
60
|
+
- `--verbose` — Enable verbose output.
|
|
98
61
|
|
|
99
|
-
|
|
100
|
-
npm run test:watch
|
|
101
|
-
```
|
|
102
|
-
</details>
|
|
62
|
+
## Configuration
|
|
103
63
|
|
|
104
|
-
|
|
64
|
+
`badges-ts` supports both environment variables and a project config file (`badges-ts.json`).
|
|
105
65
|
|
|
106
|
-
|
|
107
|
-
npm run test:coverage
|
|
108
|
-
```
|
|
109
|
-
</details>
|
|
66
|
+
See [Configuration Profiles](DOCUMENTATION.md#configuration-profiles) for ready-to-use examples (default, monorepo, and CI-only).
|
|
110
67
|
|
|
111
|
-
|
|
68
|
+
Example:
|
|
112
69
|
|
|
113
|
-
```
|
|
114
|
-
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"kit.badges.folder": "badges",
|
|
73
|
+
"kit.coverage.summary.path": "coverage/coverage-summary.json",
|
|
74
|
+
"kit.coverage.summary.badge.path": "main-coverage.svg",
|
|
75
|
+
"kit.npm.badge.path": "main-npm.svg",
|
|
76
|
+
"kit.typedoc.badge.path": "main-typedoc.svg",
|
|
77
|
+
"kit.template.badge.path": "src/data/badge-template.svg.dat",
|
|
78
|
+
"kit.above.90.percent.color": "#377526",
|
|
79
|
+
"kit.0.percent.color": "#ff0000"
|
|
80
|
+
}
|
|
115
81
|
```
|
|
116
|
-
</details>
|
|
117
82
|
|
|
118
|
-
|
|
83
|
+
The default badge SVG template is custom/original and stored at `src/data/badge-template.svg.dat`.
|
|
84
|
+
You can override it with `KIT_TEMPLATE_BADGE_PATH`:
|
|
119
85
|
|
|
120
86
|
```bash
|
|
121
|
-
|
|
87
|
+
KIT_TEMPLATE_BADGE_PATH=./my-template.svg npx badges-ts generate
|
|
122
88
|
```
|
|
123
|
-
</details>
|
|
124
89
|
|
|
125
|
-
|
|
90
|
+
## Documentation
|
|
126
91
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
92
|
+
- [Full Documentation](DOCUMENTATION.md)
|
|
93
|
+
- [TypeDoc API](https://jonloucks.github.io/badges-ts/typedoc/)
|
|
94
|
+
- [Coverage Report](https://jonloucks.github.io/badges-ts/lcov-report)
|
|
95
|
+
- [Contributing](CONTRIBUTING.md)
|
|
96
|
+
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
97
|
+
- [Coding Standards](CODING_STANDARDS.md)
|
|
98
|
+
- [Security Policy](SECURITY.md)
|
|
131
99
|
|
|
132
|
-
|
|
100
|
+
## Development
|
|
133
101
|
|
|
134
102
|
```bash
|
|
103
|
+
npm install
|
|
104
|
+
npm run build
|
|
105
|
+
npm run test
|
|
106
|
+
npm run lint
|
|
107
|
+
npm run docs
|
|
135
108
|
npm run badges
|
|
136
109
|
```
|
|
137
|
-
</details>
|
|
138
|
-
|
|
139
|
-
<details markdown="1"><summary>Project Structure</summary>
|
|
140
|
-
|
|
141
|
-
* All tests must have suffix of -test.ts or -spec.ts
|
|
142
|
-
* Tests that validate supported APIs go in src/test
|
|
143
|
-
* Tests that validate internal implementation details go in src/impl
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
badges-ts
|
|
147
|
-
├── .github
|
|
148
|
-
│ ├── ISSUE_TEMPLATE
|
|
149
|
-
│ │ ├── bug_report.md
|
|
150
|
-
│ │ └── feature_request.md
|
|
151
|
-
│ └── workflows
|
|
152
|
-
│ ├── main-pull-request-matrix.yml
|
|
153
|
-
│ ├── main-pull-request.yml
|
|
154
|
-
│ ├── main-push.yml
|
|
155
|
-
│ ├── main-push-publish.yml
|
|
156
|
-
│ └── main-release.yml
|
|
157
|
-
├── CODE_OF_CONDUCT.md
|
|
158
|
-
├── CODING_STANDARDS.md
|
|
159
|
-
├── CONTRIBUTING.md
|
|
160
|
-
├── editorconfig
|
|
161
|
-
├── eslint.config.mjs
|
|
162
|
-
├── jest.config.js
|
|
163
|
-
├── LICENSE
|
|
164
|
-
├── package-lock.json
|
|
165
|
-
├── package.json
|
|
166
|
-
├── PULL_REQUEST_TEMPLATE.md
|
|
167
|
-
├── README.md
|
|
168
|
-
├── scripts
|
|
169
|
-
│ ├── badge-template.svg.dat
|
|
170
|
-
│ └── tsconfig.json
|
|
171
|
-
├── SECURITY.md
|
|
172
|
-
├── src
|
|
173
|
-
│ ├── index.ts
|
|
174
|
-
│ ├── version.ts
|
|
175
|
-
│ ├── api
|
|
176
|
-
│ │ ├── *.ts
|
|
177
|
-
│ │ ├── *.api.ts
|
|
178
|
-
│ ├── auxiliary
|
|
179
|
-
│ │ ├── *.ts
|
|
180
|
-
│ │ ├── *.impl.ts
|
|
181
|
-
│ │ ├── *.test.ts // internal implementation specific
|
|
182
|
-
│ │ └── *.api.ts
|
|
183
|
-
│ ├── impl
|
|
184
|
-
│ │ ├── *.ts
|
|
185
|
-
│ │ ├── *.impl.ts
|
|
186
|
-
│ │ ├── *.test.ts // internal implementation specific
|
|
187
|
-
│ │ └── *.api.ts
|
|
188
|
-
│ ├── test
|
|
189
|
-
│ │ └── *.test.ts
|
|
190
|
-
│ └── never-publish // non shippable development scripts
|
|
191
|
-
│ ├── *.ts
|
|
192
|
-
│ ├── *.*. // data files etc
|
|
193
|
-
│ └── *.test.ts
|
|
194
|
-
├── tsconfig.json
|
|
195
|
-
└── typedoc.json
|
|
196
|
-
```
|
|
197
|
-
</details>
|
|
198
|
-
|
|
199
|
-
## GitHub Workflows
|
|
200
|
-
|
|
201
|
-
<details markdown="1"><summary>Workflow File Index</summary>
|
|
202
|
-
|
|
203
|
-
- `main-pull-request.yml` (workflow name: `main-pull-request`): Pull request validation workflow for `main` (lint, build, coverage on Node 18).
|
|
204
|
-
- `main-pull-request-matrix.yml` (workflow name: `main-pull-request-matrix`): Pull request validation matrix for `main` (lint, build, coverage across Node 18/20/22/24).
|
|
205
|
-
- `main-pull-request-smoke.yml` (workflow name: `main-pull-request-smoke`): Pull request smoke packaging workflow with multi-version smoke test matrix.
|
|
206
|
-
- `main-push.yml` (workflow name: `main-push`): Unprivileged push workflow for `main` that builds/tests and uploads publish artifacts.
|
|
207
|
-
- `main-push-publish.yml` (workflow name: `main-push-publish`): Privileged `workflow_run` publisher that updates `gh-pages` and `badges` from artifacts.
|
|
208
|
-
- `main-push-smoke.yml` (workflow name: `main-push-smoke`): Push smoke packaging workflow with multi-version smoke test matrix.
|
|
209
|
-
- `main-release-smoke.yml` (workflow name: `main-release-smoke`): Release-created smoke workflow that builds package and validates install/tests.
|
|
210
|
-
- `main-release.yml` (workflow name: `Publish`): Release publishing workflow triggered after smoke success.
|
|
211
|
-
|
|
212
|
-
</details>
|
|
213
|
-
|
|
214
|
-
<details markdown="1"><summary>CI Workflow</summary>
|
|
215
|
-
|
|
216
|
-
The CI workflow runs on every push and pull request to `main` branch. It:
|
|
217
|
-
- Tests against Node.js versions 18.x, 20.x, 22.x, and 24.x
|
|
218
|
-
- Runs linting
|
|
219
|
-
- Builds the project
|
|
220
|
-
- Runs tests with coverage
|
|
221
|
-
- Uploads build outputs as workflow artifacts for downstream jobs
|
|
222
|
-
|
|
223
|
-
Security model:
|
|
224
|
-
- Pull request workflows run with read-only repository permissions.
|
|
225
|
-
- `main-push` runs as an unprivileged build/test workflow and uploads publish artifacts.
|
|
226
|
-
- `main-push-publish` is a separate `workflow_run` workflow that downloads artifacts and performs privileged writes to `gh-pages` and `badges` branches.
|
|
227
|
-
|
|
228
|
-
</details>
|
|
229
|
-
|
|
230
|
-
<details markdown="1"><summary>Publish Workflow</summary>
|
|
231
|
-
|
|
232
|
-
The GitHub publishings workflows are run to make an official release.
|
|
233
|
-
- If all scanning and tests pass it is published. There is no other way allowed.
|
|
234
|
-
- Publishing authentication is done using ([OIDC trusted publishing](https://docs.npmjs.com/trusted-publishers))
|
|
235
|
-
|
|
236
|
-
To set up your own publishing:
|
|
237
|
-
1. Publishing this project as is intentionally disabled
|
|
238
|
-
2. You are welcome to fork this repository and publish where you want.
|
|
239
|
-
3. Run `npm pkg delete private` to remove the `private` flag from the package.
|
|
240
|
-
4. Change the `name` field in `package.json` to your desired package name.
|
|
241
|
-
|
|
242
|
-
</details>
|
|
243
110
|
|
|
244
111
|
## License
|
|
245
112
|
|
package/api/Variances.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Variant } from "@jonloucks/variants-ts/api/Variant";
|
|
2
|
+
/**
|
|
3
|
+
* Only resolving KIT_PROJECT_FOLDER to an absolute path at the point of initialization allows it to be set to a
|
|
4
|
+
* relative path that is resolved from the current working directory instead of the location of the
|
|
5
|
+
* executing code. Other path variances should be resolved relative to KIT_PROJECT_FOLDER,
|
|
6
|
+
* so they will be resolved correctly as well.
|
|
7
|
+
*/
|
|
2
8
|
export declare const KIT_PROJECT_FOLDER: Variant<string>;
|
|
9
|
+
export declare const KIT_BADGES_CONFIG_PATH: Variant<string>;
|
|
3
10
|
export declare const KIT_PACKAGE_JSON_PATH: Variant<string>;
|
|
4
11
|
export declare const KIT_COVERAGE_SUMMARY_PATH: Variant<string>;
|
|
5
12
|
export declare const KIT_CODE_COVERAGE_PERCENT: Variant<number>;
|
|
@@ -11,4 +18,13 @@ export declare const KIT_TEMPLATE_BADGE_PATH: Variant<string>;
|
|
|
11
18
|
export declare const KIT_RELEASE_NOTES_OUTPUT_FOLDER: Variant<string>;
|
|
12
19
|
export declare const KIT_RELEASE_NOTES_TEMPLATE_PATH: Variant<string>;
|
|
13
20
|
export declare const KIT_LCOV_REPORT_INDEX_PATH: Variant<string>;
|
|
21
|
+
export declare const KIT_LCOV_INFO_PATH: Variant<string>;
|
|
22
|
+
export declare const KIT_VERSION_TS_PATH: Variant<string>;
|
|
23
|
+
export declare const KIT_100_PERCENT_COLOR: Variant<string>;
|
|
24
|
+
export declare const KIT_ABOVE_90_PERCENT_COLOR: Variant<string>;
|
|
25
|
+
export declare const KIT_ABOVE_80_PERCENT_COLOR: Variant<string>;
|
|
26
|
+
export declare const KIT_ABOVE_70_PERCENT_COLOR: Variant<string>;
|
|
27
|
+
export declare const KIT_ABOVE_60_PERCENT_COLOR: Variant<string>;
|
|
28
|
+
export declare const KIT_BELOW_60_PERCENT_COLOR: Variant<string>;
|
|
29
|
+
export declare const KIT_0_PERCENT_COLOR: Variant<string>;
|
|
14
30
|
//# sourceMappingURL=Variances.d.ts.map
|
package/api/Variances.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Variances.d.ts","sourceRoot":"","sources":["../../src/api/Variances.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"Variances.d.ts","sourceRoot":"","sources":["../../src/api/Variances.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MA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,CAMrD,CAAC;AAEH,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAMrD,CAAC;AAEH,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAMrD,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAM9C,CAAC"}
|
package/api/Variances.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { createVariant, ofNumber, ofString } from "@jonloucks/variants-ts/auxiliary/Convenience";
|
|
2
2
|
import { resolveDataPath } from "../data/Resolver.js";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* Only resolving KIT_PROJECT_FOLDER to an absolute path at the point of initialization allows it to be set to a
|
|
6
|
+
* relative path that is resolved from the current working directory instead of the location of the
|
|
7
|
+
* executing code. Other path variances should be resolved relative to KIT_PROJECT_FOLDER,
|
|
8
|
+
* so they will be resolved correctly as well.
|
|
9
|
+
*/
|
|
3
10
|
export const KIT_PROJECT_FOLDER = createVariant({
|
|
4
11
|
name: 'Project Folder',
|
|
5
12
|
keys: ['KIT_PROJECT_FOLDER', 'kit.project.folder'],
|
|
6
13
|
description: 'The folder path of the project.',
|
|
7
14
|
of: ofString(),
|
|
8
|
-
fallback: './'
|
|
15
|
+
fallback: resolve('./')
|
|
16
|
+
});
|
|
17
|
+
export const KIT_BADGES_CONFIG_PATH = createVariant({
|
|
18
|
+
name: 'Config Path',
|
|
19
|
+
keys: ['KIT_BADGES_CONFIG_PATH', 'kit.badges.config.path'],
|
|
20
|
+
description: 'The file path to the configuration file.',
|
|
21
|
+
of: ofString(),
|
|
22
|
+
fallback: 'badges-ts.json'
|
|
9
23
|
});
|
|
10
24
|
export const KIT_PACKAGE_JSON_PATH = createVariant({
|
|
11
25
|
name: 'Package JSON Path',
|
|
@@ -84,4 +98,67 @@ export const KIT_LCOV_REPORT_INDEX_PATH = createVariant({
|
|
|
84
98
|
of: ofString(),
|
|
85
99
|
fallback: 'coverage/lcov-report/index.html'
|
|
86
100
|
});
|
|
101
|
+
export const KIT_LCOV_INFO_PATH = createVariant({
|
|
102
|
+
name: 'LCOV Info Path',
|
|
103
|
+
keys: ['KIT_LCOV_INFO_PATH', 'kit.lcov.info.path'],
|
|
104
|
+
description: 'The file path to the LCOV info file.',
|
|
105
|
+
of: ofString(),
|
|
106
|
+
fallback: 'coverage/lcov.info'
|
|
107
|
+
});
|
|
108
|
+
export const KIT_VERSION_TS_PATH = createVariant({
|
|
109
|
+
name: 'Version TS Path',
|
|
110
|
+
keys: ['KIT_VERSION_TS_PATH', 'kit.version.ts.path'],
|
|
111
|
+
description: 'The file path to output the generated version.ts file.',
|
|
112
|
+
of: ofString(),
|
|
113
|
+
fallback: 'src/version.ts'
|
|
114
|
+
});
|
|
115
|
+
export const KIT_100_PERCENT_COLOR = createVariant({
|
|
116
|
+
name: '100% Color',
|
|
117
|
+
keys: ['KIT_100_PERCENT_COLOR', 'kit.100.percent.color'],
|
|
118
|
+
description: 'The color to use for badges that are at 100% complete.',
|
|
119
|
+
of: ofString(),
|
|
120
|
+
fallback: '#4bc124'
|
|
121
|
+
});
|
|
122
|
+
export const KIT_ABOVE_90_PERCENT_COLOR = createVariant({
|
|
123
|
+
name: 'Above 90% Color',
|
|
124
|
+
keys: ['KIT_ABOVE_90_PERCENT_COLOR', 'kit.above.90.percent.color'],
|
|
125
|
+
description: 'The color to use for badges that are above 90% complete.',
|
|
126
|
+
of: ofString(),
|
|
127
|
+
fallback: '#377526'
|
|
128
|
+
});
|
|
129
|
+
export const KIT_ABOVE_80_PERCENT_COLOR = createVariant({
|
|
130
|
+
name: 'Above 80% Color',
|
|
131
|
+
keys: ['KIT_ABOVE_80_PERCENT_COLOR', 'kit.above.80.percent.color'],
|
|
132
|
+
description: 'The color to use for badges that are above 80% complete.',
|
|
133
|
+
of: ofString(),
|
|
134
|
+
fallback: 'yellowgreen'
|
|
135
|
+
});
|
|
136
|
+
export const KIT_ABOVE_70_PERCENT_COLOR = createVariant({
|
|
137
|
+
name: 'Above 70% Color',
|
|
138
|
+
keys: ['KIT_ABOVE_70_PERCENT_COLOR', 'kit.above.70.percent.color'],
|
|
139
|
+
description: 'The color to use for badges that are above 70% complete.',
|
|
140
|
+
of: ofString(),
|
|
141
|
+
fallback: 'yellow'
|
|
142
|
+
});
|
|
143
|
+
export const KIT_ABOVE_60_PERCENT_COLOR = createVariant({
|
|
144
|
+
name: 'Above 60% Color',
|
|
145
|
+
keys: ['KIT_ABOVE_60_PERCENT_COLOR', 'kit.above.60.percent.color'],
|
|
146
|
+
description: 'The color to use for badges that are above 60% complete.',
|
|
147
|
+
of: ofString(),
|
|
148
|
+
fallback: 'orange'
|
|
149
|
+
});
|
|
150
|
+
export const KIT_BELOW_60_PERCENT_COLOR = createVariant({
|
|
151
|
+
name: 'Below 60% Color',
|
|
152
|
+
keys: ['KIT_BELOW_60_PERCENT_COLOR', 'kit.below.60.percent.color'],
|
|
153
|
+
description: 'The color to use for badges that are below 60% complete.',
|
|
154
|
+
of: ofString(),
|
|
155
|
+
fallback: 'darkred'
|
|
156
|
+
});
|
|
157
|
+
export const KIT_0_PERCENT_COLOR = createVariant({
|
|
158
|
+
name: '0% Color',
|
|
159
|
+
keys: ['KIT_0_PERCENT_COLOR', 'kit.0.percent.color'],
|
|
160
|
+
description: 'The color to use for badges that are at 0% complete.',
|
|
161
|
+
of: ofString(),
|
|
162
|
+
fallback: '#ff0000'
|
|
163
|
+
});
|
|
87
164
|
//# sourceMappingURL=Variances.js.map
|
package/api/Variances.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Variances.js","sourceRoot":"","sources":["../../src/api/Variances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AAEjG,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Variances.js","sourceRoot":"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;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAoB,aAAa,CAAS;IAC/E,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,CAAC,4BAA4B,EAAE,4BAA4B,CAAC;IAClE,WAAW,EAAE,0DAA0D;IACvE,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAoB,aAAa,CAAS;IACxE,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IACpD,WAAW,EAAE,sDAAsD;IACnE,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC"}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20" role="img" aria-label="{{LABEL}}: {{VALUE}}" viewBox="0 0 120 20">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="badge-clip">
|
|
4
|
+
<rect width="120" height="20" rx="4" ry="4" />
|
|
5
|
+
</clipPath>
|
|
6
|
+
</defs>
|
|
7
|
+
<g clip-path="url(#badge-clip)">
|
|
8
|
+
<rect width="68" height="20" fill="#30363d" />
|
|
9
|
+
<rect x="68" width="52" height="20" fill="{{COLOR}}" />
|
|
10
|
+
<rect width="120" height="20" fill="#ffffff" opacity="0.08" />
|
|
11
|
+
</g>
|
|
12
|
+
<g font-family="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif" font-size="11" fill="#ffffff" text-anchor="middle">
|
|
13
|
+
<text x="34" y="50%" dy="0.35em" xml:space="preserve">{{LABEL}}</text>
|
|
14
|
+
<text x="94" y="50%" dy="0.35em" xml:space="preserve">{{VALUE}}</text>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.impl.d.ts","sourceRoot":"","sources":["../../src/impl/Command.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"Command.impl.d.ts","sourceRoot":"","sources":["../../src/impl/Command.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAQjE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAUjD"}
|
package/impl/Command.impl.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isPresent } from "@jonloucks/badges-ts/api/Types";
|
|
2
|
+
import { createEnvironment, createProcessSource, createRecordSource } from "@jonloucks/variants-ts/auxiliary/Convenience";
|
|
2
3
|
import { used } from "@jonloucks/badges-ts/auxiliary/Checks";
|
|
4
|
+
import { KIT_BADGES_CONFIG_PATH, KIT_PROJECT_FOLDER } from "@jonloucks/badges-ts/api/Variances";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
7
|
export function toContext(args) {
|
|
8
|
+
const environment = toEnvironment();
|
|
4
9
|
const flags = parseFlags({ args });
|
|
5
10
|
const display = flagsToDisplay(flags);
|
|
6
|
-
// add load from configuration file
|
|
7
|
-
const environment = createEnvironment({
|
|
8
|
-
sources: [
|
|
9
|
-
createProcessSource()
|
|
10
|
-
]
|
|
11
|
-
});
|
|
12
11
|
return {
|
|
13
12
|
arguments: args,
|
|
14
13
|
display: display,
|
|
@@ -17,6 +16,8 @@ export function toContext(args) {
|
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
function parseFlags({ args }) {
|
|
19
|
+
// possibly use environment variables in the future to set flags as well
|
|
20
|
+
// environment.getVariance('KIT_DRY_RUN') === 'true' for example
|
|
20
21
|
return {
|
|
21
22
|
dryRun: args.includes('--dry-run') || args.includes('-d'),
|
|
22
23
|
quiet: args.includes('--quiet') || args.includes('-q'),
|
|
@@ -36,4 +37,43 @@ function flagsToDisplay(flags) {
|
|
|
36
37
|
dry: flags.quiet || !(flags.dryRun) ? DISCARD : DRY_RUN
|
|
37
38
|
};
|
|
38
39
|
}
|
|
40
|
+
function toEnvironment() {
|
|
41
|
+
const processSource = createProcessSource();
|
|
42
|
+
const processEnvironment = createEnvironment({
|
|
43
|
+
sources: [processSource]
|
|
44
|
+
});
|
|
45
|
+
const fileSource = createFileSource(processEnvironment);
|
|
46
|
+
if (isPresent(fileSource)) {
|
|
47
|
+
return createEnvironment({
|
|
48
|
+
sources: [processSource, fileSource]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return processEnvironment;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
function createFileSource(environment) {
|
|
57
|
+
// in the future we could support multiple config files and merge them together, but for now we'll just support one
|
|
58
|
+
// in the future we could check if file changes and reload the config, but for now we'll just read it once at startup
|
|
59
|
+
const configFilePath = getFileSourcePath(environment);
|
|
60
|
+
if (existsSync(configFilePath)) {
|
|
61
|
+
try {
|
|
62
|
+
const fileContents = readFileSync(configFilePath, "utf8");
|
|
63
|
+
const record = JSON.parse(fileContents);
|
|
64
|
+
return createRecordSource(record);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
68
|
+
console.warn(`Failed to read or parse config file at "${configFilePath}": ${message}`);
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
;
|
|
75
|
+
function getFileSourcePath(environment) {
|
|
76
|
+
const projectFolder = resolve(environment.getVariance(KIT_PROJECT_FOLDER));
|
|
77
|
+
return resolve(projectFolder, environment.getVariance(KIT_BADGES_CONFIG_PATH));
|
|
78
|
+
}
|
|
39
79
|
//# sourceMappingURL=Command.impl.js.map
|
package/impl/Command.impl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.impl.js","sourceRoot":"","sources":["../../src/impl/Command.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Command.impl.js","sourceRoot":"","sources":["../../src/impl/Command.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAU,MAAM,8CAA8C,CAAC;AAClI,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,WAAW,GAAgB,aAAa,EAAE,CAAC;IACjD,MAAM,KAAK,GAAU,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAY,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO;QACL,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,WAAW;KACzB,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,IAAI,EAAuB;IAC/C,wEAAwE;IACxE,gEAAgE;IAChE,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtD,KAAK,EAAE,IAA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,kBAAkB,CAAC,CAAC,CAAC;IACnF,OAAO,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC;AACjF,CAAC"}
|
package/impl/Internal.impl.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Contracts } from "@jonloucks/contracts-ts";
|
|
2
2
|
import { type RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
3
|
-
|
|
3
|
+
import { Context } from "@jonloucks/badges-ts/auxiliary/Command";
|
|
4
|
+
import { Variant } from "@jonloucks/variants-ts/api/Variant";
|
|
4
5
|
/**
|
|
5
6
|
* Helper functions for internal implementations.
|
|
6
7
|
*/
|
|
@@ -14,6 +15,10 @@ export declare const Internal: {
|
|
|
14
15
|
resolveContracts(...configs: Array<{
|
|
15
16
|
contracts?: Contracts;
|
|
16
17
|
} | undefined>): RequiredType<Contracts>;
|
|
17
|
-
|
|
18
|
+
getColorVariant(percent: number): Variant<string>;
|
|
19
|
+
colorFromPercentComplete(context: Context, percent: number): string;
|
|
20
|
+
formatPercent(percent: number): string;
|
|
21
|
+
isPercent(percent: number): boolean;
|
|
22
|
+
normalizePercent(percent: number): number;
|
|
18
23
|
};
|
|
19
24
|
//# sourceMappingURL=Internal.impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Internal.impl.d.ts","sourceRoot":"","sources":["../../src/impl/Internal.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"Internal.impl.d.ts","sourceRoot":"","sources":["../../src/impl/Internal.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAW7D;;GAEG;AACH,eAAO,MAAM,QAAQ;IAEnB;;;;;OAKG;iCAC0B,KAAK,CAAC;QAAE,SAAS,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC,GAAG,YAAY,CAAC,SAAS,CAAC;6BAS1E,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;sCAmBf,OAAO,WAAW,MAAM,GAAG,MAAM;2BAI5C,MAAM,GAAG,MAAM;uBAcnB,MAAM,GAAG,OAAO;8BAIT,MAAM,GAAG,MAAM;CAW1C,CAAA"}
|
package/impl/Internal.impl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CONTRACTS } from "@jonloucks/contracts-ts";
|
|
2
2
|
import { isPresent } from "@jonloucks/contracts-ts/api/Types";
|
|
3
|
-
|
|
3
|
+
import { KIT_0_PERCENT_COLOR, KIT_100_PERCENT_COLOR, KIT_ABOVE_80_PERCENT_COLOR, KIT_BELOW_60_PERCENT_COLOR, KIT_ABOVE_60_PERCENT_COLOR, KIT_ABOVE_70_PERCENT_COLOR, KIT_ABOVE_90_PERCENT_COLOR } from "../api/Variances.js";
|
|
4
4
|
/**
|
|
5
5
|
* Helper functions for internal implementations.
|
|
6
6
|
*/
|
|
@@ -19,21 +19,63 @@ export const Internal = {
|
|
|
19
19
|
}
|
|
20
20
|
return CONTRACTS;
|
|
21
21
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
getColorVariant(percent) {
|
|
23
|
+
const normalizedPercent = Internal.normalizePercent(percent);
|
|
24
|
+
if (normalizedPercent === 100) {
|
|
25
|
+
return KIT_100_PERCENT_COLOR;
|
|
25
26
|
}
|
|
26
|
-
else if (
|
|
27
|
-
return
|
|
27
|
+
else if (normalizedPercent >= 90) {
|
|
28
|
+
return KIT_ABOVE_90_PERCENT_COLOR;
|
|
28
29
|
}
|
|
29
|
-
else if (
|
|
30
|
-
return
|
|
30
|
+
else if (normalizedPercent >= 80) {
|
|
31
|
+
return KIT_ABOVE_80_PERCENT_COLOR;
|
|
31
32
|
}
|
|
32
|
-
else if (
|
|
33
|
-
return
|
|
33
|
+
else if (normalizedPercent >= 70) {
|
|
34
|
+
return KIT_ABOVE_70_PERCENT_COLOR;
|
|
35
|
+
}
|
|
36
|
+
else if (normalizedPercent >= 60) {
|
|
37
|
+
return KIT_ABOVE_60_PERCENT_COLOR;
|
|
38
|
+
}
|
|
39
|
+
else if (normalizedPercent > 0) {
|
|
40
|
+
return KIT_BELOW_60_PERCENT_COLOR;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return KIT_0_PERCENT_COLOR;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
colorFromPercentComplete(context, percent) {
|
|
47
|
+
return context.environment.getVariance(Internal.getColorVariant(percent));
|
|
48
|
+
},
|
|
49
|
+
formatPercent(percent) {
|
|
50
|
+
if (Internal.isPercent(percent)) {
|
|
51
|
+
if (percent >= 100) {
|
|
52
|
+
return '100%';
|
|
53
|
+
}
|
|
54
|
+
else if (percent < 0.05) {
|
|
55
|
+
return '0%';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return `${percent.toFixed(1)}%`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return 'N/A';
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
isPercent(percent) {
|
|
66
|
+
return isPresent(percent) && !isNaN(percent) && isFinite(percent) && percent >= 0;
|
|
67
|
+
},
|
|
68
|
+
normalizePercent(percent) {
|
|
69
|
+
if (Internal.isPercent(percent)) {
|
|
70
|
+
if (percent > 100) {
|
|
71
|
+
return 100;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return percent;
|
|
75
|
+
}
|
|
34
76
|
}
|
|
35
77
|
else {
|
|
36
|
-
return
|
|
78
|
+
return 0;
|
|
37
79
|
}
|
|
38
80
|
}
|
|
39
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Internal.impl.js","sourceRoot":"","sources":["../../src/impl/Internal.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAqB,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"Internal.impl.js","sourceRoot":"","sources":["../../src/impl/Internal.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAqB,MAAM,mCAAmC,CAAC;AAGjF,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IAEtB;;;;;OAKG;IACH,gBAAgB,CAAC,GAAG,OAAqD;QACvE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;gBACtD,OAAO,MAAM,CAAC,SAAS,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,eAAe,CAAC,OAAe;QAC7B,MAAM,iBAAiB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC7D,IAAI,iBAAiB,KAAK,GAAG,EAAE,CAAC;YAC9B,OAAO,qBAAqB,CAAC;QAC/B,CAAC;aAAM,IAAI,iBAAiB,IAAI,EAAE,EAAE,CAAC;YACnC,OAAO,0BAA0B,CAAC;QACpC,CAAC;aAAM,IAAI,iBAAi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B,OAAO,GAAG,CAAC;YACb,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { CONTRACT as DISCOVER_PROJECT } from "@jonloucks/badges-ts/auxiliary/Dis
|
|
|
3
3
|
import { CONTRACTS } from "@jonloucks/contracts-ts";
|
|
4
4
|
import { readFileSync, writeFileSync } from "fs";
|
|
5
5
|
import { resolve } from "path";
|
|
6
|
-
import { KIT_PROJECT_FOLDER, KIT_RELEASE_NOTES_OUTPUT_FOLDER, KIT_RELEASE_NOTES_TEMPLATE_PATH } from "@jonloucks/badges-ts/api/Variances";
|
|
6
|
+
import { KIT_PROJECT_FOLDER, KIT_RELEASE_NOTES_OUTPUT_FOLDER, KIT_RELEASE_NOTES_TEMPLATE_PATH, KIT_VERSION_TS_PATH } from "@jonloucks/badges-ts/api/Variances";
|
|
7
7
|
const COMMAND_NAME = 'apply-version';
|
|
8
8
|
export const COMMAND = {
|
|
9
9
|
execute: async function (context) {
|
|
@@ -71,8 +71,7 @@ function getProjectFolder(context) {
|
|
|
71
71
|
return context.environment.getVariance(KIT_PROJECT_FOLDER);
|
|
72
72
|
}
|
|
73
73
|
function getVersionTsPath(context) {
|
|
74
|
-
|
|
75
|
-
return resolve(getProjectFolder(context), 'src', fileName);
|
|
74
|
+
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_VERSION_TS_PATH));
|
|
76
75
|
}
|
|
77
76
|
function getReleaseNotesOutputFolder(context) {
|
|
78
77
|
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_RELEASE_NOTES_OUTPUT_FOLDER));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-version-command.js","sourceRoot":"","sources":["../../src/impl/apply-version-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC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,WAAW,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgB;IACxC,OAAO,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,2BAA2B,CAAC,OAAgB;IACnD,OAAO,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,2BAA2B,CAAC,OAAgB;IACnD,OAAO,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-command.d.ts","sourceRoot":"","sources":["../../src/impl/generate-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-command.d.ts","sourceRoot":"","sources":["../../src/impl/generate-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAevD,OAAO,EAAE,OAAO,EAAW,MAAM,wCAAwC,CAAC;AAS1E,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAUpC,CAAC"}
|
package/impl/generate-command.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { isPresent } from "@jonloucks/contracts-ts/api/Types";
|
|
2
1
|
import { CONTRACT as BADGE_FACTORY } from "@jonloucks/badges-ts/api/BadgeFactory";
|
|
2
|
+
import { KIT_BADGES_FOLDER, KIT_CODE_COVERAGE_PERCENT, KIT_COVERAGE_SUMMARY_BADGE_PATH, KIT_COVERAGE_SUMMARY_PATH, KIT_LCOV_INFO_PATH, KIT_LCOV_REPORT_INDEX_PATH, KIT_NPM_BADGE_PATH, KIT_PROJECT_FOLDER, KIT_TEMPLATE_BADGE_PATH, KIT_TYPEDOC_BADGE_PATH } from "@jonloucks/badges-ts/api/Variances";
|
|
3
3
|
import { CONTRACT as DISCOVER_PROJECT } from "@jonloucks/badges-ts/auxiliary/DiscoverProject";
|
|
4
4
|
import { CONTRACTS } from "@jonloucks/contracts-ts";
|
|
5
|
+
import { isPresent } from "@jonloucks/contracts-ts/api/Types";
|
|
6
|
+
import { used } from "@jonloucks/contracts-ts/auxiliary/Checks";
|
|
5
7
|
import { readFile } from "fs";
|
|
6
8
|
import { resolve } from "path";
|
|
7
|
-
import { Internal
|
|
8
|
-
import { KIT_BADGES_FOLDER, KIT_CODE_COVERAGE_PERCENT, KIT_COVERAGE_SUMMARY_BADGE_PATH, KIT_COVERAGE_SUMMARY_PATH, KIT_LCOV_REPORT_INDEX_PATH, KIT_NPM_BADGE_PATH, KIT_PROJECT_FOLDER, KIT_TEMPLATE_BADGE_PATH, KIT_TYPEDOC_BADGE_PATH } from "@jonloucks/badges-ts/api/Variances";
|
|
9
|
-
import { used } from "@jonloucks/contracts-ts/auxiliary/Checks";
|
|
9
|
+
import { Internal } from "./Internal.impl.js";
|
|
10
10
|
export const COMMAND = {
|
|
11
11
|
execute: async function (context) {
|
|
12
12
|
context.display.trace(`Running generate with: ${context.arguments.join(' ')}`);
|
|
@@ -44,9 +44,9 @@ async function generateNpmBadge(context) {
|
|
|
44
44
|
return await badgeFactory.createBadge({
|
|
45
45
|
name: "npm",
|
|
46
46
|
outputPath: getNpmBadgePath(context),
|
|
47
|
-
label: "
|
|
47
|
+
label: "npm",
|
|
48
48
|
value: project.version,
|
|
49
|
-
color:
|
|
49
|
+
color: Internal.colorFromPercentComplete(context, 100),
|
|
50
50
|
templatePath: getTemplateBadgePath(context),
|
|
51
51
|
flags: context.flags,
|
|
52
52
|
display: context.display
|
|
@@ -67,8 +67,8 @@ async function generateCodeCoverageBadge(context) {
|
|
|
67
67
|
name: "coverage-summary",
|
|
68
68
|
outputPath: getCodeCoverageBadgePath(context),
|
|
69
69
|
label: "coverage",
|
|
70
|
-
value: percentage
|
|
71
|
-
color: Internal.colorFromPercentComplete(percentage),
|
|
70
|
+
value: Internal.formatPercent(percentage),
|
|
71
|
+
color: Internal.colorFromPercentComplete(context, percentage),
|
|
72
72
|
templatePath: getTemplateBadgePath(context),
|
|
73
73
|
flags: context.flags,
|
|
74
74
|
display: context.display
|
|
@@ -80,6 +80,7 @@ async function getCodeCoveragePercent(context) {
|
|
|
80
80
|
// coverage percentage is provided and can accommodate different project setups
|
|
81
81
|
return await Promise.any([
|
|
82
82
|
getCodeCoverageFromEnvironment(context),
|
|
83
|
+
getCodeCoveragePercentFromLcovInfo(context),
|
|
83
84
|
getCodeCoveragePercentFromCoverageSummary(context),
|
|
84
85
|
getCodeCoveragePercentFromLcovReport(context)
|
|
85
86
|
]);
|
|
@@ -99,7 +100,7 @@ async function getCodeCoverageFromEnvironment(context) {
|
|
|
99
100
|
async function getCodeCoveragePercentFromCoverageSummary(context) {
|
|
100
101
|
return await new Promise((deliver, reject) => {
|
|
101
102
|
const inputPath = getCoverageSummaryFilePath(context);
|
|
102
|
-
readFile(inputPath, (err, data) => {
|
|
103
|
+
return readFile(inputPath, (err, data) => {
|
|
103
104
|
if (err) {
|
|
104
105
|
reject(err);
|
|
105
106
|
}
|
|
@@ -115,10 +116,75 @@ async function getCodeCoveragePercentFromCoverageSummary(context) {
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
;
|
|
119
|
+
async function getCodeCoveragePercentFromLcovInfo(context) {
|
|
120
|
+
return await new Promise((deliver, reject) => {
|
|
121
|
+
const inputPath = getLcovInfoPath(context);
|
|
122
|
+
return readFile(inputPath, 'utf8', (err, data) => {
|
|
123
|
+
if (err) {
|
|
124
|
+
reject(err);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
try {
|
|
128
|
+
deliver(readPercentageFromLcovInfo(data));
|
|
129
|
+
}
|
|
130
|
+
catch (parseError) {
|
|
131
|
+
reject(parseError);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
;
|
|
138
|
+
function readPercentageFromLcovInfo(data) {
|
|
139
|
+
let linesFound = 0;
|
|
140
|
+
let linesHit = 0;
|
|
141
|
+
let functionsFound = 0;
|
|
142
|
+
let functionsHit = 0;
|
|
143
|
+
let branchesFound = 0;
|
|
144
|
+
let branchesHit = 0;
|
|
145
|
+
for (const line of data.split(/\r?\n/)) {
|
|
146
|
+
if (line.startsWith('LF:')) {
|
|
147
|
+
linesFound += Number.parseInt(line.slice(3), 10) || 0;
|
|
148
|
+
}
|
|
149
|
+
else if (line.startsWith('LH:')) {
|
|
150
|
+
linesHit += Number.parseInt(line.slice(3), 10) || 0;
|
|
151
|
+
}
|
|
152
|
+
else if (line.startsWith('FNF:')) {
|
|
153
|
+
functionsFound += Number.parseInt(line.slice(4), 10) || 0;
|
|
154
|
+
}
|
|
155
|
+
else if (line.startsWith('FNH:')) {
|
|
156
|
+
functionsHit += Number.parseInt(line.slice(4), 10) || 0;
|
|
157
|
+
}
|
|
158
|
+
else if (line.startsWith('BRF:')) {
|
|
159
|
+
branchesFound += Number.parseInt(line.slice(4), 10) || 0;
|
|
160
|
+
}
|
|
161
|
+
else if (line.startsWith('BRH:')) {
|
|
162
|
+
branchesHit += Number.parseInt(line.slice(4), 10) || 0;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const percentages = [];
|
|
166
|
+
if (linesFound > 0) {
|
|
167
|
+
percentages.push(Internal.normalizePercent((linesHit / linesFound) * 100));
|
|
168
|
+
}
|
|
169
|
+
if (functionsFound > 0) {
|
|
170
|
+
percentages.push(Internal.normalizePercent((functionsHit / functionsFound) * 100));
|
|
171
|
+
}
|
|
172
|
+
if (branchesFound > 0) {
|
|
173
|
+
percentages.push(Internal.normalizePercent((branchesHit / branchesFound) * 100));
|
|
174
|
+
}
|
|
175
|
+
if (percentages.length > 0) {
|
|
176
|
+
let totalPercent = 0;
|
|
177
|
+
for (const percent of percentages) {
|
|
178
|
+
totalPercent += percent;
|
|
179
|
+
}
|
|
180
|
+
return totalPercent / percentages.length;
|
|
181
|
+
}
|
|
182
|
+
throw new Error('Unable to parse coverage percentages from lcov.info');
|
|
183
|
+
}
|
|
118
184
|
async function getCodeCoveragePercentFromLcovReport(context) {
|
|
119
185
|
return await new Promise((resolve, reject) => {
|
|
120
186
|
const inputPath = getLcovReportIndexPath(context);
|
|
121
|
-
readFile(inputPath, 'utf8', (err, data) => {
|
|
187
|
+
return readFile(inputPath, 'utf8', (err, data) => {
|
|
122
188
|
if (err) {
|
|
123
189
|
reject(err);
|
|
124
190
|
}
|
|
@@ -136,13 +202,13 @@ async function getCodeCoveragePercentFromLcovReport(context) {
|
|
|
136
202
|
;
|
|
137
203
|
function readPercentageFromLcovReport(data) {
|
|
138
204
|
const percentages = {};
|
|
139
|
-
const pattern = /<span class="strong">\s*([\d.]+)%\s*<\/span>\s*<span class="quiet">\s*(
|
|
205
|
+
const pattern = /<span class="strong">\s*([\d.]+)%\s*<\/span>\s*<span class="quiet">\s*(Branches|Functions|Lines)\s*<\/span>/g;
|
|
140
206
|
for (const match of data.matchAll(pattern)) {
|
|
141
207
|
const label = match[2];
|
|
142
208
|
const value = Number.parseFloat(match[1]);
|
|
143
|
-
if (
|
|
144
|
-
percentages[label.toLowerCase()] = value;
|
|
145
|
-
if (Object.keys(percentages).length >=
|
|
209
|
+
if (Internal.isPercent(value)) {
|
|
210
|
+
percentages[label.toLowerCase()] = Internal.normalizePercent(value);
|
|
211
|
+
if (Object.keys(percentages).length >= 3) {
|
|
146
212
|
break;
|
|
147
213
|
}
|
|
148
214
|
}
|
|
@@ -166,9 +232,9 @@ async function generateTypedocBadge(context) {
|
|
|
166
232
|
return await badgeFactory.createBadge({
|
|
167
233
|
name: "typedoc",
|
|
168
234
|
outputPath: getTypedocBadgePath(context),
|
|
169
|
-
label: "
|
|
170
|
-
value:
|
|
171
|
-
color:
|
|
235
|
+
label: "typedoc",
|
|
236
|
+
value: Internal.formatPercent(100),
|
|
237
|
+
color: Internal.colorFromPercentComplete(context, 100),
|
|
172
238
|
templatePath: getTemplateBadgePath(context),
|
|
173
239
|
flags: context.flags,
|
|
174
240
|
display: context.display
|
|
@@ -191,6 +257,9 @@ function getTemplateBadgePath(context) {
|
|
|
191
257
|
function getLcovReportIndexPath(context) {
|
|
192
258
|
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_LCOV_REPORT_INDEX_PATH));
|
|
193
259
|
}
|
|
260
|
+
function getLcovInfoPath(context) {
|
|
261
|
+
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_LCOV_INFO_PATH));
|
|
262
|
+
}
|
|
194
263
|
function getBadgesFolder(context) {
|
|
195
264
|
return resolve(getProjectFolder(context), context.environment.getVariance(KIT_BADGES_FOLDER));
|
|
196
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-command.js","sourceRoot":"","sources":["../../src/impl/generate-command.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate-command.js","sourceRoot":"","sources":["../../src/impl/generate-command.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAgB,MAAM,uCAAuC,CAAC;AAEhG,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,+BAA+B,EAC/B,yBAAyB,EACzB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,SAAS,E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O,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,eAAe,CAAC,OAAgB;IACvC,OAAO,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAgB;IAChD,OAAO,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAgB;IAC3C,OAAO,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,eAAe,CAAC,OAAgB;IACvC,OAAO,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jonloucks/badges-ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Node.js badge creator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"registry": "https://registry.npmjs.org/"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@types/node": "^25.
|
|
84
|
+
"@types/node": "^25.3.0",
|
|
85
85
|
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
86
86
|
"@typescript-eslint/parser": "^8.56.0",
|
|
87
87
|
"c8": "^10.1.3",
|
package/version.js
CHANGED