@codedrifters/configulator 0.0.125 → 0.0.126

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.mjs CHANGED
@@ -751,7 +751,12 @@ var VERSION_NPM_PACKAGES = [
751
751
  { key: "TURBO_VERSION", npmPackage: "turbo" },
752
752
  { key: "VITEST_VERSION", npmPackage: "vitest" }
753
753
  ];
754
- var VERSION_KEYS_SKIP = ["NODE_WORKFLOWS"];
754
+ var VERSION_KEYS_SKIP = [
755
+ "NODE_WORKFLOWS",
756
+ "VITE_VERSION",
757
+ "VITEST_VERSION"
758
+ // Pinned to 3.x for Vite 5 compatibility; skip until ESM-only (issue #142)
759
+ ];
755
760
 
756
761
  // src/versions.ts
757
762
  var VERSION = {
@@ -787,10 +792,17 @@ var VERSION = {
787
792
  * What version of the turborepo library should we use?
788
793
  */
789
794
  TURBO_VERSION: "2.8.14",
795
+ /**
796
+ * What version of Vite to use (pnpm override). Pinned to 5.x so Vitest 4.x
797
+ * can load config (Vite 6+/7+ are ESM-only; see issue #142). Remove override
798
+ * when moving to ESM-only test setup.
799
+ */
800
+ VITE_VERSION: "5.4.11",
790
801
  /**
791
802
  * What version of Vitest to use when testRunner is 'vitest'.
803
+ * Pinned to 3.x so it works with Vite 5 (Vitest 4 requires Vite 6). See issue #142.
792
804
  */
793
- VITEST_VERSION: "4.0.18"
805
+ VITEST_VERSION: "3.2.4"
794
806
  };
795
807
 
796
808
  // src/jsii/jsii-faker.ts
@@ -1295,6 +1307,86 @@ var VSCodeConfig = class extends Component9 {
1295
1307
  }
1296
1308
  };
1297
1309
 
1310
+ // src/workflows/approve-merge-upgrade.ts
1311
+ import { JobPermission as JobPermission2 } from "projen/lib/github/workflows-model";
1312
+ var MERGE_METHODS = {
1313
+ SQUASH: "squash",
1314
+ MERGE: "merge",
1315
+ REBASE: "rebase"
1316
+ };
1317
+ var DEFAULT_WORKFLOW_NAME = "approve-and-merge-upgrade";
1318
+ var DEFAULT_AUTO_APPROVE_LABEL = "auto-approve";
1319
+ var DEFAULT_HEAD_BRANCH = "github-actions/upgrade";
1320
+ var DEFAULT_APPROVAL_APP_ID_SECRET = "APPROVAL_APP_ID";
1321
+ var DEFAULT_APPROVAL_APP_PRIVATE_KEY_SECRET = "APPROVAL_APP_PRIVATE_KEY";
1322
+ var DEFAULT_MERGE_METHOD = MERGE_METHODS.SQUASH;
1323
+ var PULL_REQUEST_TARGET_TYPES = [
1324
+ "labeled",
1325
+ "synchronize",
1326
+ "reopened",
1327
+ "ready_for_review"
1328
+ ];
1329
+ function addApproveMergeUpgradeWorkflow(project, options) {
1330
+ const workflowName = options.workflowName ?? DEFAULT_WORKFLOW_NAME;
1331
+ const autoApproveLabel = options.autoApproveLabel ?? DEFAULT_AUTO_APPROVE_LABEL;
1332
+ const headBranch = options.headBranch ?? DEFAULT_HEAD_BRANCH;
1333
+ const allowedUsernames = options.allowedUsernames;
1334
+ const appIdSecret = options.approvalAppIdSecret ?? DEFAULT_APPROVAL_APP_ID_SECRET;
1335
+ const privateKeySecret = options.approvalAppPrivateKeySecret ?? DEFAULT_APPROVAL_APP_PRIVATE_KEY_SECRET;
1336
+ const mergeMethod = options.mergeMethod ?? DEFAULT_MERGE_METHOD;
1337
+ const workflow = project.github?.addWorkflow(workflowName);
1338
+ if (!workflow) return;
1339
+ workflow.on({
1340
+ pullRequestTarget: {
1341
+ types: [...PULL_REQUEST_TARGET_TYPES],
1342
+ ...options.branches && options.branches.length > 0 ? { branches: options.branches } : {}
1343
+ }
1344
+ });
1345
+ const jobCondition = [
1346
+ `contains(github.event.pull_request.labels.*.name, '${autoApproveLabel}')`,
1347
+ `github.event.pull_request.head.ref == '${headBranch}'`,
1348
+ `(${allowedUsernames.map((u) => `github.event.pull_request.user.login == '${u}'`).join(" || ")})`
1349
+ ].join(" && ");
1350
+ workflow.addJobs({
1351
+ "approve-and-merge": {
1352
+ name: "Approve and merge upgrade PR",
1353
+ runsOn: ["ubuntu-latest"],
1354
+ permissions: {
1355
+ pullRequests: JobPermission2.WRITE,
1356
+ contents: JobPermission2.WRITE
1357
+ },
1358
+ if: jobCondition,
1359
+ steps: [
1360
+ {
1361
+ name: "Generate token",
1362
+ id: "generate_token",
1363
+ uses: "actions/create-github-app-token@v2",
1364
+ with: {
1365
+ "app-id": `\${{ secrets.${appIdSecret} }}`,
1366
+ "private-key": `\${{ secrets.${privateKeySecret} }}`
1367
+ }
1368
+ },
1369
+ {
1370
+ name: "Auto-approve",
1371
+ uses: "hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363",
1372
+ with: {
1373
+ "github-token": "${{ steps.generate_token.outputs.token }}"
1374
+ }
1375
+ },
1376
+ {
1377
+ name: "Enable auto-merge (squash)",
1378
+ uses: "peter-evans/enable-pull-request-automerge@v3",
1379
+ with: {
1380
+ token: "${{ steps.generate_token.outputs.token }}",
1381
+ "pull-request-number": "${{ github.event.pull_request.number }}",
1382
+ "merge-method": mergeMethod
1383
+ }
1384
+ }
1385
+ ]
1386
+ }
1387
+ });
1388
+ }
1389
+
1298
1390
  // src/projects/monorepo-project.ts
1299
1391
  var postInstallDependenciesMap = /* @__PURE__ */ new WeakMap();
1300
1392
  var MonorepoProject = class extends TypeScriptAppProject {
@@ -1529,6 +1621,9 @@ var MonorepoProject = class extends TypeScriptAppProject {
1529
1621
  )
1530
1622
  );
1531
1623
  }
1624
+ if (options.approveMergeUpgradeOptions) {
1625
+ addApproveMergeUpgradeWorkflow(this, options.approveMergeUpgradeOptions);
1626
+ }
1532
1627
  this.tasks.tryFind("post-upgrade")?.exec("pnpm upgrade -r");
1533
1628
  this.tasks.tryFind("post-upgrade")?.spawn(this.defaultTask);
1534
1629
  }
@@ -1595,7 +1690,7 @@ var import_utils3 = __toESM(require_lib());
1595
1690
  import { Component as Component11 } from "projen";
1596
1691
  import { BuildWorkflow } from "projen/lib/build";
1597
1692
  import { GitHub } from "projen/lib/github";
1598
- import { JobPermission as JobPermission2 } from "projen/lib/github/workflows-model";
1693
+ import { JobPermission as JobPermission3 } from "projen/lib/github/workflows-model";
1599
1694
  var PROD_DEPLOY_NAME = "prod-deploy";
1600
1695
  var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component11 {
1601
1696
  constructor(project, options = {}) {
@@ -1824,8 +1919,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component11 {
1824
1919
  ],
1825
1920
  runsOn: ["ubuntu-latest"],
1826
1921
  permissions: {
1827
- contents: JobPermission2.READ,
1828
- idToken: JobPermission2.WRITE
1922
+ contents: JobPermission3.READ,
1923
+ idToken: JobPermission3.WRITE
1829
1924
  },
1830
1925
  concurrency: deployJobName,
1831
1926
  if: jobCondition,
@@ -1864,6 +1959,7 @@ export {
1864
1959
  AwsDeploymentConfig,
1865
1960
  AwsDeploymentTarget,
1866
1961
  JsiiFaker,
1962
+ MERGE_METHODS,
1867
1963
  MIMIMUM_RELEASE_AGE,
1868
1964
  MonorepoProject,
1869
1965
  PROD_DEPLOY_NAME,
@@ -1881,6 +1977,7 @@ export {
1881
1977
  VERSION_NPM_PACKAGES,
1882
1978
  VSCodeConfig,
1883
1979
  Vitest,
1980
+ addApproveMergeUpgradeWorkflow,
1884
1981
  getLatestEligibleVersion
1885
1982
  };
1886
1983
  //# sourceMappingURL=index.mjs.map