@codedrifters/configulator 0.0.90 → 0.0.91
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 +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +140 -21
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +133 -15
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.mts
CHANGED
|
@@ -1343,4 +1343,4 @@ declare class AwsDeployWorkflow extends Component {
|
|
|
1343
1343
|
preSynthesize(): void;
|
|
1344
1344
|
}
|
|
1345
1345
|
|
|
1346
|
-
export { type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, type AwsOrganization, type AwsRegion, 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, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VSCodeConfig };
|
|
1346
|
+
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, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VSCodeConfig };
|
package/lib/index.d.ts
CHANGED
|
@@ -1392,5 +1392,5 @@ declare class AwsDeployWorkflow extends Component {
|
|
|
1392
1392
|
preSynthesize(): void;
|
|
1393
1393
|
}
|
|
1394
1394
|
|
|
1395
|
-
export { AwsDeployWorkflow, AwsDeploymentConfig, JsiiFaker, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VSCodeConfig };
|
|
1396
|
-
export type { AwsAccount, AwsOrganization, AwsRegion, ClassTypeOptions, DeployWorkflowOptions, GitBranch, IDependencyResolver, MonorepoProjectOptions, PnpmWorkspaceOptions, RemoteCacheOptions, ResetTaskOptions, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions };
|
|
1395
|
+
export { AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, JsiiFaker, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VSCodeConfig };
|
|
1396
|
+
export type { AwsAccount, AwsDeploymentTargetOptions, AwsLocalDeploymentConfig, AwsOrganization, AwsRegion, CiDeploymentConfig, ClassTypeOptions, DeployWorkflowOptions, GitBranch, IDependencyResolver, MonorepoProjectOptions, PnpmWorkspaceOptions, RemoteCacheOptions, ResetTaskOptions, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions };
|
package/lib/index.js
CHANGED
|
@@ -177,6 +177,7 @@ var index_exports = {};
|
|
|
177
177
|
__export(index_exports, {
|
|
178
178
|
AwsDeployWorkflow: () => AwsDeployWorkflow,
|
|
179
179
|
AwsDeploymentConfig: () => AwsDeploymentConfig,
|
|
180
|
+
AwsDeploymentTarget: () => AwsDeploymentTarget,
|
|
180
181
|
JsiiFaker: () => JsiiFaker,
|
|
181
182
|
MIMIMUM_RELEASE_AGE: () => MIMIMUM_RELEASE_AGE,
|
|
182
183
|
MonorepoProject: () => MonorepoProject,
|
|
@@ -549,6 +550,123 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen.Compo
|
|
|
549
550
|
}
|
|
550
551
|
};
|
|
551
552
|
|
|
553
|
+
// src/aws/aws-deployment-target.ts
|
|
554
|
+
var import_utils2 = __toESM(require_lib());
|
|
555
|
+
var import_projen2 = require("projen");
|
|
556
|
+
var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen2.Component {
|
|
557
|
+
constructor(project, options) {
|
|
558
|
+
super(project);
|
|
559
|
+
/**
|
|
560
|
+
* The AWS profile to use for this deployment target.
|
|
561
|
+
*
|
|
562
|
+
* @default ['main'] when prod release type, ['feature/*'] when dev type
|
|
563
|
+
*/
|
|
564
|
+
this.branches = [];
|
|
565
|
+
/*****************************************************************************
|
|
566
|
+
*
|
|
567
|
+
* Deploy Tasks
|
|
568
|
+
*
|
|
569
|
+
* - If local deploy, add a deploy task.
|
|
570
|
+
*
|
|
571
|
+
****************************************************************************/
|
|
572
|
+
this.configureDeployTask = () => {
|
|
573
|
+
if (this.localDeployment) {
|
|
574
|
+
const taskName = [
|
|
575
|
+
"deploy",
|
|
576
|
+
this.awsStageType,
|
|
577
|
+
this.account,
|
|
578
|
+
this.region
|
|
579
|
+
].join(":");
|
|
580
|
+
const deployTask = this.project.tasks.addTask(taskName, {
|
|
581
|
+
env: this.awsDeploymentConfig.env
|
|
582
|
+
});
|
|
583
|
+
deployTask.exec(
|
|
584
|
+
`cdk deploy --lookups=false --require-approval=never --profile=${this.localDeploymentConfig?.profile} --app=${this.awsDeploymentConfig.cdkOut} "${this.localDeploymentConfig?.stackPattern}"`
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
/*****************************************************************************
|
|
589
|
+
*
|
|
590
|
+
* Watch tasks
|
|
591
|
+
*
|
|
592
|
+
* - Configure watch task to use the branch name
|
|
593
|
+
* - configure watch task to use the correct synth output location.
|
|
594
|
+
*
|
|
595
|
+
****************************************************************************/
|
|
596
|
+
this.configureWatchTask = () => {
|
|
597
|
+
if (this.localDeployment) {
|
|
598
|
+
const taskName = [
|
|
599
|
+
"watch",
|
|
600
|
+
this.awsStageType,
|
|
601
|
+
this.account,
|
|
602
|
+
this.region
|
|
603
|
+
].join(":");
|
|
604
|
+
const watchTask = this.project.tasks.addTask(taskName, {
|
|
605
|
+
env: this.awsDeploymentConfig.env
|
|
606
|
+
});
|
|
607
|
+
const synthSilent = this.project.tasks.tryFind("synth:silent");
|
|
608
|
+
if (synthSilent) {
|
|
609
|
+
watchTask.spawn(synthSilent);
|
|
610
|
+
}
|
|
611
|
+
watchTask.exec(
|
|
612
|
+
`cdk deploy --lookups=false --require-approval=never --profile=${this.localDeploymentConfig?.profile} --app=${this.awsDeploymentConfig.cdkOut} "${this.localDeploymentConfig?.stackPattern}"`
|
|
613
|
+
);
|
|
614
|
+
watchTask.exec(
|
|
615
|
+
`cdk watch --lookups=false --require-approval=never --hotswap --profile=${this.localDeploymentConfig?.profile} "${this.localDeploymentConfig?.stackPattern}"`
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
this.account = options.account;
|
|
620
|
+
this.region = options.region;
|
|
621
|
+
this.awsStageType = options.awsStageType || import_utils2.AWS_STAGE_TYPE.DEV;
|
|
622
|
+
const role = options.deploymentTargetRole ?? options.awsEnvironmentType ?? import_utils2.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
623
|
+
this.deploymentTargetRole = role;
|
|
624
|
+
this.awsEnvironmentType = role;
|
|
625
|
+
this.branches = options.branches ?? (this.awsStageType === import_utils2.AWS_STAGE_TYPE.PROD ? [
|
|
626
|
+
{
|
|
627
|
+
branch: "main"
|
|
628
|
+
}
|
|
629
|
+
] : [
|
|
630
|
+
{
|
|
631
|
+
branch: "feature/*"
|
|
632
|
+
}
|
|
633
|
+
]);
|
|
634
|
+
this.localDeployment = options.localDeployment ?? this.awsStageType === import_utils2.AWS_STAGE_TYPE.DEV;
|
|
635
|
+
if (this.localDeployment) {
|
|
636
|
+
const roleName = options.localDeploymentConfig?.roleName?.toLowerCase() || "poweruseraccess";
|
|
637
|
+
const profile = options.localDeploymentConfig?.profile || `${roleName}-${this.awsStageType}-${this.account}-${this.region}`;
|
|
638
|
+
const stackPattern = options.localDeploymentConfig?.stackPattern || `${this.awsStageType}/${this.awsEnvironmentType}/*-${this.account}-${this.region}`;
|
|
639
|
+
this.localDeploymentConfig = {
|
|
640
|
+
profile,
|
|
641
|
+
roleName,
|
|
642
|
+
stackPattern,
|
|
643
|
+
...options.localDeploymentConfig
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
this.ciDeployment = options.ciDeployment ?? false;
|
|
647
|
+
if (this.ciDeployment) {
|
|
648
|
+
const roleArn = options.ciDeploymentConfig?.roleArn || `arn:aws:iam::${this.account}:role/GitHubDeployer}`;
|
|
649
|
+
const stackPattern = options.ciDeploymentConfig?.stackPattern || `${this.awsStageType}/${this.awsEnvironmentType}/*-${this.account}-${this.region}`;
|
|
650
|
+
this.ciDeploymentConfig = {
|
|
651
|
+
roleArn,
|
|
652
|
+
stackPattern,
|
|
653
|
+
...options.ciDeploymentConfig
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
this.awsDeploymentConfig = AwsDeploymentConfig.of(project) || new AwsDeploymentConfig(project);
|
|
657
|
+
this.awsDeploymentConfig.awsDeploymentTargets.push(this);
|
|
658
|
+
this.configureDeployTask();
|
|
659
|
+
this.configureWatchTask();
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Static method to discovert targets in a project.
|
|
663
|
+
*/
|
|
664
|
+
static of(project) {
|
|
665
|
+
const isDefined = (c) => c instanceof _AwsDeploymentTarget;
|
|
666
|
+
return project.components.filter(isDefined);
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
|
|
552
670
|
// src/versions.ts
|
|
553
671
|
var VERSION = {
|
|
554
672
|
/**
|
|
@@ -587,12 +705,12 @@ var VERSION = {
|
|
|
587
705
|
|
|
588
706
|
// src/jsii/jsii-faker.ts
|
|
589
707
|
var spec = __toESM(require("@jsii/spec"));
|
|
590
|
-
var
|
|
708
|
+
var import_projen3 = require("projen");
|
|
591
709
|
var ProjenBaseFqn = {
|
|
592
710
|
TYPESCRIPT_PROJECT: "projen.typescript.TypeScriptProject",
|
|
593
711
|
TYPESCRIPT_PROJECT_OPTIONS: "projen.typescript.TypeScriptProjectOptions"
|
|
594
712
|
};
|
|
595
|
-
var JsiiFaker = class _JsiiFaker extends
|
|
713
|
+
var JsiiFaker = class _JsiiFaker extends import_projen3.Component {
|
|
596
714
|
constructor(project) {
|
|
597
715
|
super(project);
|
|
598
716
|
this.project = project;
|
|
@@ -603,7 +721,7 @@ var JsiiFaker = class _JsiiFaker extends import_projen2.Component {
|
|
|
603
721
|
};
|
|
604
722
|
};
|
|
605
723
|
this._assemblyName = this.project.package.packageName;
|
|
606
|
-
new
|
|
724
|
+
new import_projen3.JsonFile(project, ".jsii", {
|
|
607
725
|
obj: () => {
|
|
608
726
|
return {
|
|
609
727
|
name: this._assemblyName,
|
|
@@ -642,7 +760,7 @@ var JsiiFaker = class _JsiiFaker extends import_projen2.Component {
|
|
|
642
760
|
|
|
643
761
|
// src/pnpm/pnpm-workspace.ts
|
|
644
762
|
var import_path = require("path");
|
|
645
|
-
var
|
|
763
|
+
var import_projen4 = require("projen");
|
|
646
764
|
var MIMIMUM_RELEASE_AGE = {
|
|
647
765
|
ZERO_DAYS: 0,
|
|
648
766
|
ONE_HOUR: 60,
|
|
@@ -656,7 +774,7 @@ var MIMIMUM_RELEASE_AGE = {
|
|
|
656
774
|
SIX_DAYS: 8640,
|
|
657
775
|
ONE_WEEK: 10080
|
|
658
776
|
};
|
|
659
|
-
var PnpmWorkspace = class _PnpmWorkspace extends
|
|
777
|
+
var PnpmWorkspace = class _PnpmWorkspace extends import_projen4.Component {
|
|
660
778
|
/**
|
|
661
779
|
* Get the pnpm workspace component of a project. If it does not exist,
|
|
662
780
|
* return undefined.
|
|
@@ -680,7 +798,7 @@ var PnpmWorkspace = class _PnpmWorkspace extends import_projen3.Component {
|
|
|
680
798
|
this.defaultCatalog = options.defaultCatalog;
|
|
681
799
|
this.namedCatalogs = options.namedCatalogs;
|
|
682
800
|
project.addPackageIgnore(this.fileName);
|
|
683
|
-
new
|
|
801
|
+
new import_projen4.YamlFile(this.project, this.fileName, {
|
|
684
802
|
obj: () => {
|
|
685
803
|
const pnpmConfig = {};
|
|
686
804
|
const packages = new Array();
|
|
@@ -726,14 +844,14 @@ var import_typescript = require("projen/lib/typescript");
|
|
|
726
844
|
var import_ts_deepmerge2 = require("ts-deepmerge");
|
|
727
845
|
|
|
728
846
|
// src/tasks/reset-task.ts
|
|
729
|
-
var
|
|
847
|
+
var import_projen6 = require("projen");
|
|
730
848
|
|
|
731
849
|
// src/projects/typescript-project.ts
|
|
732
|
-
var
|
|
850
|
+
var import_projen5 = require("projen");
|
|
733
851
|
var import_javascript = require("projen/lib/javascript");
|
|
734
852
|
var import_release = require("projen/lib/release");
|
|
735
853
|
var import_ts_deepmerge = require("ts-deepmerge");
|
|
736
|
-
var TypeScriptProject = class extends
|
|
854
|
+
var TypeScriptProject = class extends import_projen5.typescript.TypeScriptProject {
|
|
737
855
|
constructor(userOptions) {
|
|
738
856
|
const pnpmVersion = userOptions.parent && userOptions.parent instanceof MonorepoProject ? userOptions.parent.pnpmVersion : VERSION.PNPM_VERSION;
|
|
739
857
|
const pnpmWorkspace = userOptions.parent && userOptions.parent instanceof MonorepoProject ? PnpmWorkspace.of(userOptions.parent) : void 0;
|
|
@@ -870,7 +988,7 @@ var TypeScriptProject = class extends import_projen4.typescript.TypeScriptProjec
|
|
|
870
988
|
};
|
|
871
989
|
|
|
872
990
|
// src/tasks/reset-task.ts
|
|
873
|
-
var ResetTask = class _ResetTask extends
|
|
991
|
+
var ResetTask = class _ResetTask extends import_projen6.Component {
|
|
874
992
|
constructor(project, options = {}) {
|
|
875
993
|
super(project);
|
|
876
994
|
this.project = project;
|
|
@@ -943,12 +1061,12 @@ var ResetTask = class _ResetTask extends import_projen5.Component {
|
|
|
943
1061
|
};
|
|
944
1062
|
|
|
945
1063
|
// src/vscode/vscode.ts
|
|
946
|
-
var
|
|
947
|
-
var VSCodeConfig = class extends
|
|
1064
|
+
var import_projen7 = require("projen");
|
|
1065
|
+
var VSCodeConfig = class extends import_projen7.Component {
|
|
948
1066
|
constructor(project) {
|
|
949
1067
|
super(project);
|
|
950
|
-
const vsConfig = new
|
|
951
|
-
const vsSettings = new
|
|
1068
|
+
const vsConfig = new import_projen7.vscode.VsCode(project);
|
|
1069
|
+
const vsSettings = new import_projen7.vscode.VsCodeSettings(vsConfig);
|
|
952
1070
|
vsSettings.addSetting("editor.tabSize", 2);
|
|
953
1071
|
vsSettings.addSetting("editor.detectIndentation", false);
|
|
954
1072
|
vsSettings.addSetting("editor.bracketPairColorization.enabled", true);
|
|
@@ -1212,9 +1330,9 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
|
|
|
1212
1330
|
|
|
1213
1331
|
// src/typescript/typescript-config.ts
|
|
1214
1332
|
var import_node_path2 = require("path");
|
|
1215
|
-
var
|
|
1333
|
+
var import_projen8 = require("projen");
|
|
1216
1334
|
var import_path2 = require("projen/lib/util/path");
|
|
1217
|
-
var TypeScriptConfig = class extends
|
|
1335
|
+
var TypeScriptConfig = class extends import_projen8.Component {
|
|
1218
1336
|
constructor(project) {
|
|
1219
1337
|
super(project);
|
|
1220
1338
|
let tsPaths = {};
|
|
@@ -1241,13 +1359,13 @@ var TypeScriptConfig = class extends import_projen7.Component {
|
|
|
1241
1359
|
};
|
|
1242
1360
|
|
|
1243
1361
|
// src/workflows/aws-deploy-workflow.ts
|
|
1244
|
-
var
|
|
1245
|
-
var
|
|
1362
|
+
var import_utils3 = __toESM(require_lib());
|
|
1363
|
+
var import_projen9 = require("projen");
|
|
1246
1364
|
var import_build = require("projen/lib/build");
|
|
1247
1365
|
var import_github = require("projen/lib/github");
|
|
1248
1366
|
var import_workflows_model2 = require("projen/lib/github/workflows-model");
|
|
1249
1367
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
1250
|
-
var AwsDeployWorkflow = class _AwsDeployWorkflow extends
|
|
1368
|
+
var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen9.Component {
|
|
1251
1369
|
constructor(project, options = {}) {
|
|
1252
1370
|
super(project);
|
|
1253
1371
|
this.project = project;
|
|
@@ -1257,7 +1375,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen8.Componen
|
|
|
1257
1375
|
* @deprecated Use deployment target role terminology elsewhere. This property is maintained for backward compatibility.
|
|
1258
1376
|
* @default 'primary' (this is the only type supported currently)
|
|
1259
1377
|
*/
|
|
1260
|
-
this.awsEnvironmentType =
|
|
1378
|
+
this.awsEnvironmentType = import_utils3.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
1261
1379
|
this.setupNode = () => {
|
|
1262
1380
|
return [
|
|
1263
1381
|
{
|
|
@@ -1366,7 +1484,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen8.Componen
|
|
|
1366
1484
|
}
|
|
1367
1485
|
const turbo = TurboRepo.of(this.rootProject);
|
|
1368
1486
|
const buildWorkflowOptions = turbo?.remoteCacheOptions ? TurboRepo.buildWorkflowOptions(turbo.remoteCacheOptions) : {};
|
|
1369
|
-
this.awsStageType = options.awsStageType ??
|
|
1487
|
+
this.awsStageType = options.awsStageType ?? import_utils3.AWS_STAGE_TYPE.DEV;
|
|
1370
1488
|
this.awsDeploymentTargets = options.awsDeploymentTargets ?? AwsDeploymentConfig.of(project)?.awsDeploymentTargets.filter(
|
|
1371
1489
|
(target) => target.awsStageType === this.awsStageType && target.ciDeployment
|
|
1372
1490
|
) ?? [];
|
|
@@ -1491,6 +1609,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen8.Componen
|
|
|
1491
1609
|
0 && (module.exports = {
|
|
1492
1610
|
AwsDeployWorkflow,
|
|
1493
1611
|
AwsDeploymentConfig,
|
|
1612
|
+
AwsDeploymentTarget,
|
|
1494
1613
|
JsiiFaker,
|
|
1495
1614
|
MIMIMUM_RELEASE_AGE,
|
|
1496
1615
|
MonorepoProject,
|