@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.mjs
CHANGED
|
@@ -5586,8 +5586,14 @@ var TestRunner = {
|
|
|
5586
5586
|
};
|
|
5587
5587
|
var TypeScriptProject = class extends typescript.TypeScriptProject {
|
|
5588
5588
|
constructor(userOptions) {
|
|
5589
|
-
|
|
5590
|
-
|
|
5589
|
+
if (!(userOptions.parent instanceof MonorepoProject)) {
|
|
5590
|
+
throw new Error(
|
|
5591
|
+
"TypeScriptProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
|
|
5592
|
+
);
|
|
5593
|
+
}
|
|
5594
|
+
const parent = userOptions.parent;
|
|
5595
|
+
const pnpmVersion = parent.pnpmVersion;
|
|
5596
|
+
const pnpmWorkspace = PnpmWorkspace.of(parent);
|
|
5591
5597
|
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
5592
5598
|
const useJest = testRunner === TestRunner.JEST;
|
|
5593
5599
|
const defaultOptions = {
|
|
@@ -5853,44 +5859,24 @@ var DEFAULT_INDEX_ASTRO = `---
|
|
|
5853
5859
|
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>
|
|
5854
5860
|
`;
|
|
5855
5861
|
|
|
5856
|
-
// src/
|
|
5857
|
-
import {
|
|
5858
|
-
import {
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
(d) => d.version === "workspace:*"
|
|
5866
|
-
);
|
|
5867
|
-
workspaceDeps.forEach((dep) => {
|
|
5868
|
-
const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
|
|
5869
|
-
if (!subproject) {
|
|
5870
|
-
throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
|
|
5871
|
-
}
|
|
5872
|
-
tsPaths = {
|
|
5873
|
-
...tsPaths,
|
|
5874
|
-
[dep.name]: [
|
|
5875
|
-
ensureRelativePathStartsWithDot(
|
|
5876
|
-
relative4(project.outdir, subproject.outdir)
|
|
5877
|
-
)
|
|
5878
|
-
]
|
|
5879
|
-
};
|
|
5880
|
-
});
|
|
5881
|
-
project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
5882
|
-
project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
5883
|
-
}
|
|
5884
|
-
};
|
|
5862
|
+
// src/projects/aws-cdk-project.ts
|
|
5863
|
+
import { awscdk } from "projen";
|
|
5864
|
+
import {
|
|
5865
|
+
NodePackageManager as NodePackageManager3,
|
|
5866
|
+
Transform as Transform2,
|
|
5867
|
+
UpgradeDependenciesSchedule as UpgradeDependenciesSchedule3
|
|
5868
|
+
} from "projen/lib/javascript";
|
|
5869
|
+
import { ReleaseTrigger as ReleaseTrigger2 } from "projen/lib/release";
|
|
5870
|
+
import { merge as merge3 } from "ts-deepmerge";
|
|
5885
5871
|
|
|
5886
5872
|
// src/workflows/aws-deploy-workflow.ts
|
|
5887
5873
|
var import_utils11 = __toESM(require_lib());
|
|
5888
|
-
import { Component as
|
|
5874
|
+
import { Component as Component16 } from "projen";
|
|
5889
5875
|
import { BuildWorkflow } from "projen/lib/build";
|
|
5890
5876
|
import { GitHub as GitHub2 } from "projen/lib/github";
|
|
5891
5877
|
import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
|
|
5892
5878
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
5893
|
-
var AwsDeployWorkflow = class _AwsDeployWorkflow extends
|
|
5879
|
+
var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component16 {
|
|
5894
5880
|
constructor(project, options = {}) {
|
|
5895
5881
|
super(project);
|
|
5896
5882
|
this.project = project;
|
|
@@ -6153,6 +6139,226 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component17 {
|
|
|
6153
6139
|
super.preSynthesize();
|
|
6154
6140
|
}
|
|
6155
6141
|
};
|
|
6142
|
+
|
|
6143
|
+
// src/projects/aws-cdk-project.ts
|
|
6144
|
+
var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
|
|
6145
|
+
constructor(userOptions) {
|
|
6146
|
+
if (!(userOptions.parent instanceof MonorepoProject)) {
|
|
6147
|
+
throw new Error(
|
|
6148
|
+
"AwsCdkProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
|
|
6149
|
+
);
|
|
6150
|
+
}
|
|
6151
|
+
const parent = userOptions.parent;
|
|
6152
|
+
const pnpmVersion = parent.pnpmVersion;
|
|
6153
|
+
const pnpmWorkspace = PnpmWorkspace.of(parent);
|
|
6154
|
+
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
6155
|
+
const useJest = testRunner === TestRunner.JEST;
|
|
6156
|
+
const defaultOptions = {
|
|
6157
|
+
defaultReleaseBranch: "main",
|
|
6158
|
+
/**
|
|
6159
|
+
* Enable reset task by default.
|
|
6160
|
+
*/
|
|
6161
|
+
resetTask: true,
|
|
6162
|
+
/**
|
|
6163
|
+
* Packaging options.
|
|
6164
|
+
*/
|
|
6165
|
+
packageManager: NodePackageManager3.PNPM,
|
|
6166
|
+
pnpmVersion,
|
|
6167
|
+
licensed: userOptions.license !== void 0 || false,
|
|
6168
|
+
copyrightOwner: "CodeDrifters",
|
|
6169
|
+
release: false,
|
|
6170
|
+
/**
|
|
6171
|
+
* Don't add sample code.
|
|
6172
|
+
*/
|
|
6173
|
+
sampleCode: false,
|
|
6174
|
+
/**
|
|
6175
|
+
* CDK versions sourced from the configulator-managed catalog.
|
|
6176
|
+
*/
|
|
6177
|
+
cdkVersion: VERSION.AWS_CDK_LIB_VERSION,
|
|
6178
|
+
cdkCliVersion: VERSION.AWS_CDK_CLI_VERSION,
|
|
6179
|
+
...useJest ? {
|
|
6180
|
+
/**
|
|
6181
|
+
* Make sure jest config is stored outside of package.json and use
|
|
6182
|
+
* SWC for faster compilation (matches TypeScriptProject).
|
|
6183
|
+
*/
|
|
6184
|
+
jestOptions: {
|
|
6185
|
+
configFilePath: "jest.config.json",
|
|
6186
|
+
jestConfig: {
|
|
6187
|
+
roots: [`<rootDir>/src`],
|
|
6188
|
+
transform: {
|
|
6189
|
+
["^.+\\.[t]sx?$"]: new Transform2("@swc/jest")
|
|
6190
|
+
},
|
|
6191
|
+
moduleFileExtensions: ["js", "ts"]
|
|
6192
|
+
}
|
|
6193
|
+
},
|
|
6194
|
+
devDeps: ["@swc/jest", "@swc/core"]
|
|
6195
|
+
} : {
|
|
6196
|
+
jest: false,
|
|
6197
|
+
devDeps: []
|
|
6198
|
+
},
|
|
6199
|
+
/**
|
|
6200
|
+
* Turn on prettier formatting.
|
|
6201
|
+
*/
|
|
6202
|
+
prettier: true,
|
|
6203
|
+
/**
|
|
6204
|
+
* Don't package test files.
|
|
6205
|
+
*/
|
|
6206
|
+
npmIgnoreOptions: {
|
|
6207
|
+
ignorePatterns: ["*.spec.*", "*.test.*"]
|
|
6208
|
+
},
|
|
6209
|
+
/**
|
|
6210
|
+
* Options for the automated dependency upgrade task / workflow.
|
|
6211
|
+
* Exclude any packages managed by the parent project's default catalog
|
|
6212
|
+
* so the catalog stays the source of truth.
|
|
6213
|
+
*/
|
|
6214
|
+
depsUpgrade: true,
|
|
6215
|
+
depsUpgradeOptions: {
|
|
6216
|
+
workflow: false,
|
|
6217
|
+
exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
|
|
6218
|
+
workflowOptions: {
|
|
6219
|
+
schedule: UpgradeDependenciesSchedule3.WEEKLY
|
|
6220
|
+
},
|
|
6221
|
+
cooldown: 1
|
|
6222
|
+
},
|
|
6223
|
+
/**
|
|
6224
|
+
* Only release when the package source content or package.json changes.
|
|
6225
|
+
*/
|
|
6226
|
+
releaseTrigger: ReleaseTrigger2.continuous({
|
|
6227
|
+
paths: [
|
|
6228
|
+
`${userOptions.outdir}/src/**`,
|
|
6229
|
+
`${userOptions.outdir}/package.json`
|
|
6230
|
+
]
|
|
6231
|
+
})
|
|
6232
|
+
};
|
|
6233
|
+
const options = merge3(defaultOptions, userOptions);
|
|
6234
|
+
super(options);
|
|
6235
|
+
this.addDevDeps("@types/node@catalog:");
|
|
6236
|
+
this.tsconfig?.addExclude("**/*.test.*");
|
|
6237
|
+
this.tsconfig?.addExclude("**/*.spec.*");
|
|
6238
|
+
if (testRunner === TestRunner.VITEST) {
|
|
6239
|
+
new Vitest(this, {
|
|
6240
|
+
config: {
|
|
6241
|
+
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
|
|
6242
|
+
...options.vitestOptions?.config
|
|
6243
|
+
},
|
|
6244
|
+
...options.vitestOptions
|
|
6245
|
+
});
|
|
6246
|
+
} else {
|
|
6247
|
+
this.deps.removeDependency("ts-jest");
|
|
6248
|
+
}
|
|
6249
|
+
this.package.file.addOverride(
|
|
6250
|
+
"packageManager",
|
|
6251
|
+
`pnpm@${options.pnpmVersion}`
|
|
6252
|
+
);
|
|
6253
|
+
this.eslint?.addOverride({
|
|
6254
|
+
files: ["**/*.test.*", "**/*.spec.*"],
|
|
6255
|
+
rules: {
|
|
6256
|
+
"import/no-extraneous-dependencies": "off"
|
|
6257
|
+
}
|
|
6258
|
+
});
|
|
6259
|
+
this.gitignore?.addPatterns(".DS_Store", "test-reports", "cdk.out");
|
|
6260
|
+
this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
|
|
6261
|
+
new AwsDeploymentConfig(this);
|
|
6262
|
+
(options.deploymentTargets ?? []).forEach(
|
|
6263
|
+
(targetOptions) => this.addDeploymentTarget(targetOptions)
|
|
6264
|
+
);
|
|
6265
|
+
const targetsForAutoDerive = AwsDeploymentConfig.of(this)?.awsDeploymentTargets ?? [];
|
|
6266
|
+
const deployWorkflows = options.deployWorkflows ?? Array.from(new Set(targetsForAutoDerive.map((t) => t.awsStageType))).map(
|
|
6267
|
+
(awsStageType) => ({
|
|
6268
|
+
awsStageType,
|
|
6269
|
+
buildWorkflow: options.sharedBuildWorkflow
|
|
6270
|
+
})
|
|
6271
|
+
);
|
|
6272
|
+
deployWorkflows.forEach(
|
|
6273
|
+
(workflowOptions) => new AwsDeployWorkflow(this, workflowOptions)
|
|
6274
|
+
);
|
|
6275
|
+
const turboActive = TurboRepo.of(parent) !== void 0;
|
|
6276
|
+
if (turboActive) {
|
|
6277
|
+
const turbo = new TurboRepo(this);
|
|
6278
|
+
turbo.postCompileTask?.outputs.push("dist/**");
|
|
6279
|
+
turbo.postCompileTask?.inputs.push("src/**");
|
|
6280
|
+
}
|
|
6281
|
+
if (options.agentConfig === true || typeof options.agentConfig === "object") {
|
|
6282
|
+
new AgentConfig(
|
|
6283
|
+
this,
|
|
6284
|
+
typeof options.agentConfig === "object" ? options.agentConfig : {}
|
|
6285
|
+
);
|
|
6286
|
+
}
|
|
6287
|
+
if (options.resetTask !== false) {
|
|
6288
|
+
const defaultResetTaskOptions = {
|
|
6289
|
+
pathsToRemove: [
|
|
6290
|
+
"node_modules",
|
|
6291
|
+
"dist",
|
|
6292
|
+
"lib",
|
|
6293
|
+
"cdk.out",
|
|
6294
|
+
"coverage",
|
|
6295
|
+
"test-reports",
|
|
6296
|
+
".turbo",
|
|
6297
|
+
"tsconfig.tsbuildinfo",
|
|
6298
|
+
this.artifactsDirectory
|
|
6299
|
+
]
|
|
6300
|
+
};
|
|
6301
|
+
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
6302
|
+
const resetTaskOptions = merge3(
|
|
6303
|
+
defaultResetTaskOptions,
|
|
6304
|
+
{
|
|
6305
|
+
...userResetTaskOptions,
|
|
6306
|
+
pathsToRemove: [
|
|
6307
|
+
...defaultResetTaskOptions.pathsToRemove ?? [],
|
|
6308
|
+
...userResetTaskOptions.pathsToRemove ?? []
|
|
6309
|
+
]
|
|
6310
|
+
}
|
|
6311
|
+
);
|
|
6312
|
+
new ResetTask(this, resetTaskOptions);
|
|
6313
|
+
}
|
|
6314
|
+
const originalResolve = this.package.resolveDepsAndWritePackageJson;
|
|
6315
|
+
this.package.installDependencies = () => {
|
|
6316
|
+
parent.requestInstallDependencies({
|
|
6317
|
+
resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
|
|
6318
|
+
});
|
|
6319
|
+
};
|
|
6320
|
+
this.package.resolveDepsAndWritePackageJson = () => {
|
|
6321
|
+
};
|
|
6322
|
+
}
|
|
6323
|
+
/**
|
|
6324
|
+
* Add an AWS deployment target to this project after construction. The
|
|
6325
|
+
* target is registered on the existing `AwsDeploymentConfig` and immediately
|
|
6326
|
+
* available for `AwsDeployWorkflow` consumption.
|
|
6327
|
+
*/
|
|
6328
|
+
addDeploymentTarget(options) {
|
|
6329
|
+
return new AwsDeploymentTarget(this, options);
|
|
6330
|
+
}
|
|
6331
|
+
};
|
|
6332
|
+
|
|
6333
|
+
// src/typescript/typescript-config.ts
|
|
6334
|
+
import { relative as relative4 } from "path";
|
|
6335
|
+
import { Component as Component17 } from "projen";
|
|
6336
|
+
import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
|
|
6337
|
+
var TypeScriptConfig = class extends Component17 {
|
|
6338
|
+
constructor(project) {
|
|
6339
|
+
super(project);
|
|
6340
|
+
let tsPaths = {};
|
|
6341
|
+
const workspaceDeps = project.deps.all.filter(
|
|
6342
|
+
(d) => d.version === "workspace:*"
|
|
6343
|
+
);
|
|
6344
|
+
workspaceDeps.forEach((dep) => {
|
|
6345
|
+
const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
|
|
6346
|
+
if (!subproject) {
|
|
6347
|
+
throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
|
|
6348
|
+
}
|
|
6349
|
+
tsPaths = {
|
|
6350
|
+
...tsPaths,
|
|
6351
|
+
[dep.name]: [
|
|
6352
|
+
ensureRelativePathStartsWithDot(
|
|
6353
|
+
relative4(project.outdir, subproject.outdir)
|
|
6354
|
+
)
|
|
6355
|
+
]
|
|
6356
|
+
};
|
|
6357
|
+
});
|
|
6358
|
+
project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
6359
|
+
project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
|
|
6360
|
+
}
|
|
6361
|
+
};
|
|
6156
6362
|
export {
|
|
6157
6363
|
AGENT_MODEL,
|
|
6158
6364
|
AGENT_PLATFORM,
|
|
@@ -6161,6 +6367,7 @@ export {
|
|
|
6161
6367
|
AstroConfig,
|
|
6162
6368
|
AstroOutput,
|
|
6163
6369
|
AstroProject,
|
|
6370
|
+
AwsCdkProject,
|
|
6164
6371
|
AwsDeployWorkflow,
|
|
6165
6372
|
AwsDeploymentConfig,
|
|
6166
6373
|
AwsDeploymentTarget,
|