@codedrifters/configulator 0.0.130 → 0.0.132

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/lib/index.d.mts CHANGED
@@ -1251,7 +1251,7 @@ declare function addApproveMergeUpgradeWorkflow(project: NodeProject, options: A
1251
1251
 
1252
1252
  /*******************************************************************************
1253
1253
  *
1254
- * Monorepo Root Project
1254
+ * Monorepo Root Project.
1255
1255
  *
1256
1256
  * This project should be used as the base project for other projects in a
1257
1257
  * monorepo. The Monorepo root project generally won't contain any code, but it
@@ -1310,12 +1310,24 @@ interface MonorepoProjectOptions extends Omit<TypeScriptProjectOptions$1, "defau
1310
1310
  * @see ApproveMergeUpgradeOptions
1311
1311
  */
1312
1312
  readonly approveMergeUpgradeOptions?: ApproveMergeUpgradeOptions;
1313
+ /**
1314
+ * Whether this monorepo consumes @codedrifters/configulator from a registry (npm).
1315
+ * When true, the upgrade workflow adds steps to sync configulator and synthesize.
1316
+ * Set to false when configulator is developed in this repo (e.g. workspace dependency).
1317
+ *
1318
+ * @default true
1319
+ */
1320
+ readonly configulatorRegistryConsumer?: boolean;
1313
1321
  }
1314
1322
  declare class MonorepoProject extends TypeScriptAppProject {
1315
1323
  /**
1316
1324
  * Version of PNPM which the whole monorepo should use.
1317
1325
  */
1318
1326
  readonly pnpmVersion: string;
1327
+ /**
1328
+ * Whether this monorepo consumes configulator from a registry (drives upgrade workflow steps).
1329
+ */
1330
+ readonly configulatorRegistryConsumer: boolean;
1319
1331
  constructor(userOptions: MonorepoProjectOptions);
1320
1332
  /**
1321
1333
  * Allows a sub project to request installation of dependency at the Monorepo root
package/lib/index.d.ts CHANGED
@@ -1300,7 +1300,7 @@ declare function addApproveMergeUpgradeWorkflow(project: NodeProject, options: A
1300
1300
 
1301
1301
  /*******************************************************************************
1302
1302
  *
1303
- * Monorepo Root Project
1303
+ * Monorepo Root Project.
1304
1304
  *
1305
1305
  * This project should be used as the base project for other projects in a
1306
1306
  * monorepo. The Monorepo root project generally won't contain any code, but it
@@ -1359,12 +1359,24 @@ interface MonorepoProjectOptions extends Omit<TypeScriptProjectOptions$1, "defau
1359
1359
  * @see ApproveMergeUpgradeOptions
1360
1360
  */
1361
1361
  readonly approveMergeUpgradeOptions?: ApproveMergeUpgradeOptions;
1362
+ /**
1363
+ * Whether this monorepo consumes @codedrifters/configulator from a registry (npm).
1364
+ * When true, the upgrade workflow adds steps to sync configulator and synthesize.
1365
+ * Set to false when configulator is developed in this repo (e.g. workspace dependency).
1366
+ *
1367
+ * @default true
1368
+ */
1369
+ readonly configulatorRegistryConsumer?: boolean;
1362
1370
  }
1363
1371
  declare class MonorepoProject extends TypeScriptAppProject {
1364
1372
  /**
1365
1373
  * Version of PNPM which the whole monorepo should use.
1366
1374
  */
1367
1375
  readonly pnpmVersion: string;
1376
+ /**
1377
+ * Whether this monorepo consumes configulator from a registry (drives upgrade workflow steps).
1378
+ */
1379
+ readonly configulatorRegistryConsumer: boolean;
1368
1380
  constructor(userOptions: MonorepoProjectOptions);
1369
1381
  /**
1370
1382
  * Allows a sub project to request installation of dependency at the Monorepo root
package/lib/index.js CHANGED
@@ -1458,17 +1458,6 @@ function addBuildCompleteJob(buildWorkflow) {
1458
1458
 
1459
1459
  // src/projects/monorepo-project.ts
1460
1460
  var CONFIGULATOR_PACKAGE_NAME = "@codedrifters/configulator";
1461
- function isConfigulatorRegistryConsumer(project) {
1462
- const dep = project.deps.all.find(
1463
- (d) => d.name === CONFIGULATOR_PACKAGE_NAME
1464
- );
1465
- if (!dep?.version) return false;
1466
- const v = dep.version;
1467
- if (v.startsWith("workspace:") || v.startsWith("file:") || v.startsWith("link:") || v.startsWith("catalog:")) {
1468
- return false;
1469
- }
1470
- return true;
1471
- }
1472
1461
  var postInstallDependenciesMap = /* @__PURE__ */ new WeakMap();
1473
1462
  var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
1474
1463
  constructor(userOptions) {
@@ -1540,6 +1529,10 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
1540
1529
  * Default PNPM version to use in the monorepo.
1541
1530
  */
1542
1531
  pnpmVersion: VERSION.PNPM_VERSION,
1532
+ /**
1533
+ * By default treat as a registry consumer (upgrade workflow syncs configulator).
1534
+ */
1535
+ configulatorRegistryConsumer: true,
1543
1536
  /**
1544
1537
  * We don't want sample code generated for the root project.
1545
1538
  */
@@ -1646,6 +1639,7 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
1646
1639
  super({ ...options });
1647
1640
  postInstallDependenciesMap.set(this, []);
1648
1641
  this.pnpmVersion = options.pnpmVersion;
1642
+ this.configulatorRegistryConsumer = options.configulatorRegistryConsumer ?? true;
1649
1643
  new VSCodeConfig(this);
1650
1644
  new PnpmWorkspace(this, options.pnpmOptions?.pnpmWorkspaceOptions);
1651
1645
  if (options.turbo) {
@@ -1696,16 +1690,12 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
1696
1690
  if (this.buildWorkflow) {
1697
1691
  addBuildCompleteJob(this.buildWorkflow);
1698
1692
  }
1699
- if (isConfigulatorRegistryConsumer(this)) {
1700
- this.tasks.tryFind("post-upgrade")?.exec(`pnpm update -r ${CONFIGULATOR_PACKAGE_NAME}`);
1701
- this.tasks.tryFind("post-upgrade")?.spawn(this.defaultTask);
1702
- }
1703
1693
  const upgradeWorkflow = this.github?.tryFindWorkflow("upgrade");
1704
1694
  const upgradeJob = upgradeWorkflow?.getJob("upgrade");
1705
1695
  const jobWithSteps = upgradeJob && "steps" in upgradeJob ? upgradeJob : void 0;
1706
1696
  if (jobWithSteps?.steps && Array.isArray(jobWithSteps.steps)) {
1707
1697
  const insertIndex = 4;
1708
- if (isConfigulatorRegistryConsumer(this)) {
1698
+ if (this.configulatorRegistryConsumer) {
1709
1699
  jobWithSteps.steps.splice(insertIndex, 0, {
1710
1700
  name: `Sync ${CONFIGULATOR_PACKAGE_NAME} in workspace`,
1711
1701
  run: `pnpm update -r ${CONFIGULATOR_PACKAGE_NAME}`
@@ -1716,7 +1706,7 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
1716
1706
  });
1717
1707
  }
1718
1708
  jobWithSteps.steps.splice(
1719
- insertIndex + (isConfigulatorRegistryConsumer(this) ? 2 : 0),
1709
+ insertIndex + (this.configulatorRegistryConsumer ? 2 : 0),
1720
1710
  0,
1721
1711
  {
1722
1712
  name: "Run subproject upgrades",