@codedrifters/configulator 0.0.126 → 0.0.127

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
@@ -1586,4 +1586,17 @@ declare class AwsDeployWorkflow extends Component {
1586
1586
  preSynthesize(): void;
1587
1587
  }
1588
1588
 
1589
- export { type ApproveMergeUpgradeOptions, type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, type AwsDeploymentTargetOptions, type AwsLocalDeploymentConfig, type AwsOrganization, type AwsRegion, type CiDeploymentConfig, type ClassTypeOptions, type DeployWorkflowOptions, type GitBranch, type IDependencyResolver, JsiiFaker, MERGE_METHODS, MIMIMUM_RELEASE_AGE, type MergeMethod, MonorepoProject, type MonorepoProjectOptions, PROD_DEPLOY_NAME, PnpmWorkspace, type PnpmWorkspaceOptions, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, type RemoteCacheOptions, ResetTask, type ResetTaskOptions, TestRunner, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, type VersionKey, Vitest, type VitestConfigOptions, type VitestOptions, addApproveMergeUpgradeWorkflow, getLatestEligibleVersion };
1589
+ /** Name of the gate job appended to build workflows (ADR 0004). */
1590
+ declare const COMPLETE_JOB_ID = "complete";
1591
+ /**
1592
+ * Appends the "complete" gate job to a build workflow (ADR 0004, issue #165).
1593
+ * The job runs after all other jobs, uses {@code if: always()}, and succeeds
1594
+ * only when the build job succeeded and every other job succeeded or was skipped.
1595
+ * Call this for the default build workflow and for any build workflow created
1596
+ * by Configulator (e.g. AwsDeployWorkflow).
1597
+ *
1598
+ * @param buildWorkflow The Projen BuildWorkflow to append the complete job to.
1599
+ */
1600
+ declare function addBuildCompleteJob(buildWorkflow: BuildWorkflow): void;
1601
+
1602
+ export { type ApproveMergeUpgradeOptions, type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, type AwsDeploymentTargetOptions, type AwsLocalDeploymentConfig, type AwsOrganization, type AwsRegion, COMPLETE_JOB_ID, type CiDeploymentConfig, type ClassTypeOptions, type DeployWorkflowOptions, type GitBranch, type IDependencyResolver, JsiiFaker, MERGE_METHODS, MIMIMUM_RELEASE_AGE, type MergeMethod, MonorepoProject, type MonorepoProjectOptions, PROD_DEPLOY_NAME, PnpmWorkspace, type PnpmWorkspaceOptions, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, type RemoteCacheOptions, ResetTask, type ResetTaskOptions, TestRunner, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, type VersionKey, Vitest, type VitestConfigOptions, type VitestOptions, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, getLatestEligibleVersion };
package/lib/index.d.ts CHANGED
@@ -1635,5 +1635,18 @@ declare class AwsDeployWorkflow extends Component {
1635
1635
  preSynthesize(): void;
1636
1636
  }
1637
1637
 
1638
- export { AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, JsiiFaker, MERGE_METHODS, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TestRunner, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, Vitest, addApproveMergeUpgradeWorkflow, getLatestEligibleVersion };
1638
+ /** Name of the gate job appended to build workflows (ADR 0004). */
1639
+ declare const COMPLETE_JOB_ID = "complete";
1640
+ /**
1641
+ * Appends the "complete" gate job to a build workflow (ADR 0004, issue #165).
1642
+ * The job runs after all other jobs, uses {@code if: always()}, and succeeds
1643
+ * only when the build job succeeded and every other job succeeded or was skipped.
1644
+ * Call this for the default build workflow and for any build workflow created
1645
+ * by Configulator (e.g. AwsDeployWorkflow).
1646
+ *
1647
+ * @param buildWorkflow The Projen BuildWorkflow to append the complete job to.
1648
+ */
1649
+ declare function addBuildCompleteJob(buildWorkflow: BuildWorkflow): void;
1650
+
1651
+ export { AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, COMPLETE_JOB_ID, JsiiFaker, MERGE_METHODS, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TestRunner, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, Vitest, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, getLatestEligibleVersion };
1639
1652
  export type { ApproveMergeUpgradeOptions, AwsAccount, AwsDeploymentTargetOptions, AwsLocalDeploymentConfig, AwsOrganization, AwsRegion, CiDeploymentConfig, ClassTypeOptions, DeployWorkflowOptions, GitBranch, IDependencyResolver, MergeMethod, MonorepoProjectOptions, PnpmWorkspaceOptions, RemoteCacheOptions, ResetTaskOptions, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions, VersionKey, VitestConfigOptions, VitestOptions };
package/lib/index.js CHANGED
@@ -178,6 +178,7 @@ __export(index_exports, {
178
178
  AwsDeployWorkflow: () => AwsDeployWorkflow,
179
179
  AwsDeploymentConfig: () => AwsDeploymentConfig,
180
180
  AwsDeploymentTarget: () => AwsDeploymentTarget,
181
+ COMPLETE_JOB_ID: () => COMPLETE_JOB_ID,
181
182
  JsiiFaker: () => JsiiFaker,
182
183
  MERGE_METHODS: () => MERGE_METHODS,
183
184
  MIMIMUM_RELEASE_AGE: () => MIMIMUM_RELEASE_AGE,
@@ -198,6 +199,7 @@ __export(index_exports, {
198
199
  VSCodeConfig: () => VSCodeConfig,
199
200
  Vitest: () => Vitest,
200
201
  addApproveMergeUpgradeWorkflow: () => addApproveMergeUpgradeWorkflow,
202
+ addBuildCompleteJob: () => addBuildCompleteJob,
201
203
  getLatestEligibleVersion: () => getLatestEligibleVersion
202
204
  });
203
205
  module.exports = __toCommonJS(index_exports);
@@ -1407,6 +1409,53 @@ function addApproveMergeUpgradeWorkflow(project, options) {
1407
1409
  });
1408
1410
  }
1409
1411
 
1412
+ // src/workflows/build-complete-job.ts
1413
+ var import_workflows_model3 = require("projen/lib/github/workflows-model");
1414
+ var BUILD_JOB_ID = "build";
1415
+ var COMPLETE_JOB_ID = "complete";
1416
+ function buildCompleteJobRunScript(jobIds) {
1417
+ const lines = [];
1418
+ for (const id of jobIds) {
1419
+ const expr = "${{ needs." + id + ".result }}";
1420
+ if (id === BUILD_JOB_ID) {
1421
+ lines.push(
1422
+ `if [ "${expr}" != "success" ]; then echo "Job ${id} must succeed"; exit 1; fi`
1423
+ );
1424
+ } else {
1425
+ lines.push(
1426
+ `if [ "${expr}" != "success" ] && [ "${expr}" != "skipped" ]; then echo "Job ${id} must succeed or be skipped"; exit 1; fi`
1427
+ );
1428
+ }
1429
+ }
1430
+ return lines.join("\n");
1431
+ }
1432
+ function addBuildCompleteJob(buildWorkflow) {
1433
+ const w = buildWorkflow.workflow;
1434
+ if (!w?.jobs || typeof w.addJob !== "function") {
1435
+ return;
1436
+ }
1437
+ const jobIds = Object.keys(w.jobs).filter((id) => id !== COMPLETE_JOB_ID);
1438
+ if (jobIds.length === 0) {
1439
+ return;
1440
+ }
1441
+ const runScript = buildCompleteJobRunScript(jobIds);
1442
+ w.addJob(COMPLETE_JOB_ID, {
1443
+ name: "Complete",
1444
+ needs: jobIds,
1445
+ if: "always()",
1446
+ runsOn: ["ubuntu-latest"],
1447
+ permissions: {
1448
+ contents: import_workflows_model3.JobPermission.NONE
1449
+ },
1450
+ steps: [
1451
+ {
1452
+ name: "Verify all jobs succeeded or were skipped",
1453
+ run: runScript
1454
+ }
1455
+ ]
1456
+ });
1457
+ }
1458
+
1410
1459
  // src/projects/monorepo-project.ts
1411
1460
  var postInstallDependenciesMap = /* @__PURE__ */ new WeakMap();
1412
1461
  var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
@@ -1644,6 +1693,9 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
1644
1693
  if (options.approveMergeUpgradeOptions) {
1645
1694
  addApproveMergeUpgradeWorkflow(this, options.approveMergeUpgradeOptions);
1646
1695
  }
1696
+ if (this.buildWorkflow) {
1697
+ addBuildCompleteJob(this.buildWorkflow);
1698
+ }
1647
1699
  this.tasks.tryFind("post-upgrade")?.exec("pnpm upgrade -r");
1648
1700
  this.tasks.tryFind("post-upgrade")?.spawn(this.defaultTask);
1649
1701
  }
@@ -1710,7 +1762,7 @@ var import_utils3 = __toESM(require_lib());
1710
1762
  var import_projen10 = require("projen");
1711
1763
  var import_build = require("projen/lib/build");
1712
1764
  var import_github = require("projen/lib/github");
1713
- var import_workflows_model3 = require("projen/lib/github/workflows-model");
1765
+ var import_workflows_model4 = require("projen/lib/github/workflows-model");
1714
1766
  var PROD_DEPLOY_NAME = "prod-deploy";
1715
1767
  var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Component {
1716
1768
  constructor(project, options = {}) {
@@ -1939,14 +1991,15 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
1939
1991
  ],
1940
1992
  runsOn: ["ubuntu-latest"],
1941
1993
  permissions: {
1942
- contents: import_workflows_model3.JobPermission.READ,
1943
- idToken: import_workflows_model3.JobPermission.WRITE
1994
+ contents: import_workflows_model4.JobPermission.READ,
1995
+ idToken: import_workflows_model4.JobPermission.WRITE
1944
1996
  },
1945
1997
  concurrency: deployJobName,
1946
1998
  if: jobCondition,
1947
1999
  steps: [...this.deploySteps(target)]
1948
2000
  });
1949
2001
  });
2002
+ addBuildCompleteJob(this.buildWorkflow);
1950
2003
  }
1951
2004
  static of(project, buildWorkflow) {
1952
2005
  const isDefined = (c) => c instanceof _AwsDeployWorkflow && c.buildWorkflow === buildWorkflow;
@@ -1979,6 +2032,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
1979
2032
  AwsDeployWorkflow,
1980
2033
  AwsDeploymentConfig,
1981
2034
  AwsDeploymentTarget,
2035
+ COMPLETE_JOB_ID,
1982
2036
  JsiiFaker,
1983
2037
  MERGE_METHODS,
1984
2038
  MIMIMUM_RELEASE_AGE,
@@ -1999,6 +2053,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
1999
2053
  VSCodeConfig,
2000
2054
  Vitest,
2001
2055
  addApproveMergeUpgradeWorkflow,
2056
+ addBuildCompleteJob,
2002
2057
  getLatestEligibleVersion
2003
2058
  });
2004
2059
  //# sourceMappingURL=index.js.map