@dbx-tools/projen 0.3.42 → 0.3.44
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/package.json +1 -1
- package/src/pnpm-workspace.ts +21 -0
package/package.json
CHANGED
package/src/pnpm-workspace.ts
CHANGED
|
@@ -157,16 +157,21 @@ export class PnpmWorkspaceState {
|
|
|
157
157
|
private readonly packages: string[] = [];
|
|
158
158
|
private readonly catalog: Catalog;
|
|
159
159
|
private readonly allowBuilds: AllowBuilds;
|
|
160
|
+
private readonly overrides: Record<string, string>;
|
|
160
161
|
|
|
161
162
|
constructor(options: DBXToolsPNPMWorkspaceOptions = {}) {
|
|
162
163
|
this.catalog = { ...DEFAULT_CATALOG, ...options.catalog };
|
|
163
164
|
this.allowBuilds = { ...DEFAULT_ALLOW_BUILDS, ...options.allowBuilds };
|
|
165
|
+
// Seeded even when empty so `addOverride` has a reference projen already
|
|
166
|
+
// captured; projen's `omitEmpty` drops the key while it stays empty.
|
|
167
|
+
this.overrides = { ...options.workspaceYaml?.overrides };
|
|
164
168
|
this.options = {
|
|
165
169
|
...DEFAULT_WORKSPACE_YAML,
|
|
166
170
|
...options.workspaceYaml,
|
|
167
171
|
packages: this.packages,
|
|
168
172
|
catalog: this.catalog,
|
|
169
173
|
allowBuilds: this.allowBuilds,
|
|
174
|
+
overrides: this.overrides,
|
|
170
175
|
};
|
|
171
176
|
}
|
|
172
177
|
|
|
@@ -185,6 +190,22 @@ export class PnpmWorkspaceState {
|
|
|
185
190
|
this.allowBuilds[name] = true;
|
|
186
191
|
}
|
|
187
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Force every resolution of `name` to `version`, workspace-wide (pnpm
|
|
195
|
+
* `overrides`) - the escape hatch for a transitive dependency you do not
|
|
196
|
+
* declare, e.g. pinning past an unmet peer range a dependency has not yet
|
|
197
|
+
* widened.
|
|
198
|
+
*
|
|
199
|
+
* Blunt by design: it applies to EVERY package in the workspace, including
|
|
200
|
+
* ones whose declared range excludes it, so reach for a catalog entry first
|
|
201
|
+
* when the dependency is one you actually declare.
|
|
202
|
+
*
|
|
203
|
+
* Note this is a pnpm override, unrelated to projen's `FileBase.addOverride`.
|
|
204
|
+
*/
|
|
205
|
+
public addOverride(name: string, version: string): void {
|
|
206
|
+
this.overrides[name] = version;
|
|
207
|
+
}
|
|
208
|
+
|
|
188
209
|
/**
|
|
189
210
|
* Fill `packages` from the project's attached subprojects.
|
|
190
211
|
*
|