@codedrifters/configulator 0.0.90 → 0.0.92
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 +3 -3
- package/lib/index.d.ts +4 -4
- package/lib/index.js +142 -23
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +135 -17
- package/lib/index.mjs.map +1 -1
- package/package.json +8 -8
package/lib/index.mjs
CHANGED
|
@@ -527,6 +527,123 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component3 {
|
|
|
527
527
|
}
|
|
528
528
|
};
|
|
529
529
|
|
|
530
|
+
// src/aws/aws-deployment-target.ts
|
|
531
|
+
var import_utils2 = __toESM(require_lib());
|
|
532
|
+
import { Component as Component4 } from "projen";
|
|
533
|
+
var AwsDeploymentTarget = class _AwsDeploymentTarget extends Component4 {
|
|
534
|
+
constructor(project, options) {
|
|
535
|
+
super(project);
|
|
536
|
+
/**
|
|
537
|
+
* The AWS profile to use for this deployment target.
|
|
538
|
+
*
|
|
539
|
+
* @default ['main'] when prod release type, ['feature/*'] when dev type
|
|
540
|
+
*/
|
|
541
|
+
this.branches = [];
|
|
542
|
+
/*****************************************************************************
|
|
543
|
+
*
|
|
544
|
+
* Deploy Tasks
|
|
545
|
+
*
|
|
546
|
+
* - If local deploy, add a deploy task.
|
|
547
|
+
*
|
|
548
|
+
****************************************************************************/
|
|
549
|
+
this.configureDeployTask = () => {
|
|
550
|
+
if (this.localDeployment) {
|
|
551
|
+
const taskName = [
|
|
552
|
+
"deploy",
|
|
553
|
+
this.awsStageType,
|
|
554
|
+
this.account,
|
|
555
|
+
this.region
|
|
556
|
+
].join(":");
|
|
557
|
+
const deployTask = this.project.tasks.addTask(taskName, {
|
|
558
|
+
env: this.awsDeploymentConfig.env
|
|
559
|
+
});
|
|
560
|
+
deployTask.exec(
|
|
561
|
+
`cdk deploy --lookups=false --require-approval=never --profile=${this.localDeploymentConfig?.profile} --app=${this.awsDeploymentConfig.cdkOut} "${this.localDeploymentConfig?.stackPattern}"`
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
/*****************************************************************************
|
|
566
|
+
*
|
|
567
|
+
* Watch tasks
|
|
568
|
+
*
|
|
569
|
+
* - Configure watch task to use the branch name
|
|
570
|
+
* - configure watch task to use the correct synth output location.
|
|
571
|
+
*
|
|
572
|
+
****************************************************************************/
|
|
573
|
+
this.configureWatchTask = () => {
|
|
574
|
+
if (this.localDeployment) {
|
|
575
|
+
const taskName = [
|
|
576
|
+
"watch",
|
|
577
|
+
this.awsStageType,
|
|
578
|
+
this.account,
|
|
579
|
+
this.region
|
|
580
|
+
].join(":");
|
|
581
|
+
const watchTask = this.project.tasks.addTask(taskName, {
|
|
582
|
+
env: this.awsDeploymentConfig.env
|
|
583
|
+
});
|
|
584
|
+
const synthSilent = this.project.tasks.tryFind("synth:silent");
|
|
585
|
+
if (synthSilent) {
|
|
586
|
+
watchTask.spawn(synthSilent);
|
|
587
|
+
}
|
|
588
|
+
watchTask.exec(
|
|
589
|
+
`cdk deploy --lookups=false --require-approval=never --profile=${this.localDeploymentConfig?.profile} --app=${this.awsDeploymentConfig.cdkOut} "${this.localDeploymentConfig?.stackPattern}"`
|
|
590
|
+
);
|
|
591
|
+
watchTask.exec(
|
|
592
|
+
`cdk watch --lookups=false --require-approval=never --hotswap --profile=${this.localDeploymentConfig?.profile} "${this.localDeploymentConfig?.stackPattern}"`
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
this.account = options.account;
|
|
597
|
+
this.region = options.region;
|
|
598
|
+
this.awsStageType = options.awsStageType || import_utils2.AWS_STAGE_TYPE.DEV;
|
|
599
|
+
const role = options.deploymentTargetRole ?? options.awsEnvironmentType ?? import_utils2.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
600
|
+
this.deploymentTargetRole = role;
|
|
601
|
+
this.awsEnvironmentType = role;
|
|
602
|
+
this.branches = options.branches ?? (this.awsStageType === import_utils2.AWS_STAGE_TYPE.PROD ? [
|
|
603
|
+
{
|
|
604
|
+
branch: "main"
|
|
605
|
+
}
|
|
606
|
+
] : [
|
|
607
|
+
{
|
|
608
|
+
branch: "feature/*"
|
|
609
|
+
}
|
|
610
|
+
]);
|
|
611
|
+
this.localDeployment = options.localDeployment ?? this.awsStageType === import_utils2.AWS_STAGE_TYPE.DEV;
|
|
612
|
+
if (this.localDeployment) {
|
|
613
|
+
const roleName = options.localDeploymentConfig?.roleName?.toLowerCase() || "poweruseraccess";
|
|
614
|
+
const profile = options.localDeploymentConfig?.profile || `${roleName}-${this.awsStageType}-${this.account}-${this.region}`;
|
|
615
|
+
const stackPattern = options.localDeploymentConfig?.stackPattern || `${this.awsStageType}/${this.awsEnvironmentType}/*-${this.account}-${this.region}`;
|
|
616
|
+
this.localDeploymentConfig = {
|
|
617
|
+
profile,
|
|
618
|
+
roleName,
|
|
619
|
+
stackPattern,
|
|
620
|
+
...options.localDeploymentConfig
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
this.ciDeployment = options.ciDeployment ?? false;
|
|
624
|
+
if (this.ciDeployment) {
|
|
625
|
+
const roleArn = options.ciDeploymentConfig?.roleArn || `arn:aws:iam::${this.account}:role/GitHubDeployer}`;
|
|
626
|
+
const stackPattern = options.ciDeploymentConfig?.stackPattern || `${this.awsStageType}/${this.awsEnvironmentType}/*-${this.account}-${this.region}`;
|
|
627
|
+
this.ciDeploymentConfig = {
|
|
628
|
+
roleArn,
|
|
629
|
+
stackPattern,
|
|
630
|
+
...options.ciDeploymentConfig
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
this.awsDeploymentConfig = AwsDeploymentConfig.of(project) || new AwsDeploymentConfig(project);
|
|
634
|
+
this.awsDeploymentConfig.awsDeploymentTargets.push(this);
|
|
635
|
+
this.configureDeployTask();
|
|
636
|
+
this.configureWatchTask();
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Static method to discovert targets in a project.
|
|
640
|
+
*/
|
|
641
|
+
static of(project) {
|
|
642
|
+
const isDefined = (c) => c instanceof _AwsDeploymentTarget;
|
|
643
|
+
return project.components.filter(isDefined);
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
|
|
530
647
|
// src/versions.ts
|
|
531
648
|
var VERSION = {
|
|
532
649
|
/**
|
|
@@ -534,7 +651,7 @@ var VERSION = {
|
|
|
534
651
|
*
|
|
535
652
|
* CLI and lib are versioned separately, so this is the CLI version.
|
|
536
653
|
*/
|
|
537
|
-
AWS_CDK_CLI_VERSION: "2.
|
|
654
|
+
AWS_CDK_CLI_VERSION: "2.1105.0",
|
|
538
655
|
/**
|
|
539
656
|
* CDK Version to use for construct projects.
|
|
540
657
|
*
|
|
@@ -556,7 +673,7 @@ var VERSION = {
|
|
|
556
673
|
/**
|
|
557
674
|
* Version of Projen to use.
|
|
558
675
|
*/
|
|
559
|
-
PROJEN_VERSION: "0.99.
|
|
676
|
+
PROJEN_VERSION: "0.99.11",
|
|
560
677
|
/**
|
|
561
678
|
* What version of the turborepo library should we use?
|
|
562
679
|
*/
|
|
@@ -565,12 +682,12 @@ var VERSION = {
|
|
|
565
682
|
|
|
566
683
|
// src/jsii/jsii-faker.ts
|
|
567
684
|
import * as spec from "@jsii/spec";
|
|
568
|
-
import { Component as
|
|
685
|
+
import { Component as Component5, JsonFile as JsonFile2 } from "projen";
|
|
569
686
|
var ProjenBaseFqn = {
|
|
570
687
|
TYPESCRIPT_PROJECT: "projen.typescript.TypeScriptProject",
|
|
571
688
|
TYPESCRIPT_PROJECT_OPTIONS: "projen.typescript.TypeScriptProjectOptions"
|
|
572
689
|
};
|
|
573
|
-
var JsiiFaker = class _JsiiFaker extends
|
|
690
|
+
var JsiiFaker = class _JsiiFaker extends Component5 {
|
|
574
691
|
constructor(project) {
|
|
575
692
|
super(project);
|
|
576
693
|
this.project = project;
|
|
@@ -620,7 +737,7 @@ var JsiiFaker = class _JsiiFaker extends Component4 {
|
|
|
620
737
|
|
|
621
738
|
// src/pnpm/pnpm-workspace.ts
|
|
622
739
|
import { relative as relative2 } from "path";
|
|
623
|
-
import { Component as
|
|
740
|
+
import { Component as Component6, YamlFile } from "projen";
|
|
624
741
|
var MIMIMUM_RELEASE_AGE = {
|
|
625
742
|
ZERO_DAYS: 0,
|
|
626
743
|
ONE_HOUR: 60,
|
|
@@ -634,7 +751,7 @@ var MIMIMUM_RELEASE_AGE = {
|
|
|
634
751
|
SIX_DAYS: 8640,
|
|
635
752
|
ONE_WEEK: 10080
|
|
636
753
|
};
|
|
637
|
-
var PnpmWorkspace = class _PnpmWorkspace extends
|
|
754
|
+
var PnpmWorkspace = class _PnpmWorkspace extends Component6 {
|
|
638
755
|
/**
|
|
639
756
|
* Get the pnpm workspace component of a project. If it does not exist,
|
|
640
757
|
* return undefined.
|
|
@@ -710,7 +827,7 @@ import {
|
|
|
710
827
|
import { merge as merge2 } from "ts-deepmerge";
|
|
711
828
|
|
|
712
829
|
// src/tasks/reset-task.ts
|
|
713
|
-
import { Component as
|
|
830
|
+
import { Component as Component7 } from "projen";
|
|
714
831
|
|
|
715
832
|
// src/projects/typescript-project.ts
|
|
716
833
|
import { typescript } from "projen";
|
|
@@ -858,7 +975,7 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
|
|
|
858
975
|
};
|
|
859
976
|
|
|
860
977
|
// src/tasks/reset-task.ts
|
|
861
|
-
var ResetTask = class _ResetTask extends
|
|
978
|
+
var ResetTask = class _ResetTask extends Component7 {
|
|
862
979
|
constructor(project, options = {}) {
|
|
863
980
|
super(project);
|
|
864
981
|
this.project = project;
|
|
@@ -931,8 +1048,8 @@ var ResetTask = class _ResetTask extends Component6 {
|
|
|
931
1048
|
};
|
|
932
1049
|
|
|
933
1050
|
// src/vscode/vscode.ts
|
|
934
|
-
import { Component as
|
|
935
|
-
var VSCodeConfig = class extends
|
|
1051
|
+
import { Component as Component8, vscode } from "projen";
|
|
1052
|
+
var VSCodeConfig = class extends Component8 {
|
|
936
1053
|
constructor(project) {
|
|
937
1054
|
super(project);
|
|
938
1055
|
const vsConfig = new vscode.VsCode(project);
|
|
@@ -1200,9 +1317,9 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
1200
1317
|
|
|
1201
1318
|
// src/typescript/typescript-config.ts
|
|
1202
1319
|
import { relative as relative3 } from "path";
|
|
1203
|
-
import { Component as
|
|
1320
|
+
import { Component as Component9 } from "projen";
|
|
1204
1321
|
import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
|
|
1205
|
-
var TypeScriptConfig = class extends
|
|
1322
|
+
var TypeScriptConfig = class extends Component9 {
|
|
1206
1323
|
constructor(project) {
|
|
1207
1324
|
super(project);
|
|
1208
1325
|
let tsPaths = {};
|
|
@@ -1229,13 +1346,13 @@ var TypeScriptConfig = class extends Component8 {
|
|
|
1229
1346
|
};
|
|
1230
1347
|
|
|
1231
1348
|
// src/workflows/aws-deploy-workflow.ts
|
|
1232
|
-
var
|
|
1233
|
-
import { Component as
|
|
1349
|
+
var import_utils3 = __toESM(require_lib());
|
|
1350
|
+
import { Component as Component10 } from "projen";
|
|
1234
1351
|
import { BuildWorkflow } from "projen/lib/build";
|
|
1235
1352
|
import { GitHub } from "projen/lib/github";
|
|
1236
1353
|
import { JobPermission as JobPermission2 } from "projen/lib/github/workflows-model";
|
|
1237
1354
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
1238
|
-
var AwsDeployWorkflow = class _AwsDeployWorkflow extends
|
|
1355
|
+
var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component10 {
|
|
1239
1356
|
constructor(project, options = {}) {
|
|
1240
1357
|
super(project);
|
|
1241
1358
|
this.project = project;
|
|
@@ -1245,7 +1362,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component9 {
|
|
|
1245
1362
|
* @deprecated Use deployment target role terminology elsewhere. This property is maintained for backward compatibility.
|
|
1246
1363
|
* @default 'primary' (this is the only type supported currently)
|
|
1247
1364
|
*/
|
|
1248
|
-
this.awsEnvironmentType =
|
|
1365
|
+
this.awsEnvironmentType = import_utils3.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
1249
1366
|
this.setupNode = () => {
|
|
1250
1367
|
return [
|
|
1251
1368
|
{
|
|
@@ -1354,7 +1471,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component9 {
|
|
|
1354
1471
|
}
|
|
1355
1472
|
const turbo = TurboRepo.of(this.rootProject);
|
|
1356
1473
|
const buildWorkflowOptions = turbo?.remoteCacheOptions ? TurboRepo.buildWorkflowOptions(turbo.remoteCacheOptions) : {};
|
|
1357
|
-
this.awsStageType = options.awsStageType ??
|
|
1474
|
+
this.awsStageType = options.awsStageType ?? import_utils3.AWS_STAGE_TYPE.DEV;
|
|
1358
1475
|
this.awsDeploymentTargets = options.awsDeploymentTargets ?? AwsDeploymentConfig.of(project)?.awsDeploymentTargets.filter(
|
|
1359
1476
|
(target) => target.awsStageType === this.awsStageType && target.ciDeployment
|
|
1360
1477
|
) ?? [];
|
|
@@ -1478,6 +1595,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component9 {
|
|
|
1478
1595
|
export {
|
|
1479
1596
|
AwsDeployWorkflow,
|
|
1480
1597
|
AwsDeploymentConfig,
|
|
1598
|
+
AwsDeploymentTarget,
|
|
1481
1599
|
JsiiFaker,
|
|
1482
1600
|
MIMIMUM_RELEASE_AGE,
|
|
1483
1601
|
MonorepoProject,
|