@codedrifters/configulator 0.0.195 → 0.0.196
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 +166 -84
- package/lib/index.d.ts +166 -84
- package/lib/index.js +237 -33
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +240 -33
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -182,6 +182,7 @@ __export(index_exports, {
|
|
|
182
182
|
AstroConfig: () => AstroConfig,
|
|
183
183
|
AstroOutput: () => AstroOutput,
|
|
184
184
|
AstroProject: () => AstroProject,
|
|
185
|
+
AwsCdkProject: () => AwsCdkProject,
|
|
185
186
|
AwsDeployWorkflow: () => AwsDeployWorkflow,
|
|
186
187
|
AwsDeploymentConfig: () => AwsDeploymentConfig,
|
|
187
188
|
AwsDeploymentTarget: () => AwsDeploymentTarget,
|
|
@@ -5639,8 +5640,14 @@ var TestRunner = {
|
|
|
5639
5640
|
};
|
|
5640
5641
|
var TypeScriptProject = class extends import_projen16.typescript.TypeScriptProject {
|
|
5641
5642
|
constructor(userOptions) {
|
|
5642
|
-
|
|
5643
|
-
|
|
5643
|
+
if (!(userOptions.parent instanceof MonorepoProject)) {
|
|
5644
|
+
throw new Error(
|
|
5645
|
+
"TypeScriptProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
|
|
5646
|
+
);
|
|
5647
|
+
}
|
|
5648
|
+
const parent = userOptions.parent;
|
|
5649
|
+
const pnpmVersion = parent.pnpmVersion;
|
|
5650
|
+
const pnpmWorkspace = PnpmWorkspace.of(parent);
|
|
5644
5651
|
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
5645
5652
|
const useJest = testRunner === TestRunner.JEST;
|
|
5646
5653
|
const defaultOptions = {
|
|
@@ -5906,44 +5913,20 @@ var DEFAULT_INDEX_ASTRO = `---
|
|
|
5906
5913
|
var DEFAULT_FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path d="M64 8a56 56 0 1 0 0 112A56 56 0 0 0 64 8Z" fill="#ff5d01"/></svg>
|
|
5907
5914
|
`;
|
|
5908
5915
|
|
|
5909
|
-
// src/
|
|
5910
|
-
var
|
|
5911
|
-
var
|
|
5912
|
-
var
|
|
5913
|
-
var
|
|
5914
|
-
constructor(project) {
|
|
5915
|
-
super(project);
|
|
5916
|
-
let tsPaths = {};
|
|
5917
|
-
const workspaceDeps = project.deps.all.filter(
|
|
5918
|
-
(d) => d.version === "workspace:*"
|
|
5919
|
-
);
|
|
5920
|
-
workspaceDeps.forEach((dep) => {
|
|
5921
|
-
const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
|
|
5922
|
-
if (!subproject) {
|
|
5923
|
-
throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
|
|
5924
|
-
}
|
|
5925
|
-
tsPaths = {
|
|
5926
|
-
...tsPaths,
|
|
5927
|
-
[dep.name]: [
|
|
5928
|
-
(0, import_path2.ensureRelativePathStartsWithDot)(
|
|
5929
|
-
(0, import_node_path2.relative)(project.outdir, subproject.outdir)
|
|
5930
|
-
)
|
|
5931
|
-
]
|
|
5932
|
-
};
|
|
5933
|
-
});
|
|
5934
|
-
project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
5935
|
-
project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
5936
|
-
}
|
|
5937
|
-
};
|
|
5916
|
+
// src/projects/aws-cdk-project.ts
|
|
5917
|
+
var import_projen19 = require("projen");
|
|
5918
|
+
var import_javascript5 = require("projen/lib/javascript");
|
|
5919
|
+
var import_release2 = require("projen/lib/release");
|
|
5920
|
+
var import_ts_deepmerge3 = require("ts-deepmerge");
|
|
5938
5921
|
|
|
5939
5922
|
// src/workflows/aws-deploy-workflow.ts
|
|
5940
5923
|
var import_utils11 = __toESM(require_lib());
|
|
5941
|
-
var
|
|
5924
|
+
var import_projen18 = require("projen");
|
|
5942
5925
|
var import_build = require("projen/lib/build");
|
|
5943
5926
|
var import_github2 = require("projen/lib/github");
|
|
5944
5927
|
var import_workflows_model5 = require("projen/lib/github/workflows-model");
|
|
5945
5928
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
5946
|
-
var AwsDeployWorkflow = class _AwsDeployWorkflow extends
|
|
5929
|
+
var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen18.Component {
|
|
5947
5930
|
constructor(project, options = {}) {
|
|
5948
5931
|
super(project);
|
|
5949
5932
|
this.project = project;
|
|
@@ -6206,6 +6189,226 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen19.Compone
|
|
|
6206
6189
|
super.preSynthesize();
|
|
6207
6190
|
}
|
|
6208
6191
|
};
|
|
6192
|
+
|
|
6193
|
+
// src/projects/aws-cdk-project.ts
|
|
6194
|
+
var AwsCdkProject = class extends import_projen19.awscdk.AwsCdkTypeScriptApp {
|
|
6195
|
+
constructor(userOptions) {
|
|
6196
|
+
if (!(userOptions.parent instanceof MonorepoProject)) {
|
|
6197
|
+
throw new Error(
|
|
6198
|
+
"AwsCdkProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
|
|
6199
|
+
);
|
|
6200
|
+
}
|
|
6201
|
+
const parent = userOptions.parent;
|
|
6202
|
+
const pnpmVersion = parent.pnpmVersion;
|
|
6203
|
+
const pnpmWorkspace = PnpmWorkspace.of(parent);
|
|
6204
|
+
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
6205
|
+
const useJest = testRunner === TestRunner.JEST;
|
|
6206
|
+
const defaultOptions = {
|
|
6207
|
+
defaultReleaseBranch: "main",
|
|
6208
|
+
/**
|
|
6209
|
+
* Enable reset task by default.
|
|
6210
|
+
*/
|
|
6211
|
+
resetTask: true,
|
|
6212
|
+
/**
|
|
6213
|
+
* Packaging options.
|
|
6214
|
+
*/
|
|
6215
|
+
packageManager: import_javascript5.NodePackageManager.PNPM,
|
|
6216
|
+
pnpmVersion,
|
|
6217
|
+
licensed: userOptions.license !== void 0 || false,
|
|
6218
|
+
copyrightOwner: "CodeDrifters",
|
|
6219
|
+
release: false,
|
|
6220
|
+
/**
|
|
6221
|
+
* Don't add sample code.
|
|
6222
|
+
*/
|
|
6223
|
+
sampleCode: false,
|
|
6224
|
+
/**
|
|
6225
|
+
* CDK versions sourced from the configulator-managed catalog.
|
|
6226
|
+
*/
|
|
6227
|
+
cdkVersion: VERSION.AWS_CDK_LIB_VERSION,
|
|
6228
|
+
cdkCliVersion: VERSION.AWS_CDK_CLI_VERSION,
|
|
6229
|
+
...useJest ? {
|
|
6230
|
+
/**
|
|
6231
|
+
* Make sure jest config is stored outside of package.json and use
|
|
6232
|
+
* SWC for faster compilation (matches TypeScriptProject).
|
|
6233
|
+
*/
|
|
6234
|
+
jestOptions: {
|
|
6235
|
+
configFilePath: "jest.config.json",
|
|
6236
|
+
jestConfig: {
|
|
6237
|
+
roots: [`<rootDir>/src`],
|
|
6238
|
+
transform: {
|
|
6239
|
+
["^.+\\.[t]sx?$"]: new import_javascript5.Transform("@swc/jest")
|
|
6240
|
+
},
|
|
6241
|
+
moduleFileExtensions: ["js", "ts"]
|
|
6242
|
+
}
|
|
6243
|
+
},
|
|
6244
|
+
devDeps: ["@swc/jest", "@swc/core"]
|
|
6245
|
+
} : {
|
|
6246
|
+
jest: false,
|
|
6247
|
+
devDeps: []
|
|
6248
|
+
},
|
|
6249
|
+
/**
|
|
6250
|
+
* Turn on prettier formatting.
|
|
6251
|
+
*/
|
|
6252
|
+
prettier: true,
|
|
6253
|
+
/**
|
|
6254
|
+
* Don't package test files.
|
|
6255
|
+
*/
|
|
6256
|
+
npmIgnoreOptions: {
|
|
6257
|
+
ignorePatterns: ["*.spec.*", "*.test.*"]
|
|
6258
|
+
},
|
|
6259
|
+
/**
|
|
6260
|
+
* Options for the automated dependency upgrade task / workflow.
|
|
6261
|
+
* Exclude any packages managed by the parent project's default catalog
|
|
6262
|
+
* so the catalog stays the source of truth.
|
|
6263
|
+
*/
|
|
6264
|
+
depsUpgrade: true,
|
|
6265
|
+
depsUpgradeOptions: {
|
|
6266
|
+
workflow: false,
|
|
6267
|
+
exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
|
|
6268
|
+
workflowOptions: {
|
|
6269
|
+
schedule: import_javascript5.UpgradeDependenciesSchedule.WEEKLY
|
|
6270
|
+
},
|
|
6271
|
+
cooldown: 1
|
|
6272
|
+
},
|
|
6273
|
+
/**
|
|
6274
|
+
* Only release when the package source content or package.json changes.
|
|
6275
|
+
*/
|
|
6276
|
+
releaseTrigger: import_release2.ReleaseTrigger.continuous({
|
|
6277
|
+
paths: [
|
|
6278
|
+
`${userOptions.outdir}/src/**`,
|
|
6279
|
+
`${userOptions.outdir}/package.json`
|
|
6280
|
+
]
|
|
6281
|
+
})
|
|
6282
|
+
};
|
|
6283
|
+
const options = (0, import_ts_deepmerge3.merge)(defaultOptions, userOptions);
|
|
6284
|
+
super(options);
|
|
6285
|
+
this.addDevDeps("@types/node@catalog:");
|
|
6286
|
+
this.tsconfig?.addExclude("**/*.test.*");
|
|
6287
|
+
this.tsconfig?.addExclude("**/*.spec.*");
|
|
6288
|
+
if (testRunner === TestRunner.VITEST) {
|
|
6289
|
+
new Vitest(this, {
|
|
6290
|
+
config: {
|
|
6291
|
+
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
|
|
6292
|
+
...options.vitestOptions?.config
|
|
6293
|
+
},
|
|
6294
|
+
...options.vitestOptions
|
|
6295
|
+
});
|
|
6296
|
+
} else {
|
|
6297
|
+
this.deps.removeDependency("ts-jest");
|
|
6298
|
+
}
|
|
6299
|
+
this.package.file.addOverride(
|
|
6300
|
+
"packageManager",
|
|
6301
|
+
`pnpm@${options.pnpmVersion}`
|
|
6302
|
+
);
|
|
6303
|
+
this.eslint?.addOverride({
|
|
6304
|
+
files: ["**/*.test.*", "**/*.spec.*"],
|
|
6305
|
+
rules: {
|
|
6306
|
+
"import/no-extraneous-dependencies": "off"
|
|
6307
|
+
}
|
|
6308
|
+
});
|
|
6309
|
+
this.gitignore?.addPatterns(".DS_Store", "test-reports", "cdk.out");
|
|
6310
|
+
this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
|
|
6311
|
+
new AwsDeploymentConfig(this);
|
|
6312
|
+
(options.deploymentTargets ?? []).forEach(
|
|
6313
|
+
(targetOptions) => this.addDeploymentTarget(targetOptions)
|
|
6314
|
+
);
|
|
6315
|
+
const targetsForAutoDerive = AwsDeploymentConfig.of(this)?.awsDeploymentTargets ?? [];
|
|
6316
|
+
const deployWorkflows = options.deployWorkflows ?? Array.from(new Set(targetsForAutoDerive.map((t) => t.awsStageType))).map(
|
|
6317
|
+
(awsStageType) => ({
|
|
6318
|
+
awsStageType,
|
|
6319
|
+
buildWorkflow: options.sharedBuildWorkflow
|
|
6320
|
+
})
|
|
6321
|
+
);
|
|
6322
|
+
deployWorkflows.forEach(
|
|
6323
|
+
(workflowOptions) => new AwsDeployWorkflow(this, workflowOptions)
|
|
6324
|
+
);
|
|
6325
|
+
const turboActive = TurboRepo.of(parent) !== void 0;
|
|
6326
|
+
if (turboActive) {
|
|
6327
|
+
const turbo = new TurboRepo(this);
|
|
6328
|
+
turbo.postCompileTask?.outputs.push("dist/**");
|
|
6329
|
+
turbo.postCompileTask?.inputs.push("src/**");
|
|
6330
|
+
}
|
|
6331
|
+
if (options.agentConfig === true || typeof options.agentConfig === "object") {
|
|
6332
|
+
new AgentConfig(
|
|
6333
|
+
this,
|
|
6334
|
+
typeof options.agentConfig === "object" ? options.agentConfig : {}
|
|
6335
|
+
);
|
|
6336
|
+
}
|
|
6337
|
+
if (options.resetTask !== false) {
|
|
6338
|
+
const defaultResetTaskOptions = {
|
|
6339
|
+
pathsToRemove: [
|
|
6340
|
+
"node_modules",
|
|
6341
|
+
"dist",
|
|
6342
|
+
"lib",
|
|
6343
|
+
"cdk.out",
|
|
6344
|
+
"coverage",
|
|
6345
|
+
"test-reports",
|
|
6346
|
+
".turbo",
|
|
6347
|
+
"tsconfig.tsbuildinfo",
|
|
6348
|
+
this.artifactsDirectory
|
|
6349
|
+
]
|
|
6350
|
+
};
|
|
6351
|
+
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
6352
|
+
const resetTaskOptions = (0, import_ts_deepmerge3.merge)(
|
|
6353
|
+
defaultResetTaskOptions,
|
|
6354
|
+
{
|
|
6355
|
+
...userResetTaskOptions,
|
|
6356
|
+
pathsToRemove: [
|
|
6357
|
+
...defaultResetTaskOptions.pathsToRemove ?? [],
|
|
6358
|
+
...userResetTaskOptions.pathsToRemove ?? []
|
|
6359
|
+
]
|
|
6360
|
+
}
|
|
6361
|
+
);
|
|
6362
|
+
new ResetTask(this, resetTaskOptions);
|
|
6363
|
+
}
|
|
6364
|
+
const originalResolve = this.package.resolveDepsAndWritePackageJson;
|
|
6365
|
+
this.package.installDependencies = () => {
|
|
6366
|
+
parent.requestInstallDependencies({
|
|
6367
|
+
resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
|
|
6368
|
+
});
|
|
6369
|
+
};
|
|
6370
|
+
this.package.resolveDepsAndWritePackageJson = () => {
|
|
6371
|
+
};
|
|
6372
|
+
}
|
|
6373
|
+
/**
|
|
6374
|
+
* Add an AWS deployment target to this project after construction. The
|
|
6375
|
+
* target is registered on the existing `AwsDeploymentConfig` and immediately
|
|
6376
|
+
* available for `AwsDeployWorkflow` consumption.
|
|
6377
|
+
*/
|
|
6378
|
+
addDeploymentTarget(options) {
|
|
6379
|
+
return new AwsDeploymentTarget(this, options);
|
|
6380
|
+
}
|
|
6381
|
+
};
|
|
6382
|
+
|
|
6383
|
+
// src/typescript/typescript-config.ts
|
|
6384
|
+
var import_node_path2 = require("path");
|
|
6385
|
+
var import_projen20 = require("projen");
|
|
6386
|
+
var import_path2 = require("projen/lib/util/path");
|
|
6387
|
+
var TypeScriptConfig = class extends import_projen20.Component {
|
|
6388
|
+
constructor(project) {
|
|
6389
|
+
super(project);
|
|
6390
|
+
let tsPaths = {};
|
|
6391
|
+
const workspaceDeps = project.deps.all.filter(
|
|
6392
|
+
(d) => d.version === "workspace:*"
|
|
6393
|
+
);
|
|
6394
|
+
workspaceDeps.forEach((dep) => {
|
|
6395
|
+
const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
|
|
6396
|
+
if (!subproject) {
|
|
6397
|
+
throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
|
|
6398
|
+
}
|
|
6399
|
+
tsPaths = {
|
|
6400
|
+
...tsPaths,
|
|
6401
|
+
[dep.name]: [
|
|
6402
|
+
(0, import_path2.ensureRelativePathStartsWithDot)(
|
|
6403
|
+
(0, import_node_path2.relative)(project.outdir, subproject.outdir)
|
|
6404
|
+
)
|
|
6405
|
+
]
|
|
6406
|
+
};
|
|
6407
|
+
});
|
|
6408
|
+
project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
6409
|
+
project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
6410
|
+
}
|
|
6411
|
+
};
|
|
6209
6412
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6210
6413
|
0 && (module.exports = {
|
|
6211
6414
|
AGENT_MODEL,
|
|
@@ -6215,6 +6418,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen19.Compone
|
|
|
6215
6418
|
AstroConfig,
|
|
6216
6419
|
AstroOutput,
|
|
6217
6420
|
AstroProject,
|
|
6421
|
+
AwsCdkProject,
|
|
6218
6422
|
AwsDeployWorkflow,
|
|
6219
6423
|
AwsDeploymentConfig,
|
|
6220
6424
|
AwsDeploymentTarget,
|