@contractkit/plugin-bruno 0.10.0 → 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/.turbo/turbo-build$colon$ci.log +7 -7
- package/.turbo/turbo-test$colon$ci.log +8 -9
- package/CHANGELOG.md +36 -0
- package/README.md +34 -12
- package/coverage/clover.xml +285 -323
- package/coverage/coverage-final.json +2 -3
- package/coverage/index.html +19 -19
- package/coverage/src/codegen-bruno.ts.html +218 -119
- package/coverage/src/index.html +19 -34
- package/coverage/tests/helpers.ts.html +9 -9
- package/coverage/tests/index.html +1 -1
- package/dist/codegen-bruno.d.ts +11 -0
- package/dist/codegen-bruno.d.ts.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -28
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/codegen-bruno.ts +40 -7
- package/src/index.ts +13 -19
- package/tests/codegen-bruno.test.ts +55 -67
- package/coverage/src/index.ts.html +0 -562
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/plugin-bruno@
|
|
2
|
+
> @contractkit/plugin-bruno@1.1.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
|
|
3
3
|
> eslint --max-warnings=0 && pnpm run build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @contractkit/plugin-bruno@
|
|
6
|
+
> @contractkit/plugin-bruno@1.1.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
|
|
7
7
|
> tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
|
|
8
8
|
|
|
9
9
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
[34mCLI[39m tsup v8.5.1
|
|
12
12
|
[34mCLI[39m Target: esnext
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[32m21.
|
|
15
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m21.88 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m53.25 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 164ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 4541ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.52 KB[39m
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/plugin-bruno@
|
|
2
|
+
> @contractkit/plugin-bruno@1.1.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
|
|
3
3
|
> vitest run --coverage
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.5 [39m[90m/home/runner/work/ContractKit/ContractKit/packages/plugin-bruno[39m
|
|
7
7
|
[2mCoverage enabled with [22m[33mv8[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m tests/codegen-bruno.test.ts [2m([22m[
|
|
9
|
+
[32m✓[39m tests/codegen-bruno.test.ts [2m([22m[2m100 tests[22m[2m)[22m[33m 556[2mms[22m[39m
|
|
10
10
|
|
|
11
11
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
12
|
-
[2m Tests [22m [1m[
|
|
13
|
-
[2m Start at [22m
|
|
14
|
-
[2m Duration [22m 5.
|
|
12
|
+
[2m Tests [22m [1m[32m100 passed[39m[22m[90m (100)[39m
|
|
13
|
+
[2m Start at [22m 19:41:31
|
|
14
|
+
[2m Duration [22m 5.27s[2m (transform 1.13s, setup 0ms, import 3.31s, tests 556ms, environment 0ms)[22m
|
|
15
15
|
|
|
16
16
|
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
17
17
|
-------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------
|
|
18
18
|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
19
19
|
-------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------
|
|
20
|
-
All files |
|
|
21
|
-
src |
|
|
22
|
-
codegen-bruno.ts |
|
|
23
|
-
index.ts | 41.3 | 44.11 | 80 | 37.2 | 45-61,128-155
|
|
20
|
+
All files | 85.67 | 76.97 | 86.48 | 87.38 |
|
|
21
|
+
src | 87.14 | 76.92 | 91.83 | 88.53 |
|
|
22
|
+
codegen-bruno.ts | 87.14 | 76.92 | 91.83 | 88.53 | 318-319,403,411,464-467,474-481,501,507,511-513,529,539,563,573-575,581-583,588,592-600,609,613
|
|
24
23
|
tests | 75 | 77.41 | 76 | 78.94 |
|
|
25
24
|
helpers.ts | 75 | 77.41 | 76 | 78.94 | 43-47,55-59,71,113,133,145
|
|
26
25
|
-------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @contractkit/contractkit-plugin-bruno
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 20ce949: Add `environments` config for the Bruno plugin.
|
|
8
|
+
|
|
9
|
+
Provide a map of environment name → variables in the plugin config and the codegen will emit one `environments/<name>.yml` per entry. Useful for shipping multiple Bruno environments (local, staging, etc.) alongside the generated collection.
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
"@contractkit/plugin-bruno": {
|
|
13
|
+
"environments": {
|
|
14
|
+
"local": {
|
|
15
|
+
"baseUrl": "http://localhost:3000",
|
|
16
|
+
"token": ""
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
When `environments` is omitted, the default `environments/local.yml` is emitted (existing behavior). When provided, it replaces the default — include auth variables (e.g. `token`) explicitly if you need them. Also fixes a small omission in `createBrunoPlugin`: `includeInternal` is now forwarded to the codegen, matching the default plugin export.
|
|
23
|
+
|
|
24
|
+
## 1.0.0
|
|
25
|
+
|
|
26
|
+
### Major Changes
|
|
27
|
+
|
|
28
|
+
- 7555412: Drop the `overrideDir` config option from the Bruno plugin.
|
|
29
|
+
|
|
30
|
+
Per-operation overrides via `plugins: { bruno: "..." }` combined with the new `{{var}}` substitution in `.ck` files cover the same use cases more directly. Define a shared base path once in `options { keys: { bruno: "../bruno-overrides" } }` (or in the plugin's `keys` config in `contractkit.config.json` for a workspace-wide default) and reference per-operation override files with `plugins: { bruno: "{{bruno}}/path/to/file.yml" }`.
|
|
31
|
+
|
|
32
|
+
Migration: replace the `overrideDir` entry in your plugin config with a per-operation `plugins.bruno` declaration on each operation that needs an override.
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [7555412]
|
|
37
|
+
- @contractkit/core@0.13.0
|
|
38
|
+
|
|
3
39
|
## 0.10.0
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -39,9 +39,9 @@ pnpm add @contractkit/contractkit-plugin-bruno
|
|
|
39
39
|
| `collectionName` | `string` | basename of `rootDir` | Collection name shown in Bruno |
|
|
40
40
|
| `randomExamples` | `boolean` | `true` | Use Bruno faker templates (`{{$randomUUID}}`, `{{$randomEmail}}`, etc.) for compatible scalar fields so each send produces fresh data. Set to `false` for stable, deterministic placeholders. |
|
|
41
41
|
| `includeInternal` | `boolean` | `true` | Include operations marked `internal`. Set to `false` to omit them from the collection. |
|
|
42
|
-
| `overrideDir` | `string` | — | Directory of YAML override files (relative to `rootDir`). Files mirror the generated output structure and are deep-merged at codegen time. See [Directory overrides](#directory-overrides). |
|
|
43
42
|
| `auth.defaultScheme` | `string` | — | Key from `auth.schemes` to apply by default |
|
|
44
43
|
| `auth.schemes` | `object` | — | Map of scheme name → security scheme definition |
|
|
44
|
+
| `environments` | `object` | — | Map of environment name → variables. Each entry produces a `environments/<name>.yml` file. See [Environments](#environments). |
|
|
45
45
|
|
|
46
46
|
### Auth scheme types
|
|
47
47
|
|
|
@@ -87,30 +87,52 @@ runtime:
|
|
|
87
87
|
bru.setVar("token", bru.getEnvVar("adminToken"));
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Set `overrideDir` to a directory that mirrors the generated output structure. Any file found there is deep-merged into the matching generated file:
|
|
90
|
+
Authoring tip: combine per-operation `plugins.bruno` paths with `{{var}}` substitution to factor out a shared override directory:
|
|
93
91
|
|
|
94
92
|
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
options {
|
|
94
|
+
keys: { bruno: "../../bruno-overrides" }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
operation /payments/{id}: {
|
|
98
|
+
get: {
|
|
99
|
+
plugins: { bruno: "{{bruno}}/payments/get-payment.yml" }
|
|
100
|
+
response: { 200: { application/json: Payment } }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
101
103
|
```
|
|
102
104
|
|
|
105
|
+
The `{{bruno}}` reference can also be supplied workspace-wide via the plugin's `keys` config in `contractkit.config.json`.
|
|
106
|
+
|
|
107
|
+
## Environments
|
|
108
|
+
|
|
109
|
+
Provide an `environments` block in the plugin config to control what `environments/<name>.yml` files Bruno sees. Each top-level key becomes a file; its values become the variables in that file:
|
|
110
|
+
|
|
103
111
|
```json
|
|
104
112
|
{
|
|
105
113
|
"plugins": {
|
|
106
114
|
"@contractkit/contractkit-plugin-bruno": {
|
|
107
|
-
"
|
|
108
|
-
|
|
115
|
+
"environments": {
|
|
116
|
+
"local": {
|
|
117
|
+
"baseUrl": "http://localhost:3000",
|
|
118
|
+
"token": ""
|
|
119
|
+
},
|
|
120
|
+
"staging": {
|
|
121
|
+
"baseUrl": "https://staging.example.com",
|
|
122
|
+
"token": ""
|
|
123
|
+
}
|
|
124
|
+
}
|
|
109
125
|
}
|
|
110
126
|
}
|
|
111
127
|
}
|
|
112
128
|
```
|
|
113
129
|
|
|
130
|
+
Notes:
|
|
131
|
+
|
|
132
|
+
- Variable values are coerced to strings and always emitted with double quotes.
|
|
133
|
+
- When `environments` is omitted or empty, a default `environments/local.yml` is emitted with `baseUrl=http://localhost:3000` plus any auth env-var placeholders the default `auth` scheme requires.
|
|
134
|
+
- When `environments` is provided, the default is replaced entirely — auth variables are not auto-injected, so include them explicitly if needed.
|
|
135
|
+
|
|
114
136
|
## Programmatic use
|
|
115
137
|
|
|
116
138
|
```typescript
|