@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.d.mts +86 -4
- package/lib/index.d.ts +87 -5
- package/lib/index.js +104 -5
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +102 -5
- package/lib/index.mjs.map +1 -1
- package/package.json +3 -3
package/lib/index.d.mts
CHANGED
|
@@ -399,10 +399,17 @@ declare const VERSION: {
|
|
|
399
399
|
* What version of the turborepo library should we use?
|
|
400
400
|
*/
|
|
401
401
|
readonly TURBO_VERSION: "2.8.14";
|
|
402
|
+
/**
|
|
403
|
+
* What version of Vite to use (pnpm override). Pinned to 5.x so Vitest 4.x
|
|
404
|
+
* can load config (Vite 6+/7+ are ESM-only; see issue #142). Remove override
|
|
405
|
+
* when moving to ESM-only test setup.
|
|
406
|
+
*/
|
|
407
|
+
readonly VITE_VERSION: "5.4.11";
|
|
402
408
|
/**
|
|
403
409
|
* What version of Vitest to use when testRunner is 'vitest'.
|
|
410
|
+
* Pinned to 3.x so it works with Vite 5 (Vitest 4 requires Vite 6). See issue #142.
|
|
404
411
|
*/
|
|
405
|
-
readonly VITEST_VERSION: "
|
|
412
|
+
readonly VITEST_VERSION: "3.2.4";
|
|
406
413
|
};
|
|
407
414
|
|
|
408
415
|
/**
|
|
@@ -421,8 +428,9 @@ declare const VERSION_NPM_PACKAGES: ReadonlyArray<{
|
|
|
421
428
|
npmPackage: string;
|
|
422
429
|
}>;
|
|
423
430
|
/**
|
|
424
|
-
* VERSION keys that are not backed by npm
|
|
425
|
-
* auto-update (e.g. runtime versions like Node.js
|
|
431
|
+
* VERSION keys that are not backed by npm or must be skipped by
|
|
432
|
+
* auto-update (e.g. runtime versions like Node.js, or pinned deps like
|
|
433
|
+
* VITE_VERSION until ESM-only test setup).
|
|
426
434
|
*/
|
|
427
435
|
declare const VERSION_KEYS_SKIP: ReadonlyArray<VersionKey>;
|
|
428
436
|
|
|
@@ -1176,6 +1184,71 @@ declare class TurboRepo extends Component$1 {
|
|
|
1176
1184
|
preSynthesize(): void;
|
|
1177
1185
|
}
|
|
1178
1186
|
|
|
1187
|
+
/** Merge methods supported by enable-pull-request-automerge. */
|
|
1188
|
+
declare const MERGE_METHODS: {
|
|
1189
|
+
readonly SQUASH: "squash";
|
|
1190
|
+
readonly MERGE: "merge";
|
|
1191
|
+
readonly REBASE: "rebase";
|
|
1192
|
+
};
|
|
1193
|
+
/** Merge method for the approve-and-merge-upgrade workflow. */
|
|
1194
|
+
type MergeMethod = (typeof MERGE_METHODS)[keyof typeof MERGE_METHODS];
|
|
1195
|
+
/**
|
|
1196
|
+
* Options for the approve-and-merge-upgrade workflow (ADR 0001 §2).
|
|
1197
|
+
* When set, adds a workflow that approves and merges the dependency-upgrade PR
|
|
1198
|
+
* when it has the auto-approve label and head branch matches. Trigger types
|
|
1199
|
+
* exclude `opened` to prevent double approval when the PR is created with the label.
|
|
1200
|
+
*/
|
|
1201
|
+
interface ApproveMergeUpgradeOptions {
|
|
1202
|
+
/**
|
|
1203
|
+
* Workflow file name (display name in Actions tab).
|
|
1204
|
+
* @default "approve-and-merge-upgrade"
|
|
1205
|
+
*/
|
|
1206
|
+
readonly workflowName?: string;
|
|
1207
|
+
/**
|
|
1208
|
+
* Label that must be present on the PR to trigger approve-and-merge.
|
|
1209
|
+
* @default "auto-approve"
|
|
1210
|
+
*/
|
|
1211
|
+
readonly autoApproveLabel?: string;
|
|
1212
|
+
/**
|
|
1213
|
+
* Head branch name the PR must target (e.g. the branch created by the upgrade workflow).
|
|
1214
|
+
* @default "github-actions/upgrade"
|
|
1215
|
+
*/
|
|
1216
|
+
readonly headBranch?: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* GitHub usernames allowed as PR authors (e.g. automation bot logins).
|
|
1219
|
+
* The workflow runs only when the PR user is in this list.
|
|
1220
|
+
*/
|
|
1221
|
+
readonly allowedUsernames: string[];
|
|
1222
|
+
/**
|
|
1223
|
+
* Repository secret name for the approval GitHub App ID.
|
|
1224
|
+
* @default "APPROVAL_APP_ID"
|
|
1225
|
+
*/
|
|
1226
|
+
readonly approvalAppIdSecret?: string;
|
|
1227
|
+
/**
|
|
1228
|
+
* Repository secret name for the approval GitHub App private key (PEM).
|
|
1229
|
+
* @default "APPROVAL_APP_PRIVATE_KEY"
|
|
1230
|
+
*/
|
|
1231
|
+
readonly approvalAppPrivateKeySecret?: string;
|
|
1232
|
+
/**
|
|
1233
|
+
* Merge method for enable-pull-request-automerge.
|
|
1234
|
+
* @default "squash"
|
|
1235
|
+
*/
|
|
1236
|
+
readonly mergeMethod?: MergeMethod;
|
|
1237
|
+
/**
|
|
1238
|
+
* Optional branch filters for pull_request_target (e.g. base branches).
|
|
1239
|
+
* @see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
|
|
1240
|
+
*/
|
|
1241
|
+
readonly branches?: string[];
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Adds the approve-and-merge-upgrade workflow to the project.
|
|
1245
|
+
* Uses a GitHub App token for approve + enable automerge (squash by default).
|
|
1246
|
+
*
|
|
1247
|
+
* @param project - A NodeProject with GitHub (e.g. MonorepoProject)
|
|
1248
|
+
* @param options - Options for the workflow; allowedUsernames is required
|
|
1249
|
+
*/
|
|
1250
|
+
declare function addApproveMergeUpgradeWorkflow(project: NodeProject, options: ApproveMergeUpgradeOptions): void;
|
|
1251
|
+
|
|
1179
1252
|
/*******************************************************************************
|
|
1180
1253
|
*
|
|
1181
1254
|
* Monorepo Root Project
|
|
@@ -1243,6 +1316,15 @@ interface MonorepoProjectOptions extends Omit<TypeScriptProjectOptions$1, "defau
|
|
|
1243
1316
|
* @default: daily schedule
|
|
1244
1317
|
*/
|
|
1245
1318
|
readonly upgradeConfigulatorTaskOptions?: UpgradeDependenciesOptions;
|
|
1319
|
+
/**
|
|
1320
|
+
* When set, adds the approve-and-merge-upgrade workflow (ADR 0001 §2).
|
|
1321
|
+
* Uses a second GitHub App to approve and merge the dependency-upgrade PR
|
|
1322
|
+
* when it has the auto-approve label and head branch matches. Trigger types
|
|
1323
|
+
* exclude `opened` to prevent double approval.
|
|
1324
|
+
*
|
|
1325
|
+
* @see ApproveMergeUpgradeOptions
|
|
1326
|
+
*/
|
|
1327
|
+
readonly approveMergeUpgradeOptions?: ApproveMergeUpgradeOptions;
|
|
1246
1328
|
}
|
|
1247
1329
|
declare class MonorepoProject extends TypeScriptAppProject {
|
|
1248
1330
|
/**
|
|
@@ -1504,4 +1586,4 @@ declare class AwsDeployWorkflow extends Component {
|
|
|
1504
1586
|
preSynthesize(): void;
|
|
1505
1587
|
}
|
|
1506
1588
|
|
|
1507
|
-
export { type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, type AwsDeploymentTargetOptions, type AwsLocalDeploymentConfig, type AwsOrganization, type AwsRegion, type CiDeploymentConfig, type ClassTypeOptions, type DeployWorkflowOptions, type GitBranch, type IDependencyResolver, JsiiFaker, MIMIMUM_RELEASE_AGE, 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, getLatestEligibleVersion };
|
|
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 };
|
package/lib/index.d.ts
CHANGED
|
@@ -448,10 +448,17 @@ declare const VERSION: {
|
|
|
448
448
|
* What version of the turborepo library should we use?
|
|
449
449
|
*/
|
|
450
450
|
readonly TURBO_VERSION: "2.8.14";
|
|
451
|
+
/**
|
|
452
|
+
* What version of Vite to use (pnpm override). Pinned to 5.x so Vitest 4.x
|
|
453
|
+
* can load config (Vite 6+/7+ are ESM-only; see issue #142). Remove override
|
|
454
|
+
* when moving to ESM-only test setup.
|
|
455
|
+
*/
|
|
456
|
+
readonly VITE_VERSION: "5.4.11";
|
|
451
457
|
/**
|
|
452
458
|
* What version of Vitest to use when testRunner is 'vitest'.
|
|
459
|
+
* Pinned to 3.x so it works with Vite 5 (Vitest 4 requires Vite 6). See issue #142.
|
|
453
460
|
*/
|
|
454
|
-
readonly VITEST_VERSION: "
|
|
461
|
+
readonly VITEST_VERSION: "3.2.4";
|
|
455
462
|
};
|
|
456
463
|
|
|
457
464
|
/**
|
|
@@ -470,8 +477,9 @@ declare const VERSION_NPM_PACKAGES: ReadonlyArray<{
|
|
|
470
477
|
npmPackage: string;
|
|
471
478
|
}>;
|
|
472
479
|
/**
|
|
473
|
-
* VERSION keys that are not backed by npm
|
|
474
|
-
* auto-update (e.g. runtime versions like Node.js
|
|
480
|
+
* VERSION keys that are not backed by npm or must be skipped by
|
|
481
|
+
* auto-update (e.g. runtime versions like Node.js, or pinned deps like
|
|
482
|
+
* VITE_VERSION until ESM-only test setup).
|
|
475
483
|
*/
|
|
476
484
|
declare const VERSION_KEYS_SKIP: ReadonlyArray<VersionKey>;
|
|
477
485
|
|
|
@@ -1225,6 +1233,71 @@ declare class TurboRepo extends Component$1 {
|
|
|
1225
1233
|
preSynthesize(): void;
|
|
1226
1234
|
}
|
|
1227
1235
|
|
|
1236
|
+
/** Merge methods supported by enable-pull-request-automerge. */
|
|
1237
|
+
declare const MERGE_METHODS: {
|
|
1238
|
+
readonly SQUASH: "squash";
|
|
1239
|
+
readonly MERGE: "merge";
|
|
1240
|
+
readonly REBASE: "rebase";
|
|
1241
|
+
};
|
|
1242
|
+
/** Merge method for the approve-and-merge-upgrade workflow. */
|
|
1243
|
+
type MergeMethod = (typeof MERGE_METHODS)[keyof typeof MERGE_METHODS];
|
|
1244
|
+
/**
|
|
1245
|
+
* Options for the approve-and-merge-upgrade workflow (ADR 0001 §2).
|
|
1246
|
+
* When set, adds a workflow that approves and merges the dependency-upgrade PR
|
|
1247
|
+
* when it has the auto-approve label and head branch matches. Trigger types
|
|
1248
|
+
* exclude `opened` to prevent double approval when the PR is created with the label.
|
|
1249
|
+
*/
|
|
1250
|
+
interface ApproveMergeUpgradeOptions {
|
|
1251
|
+
/**
|
|
1252
|
+
* Workflow file name (display name in Actions tab).
|
|
1253
|
+
* @default "approve-and-merge-upgrade"
|
|
1254
|
+
*/
|
|
1255
|
+
readonly workflowName?: string;
|
|
1256
|
+
/**
|
|
1257
|
+
* Label that must be present on the PR to trigger approve-and-merge.
|
|
1258
|
+
* @default "auto-approve"
|
|
1259
|
+
*/
|
|
1260
|
+
readonly autoApproveLabel?: string;
|
|
1261
|
+
/**
|
|
1262
|
+
* Head branch name the PR must target (e.g. the branch created by the upgrade workflow).
|
|
1263
|
+
* @default "github-actions/upgrade"
|
|
1264
|
+
*/
|
|
1265
|
+
readonly headBranch?: string;
|
|
1266
|
+
/**
|
|
1267
|
+
* GitHub usernames allowed as PR authors (e.g. automation bot logins).
|
|
1268
|
+
* The workflow runs only when the PR user is in this list.
|
|
1269
|
+
*/
|
|
1270
|
+
readonly allowedUsernames: string[];
|
|
1271
|
+
/**
|
|
1272
|
+
* Repository secret name for the approval GitHub App ID.
|
|
1273
|
+
* @default "APPROVAL_APP_ID"
|
|
1274
|
+
*/
|
|
1275
|
+
readonly approvalAppIdSecret?: string;
|
|
1276
|
+
/**
|
|
1277
|
+
* Repository secret name for the approval GitHub App private key (PEM).
|
|
1278
|
+
* @default "APPROVAL_APP_PRIVATE_KEY"
|
|
1279
|
+
*/
|
|
1280
|
+
readonly approvalAppPrivateKeySecret?: string;
|
|
1281
|
+
/**
|
|
1282
|
+
* Merge method for enable-pull-request-automerge.
|
|
1283
|
+
* @default "squash"
|
|
1284
|
+
*/
|
|
1285
|
+
readonly mergeMethod?: MergeMethod;
|
|
1286
|
+
/**
|
|
1287
|
+
* Optional branch filters for pull_request_target (e.g. base branches).
|
|
1288
|
+
* @see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
|
|
1289
|
+
*/
|
|
1290
|
+
readonly branches?: string[];
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Adds the approve-and-merge-upgrade workflow to the project.
|
|
1294
|
+
* Uses a GitHub App token for approve + enable automerge (squash by default).
|
|
1295
|
+
*
|
|
1296
|
+
* @param project - A NodeProject with GitHub (e.g. MonorepoProject)
|
|
1297
|
+
* @param options - Options for the workflow; allowedUsernames is required
|
|
1298
|
+
*/
|
|
1299
|
+
declare function addApproveMergeUpgradeWorkflow(project: NodeProject, options: ApproveMergeUpgradeOptions): void;
|
|
1300
|
+
|
|
1228
1301
|
/*******************************************************************************
|
|
1229
1302
|
*
|
|
1230
1303
|
* Monorepo Root Project
|
|
@@ -1292,6 +1365,15 @@ interface MonorepoProjectOptions extends Omit<TypeScriptProjectOptions$1, "defau
|
|
|
1292
1365
|
* @default: daily schedule
|
|
1293
1366
|
*/
|
|
1294
1367
|
readonly upgradeConfigulatorTaskOptions?: UpgradeDependenciesOptions;
|
|
1368
|
+
/**
|
|
1369
|
+
* When set, adds the approve-and-merge-upgrade workflow (ADR 0001 §2).
|
|
1370
|
+
* Uses a second GitHub App to approve and merge the dependency-upgrade PR
|
|
1371
|
+
* when it has the auto-approve label and head branch matches. Trigger types
|
|
1372
|
+
* exclude `opened` to prevent double approval.
|
|
1373
|
+
*
|
|
1374
|
+
* @see ApproveMergeUpgradeOptions
|
|
1375
|
+
*/
|
|
1376
|
+
readonly approveMergeUpgradeOptions?: ApproveMergeUpgradeOptions;
|
|
1295
1377
|
}
|
|
1296
1378
|
declare class MonorepoProject extends TypeScriptAppProject {
|
|
1297
1379
|
/**
|
|
@@ -1553,5 +1635,5 @@ declare class AwsDeployWorkflow extends Component {
|
|
|
1553
1635
|
preSynthesize(): void;
|
|
1554
1636
|
}
|
|
1555
1637
|
|
|
1556
|
-
export { AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, JsiiFaker, 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, getLatestEligibleVersion };
|
|
1557
|
-
export type { AwsAccount, AwsDeploymentTargetOptions, AwsLocalDeploymentConfig, AwsOrganization, AwsRegion, CiDeploymentConfig, ClassTypeOptions, DeployWorkflowOptions, GitBranch, IDependencyResolver, MonorepoProjectOptions, PnpmWorkspaceOptions, RemoteCacheOptions, ResetTaskOptions, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions, VersionKey, VitestConfigOptions, VitestOptions };
|
|
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 };
|
|
1639
|
+
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
|
@@ -179,6 +179,7 @@ __export(index_exports, {
|
|
|
179
179
|
AwsDeploymentConfig: () => AwsDeploymentConfig,
|
|
180
180
|
AwsDeploymentTarget: () => AwsDeploymentTarget,
|
|
181
181
|
JsiiFaker: () => JsiiFaker,
|
|
182
|
+
MERGE_METHODS: () => MERGE_METHODS,
|
|
182
183
|
MIMIMUM_RELEASE_AGE: () => MIMIMUM_RELEASE_AGE,
|
|
183
184
|
MonorepoProject: () => MonorepoProject,
|
|
184
185
|
PROD_DEPLOY_NAME: () => PROD_DEPLOY_NAME,
|
|
@@ -196,6 +197,7 @@ __export(index_exports, {
|
|
|
196
197
|
VERSION_NPM_PACKAGES: () => VERSION_NPM_PACKAGES,
|
|
197
198
|
VSCodeConfig: () => VSCodeConfig,
|
|
198
199
|
Vitest: () => Vitest,
|
|
200
|
+
addApproveMergeUpgradeWorkflow: () => addApproveMergeUpgradeWorkflow,
|
|
199
201
|
getLatestEligibleVersion: () => getLatestEligibleVersion
|
|
200
202
|
});
|
|
201
203
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -779,7 +781,12 @@ var VERSION_NPM_PACKAGES = [
|
|
|
779
781
|
{ key: "TURBO_VERSION", npmPackage: "turbo" },
|
|
780
782
|
{ key: "VITEST_VERSION", npmPackage: "vitest" }
|
|
781
783
|
];
|
|
782
|
-
var VERSION_KEYS_SKIP = [
|
|
784
|
+
var VERSION_KEYS_SKIP = [
|
|
785
|
+
"NODE_WORKFLOWS",
|
|
786
|
+
"VITE_VERSION",
|
|
787
|
+
"VITEST_VERSION"
|
|
788
|
+
// Pinned to 3.x for Vite 5 compatibility; skip until ESM-only (issue #142)
|
|
789
|
+
];
|
|
783
790
|
|
|
784
791
|
// src/versions.ts
|
|
785
792
|
var VERSION = {
|
|
@@ -815,10 +822,17 @@ var VERSION = {
|
|
|
815
822
|
* What version of the turborepo library should we use?
|
|
816
823
|
*/
|
|
817
824
|
TURBO_VERSION: "2.8.14",
|
|
825
|
+
/**
|
|
826
|
+
* What version of Vite to use (pnpm override). Pinned to 5.x so Vitest 4.x
|
|
827
|
+
* can load config (Vite 6+/7+ are ESM-only; see issue #142). Remove override
|
|
828
|
+
* when moving to ESM-only test setup.
|
|
829
|
+
*/
|
|
830
|
+
VITE_VERSION: "5.4.11",
|
|
818
831
|
/**
|
|
819
832
|
* What version of Vitest to use when testRunner is 'vitest'.
|
|
833
|
+
* Pinned to 3.x so it works with Vite 5 (Vitest 4 requires Vite 6). See issue #142.
|
|
820
834
|
*/
|
|
821
|
-
VITEST_VERSION: "
|
|
835
|
+
VITEST_VERSION: "3.2.4"
|
|
822
836
|
};
|
|
823
837
|
|
|
824
838
|
// src/jsii/jsii-faker.ts
|
|
@@ -1313,6 +1327,86 @@ var VSCodeConfig = class extends import_projen8.Component {
|
|
|
1313
1327
|
}
|
|
1314
1328
|
};
|
|
1315
1329
|
|
|
1330
|
+
// src/workflows/approve-merge-upgrade.ts
|
|
1331
|
+
var import_workflows_model2 = require("projen/lib/github/workflows-model");
|
|
1332
|
+
var MERGE_METHODS = {
|
|
1333
|
+
SQUASH: "squash",
|
|
1334
|
+
MERGE: "merge",
|
|
1335
|
+
REBASE: "rebase"
|
|
1336
|
+
};
|
|
1337
|
+
var DEFAULT_WORKFLOW_NAME = "approve-and-merge-upgrade";
|
|
1338
|
+
var DEFAULT_AUTO_APPROVE_LABEL = "auto-approve";
|
|
1339
|
+
var DEFAULT_HEAD_BRANCH = "github-actions/upgrade";
|
|
1340
|
+
var DEFAULT_APPROVAL_APP_ID_SECRET = "APPROVAL_APP_ID";
|
|
1341
|
+
var DEFAULT_APPROVAL_APP_PRIVATE_KEY_SECRET = "APPROVAL_APP_PRIVATE_KEY";
|
|
1342
|
+
var DEFAULT_MERGE_METHOD = MERGE_METHODS.SQUASH;
|
|
1343
|
+
var PULL_REQUEST_TARGET_TYPES = [
|
|
1344
|
+
"labeled",
|
|
1345
|
+
"synchronize",
|
|
1346
|
+
"reopened",
|
|
1347
|
+
"ready_for_review"
|
|
1348
|
+
];
|
|
1349
|
+
function addApproveMergeUpgradeWorkflow(project, options) {
|
|
1350
|
+
const workflowName = options.workflowName ?? DEFAULT_WORKFLOW_NAME;
|
|
1351
|
+
const autoApproveLabel = options.autoApproveLabel ?? DEFAULT_AUTO_APPROVE_LABEL;
|
|
1352
|
+
const headBranch = options.headBranch ?? DEFAULT_HEAD_BRANCH;
|
|
1353
|
+
const allowedUsernames = options.allowedUsernames;
|
|
1354
|
+
const appIdSecret = options.approvalAppIdSecret ?? DEFAULT_APPROVAL_APP_ID_SECRET;
|
|
1355
|
+
const privateKeySecret = options.approvalAppPrivateKeySecret ?? DEFAULT_APPROVAL_APP_PRIVATE_KEY_SECRET;
|
|
1356
|
+
const mergeMethod = options.mergeMethod ?? DEFAULT_MERGE_METHOD;
|
|
1357
|
+
const workflow = project.github?.addWorkflow(workflowName);
|
|
1358
|
+
if (!workflow) return;
|
|
1359
|
+
workflow.on({
|
|
1360
|
+
pullRequestTarget: {
|
|
1361
|
+
types: [...PULL_REQUEST_TARGET_TYPES],
|
|
1362
|
+
...options.branches && options.branches.length > 0 ? { branches: options.branches } : {}
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
const jobCondition = [
|
|
1366
|
+
`contains(github.event.pull_request.labels.*.name, '${autoApproveLabel}')`,
|
|
1367
|
+
`github.event.pull_request.head.ref == '${headBranch}'`,
|
|
1368
|
+
`(${allowedUsernames.map((u) => `github.event.pull_request.user.login == '${u}'`).join(" || ")})`
|
|
1369
|
+
].join(" && ");
|
|
1370
|
+
workflow.addJobs({
|
|
1371
|
+
"approve-and-merge": {
|
|
1372
|
+
name: "Approve and merge upgrade PR",
|
|
1373
|
+
runsOn: ["ubuntu-latest"],
|
|
1374
|
+
permissions: {
|
|
1375
|
+
pullRequests: import_workflows_model2.JobPermission.WRITE,
|
|
1376
|
+
contents: import_workflows_model2.JobPermission.WRITE
|
|
1377
|
+
},
|
|
1378
|
+
if: jobCondition,
|
|
1379
|
+
steps: [
|
|
1380
|
+
{
|
|
1381
|
+
name: "Generate token",
|
|
1382
|
+
id: "generate_token",
|
|
1383
|
+
uses: "actions/create-github-app-token@v2",
|
|
1384
|
+
with: {
|
|
1385
|
+
"app-id": `\${{ secrets.${appIdSecret} }}`,
|
|
1386
|
+
"private-key": `\${{ secrets.${privateKeySecret} }}`
|
|
1387
|
+
}
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
name: "Auto-approve",
|
|
1391
|
+
uses: "hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363",
|
|
1392
|
+
with: {
|
|
1393
|
+
"github-token": "${{ steps.generate_token.outputs.token }}"
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
name: "Enable auto-merge (squash)",
|
|
1398
|
+
uses: "peter-evans/enable-pull-request-automerge@v3",
|
|
1399
|
+
with: {
|
|
1400
|
+
token: "${{ steps.generate_token.outputs.token }}",
|
|
1401
|
+
"pull-request-number": "${{ github.event.pull_request.number }}",
|
|
1402
|
+
"merge-method": mergeMethod
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
]
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1316
1410
|
// src/projects/monorepo-project.ts
|
|
1317
1411
|
var postInstallDependenciesMap = /* @__PURE__ */ new WeakMap();
|
|
1318
1412
|
var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
|
|
@@ -1547,6 +1641,9 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
|
|
|
1547
1641
|
)
|
|
1548
1642
|
);
|
|
1549
1643
|
}
|
|
1644
|
+
if (options.approveMergeUpgradeOptions) {
|
|
1645
|
+
addApproveMergeUpgradeWorkflow(this, options.approveMergeUpgradeOptions);
|
|
1646
|
+
}
|
|
1550
1647
|
this.tasks.tryFind("post-upgrade")?.exec("pnpm upgrade -r");
|
|
1551
1648
|
this.tasks.tryFind("post-upgrade")?.spawn(this.defaultTask);
|
|
1552
1649
|
}
|
|
@@ -1613,7 +1710,7 @@ var import_utils3 = __toESM(require_lib());
|
|
|
1613
1710
|
var import_projen10 = require("projen");
|
|
1614
1711
|
var import_build = require("projen/lib/build");
|
|
1615
1712
|
var import_github = require("projen/lib/github");
|
|
1616
|
-
var
|
|
1713
|
+
var import_workflows_model3 = require("projen/lib/github/workflows-model");
|
|
1617
1714
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
1618
1715
|
var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Component {
|
|
1619
1716
|
constructor(project, options = {}) {
|
|
@@ -1842,8 +1939,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
|
|
|
1842
1939
|
],
|
|
1843
1940
|
runsOn: ["ubuntu-latest"],
|
|
1844
1941
|
permissions: {
|
|
1845
|
-
contents:
|
|
1846
|
-
idToken:
|
|
1942
|
+
contents: import_workflows_model3.JobPermission.READ,
|
|
1943
|
+
idToken: import_workflows_model3.JobPermission.WRITE
|
|
1847
1944
|
},
|
|
1848
1945
|
concurrency: deployJobName,
|
|
1849
1946
|
if: jobCondition,
|
|
@@ -1883,6 +1980,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
|
|
|
1883
1980
|
AwsDeploymentConfig,
|
|
1884
1981
|
AwsDeploymentTarget,
|
|
1885
1982
|
JsiiFaker,
|
|
1983
|
+
MERGE_METHODS,
|
|
1886
1984
|
MIMIMUM_RELEASE_AGE,
|
|
1887
1985
|
MonorepoProject,
|
|
1888
1986
|
PROD_DEPLOY_NAME,
|
|
@@ -1900,6 +1998,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
|
|
|
1900
1998
|
VERSION_NPM_PACKAGES,
|
|
1901
1999
|
VSCodeConfig,
|
|
1902
2000
|
Vitest,
|
|
2001
|
+
addApproveMergeUpgradeWorkflow,
|
|
1903
2002
|
getLatestEligibleVersion
|
|
1904
2003
|
});
|
|
1905
2004
|
//# sourceMappingURL=index.js.map
|