@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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @contractkit/plugin-bruno@0.10.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/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@0.10.0 build /home/runner/work/ContractKit/ContractKit/packages/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
  CLI Building entry: src/index.ts
@@ -11,9 +11,9 @@
11
11
  CLI tsup v8.5.1
12
12
  CLI Target: esnext
13
13
  ESM Build start
14
- ESM dist/index.js 21.63 KB
15
- ESM dist/index.js.map 51.98 KB
16
- ESM ⚡️ Build success in 175ms
14
+ ESM dist/index.js 21.88 KB
15
+ ESM dist/index.js.map 53.25 KB
16
+ ESM ⚡️ Build success in 164ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 3273ms
19
- DTS dist/index.d.ts 2.53 KB
18
+ DTS ⚡️ Build success in 4541ms
19
+ DTS dist/index.d.ts 2.52 KB
@@ -1,26 +1,25 @@
1
1
 
2
- > @contractkit/plugin-bruno@0.10.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/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
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
7
7
  Coverage enabled with v8
8
8
 
9
- ✓ tests/codegen-bruno.test.ts (98 tests) 220ms
9
+ ✓ tests/codegen-bruno.test.ts (100 tests) 556ms
10
10
 
11
11
   Test Files  1 passed (1)
12
-  Tests  98 passed (98)
13
-  Start at  17:30:31
14
-  Duration  5.24s (transform 1.48s, setup 0ms, import 3.93s, tests 220ms, environment 0ms)
12
+  Tests  100 passed (100)
13
+  Start at  19:41:31
14
+  Duration  5.27s (transform 1.13s, setup 0ms, import 3.31s, tests 556ms, environment 0ms)
15
15
 
16
16
   % Coverage report from v8
17
17
  -------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------
18
18
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
19
19
  -------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------------------
20
- All files | 80.2 | 73.2 | 85.52 | 80.96 |
21
- src | 80.84 | 72.75 | 90.19 | 81.21 |
22
- codegen-bruno.ts | 86.73 | 76.56 | 91.3 | 88.19 | 285-286,370,378,431-434,441-448,468,474,478-480,496,506,530,540-542,548-550,555,559-567,576,580
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
- ## Directory overrides
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
- bruno-overrides/
96
- ├── opencollection.yml # merged into collection root
97
- ├── environments/
98
- │ └── local.yml # merged into the Local environment
99
- └── payments/
100
- └── get-payment.yml # merged into that request file
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
- "output": "bruno-collection",
108
- "overrideDir": "bruno-overrides"
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