@jonloucks/badges-ts 1.0.3 → 1.1.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 +20 -1
- package/api/Variances.d.ts +14 -0
- package/api/Variances.d.ts.map +1 -0
- package/api/Variances.js +87 -0
- package/api/Variances.js.map +1 -0
- package/auxiliary/Command.d.ts +2 -0
- package/auxiliary/Command.d.ts.map +1 -1
- package/auxiliary/DiscoverProject.d.ts +2 -1
- package/auxiliary/DiscoverProject.d.ts.map +1 -1
- package/auxiliary/DiscoverProject.js.map +1 -1
- package/cli.d.ts.map +1 -1
- package/cli.js +2 -66
- package/cli.js.map +1 -1
- package/data/Resolver.d.ts.map +1 -1
- package/data/Resolver.js +4 -5
- package/data/Resolver.js.map +1 -1
- package/impl/BadgeFactory.impl.d.ts +5 -1
- package/impl/BadgeFactory.impl.d.ts.map +1 -1
- package/impl/BadgeFactory.impl.js +19 -33
- package/impl/BadgeFactory.impl.js.map +1 -1
- package/impl/Command.impl.d.ts.map +1 -1
- package/impl/Command.impl.js +16 -25
- package/impl/Command.impl.js.map +1 -1
- package/impl/DiscoverProject.impl.d.ts +5 -1
- package/impl/DiscoverProject.impl.d.ts.map +1 -1
- package/impl/DiscoverProject.impl.js +50 -22
- package/impl/DiscoverProject.impl.js.map +1 -1
- package/impl/Installer.impl.d.ts.map +1 -1
- package/impl/Installer.impl.js +24 -8
- package/impl/Installer.impl.js.map +1 -1
- package/impl/Internal.impl.d.ts +0 -4
- package/impl/Internal.impl.d.ts.map +1 -1
- package/impl/Internal.impl.js +1 -24
- package/impl/Internal.impl.js.map +1 -1
- package/impl/apply-version-command.js +16 -9
- package/impl/apply-version-command.js.map +1 -1
- package/impl/discover-command.js +1 -1
- package/impl/discover-command.js.map +1 -1
- package/impl/generate-command.d.ts +0 -11
- package/impl/generate-command.d.ts.map +1 -1
- package/impl/generate-command.js +65 -53
- package/impl/generate-command.js.map +1 -1
- package/package.json +15 -20
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -152,6 +152,7 @@ badges-ts
|
|
|
152
152
|
│ ├── main-pull-request-matrix.yml
|
|
153
153
|
│ ├── main-pull-request.yml
|
|
154
154
|
│ ├── main-push.yml
|
|
155
|
+
│ ├── main-push-publish.yml
|
|
155
156
|
│ └── main-release.yml
|
|
156
157
|
├── CODE_OF_CONDUCT.md
|
|
157
158
|
├── CODING_STANDARDS.md
|
|
@@ -197,6 +198,19 @@ badges-ts
|
|
|
197
198
|
|
|
198
199
|
## GitHub Workflows
|
|
199
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
|
+
|
|
200
214
|
<details markdown="1"><summary>CI Workflow</summary>
|
|
201
215
|
|
|
202
216
|
The CI workflow runs on every push and pull request to `main` branch. It:
|
|
@@ -204,7 +218,12 @@ The CI workflow runs on every push and pull request to `main` branch. It:
|
|
|
204
218
|
- Runs linting
|
|
205
219
|
- Builds the project
|
|
206
220
|
- Runs tests with coverage
|
|
207
|
-
- Uploads
|
|
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.
|
|
208
227
|
|
|
209
228
|
</details>
|
|
210
229
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Variant } from "@jonloucks/variants-ts/api/Variant";
|
|
2
|
+
export declare const KIT_PROJECT_FOLDER: Variant<string>;
|
|
3
|
+
export declare const KIT_PACKAGE_JSON_PATH: Variant<string>;
|
|
4
|
+
export declare const KIT_COVERAGE_SUMMARY_PATH: Variant<string>;
|
|
5
|
+
export declare const KIT_CODE_COVERAGE_PERCENT: Variant<number>;
|
|
6
|
+
export declare const KIT_COVERAGE_SUMMARY_BADGE_PATH: Variant<string>;
|
|
7
|
+
export declare const KIT_TYPEDOC_BADGE_PATH: Variant<string>;
|
|
8
|
+
export declare const KIT_BADGES_FOLDER: Variant<string>;
|
|
9
|
+
export declare const KIT_NPM_BADGE_PATH: Variant<string>;
|
|
10
|
+
export declare const KIT_TEMPLATE_BADGE_PATH: Variant<string>;
|
|
11
|
+
export declare const KIT_RELEASE_NOTES_OUTPUT_FOLDER: Variant<string>;
|
|
12
|
+
export declare const KIT_RELEASE_NOTES_TEMPLATE_PATH: Variant<string>;
|
|
13
|
+
export declare const KIT_LCOV_REPORT_INDEX_PATH: Variant<string>;
|
|
14
|
+
//# sourceMappingURL=Variances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Variances.d.ts","sourceRoot":"","sources":["../../src/api/Variances.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAG7D,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAM7C,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,MAAM,CAMhD,CAAC;AAEH,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAAC,MAAM,CAMpD,CAAC;AAEH,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAAC,MAAM,CAMpD,CAAC;AAEH,eAAO,MAAM,+BAA+B,EAAE,OAAO,CAAC,MAAM,CAM1D,CAAC;AAEH,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,MAAM,CAMjD,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAM5C,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAM7C,CAAC;AAEH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAMlD,CAAC;AAEH,eAAO,MAAM,+BAA+B,EAAE,OAAO,CAAC,MAAM,CAM1D,CAAC;AAEH,eAAO,MAAM,+BAA+B,EAAE,OAAO,CAAC,MAAM,CAM1D,CAAC;AAEH,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAMrD,CAAC"}
|
package/api/Variances.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createVariant, ofNumber, ofString } from "@jonloucks/variants-ts/auxiliary/Convenience";
|
|
2
|
+
import { resolveDataPath } from "../data/Resolver.js";
|
|
3
|
+
export const KIT_PROJECT_FOLDER = createVariant({
|
|
4
|
+
name: 'Project Folder',
|
|
5
|
+
keys: ['KIT_PROJECT_FOLDER', 'kit.project.folder'],
|
|
6
|
+
description: 'The folder path of the project.',
|
|
7
|
+
of: ofString(),
|
|
8
|
+
fallback: './'
|
|
9
|
+
});
|
|
10
|
+
export const KIT_PACKAGE_JSON_PATH = createVariant({
|
|
11
|
+
name: 'Package JSON Path',
|
|
12
|
+
keys: ['KIT_PACKAGE_JSON_PATH', 'kit.package.json.path'],
|
|
13
|
+
description: 'The file path to the package.json file.',
|
|
14
|
+
of: ofString(),
|
|
15
|
+
fallback: 'package.json'
|
|
16
|
+
});
|
|
17
|
+
export const KIT_COVERAGE_SUMMARY_PATH = createVariant({
|
|
18
|
+
name: 'Coverage Summary Path',
|
|
19
|
+
keys: ['KIT_COVERAGE_SUMMARY_PATH', 'kit.coverage.summary.path'],
|
|
20
|
+
description: 'The file path to the coverage summary JSON file.',
|
|
21
|
+
of: ofString(),
|
|
22
|
+
fallback: 'coverage/coverage-summary.json'
|
|
23
|
+
});
|
|
24
|
+
export const KIT_CODE_COVERAGE_PERCENT = createVariant({
|
|
25
|
+
name: 'Code Coverage Percent',
|
|
26
|
+
keys: ['KIT_CODE_COVERAGE_PERCENT', 'kit.code.coverage.percent'],
|
|
27
|
+
description: 'The code coverage percentage.',
|
|
28
|
+
of: ofNumber(),
|
|
29
|
+
fallback: undefined
|
|
30
|
+
});
|
|
31
|
+
export const KIT_COVERAGE_SUMMARY_BADGE_PATH = createVariant({
|
|
32
|
+
name: 'Coverage Summary Badge Path',
|
|
33
|
+
keys: ['KIT_COVERAGE_SUMMARY_BADGE_PATH', 'kit.coverage.summary.badge.path'],
|
|
34
|
+
description: 'The file path to output the generated coverage summary badge SVG file.',
|
|
35
|
+
of: ofString(),
|
|
36
|
+
fallback: 'coverage-summary.svg'
|
|
37
|
+
});
|
|
38
|
+
export const KIT_TYPEDOC_BADGE_PATH = createVariant({
|
|
39
|
+
name: 'Typedoc Badge Path',
|
|
40
|
+
keys: ['KIT_TYPEDOC_BADGE_PATH', 'kit.typedoc.badge.path'],
|
|
41
|
+
description: 'The file path to output the generated typedoc badge SVG file.',
|
|
42
|
+
of: ofString(),
|
|
43
|
+
fallback: 'typedoc-badge.svg'
|
|
44
|
+
});
|
|
45
|
+
export const KIT_BADGES_FOLDER = createVariant({
|
|
46
|
+
name: 'Badges Folder',
|
|
47
|
+
keys: ['KIT_BADGES_FOLDER', 'kit.badges.folder'],
|
|
48
|
+
description: 'The folder path to output the generated badge SVG files.',
|
|
49
|
+
of: ofString(),
|
|
50
|
+
link: KIT_PROJECT_FOLDER
|
|
51
|
+
});
|
|
52
|
+
export const KIT_NPM_BADGE_PATH = createVariant({
|
|
53
|
+
name: 'NPM Badge Path',
|
|
54
|
+
keys: ['KIT_NPM_BADGE_PATH', 'kit.npm.badge.path'],
|
|
55
|
+
description: 'The file path to output the generated npm badge SVG file.',
|
|
56
|
+
of: ofString(),
|
|
57
|
+
fallback: 'npm-badge.svg'
|
|
58
|
+
});
|
|
59
|
+
export const KIT_TEMPLATE_BADGE_PATH = createVariant({
|
|
60
|
+
name: 'Template Badge Path',
|
|
61
|
+
keys: ['KIT_TEMPLATE_BADGE_PATH', 'kit.template.badge.path'],
|
|
62
|
+
description: 'The file path to the badge template SVG file.',
|
|
63
|
+
of: ofString(),
|
|
64
|
+
fallback: resolveDataPath('badge-template.svg.dat')
|
|
65
|
+
});
|
|
66
|
+
export const KIT_RELEASE_NOTES_OUTPUT_FOLDER = createVariant({
|
|
67
|
+
name: 'Release Notes Output Folder',
|
|
68
|
+
keys: ['KIT_RELEASE_NOTES_OUTPUT_FOLDER', 'kit.release.notes.output.folder'],
|
|
69
|
+
description: 'The folder path to output the generated release notes files.',
|
|
70
|
+
of: ofString(),
|
|
71
|
+
fallback: 'notes'
|
|
72
|
+
});
|
|
73
|
+
export const KIT_RELEASE_NOTES_TEMPLATE_PATH = createVariant({
|
|
74
|
+
name: 'Release Notes Template Path',
|
|
75
|
+
keys: ['KIT_RELEASE_NOTES_TEMPLATE_PATH', 'kit.release.notes.template.path'],
|
|
76
|
+
description: 'The file path to the release notes template file.',
|
|
77
|
+
of: ofString(),
|
|
78
|
+
fallback: 'notes/release-notes-template.md'
|
|
79
|
+
});
|
|
80
|
+
export const KIT_LCOV_REPORT_INDEX_PATH = createVariant({
|
|
81
|
+
name: 'LCOV Report Index Path',
|
|
82
|
+
keys: ['KIT_LCOV_REPORT_INDEX_PATH', 'kit.lcov.report.index.path'],
|
|
83
|
+
description: 'The file path to the LCOV report index.html file.',
|
|
84
|
+
of: ofString(),
|
|
85
|
+
fallback: 'coverage/lcov-report/index.html'
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=Variances.js.map
|
|
@@ -0,0 +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;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAoB,aAAa,CAAS;IACvE,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAClD,WAAW,EAAE,iCAAiC;IAC9C,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAoB,aAAa,CAAS;IAC1E,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;IACxD,WAAW,EAAE,yCAAyC;IACtD,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,cAAc;CACzB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAoB,aAAa,CAAS;IAC9E,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,CAAC,2BAA2B,EAAE,2BAA2B,CAAC;IAChE,WAAW,EAAE,kDAAkD;IAC/D,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,gCAAgC;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAoB,aAAa,CAAS;IAC9E,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,CAAC,2BAA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AE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,eAAe,CAAC,wBAAwB,CAAC;CACpD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAoB,aAAa,CAAS;IACpF,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE,CAAC,iCAAiC,EAAE,iCAAiC,CAAC;IAC5E,WAAW,EAAE,8DAA8D;IAC3E,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,OAAO;CAClB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAoB,aAAa,CAAS;IACpF,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE,CAAC,iCAAiC,EAAE,iCAAiC,CAAC;IAC5E,WAAW,EAAE,mDAAmD;IAChE,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,iCAAiC;CAC5C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAoB,aAAa,CAAS;IAC/E,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,CAAC,4BAA4B,EAAE,4BAA4B,CAAC;IAClE,WAAW,EAAE,mDAAmD;IAChE,EAAE,EAAE,QAAQ,EAAE;IACd,QAAQ,EAAE,iCAAiC;CAC5C,CAAC,CAAC"}
|
package/auxiliary/Command.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Display, Flags } from "@jonloucks/badges-ts/api/Types";
|
|
2
|
+
import { Environment } from "@jonloucks/variants-ts/api/Environment";
|
|
2
3
|
export interface Command<T> {
|
|
3
4
|
execute(context: Context): Promise<T>;
|
|
4
5
|
}
|
|
@@ -6,5 +7,6 @@ export interface Context {
|
|
|
6
7
|
arguments: string[];
|
|
7
8
|
display: Display;
|
|
8
9
|
flags: Flags;
|
|
10
|
+
environment: Environment;
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=Command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/auxiliary/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/auxiliary/Command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,MAAM,WAAW,OAAO,CAAC,CAAC;IAExB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAEvC;AAED,MAAM,WAAW,OAAO;IAEtB,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,OAAO,EAAE,OAAO,CAAC;IAEjB,KAAK,EAAE,KAAK,CAAC;IAEb,WAAW,EAAE,WAAW,CAAC;CAC1B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Project } from "@jonloucks/badges-ts/api/Project";
|
|
2
2
|
import { RequiredType } from "@jonloucks/contracts-ts/api/Types";
|
|
3
3
|
import { Contract } from "@jonloucks/contracts-ts";
|
|
4
|
+
import { Context } from "./Command.js";
|
|
4
5
|
/**
|
|
5
6
|
* Interface for discovering project information
|
|
6
7
|
*/
|
|
@@ -10,7 +11,7 @@ export interface DiscoverProject {
|
|
|
10
11
|
*
|
|
11
12
|
* @returns a Promise that resolves to a Project
|
|
12
13
|
*/
|
|
13
|
-
discoverProject(): Promise<Project>;
|
|
14
|
+
discoverProject(context: Context): Promise<Project>;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Determine if an instance implements DiscoverProject
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscoverProject.d.ts","sourceRoot":"","sources":["../../src/auxiliary/DiscoverProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAkB,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAkB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"DiscoverProject.d.ts","sourceRoot":"","sources":["../../src/auxiliary/DiscoverProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAkB,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAkB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,eAAe;IAE9B;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAAC,eAAe,CAAC,CAElF;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAG7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscoverProject.js","sourceRoot":"","sources":["../../src/auxiliary/DiscoverProject.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAY,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"DiscoverProject.js","sourceRoot":"","sources":["../../src/auxiliary/DiscoverProject.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAY,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAgBnE;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAiB;IACrC,OAAO,cAAc,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA8B,cAAc,CAAC;IAChE,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,KAAK;CACZ,CAAC,CAAC"}
|
package/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAMpF;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAc7D"}
|
package/cli.js
CHANGED
|
@@ -1,63 +1,8 @@
|
|
|
1
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
-
if (value !== null && value !== void 0) {
|
|
3
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
-
var dispose, inner;
|
|
5
|
-
if (async) {
|
|
6
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
-
dispose = value[Symbol.asyncDispose];
|
|
8
|
-
}
|
|
9
|
-
if (dispose === void 0) {
|
|
10
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
-
dispose = value[Symbol.dispose];
|
|
12
|
-
if (async) inner = dispose;
|
|
13
|
-
}
|
|
14
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
-
}
|
|
18
|
-
else if (async) {
|
|
19
|
-
env.stack.push({ async: true });
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
-
return function (env) {
|
|
25
|
-
function fail(e) {
|
|
26
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
-
env.hasError = true;
|
|
28
|
-
}
|
|
29
|
-
var r, s = 0;
|
|
30
|
-
function next() {
|
|
31
|
-
while (r = env.stack.pop()) {
|
|
32
|
-
try {
|
|
33
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
-
if (r.dispose) {
|
|
35
|
-
var result = r.dispose.call(r.value);
|
|
36
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
-
}
|
|
38
|
-
else s |= 1;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
fail(e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
-
if (env.hasError) throw env.error;
|
|
46
|
-
}
|
|
47
|
-
return next();
|
|
48
|
-
};
|
|
49
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
-
var e = new Error(message);
|
|
51
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
-
});
|
|
53
1
|
import { COMMAND as APPLY_VERSION_COMMAND } from "./impl/apply-version-command.js";
|
|
54
2
|
import { COMMAND as DISCOVER_COMMAND } from "./impl/discover-command.js";
|
|
55
3
|
import { COMMAND as GENERATE_COMMAND } from "./impl/generate-command.js";
|
|
56
4
|
import { createInstaller } from "@jonloucks/badges-ts";
|
|
57
5
|
import { isNotPresent, isPresent } from '@jonloucks/contracts-ts/api/Types';
|
|
58
|
-
import { used } from "@jonloucks/contracts-ts/auxiliary/Checks";
|
|
59
|
-
import { toContext } from "./impl/Command.impl.js";
|
|
60
|
-
import { Internal } from './impl/Internal.impl.js';
|
|
61
6
|
import { VERSION } from "./version.js";
|
|
62
7
|
/**
|
|
63
8
|
* Main entry point for the Badges CLI application.
|
|
@@ -71,10 +16,8 @@ import { VERSION } from "./version.js";
|
|
|
71
16
|
*
|
|
72
17
|
*/
|
|
73
18
|
export async function runMain(context) {
|
|
74
|
-
const
|
|
19
|
+
const usingInstaller = createInstaller().open();
|
|
75
20
|
try {
|
|
76
|
-
const usingInstaller = __addDisposableResource(env_1, createInstaller().open(), false);
|
|
77
|
-
used(usingInstaller);
|
|
78
21
|
const command = findCommand(context);
|
|
79
22
|
if (isPresent(command)) {
|
|
80
23
|
await command.execute(context);
|
|
@@ -84,12 +27,8 @@ export async function runMain(context) {
|
|
|
84
27
|
printUsage(context);
|
|
85
28
|
}
|
|
86
29
|
}
|
|
87
|
-
catch (e_1) {
|
|
88
|
-
env_1.error = e_1;
|
|
89
|
-
env_1.hasError = true;
|
|
90
|
-
}
|
|
91
30
|
finally {
|
|
92
|
-
|
|
31
|
+
usingInstaller.close();
|
|
93
32
|
}
|
|
94
33
|
}
|
|
95
34
|
function findCommand(context) {
|
|
@@ -149,7 +88,4 @@ function findFirstCommand(args) {
|
|
|
149
88
|
}
|
|
150
89
|
return args.find(arg => !arg.startsWith('-'));
|
|
151
90
|
}
|
|
152
|
-
if (Internal.isRunning(import.meta.url)) {
|
|
153
|
-
await runMain(toContext(process.argv.slice(2)));
|
|
154
|
-
}
|
|
155
91
|
//# sourceMappingURL=cli.js.map
|
package/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBA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AM,CAAC;IAChB,CAAC;IACD,IAAI,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC5C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
package/data/Resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resolver.d.ts","sourceRoot":"","sources":["../../src/data/Resolver.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"Resolver.d.ts","sourceRoot":"","sources":["../../src/data/Resolver.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAI7D"}
|
package/data/Resolver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dirname,
|
|
1
|
+
import { dirname, resolve } from "path";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
/**
|
|
4
4
|
* Resolves a path relative to the src/data directory.
|
|
@@ -9,9 +9,8 @@ import { fileURLToPath } from "url";
|
|
|
9
9
|
* @returns The resolved path.
|
|
10
10
|
*/
|
|
11
11
|
export function resolveDataPath(...segments) {
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
return join(__dirname, ...segments);
|
|
12
|
+
// reducing complexity using least common denominator approach;
|
|
13
|
+
// the path is resolved relative to the src/data directory, which is a known location within the package
|
|
14
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), ...segments);
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=Resolver.js.map
|
package/data/Resolver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resolver.js","sourceRoot":"","sources":["../../src/data/Resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Resolver.js","sourceRoot":"","sources":["../../src/data/Resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,GAAG,QAAkB;IACnD,gEAAgE;IAChE,wGAAwG;IACxG,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BadgeFactory } from "@jonloucks/badges-ts/api/BadgeFactory";
|
|
2
|
+
import { Contracts } from "@jonloucks/contracts-ts/api/Contracts";
|
|
2
3
|
/**
|
|
3
4
|
* Factory for creating badges based on templates and provided data.
|
|
4
5
|
* The factory reads a badge template file, replaces placeholders with actual values,
|
|
@@ -22,5 +23,8 @@ import { BadgeFactory } from "@jonloucks/badges-ts/api/BadgeFactory";
|
|
|
22
23
|
* console.log(`Badge created at ${badge.outputPath}`);
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
|
25
|
-
export
|
|
26
|
+
export interface Config {
|
|
27
|
+
contracts: Contracts;
|
|
28
|
+
}
|
|
29
|
+
export declare function create(config: Config): BadgeFactory;
|
|
26
30
|
//# sourceMappingURL=BadgeFactory.impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeFactory.impl.d.ts","sourceRoot":"","sources":["../../src/impl/BadgeFactory.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"BadgeFactory.impl.d.ts","sourceRoot":"","sources":["../../src/impl/BadgeFactory.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAGlE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAEnD"}
|
|
@@ -1,30 +1,14 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var _BadgeFactoryImpl_contracts;
|
|
1
8
|
import { presentCheck } from "@jonloucks/badges-ts/auxiliary/Checks";
|
|
2
9
|
import { readFile, writeFile } from "fs";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The factory reads a badge template file, replaces placeholders with actual values,
|
|
6
|
-
* and writes the generated badge to the specified output path.
|
|
7
|
-
* Placeholders in the template should be in the format {{KEYWORD}} where KEYWORD corresponds to properties in the GenerateOptions.
|
|
8
|
-
* Supported placeholders include:
|
|
9
|
-
* - {{LABEL}}: Placeholder for the badge label.
|
|
10
|
-
* - {{VALUE}}: Placeholder for the badge value.
|
|
11
|
-
* - {{COLOR}}: Placeholder for the badge background color.
|
|
12
|
-
* Usage:
|
|
13
|
-
* ```
|
|
14
|
-
* const badgeFactory = createBadgeFactory();
|
|
15
|
-
* const badge = await badgeFactory.createBadge({
|
|
16
|
-
* name: "coverage",
|
|
17
|
-
* templatePath: "./path/to/template.svg",
|
|
18
|
-
* outputPath: "./path/to/output/badge.svg",
|
|
19
|
-
* label: "coverage",
|
|
20
|
-
* value: "95%",
|
|
21
|
-
* color: "#4bc124"
|
|
22
|
-
* });
|
|
23
|
-
* console.log(`Badge created at ${badge.outputPath}`);
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export function create() {
|
|
27
|
-
return BadgeFactoryImpl.internalCreate();
|
|
10
|
+
export function create(config) {
|
|
11
|
+
return BadgeFactoryImpl.internalCreate(config);
|
|
28
12
|
}
|
|
29
13
|
// ---- Implementation details below ----
|
|
30
14
|
class BadgeFactoryImpl {
|
|
@@ -50,33 +34,35 @@ class BadgeFactoryImpl {
|
|
|
50
34
|
});
|
|
51
35
|
}
|
|
52
36
|
}
|
|
53
|
-
static internalCreate() {
|
|
54
|
-
return new BadgeFactoryImpl();
|
|
37
|
+
static internalCreate(config) {
|
|
38
|
+
return new BadgeFactoryImpl(config);
|
|
55
39
|
}
|
|
56
|
-
constructor() {
|
|
57
|
-
|
|
40
|
+
constructor(config) {
|
|
41
|
+
_BadgeFactoryImpl_contracts.set(this, void 0);
|
|
42
|
+
__classPrivateFieldSet(this, _BadgeFactoryImpl_contracts, config.contracts, "f");
|
|
58
43
|
}
|
|
59
44
|
}
|
|
45
|
+
_BadgeFactoryImpl_contracts = new WeakMap();
|
|
60
46
|
async function readDataFile(filePath) {
|
|
61
|
-
return new Promise((
|
|
47
|
+
return new Promise((deliver, reject) => {
|
|
62
48
|
readFile(filePath, (err, data) => {
|
|
63
49
|
if (err) {
|
|
64
50
|
reject(err);
|
|
65
51
|
}
|
|
66
52
|
else {
|
|
67
|
-
|
|
53
|
+
deliver(data);
|
|
68
54
|
}
|
|
69
55
|
});
|
|
70
56
|
});
|
|
71
57
|
}
|
|
72
58
|
async function writeDataFile(filePath, data) {
|
|
73
|
-
return new Promise((
|
|
59
|
+
return new Promise((deliver, reject) => {
|
|
74
60
|
writeFile(filePath, data, (err) => {
|
|
75
61
|
if (err) {
|
|
76
62
|
reject(err);
|
|
77
63
|
}
|
|
78
64
|
else {
|
|
79
|
-
|
|
65
|
+
deliver();
|
|
80
66
|
}
|
|
81
67
|
});
|
|
82
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeFactory.impl.js","sourceRoot":"","sources":["../../src/impl/BadgeFactory.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"BadgeFactory.impl.js","sourceRoot":"","sources":["../../src/impl/BadgeFactory.impl.ts"],"names":[],"mappings":";;;;;;;AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AA8BzC,MAAM,UAAU,MAAM,CAAC,MAAc;IACnC,OAAO,gBAAgB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,yCAAyC;AAEzC,MAAM,gBAAgB;IAEpB,KAAK,CAAC,WAAW,CAAC,MAAmB;QACnC,MAAM,YAAY,GAAW,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,uDAAuD,CAAC,CAAC;QACxH,MAAM,IAAI,GAAW,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC;QACtD,MAAM,SAAS,GAAW,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAEzE,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;YACrE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC9B,OAAO;gBACL,IAAI,EAAE,M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AC;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,OAAwB,EAAE,QAAgB;IACjE,MAAM,YAAY,GAAG;QACnB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IACF,uEAAuE;IACvE,MAAM,gBAAgB,GAAW,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;QACrF,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAA+B,CAAC;QAC3D,yDAAyD;QACzD,OAAO,YAAY,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3F,CAAC,CAAC,CAAA;IACF,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -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;AAKjE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAgBjD"}
|
package/impl/Command.impl.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import { createEnvironment, createProcessSource } from "@jonloucks/variants-ts/auxiliary/Convenience";
|
|
2
|
+
import { used } from "@jonloucks/badges-ts/auxiliary/Checks";
|
|
1
3
|
export function toContext(args) {
|
|
2
4
|
const flags = parseFlags({ args });
|
|
3
5
|
const display = flagsToDisplay(flags);
|
|
6
|
+
// add load from configuration file
|
|
7
|
+
const environment = createEnvironment({
|
|
8
|
+
sources: [
|
|
9
|
+
createProcessSource()
|
|
10
|
+
]
|
|
11
|
+
});
|
|
4
12
|
return {
|
|
5
13
|
arguments: args,
|
|
6
14
|
display: display,
|
|
7
15
|
flags: flags,
|
|
16
|
+
environment: environment,
|
|
8
17
|
};
|
|
9
18
|
}
|
|
10
19
|
function parseFlags({ args }) {
|
|
@@ -16,33 +25,15 @@ function parseFlags({ args }) {
|
|
|
16
25
|
verbose: args.includes('--verbose') || args.includes('-v'),
|
|
17
26
|
};
|
|
18
27
|
}
|
|
28
|
+
const DISCARD = (message) => { used(message); };
|
|
29
|
+
const DRY_RUN = (message) => console.info(`[DRY RUN] ${message}`);
|
|
19
30
|
function flagsToDisplay(flags) {
|
|
20
31
|
return {
|
|
21
|
-
error:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
info: (message) => {
|
|
27
|
-
if (!flags.quiet) {
|
|
28
|
-
console.info(message);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
warn: (message) => {
|
|
32
|
-
if (!flags.quiet && (flags.warn || flags.verbose)) {
|
|
33
|
-
console.warn(message);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
trace: (message) => {
|
|
37
|
-
if (!flags.quiet && (flags.trace || flags.verbose)) {
|
|
38
|
-
console.info(message);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
dry: (message) => {
|
|
42
|
-
if (!flags.quiet && flags.dryRun) {
|
|
43
|
-
console.info(`[DRY RUN] ${message}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
32
|
+
error: flags.quiet ? DISCARD : console.error,
|
|
33
|
+
info: flags.quiet ? DISCARD : console.info,
|
|
34
|
+
warn: flags.quiet || !(flags.warn || flags.verbose) ? DISCARD : console.warn,
|
|
35
|
+
trace: flags.quiet || !(flags.trace || flags.verbose) ? DISCARD : console.info,
|
|
36
|
+
dry: flags.quiet || !(flags.dryRun) ? DISCARD : DRY_RUN
|
|
46
37
|
};
|
|
47
38
|
}
|
|
48
39
|
//# 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":"AAGA,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,KAAK,GAAU,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAY,cAAc,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Command.impl.js","sourceRoot":"","sources":["../../src/impl/Command.impl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAE7D,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,KAAK,GAAU,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAY,cAAc,CAAC,KAAK,CAAC,CAAC;IAE/C,mCAAmC;IACnC,MAAM,WAAW,GAAgB,iBAAiB,CAAC;QACjD,OAAO,EAAE;YACP,mBAAmB,EAAE;SACtB;KACF,CAAC,CAAC;IACH,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,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,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C,IAAI;QAC9E,GAAG,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;KACxD,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { DiscoverProject } from "@jonloucks/badges-ts/auxiliary/DiscoverProject";
|
|
2
|
-
|
|
2
|
+
import { Contracts } from "@jonloucks/contracts-ts/api/Contracts";
|
|
3
|
+
export interface Config {
|
|
4
|
+
contracts: Contracts;
|
|
5
|
+
}
|
|
6
|
+
export declare function create(config: Config): DiscoverProject;
|
|
3
7
|
//# sourceMappingURL=DiscoverProject.impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscoverProject.impl.d.ts","sourceRoot":"","sources":["../../src/impl/DiscoverProject.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DiscoverProject.impl.d.ts","sourceRoot":"","sources":["../../src/impl/DiscoverProject.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAIjF,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAKlE,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAEtD"}
|