@codedrifters/configulator 0.0.192 → 0.0.194
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 +285 -150
- package/lib/index.d.ts +286 -151
- package/lib/index.js +389 -192
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +393 -199
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -2979,6 +2979,10 @@ import { TextFile } from "projen/lib/textfile";
|
|
|
2979
2979
|
|
|
2980
2980
|
// src/versions.ts
|
|
2981
2981
|
var VERSION = {
|
|
2982
|
+
/**
|
|
2983
|
+
* Version of Astro to pin for AstroProject scaffolding.
|
|
2984
|
+
*/
|
|
2985
|
+
ASTRO_VERSION: "5.14.1",
|
|
2982
2986
|
/**
|
|
2983
2987
|
* CDK CLI for workflows and command line operations.
|
|
2984
2988
|
*
|
|
@@ -4362,11 +4366,91 @@ ${extra}`
|
|
|
4362
4366
|
}
|
|
4363
4367
|
};
|
|
4364
4368
|
|
|
4369
|
+
// src/astro/astro-config.ts
|
|
4370
|
+
import { Component as Component9 } from "projen";
|
|
4371
|
+
import { TextFile as TextFile4 } from "projen/lib/textfile";
|
|
4372
|
+
var AstroConfig = class _AstroConfig extends Component9 {
|
|
4373
|
+
constructor(project, options = {}) {
|
|
4374
|
+
super(project);
|
|
4375
|
+
this.project = project;
|
|
4376
|
+
this.configFilePath = "astro.config.mjs";
|
|
4377
|
+
this.site = options.site;
|
|
4378
|
+
this.base = options.base;
|
|
4379
|
+
this.output = options.output;
|
|
4380
|
+
this.integrations = options.integrations ?? [];
|
|
4381
|
+
this.adapter = options.adapter;
|
|
4382
|
+
this.synthesizeConfig();
|
|
4383
|
+
}
|
|
4384
|
+
/**
|
|
4385
|
+
* Find the AstroConfig component on a project.
|
|
4386
|
+
*/
|
|
4387
|
+
static of(project) {
|
|
4388
|
+
const isAstroConfig = (c) => c instanceof _AstroConfig;
|
|
4389
|
+
return project.components.find(isAstroConfig);
|
|
4390
|
+
}
|
|
4391
|
+
/**
|
|
4392
|
+
* Render the config file contents as an array of lines.
|
|
4393
|
+
*
|
|
4394
|
+
* Exposed for unit testing — `synthesizeConfig` writes these to disk.
|
|
4395
|
+
*/
|
|
4396
|
+
renderConfig() {
|
|
4397
|
+
const imports = [
|
|
4398
|
+
'import { defineConfig } from "astro/config";'
|
|
4399
|
+
];
|
|
4400
|
+
const specs = [
|
|
4401
|
+
...this.integrations,
|
|
4402
|
+
...this.adapter ? [this.adapter] : []
|
|
4403
|
+
];
|
|
4404
|
+
for (const spec2 of specs) {
|
|
4405
|
+
imports.push(renderImport(spec2));
|
|
4406
|
+
}
|
|
4407
|
+
const body = [];
|
|
4408
|
+
if (this.site !== void 0) {
|
|
4409
|
+
body.push(` site: ${JSON.stringify(this.site)},`);
|
|
4410
|
+
}
|
|
4411
|
+
if (this.base !== void 0) {
|
|
4412
|
+
body.push(` base: ${JSON.stringify(this.base)},`);
|
|
4413
|
+
}
|
|
4414
|
+
if (this.output !== void 0) {
|
|
4415
|
+
body.push(` output: ${JSON.stringify(this.output)},`);
|
|
4416
|
+
}
|
|
4417
|
+
if (this.integrations.length > 0) {
|
|
4418
|
+
const calls = this.integrations.map(renderCall).join(", ");
|
|
4419
|
+
body.push(` integrations: [${calls}],`);
|
|
4420
|
+
}
|
|
4421
|
+
if (this.adapter) {
|
|
4422
|
+
body.push(` adapter: ${renderCall(this.adapter)},`);
|
|
4423
|
+
}
|
|
4424
|
+
return [...imports, "", "export default defineConfig({", ...body, "});"];
|
|
4425
|
+
}
|
|
4426
|
+
synthesizeConfig() {
|
|
4427
|
+
this.project.tryRemoveFile(this.configFilePath);
|
|
4428
|
+
new TextFile4(this, this.configFilePath, {
|
|
4429
|
+
lines: this.renderConfig()
|
|
4430
|
+
});
|
|
4431
|
+
}
|
|
4432
|
+
};
|
|
4433
|
+
function renderImport(spec2) {
|
|
4434
|
+
const asDefault = spec2.defaultImport ?? true;
|
|
4435
|
+
const binding = asDefault ? spec2.name : `{ ${spec2.name} }`;
|
|
4436
|
+
return `import ${binding} from ${JSON.stringify(spec2.importPath)};`;
|
|
4437
|
+
}
|
|
4438
|
+
function renderCall(spec2) {
|
|
4439
|
+
return `${spec2.name}(${spec2.args ?? ""})`;
|
|
4440
|
+
}
|
|
4441
|
+
|
|
4442
|
+
// src/astro/astro-config-options.ts
|
|
4443
|
+
var AstroOutput = {
|
|
4444
|
+
STATIC: "static",
|
|
4445
|
+
SERVER: "server",
|
|
4446
|
+
HYBRID: "hybrid"
|
|
4447
|
+
};
|
|
4448
|
+
|
|
4365
4449
|
// src/aws/aws-deployment-config.ts
|
|
4366
4450
|
var import_utils9 = __toESM(require_lib());
|
|
4367
4451
|
import { join, relative as relative3 } from "path";
|
|
4368
|
-
import { Component as
|
|
4369
|
-
var AwsDeploymentConfig = class _AwsDeploymentConfig extends
|
|
4452
|
+
import { Component as Component10 } from "projen";
|
|
4453
|
+
var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component10 {
|
|
4370
4454
|
constructor(project) {
|
|
4371
4455
|
super(project);
|
|
4372
4456
|
/**
|
|
@@ -4483,8 +4567,8 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component9 {
|
|
|
4483
4567
|
|
|
4484
4568
|
// src/aws/aws-deployment-target.ts
|
|
4485
4569
|
var import_utils10 = __toESM(require_lib());
|
|
4486
|
-
import { Component as
|
|
4487
|
-
var AwsDeploymentTarget = class _AwsDeploymentTarget extends
|
|
4570
|
+
import { Component as Component11 } from "projen";
|
|
4571
|
+
var AwsDeploymentTarget = class _AwsDeploymentTarget extends Component11 {
|
|
4488
4572
|
constructor(project, options) {
|
|
4489
4573
|
super(project);
|
|
4490
4574
|
/**
|
|
@@ -4682,6 +4766,7 @@ async function getLatestEligibleVersion(packageName, minimumReleaseAgeMinutes) {
|
|
|
4682
4766
|
|
|
4683
4767
|
// src/version-package-map.ts
|
|
4684
4768
|
var VERSION_NPM_PACKAGES = [
|
|
4769
|
+
{ key: "ASTRO_VERSION", npmPackage: "astro" },
|
|
4685
4770
|
{ key: "AWS_CDK_CLI_VERSION", npmPackage: "aws-cdk" },
|
|
4686
4771
|
{ key: "AWS_CDK_LIB_VERSION", npmPackage: "aws-cdk-lib" },
|
|
4687
4772
|
{ key: "AWS_CONSTRUCTS_VERSION", npmPackage: "constructs" },
|
|
@@ -4700,12 +4785,12 @@ var VERSION_KEYS_SKIP = [
|
|
|
4700
4785
|
|
|
4701
4786
|
// src/jsii/jsii-faker.ts
|
|
4702
4787
|
import * as spec from "@jsii/spec";
|
|
4703
|
-
import { Component as
|
|
4788
|
+
import { Component as Component12, JsonFile as JsonFile4 } from "projen";
|
|
4704
4789
|
var ProjenBaseFqn = {
|
|
4705
4790
|
TYPESCRIPT_PROJECT: "projen.typescript.TypeScriptProject",
|
|
4706
4791
|
TYPESCRIPT_PROJECT_OPTIONS: "projen.typescript.TypeScriptProjectOptions"
|
|
4707
4792
|
};
|
|
4708
|
-
var JsiiFaker = class _JsiiFaker extends
|
|
4793
|
+
var JsiiFaker = class _JsiiFaker extends Component12 {
|
|
4709
4794
|
constructor(project) {
|
|
4710
4795
|
super(project);
|
|
4711
4796
|
this.project = project;
|
|
@@ -4753,200 +4838,32 @@ var JsiiFaker = class _JsiiFaker extends Component11 {
|
|
|
4753
4838
|
}
|
|
4754
4839
|
};
|
|
4755
4840
|
|
|
4756
|
-
// src/projects/
|
|
4841
|
+
// src/projects/astro-project.ts
|
|
4842
|
+
import { SampleFile } from "projen";
|
|
4843
|
+
|
|
4844
|
+
// src/projects/typescript-project.ts
|
|
4845
|
+
import { typescript } from "projen";
|
|
4757
4846
|
import {
|
|
4758
4847
|
NodePackageManager as NodePackageManager2,
|
|
4848
|
+
Transform,
|
|
4759
4849
|
UpgradeDependenciesSchedule as UpgradeDependenciesSchedule2
|
|
4760
4850
|
} from "projen/lib/javascript";
|
|
4761
|
-
import {
|
|
4762
|
-
TypeScriptAppProject
|
|
4763
|
-
} from "projen/lib/typescript";
|
|
4851
|
+
import { ReleaseTrigger } from "projen/lib/release";
|
|
4764
4852
|
import { merge as merge2 } from "ts-deepmerge";
|
|
4765
4853
|
|
|
4766
|
-
// src/
|
|
4767
|
-
import { Component as Component12 } from "projen";
|
|
4768
|
-
|
|
4769
|
-
// src/projects/typescript-project.ts
|
|
4770
|
-
import { typescript } from "projen";
|
|
4854
|
+
// src/projects/monorepo-project.ts
|
|
4771
4855
|
import {
|
|
4772
4856
|
NodePackageManager,
|
|
4773
|
-
Transform,
|
|
4774
4857
|
UpgradeDependenciesSchedule
|
|
4775
4858
|
} from "projen/lib/javascript";
|
|
4776
|
-
import {
|
|
4859
|
+
import {
|
|
4860
|
+
TypeScriptAppProject
|
|
4861
|
+
} from "projen/lib/typescript";
|
|
4777
4862
|
import { merge } from "ts-deepmerge";
|
|
4778
|
-
var TestRunner = {
|
|
4779
|
-
JEST: "jest",
|
|
4780
|
-
VITEST: "vitest"
|
|
4781
|
-
};
|
|
4782
|
-
var TypeScriptProject = class extends typescript.TypeScriptProject {
|
|
4783
|
-
constructor(userOptions) {
|
|
4784
|
-
const pnpmVersion = userOptions.parent && userOptions.parent instanceof MonorepoProject ? userOptions.parent.pnpmVersion : VERSION.PNPM_VERSION;
|
|
4785
|
-
const pnpmWorkspace = userOptions.parent && userOptions.parent instanceof MonorepoProject ? PnpmWorkspace.of(userOptions.parent) : void 0;
|
|
4786
|
-
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
4787
|
-
const useJest = testRunner === TestRunner.JEST;
|
|
4788
|
-
const defaultOptions = {
|
|
4789
|
-
/**
|
|
4790
|
-
* This is a standard, so don't require it to passed in everywhere.
|
|
4791
|
-
*/
|
|
4792
|
-
defaultReleaseBranch: "main",
|
|
4793
|
-
/**
|
|
4794
|
-
* Enable reset task by default.
|
|
4795
|
-
*/
|
|
4796
|
-
resetTask: true,
|
|
4797
|
-
/**
|
|
4798
|
-
* Packaging options
|
|
4799
|
-
*/
|
|
4800
|
-
packageManager: NodePackageManager.PNPM,
|
|
4801
|
-
pnpmVersion,
|
|
4802
|
-
licensed: userOptions.license !== void 0 || false,
|
|
4803
|
-
copyrightOwner: "CodeDrifters",
|
|
4804
|
-
release: false,
|
|
4805
|
-
/**
|
|
4806
|
-
* Don't add sample code.
|
|
4807
|
-
*/
|
|
4808
|
-
sampleCode: false,
|
|
4809
|
-
...useJest ? {
|
|
4810
|
-
/**
|
|
4811
|
-
* Make sure jest config is stored outside of package.json
|
|
4812
|
-
*/
|
|
4813
|
-
jestOptions: {
|
|
4814
|
-
configFilePath: "jest.config.json",
|
|
4815
|
-
jestConfig: {
|
|
4816
|
-
roots: [`<rootDir>/src`],
|
|
4817
|
-
transform: {
|
|
4818
|
-
["^.+\\.[t]sx?$"]: new Transform("@swc/jest")
|
|
4819
|
-
},
|
|
4820
|
-
moduleFileExtensions: ["js", "ts"]
|
|
4821
|
-
}
|
|
4822
|
-
},
|
|
4823
|
-
/**
|
|
4824
|
-
* SWC for faster testing
|
|
4825
|
-
*/
|
|
4826
|
-
devDeps: ["@swc/jest", "@swc/core"]
|
|
4827
|
-
} : {
|
|
4828
|
-
jest: false,
|
|
4829
|
-
devDeps: []
|
|
4830
|
-
},
|
|
4831
|
-
/**
|
|
4832
|
-
* Turn on prettier formatting
|
|
4833
|
-
*/
|
|
4834
|
-
prettier: true,
|
|
4835
|
-
/**
|
|
4836
|
-
* Don't package test files.
|
|
4837
|
-
*/
|
|
4838
|
-
npmIgnoreOptions: {
|
|
4839
|
-
ignorePatterns: ["*.spec.*", "*.test.*"]
|
|
4840
|
-
},
|
|
4841
|
-
/**
|
|
4842
|
-
* Options for the automated dependency upgrade task / workflow
|
|
4843
|
-
* Automatically exclude any packages that are managed by the root
|
|
4844
|
-
* project as default catalog dependencies since we want to let the
|
|
4845
|
-
* catalog manage those dependencies.
|
|
4846
|
-
*/
|
|
4847
|
-
depsUpgrade: true,
|
|
4848
|
-
depsUpgradeOptions: {
|
|
4849
|
-
workflow: false,
|
|
4850
|
-
exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
|
|
4851
|
-
...userOptions.parent && userOptions.parent instanceof MonorepoProject ? {
|
|
4852
|
-
workflowOptions: {
|
|
4853
|
-
schedule: UpgradeDependenciesSchedule.WEEKLY
|
|
4854
|
-
},
|
|
4855
|
-
cooldown: 1
|
|
4856
|
-
} : {}
|
|
4857
|
-
},
|
|
4858
|
-
/**
|
|
4859
|
-
* Only release when the package folder source content or package.json
|
|
4860
|
-
* (version, dependencies) changes.
|
|
4861
|
-
*/
|
|
4862
|
-
releaseTrigger: ReleaseTrigger.continuous({
|
|
4863
|
-
paths: [
|
|
4864
|
-
`${userOptions.outdir}/src/**`,
|
|
4865
|
-
`${userOptions.outdir}/package.json`
|
|
4866
|
-
]
|
|
4867
|
-
})
|
|
4868
|
-
};
|
|
4869
|
-
const options = merge(defaultOptions, userOptions);
|
|
4870
|
-
super(options);
|
|
4871
|
-
this.addDevDeps("@types/node@catalog:");
|
|
4872
|
-
this.tsconfig?.addExclude("**/*.test.*");
|
|
4873
|
-
this.tsconfig?.addExclude("**/*.spec.*");
|
|
4874
|
-
if (options.testRunner === TestRunner.VITEST) {
|
|
4875
|
-
new Vitest(this, {
|
|
4876
|
-
config: {
|
|
4877
|
-
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
|
|
4878
|
-
...options.vitestOptions?.config
|
|
4879
|
-
},
|
|
4880
|
-
...options.vitestOptions
|
|
4881
|
-
});
|
|
4882
|
-
} else {
|
|
4883
|
-
this.deps.removeDependency("ts-jest");
|
|
4884
|
-
}
|
|
4885
|
-
this.package.file.addOverride(
|
|
4886
|
-
"packageManager",
|
|
4887
|
-
`pnpm@${options.pnpmVersion}`
|
|
4888
|
-
);
|
|
4889
|
-
this.eslint?.addOverride({
|
|
4890
|
-
files: ["**/*.test.*", "**/*.spec.*"],
|
|
4891
|
-
rules: {
|
|
4892
|
-
"import/no-extraneous-dependencies": "off"
|
|
4893
|
-
}
|
|
4894
|
-
});
|
|
4895
|
-
this.gitignore?.addPatterns(".DS_Store", "test-reports");
|
|
4896
|
-
this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
|
|
4897
|
-
const turboActive = userOptions.parent && TurboRepo.of(userOptions.parent) !== void 0;
|
|
4898
|
-
if (turboActive) {
|
|
4899
|
-
const turbo = new TurboRepo(this);
|
|
4900
|
-
turbo.compileTask?.outputs.push("dist/**");
|
|
4901
|
-
turbo.compileTask?.outputs.push("lib/**");
|
|
4902
|
-
}
|
|
4903
|
-
if (options.agentConfig === true || typeof options.agentConfig === "object") {
|
|
4904
|
-
new AgentConfig(
|
|
4905
|
-
this,
|
|
4906
|
-
typeof options.agentConfig === "object" ? options.agentConfig : {}
|
|
4907
|
-
);
|
|
4908
|
-
}
|
|
4909
|
-
if (options.resetTask !== false) {
|
|
4910
|
-
const defaultResetTaskOptions = {
|
|
4911
|
-
pathsToRemove: [
|
|
4912
|
-
"node_modules",
|
|
4913
|
-
"dist",
|
|
4914
|
-
"lib",
|
|
4915
|
-
"coverage",
|
|
4916
|
-
"test-reports",
|
|
4917
|
-
".turbo",
|
|
4918
|
-
"tsconfig.tsbuildinfo",
|
|
4919
|
-
this.artifactsDirectory
|
|
4920
|
-
]
|
|
4921
|
-
};
|
|
4922
|
-
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
4923
|
-
const resetTaskOptions = merge(
|
|
4924
|
-
defaultResetTaskOptions,
|
|
4925
|
-
{
|
|
4926
|
-
...userResetTaskOptions,
|
|
4927
|
-
pathsToRemove: [
|
|
4928
|
-
...defaultResetTaskOptions.pathsToRemove ?? [],
|
|
4929
|
-
...userResetTaskOptions.pathsToRemove ?? []
|
|
4930
|
-
]
|
|
4931
|
-
}
|
|
4932
|
-
);
|
|
4933
|
-
new ResetTask(this, resetTaskOptions);
|
|
4934
|
-
}
|
|
4935
|
-
if (options.parent && options.parent instanceof MonorepoProject) {
|
|
4936
|
-
const originalResolve = this.package.resolveDepsAndWritePackageJson;
|
|
4937
|
-
this.package.installDependencies = () => {
|
|
4938
|
-
options.parent.requestInstallDependencies({
|
|
4939
|
-
resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
|
|
4940
|
-
});
|
|
4941
|
-
};
|
|
4942
|
-
this.package.resolveDepsAndWritePackageJson = () => {
|
|
4943
|
-
};
|
|
4944
|
-
}
|
|
4945
|
-
}
|
|
4946
|
-
};
|
|
4947
4863
|
|
|
4948
4864
|
// src/tasks/reset-task.ts
|
|
4949
|
-
|
|
4865
|
+
import { Component as Component13 } from "projen";
|
|
4866
|
+
var ResetTask = class _ResetTask extends Component13 {
|
|
4950
4867
|
constructor(project, options = {}) {
|
|
4951
4868
|
super(project);
|
|
4952
4869
|
this.project = project;
|
|
@@ -5019,8 +4936,8 @@ var ResetTask = class _ResetTask extends Component12 {
|
|
|
5019
4936
|
};
|
|
5020
4937
|
|
|
5021
4938
|
// src/vscode/vscode.ts
|
|
5022
|
-
import { Component as
|
|
5023
|
-
var VSCodeConfig = class extends
|
|
4939
|
+
import { Component as Component14, vscode } from "projen";
|
|
4940
|
+
var VSCodeConfig = class extends Component14 {
|
|
5024
4941
|
constructor(project) {
|
|
5025
4942
|
super(project);
|
|
5026
4943
|
const vsConfig = new vscode.VsCode(project);
|
|
@@ -5166,7 +5083,7 @@ function addBuildCompleteJob(buildWorkflow) {
|
|
|
5166
5083
|
}
|
|
5167
5084
|
|
|
5168
5085
|
// src/workflows/sync-labels.ts
|
|
5169
|
-
import { Component as
|
|
5086
|
+
import { Component as Component15, YamlFile as YamlFile2 } from "projen";
|
|
5170
5087
|
import { JobPermission as JobPermission4 } from "projen/lib/github/workflows-model";
|
|
5171
5088
|
var DEFAULT_STATUS_LABELS = [
|
|
5172
5089
|
{
|
|
@@ -5356,7 +5273,7 @@ function addSyncLabelsWorkflow(project, options) {
|
|
|
5356
5273
|
}
|
|
5357
5274
|
});
|
|
5358
5275
|
}
|
|
5359
|
-
var LabelsFile = class extends
|
|
5276
|
+
var LabelsFile = class extends Component15 {
|
|
5360
5277
|
constructor(project, labels) {
|
|
5361
5278
|
super(project);
|
|
5362
5279
|
new YamlFile2(project, LABELS_CONFIG_PATH, {
|
|
@@ -5468,7 +5385,7 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
5468
5385
|
depsUpgradeOptions: {
|
|
5469
5386
|
exclude: ["@codedrifters/configulator"],
|
|
5470
5387
|
workflowOptions: {
|
|
5471
|
-
schedule:
|
|
5388
|
+
schedule: UpgradeDependenciesSchedule.DAILY
|
|
5472
5389
|
},
|
|
5473
5390
|
cooldown: 1
|
|
5474
5391
|
},
|
|
@@ -5529,7 +5446,7 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
5529
5446
|
* Use PNPM instead of the default (Yarn). Much of the ecosystem depends
|
|
5530
5447
|
* on PNPM and making monorepos PNPM only simplifies many configurations.
|
|
5531
5448
|
*/
|
|
5532
|
-
packageManager:
|
|
5449
|
+
packageManager: NodePackageManager.PNPM,
|
|
5533
5450
|
/**
|
|
5534
5451
|
* Some additional pre-build steps if we're using turbo's remote cache.
|
|
5535
5452
|
* Set GIT_BRANCH_NAME so Turborepo remote cache hashes match between local and CI.
|
|
@@ -5550,7 +5467,7 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
5550
5467
|
]
|
|
5551
5468
|
}
|
|
5552
5469
|
};
|
|
5553
|
-
const options =
|
|
5470
|
+
const options = merge(
|
|
5554
5471
|
defaultOptions,
|
|
5555
5472
|
userOptions,
|
|
5556
5473
|
requiredOptions
|
|
@@ -5586,7 +5503,7 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
5586
5503
|
pathsToRemove: ["node_modules", ".turbo", "dist", "lib"]
|
|
5587
5504
|
};
|
|
5588
5505
|
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
5589
|
-
const resetTaskOptions =
|
|
5506
|
+
const resetTaskOptions = merge(
|
|
5590
5507
|
defaultResetTaskOptions,
|
|
5591
5508
|
{
|
|
5592
5509
|
...userResetTaskOptions,
|
|
@@ -5683,11 +5600,285 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
5683
5600
|
}
|
|
5684
5601
|
};
|
|
5685
5602
|
|
|
5603
|
+
// src/projects/typescript-project.ts
|
|
5604
|
+
var TestRunner = {
|
|
5605
|
+
JEST: "jest",
|
|
5606
|
+
VITEST: "vitest"
|
|
5607
|
+
};
|
|
5608
|
+
var TypeScriptProject = class extends typescript.TypeScriptProject {
|
|
5609
|
+
constructor(userOptions) {
|
|
5610
|
+
const pnpmVersion = userOptions.parent && userOptions.parent instanceof MonorepoProject ? userOptions.parent.pnpmVersion : VERSION.PNPM_VERSION;
|
|
5611
|
+
const pnpmWorkspace = userOptions.parent && userOptions.parent instanceof MonorepoProject ? PnpmWorkspace.of(userOptions.parent) : void 0;
|
|
5612
|
+
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
5613
|
+
const useJest = testRunner === TestRunner.JEST;
|
|
5614
|
+
const defaultOptions = {
|
|
5615
|
+
/**
|
|
5616
|
+
* This is a standard, so don't require it to passed in everywhere.
|
|
5617
|
+
*/
|
|
5618
|
+
defaultReleaseBranch: "main",
|
|
5619
|
+
/**
|
|
5620
|
+
* Enable reset task by default.
|
|
5621
|
+
*/
|
|
5622
|
+
resetTask: true,
|
|
5623
|
+
/**
|
|
5624
|
+
* Packaging options
|
|
5625
|
+
*/
|
|
5626
|
+
packageManager: NodePackageManager2.PNPM,
|
|
5627
|
+
pnpmVersion,
|
|
5628
|
+
licensed: userOptions.license !== void 0 || false,
|
|
5629
|
+
copyrightOwner: "CodeDrifters",
|
|
5630
|
+
release: false,
|
|
5631
|
+
/**
|
|
5632
|
+
* Don't add sample code.
|
|
5633
|
+
*/
|
|
5634
|
+
sampleCode: false,
|
|
5635
|
+
...useJest ? {
|
|
5636
|
+
/**
|
|
5637
|
+
* Make sure jest config is stored outside of package.json
|
|
5638
|
+
*/
|
|
5639
|
+
jestOptions: {
|
|
5640
|
+
configFilePath: "jest.config.json",
|
|
5641
|
+
jestConfig: {
|
|
5642
|
+
roots: [`<rootDir>/src`],
|
|
5643
|
+
transform: {
|
|
5644
|
+
["^.+\\.[t]sx?$"]: new Transform("@swc/jest")
|
|
5645
|
+
},
|
|
5646
|
+
moduleFileExtensions: ["js", "ts"]
|
|
5647
|
+
}
|
|
5648
|
+
},
|
|
5649
|
+
/**
|
|
5650
|
+
* SWC for faster testing
|
|
5651
|
+
*/
|
|
5652
|
+
devDeps: ["@swc/jest", "@swc/core"]
|
|
5653
|
+
} : {
|
|
5654
|
+
jest: false,
|
|
5655
|
+
devDeps: []
|
|
5656
|
+
},
|
|
5657
|
+
/**
|
|
5658
|
+
* Turn on prettier formatting
|
|
5659
|
+
*/
|
|
5660
|
+
prettier: true,
|
|
5661
|
+
/**
|
|
5662
|
+
* Don't package test files.
|
|
5663
|
+
*/
|
|
5664
|
+
npmIgnoreOptions: {
|
|
5665
|
+
ignorePatterns: ["*.spec.*", "*.test.*"]
|
|
5666
|
+
},
|
|
5667
|
+
/**
|
|
5668
|
+
* Options for the automated dependency upgrade task / workflow
|
|
5669
|
+
* Automatically exclude any packages that are managed by the root
|
|
5670
|
+
* project as default catalog dependencies since we want to let the
|
|
5671
|
+
* catalog manage those dependencies.
|
|
5672
|
+
*/
|
|
5673
|
+
depsUpgrade: true,
|
|
5674
|
+
depsUpgradeOptions: {
|
|
5675
|
+
workflow: false,
|
|
5676
|
+
exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
|
|
5677
|
+
...userOptions.parent && userOptions.parent instanceof MonorepoProject ? {
|
|
5678
|
+
workflowOptions: {
|
|
5679
|
+
schedule: UpgradeDependenciesSchedule2.WEEKLY
|
|
5680
|
+
},
|
|
5681
|
+
cooldown: 1
|
|
5682
|
+
} : {}
|
|
5683
|
+
},
|
|
5684
|
+
/**
|
|
5685
|
+
* Only release when the package folder source content or package.json
|
|
5686
|
+
* (version, dependencies) changes.
|
|
5687
|
+
*/
|
|
5688
|
+
releaseTrigger: ReleaseTrigger.continuous({
|
|
5689
|
+
paths: [
|
|
5690
|
+
`${userOptions.outdir}/src/**`,
|
|
5691
|
+
`${userOptions.outdir}/package.json`
|
|
5692
|
+
]
|
|
5693
|
+
})
|
|
5694
|
+
};
|
|
5695
|
+
const options = merge2(defaultOptions, userOptions);
|
|
5696
|
+
super(options);
|
|
5697
|
+
this.addDevDeps("@types/node@catalog:");
|
|
5698
|
+
this.tsconfig?.addExclude("**/*.test.*");
|
|
5699
|
+
this.tsconfig?.addExclude("**/*.spec.*");
|
|
5700
|
+
if (options.testRunner === TestRunner.VITEST) {
|
|
5701
|
+
new Vitest(this, {
|
|
5702
|
+
config: {
|
|
5703
|
+
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
|
|
5704
|
+
...options.vitestOptions?.config
|
|
5705
|
+
},
|
|
5706
|
+
...options.vitestOptions
|
|
5707
|
+
});
|
|
5708
|
+
} else {
|
|
5709
|
+
this.deps.removeDependency("ts-jest");
|
|
5710
|
+
}
|
|
5711
|
+
this.package.file.addOverride(
|
|
5712
|
+
"packageManager",
|
|
5713
|
+
`pnpm@${options.pnpmVersion}`
|
|
5714
|
+
);
|
|
5715
|
+
this.eslint?.addOverride({
|
|
5716
|
+
files: ["**/*.test.*", "**/*.spec.*"],
|
|
5717
|
+
rules: {
|
|
5718
|
+
"import/no-extraneous-dependencies": "off"
|
|
5719
|
+
}
|
|
5720
|
+
});
|
|
5721
|
+
this.gitignore?.addPatterns(".DS_Store", "test-reports");
|
|
5722
|
+
this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
|
|
5723
|
+
const turboActive = userOptions.parent && TurboRepo.of(userOptions.parent) !== void 0;
|
|
5724
|
+
if (turboActive) {
|
|
5725
|
+
const turbo = new TurboRepo(this);
|
|
5726
|
+
turbo.compileTask?.outputs.push("dist/**");
|
|
5727
|
+
turbo.compileTask?.outputs.push("lib/**");
|
|
5728
|
+
}
|
|
5729
|
+
if (options.agentConfig === true || typeof options.agentConfig === "object") {
|
|
5730
|
+
new AgentConfig(
|
|
5731
|
+
this,
|
|
5732
|
+
typeof options.agentConfig === "object" ? options.agentConfig : {}
|
|
5733
|
+
);
|
|
5734
|
+
}
|
|
5735
|
+
if (options.resetTask !== false) {
|
|
5736
|
+
const defaultResetTaskOptions = {
|
|
5737
|
+
pathsToRemove: [
|
|
5738
|
+
"node_modules",
|
|
5739
|
+
"dist",
|
|
5740
|
+
"lib",
|
|
5741
|
+
"coverage",
|
|
5742
|
+
"test-reports",
|
|
5743
|
+
".turbo",
|
|
5744
|
+
"tsconfig.tsbuildinfo",
|
|
5745
|
+
this.artifactsDirectory
|
|
5746
|
+
]
|
|
5747
|
+
};
|
|
5748
|
+
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
5749
|
+
const resetTaskOptions = merge2(
|
|
5750
|
+
defaultResetTaskOptions,
|
|
5751
|
+
{
|
|
5752
|
+
...userResetTaskOptions,
|
|
5753
|
+
pathsToRemove: [
|
|
5754
|
+
...defaultResetTaskOptions.pathsToRemove ?? [],
|
|
5755
|
+
...userResetTaskOptions.pathsToRemove ?? []
|
|
5756
|
+
]
|
|
5757
|
+
}
|
|
5758
|
+
);
|
|
5759
|
+
new ResetTask(this, resetTaskOptions);
|
|
5760
|
+
}
|
|
5761
|
+
if (options.parent && options.parent instanceof MonorepoProject) {
|
|
5762
|
+
const originalResolve = this.package.resolveDepsAndWritePackageJson;
|
|
5763
|
+
this.package.installDependencies = () => {
|
|
5764
|
+
options.parent.requestInstallDependencies({
|
|
5765
|
+
resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
|
|
5766
|
+
});
|
|
5767
|
+
};
|
|
5768
|
+
this.package.resolveDepsAndWritePackageJson = () => {
|
|
5769
|
+
};
|
|
5770
|
+
}
|
|
5771
|
+
}
|
|
5772
|
+
};
|
|
5773
|
+
|
|
5774
|
+
// src/projects/astro-project.ts
|
|
5775
|
+
var AstroProject = class extends TypeScriptProject {
|
|
5776
|
+
constructor(userOptions) {
|
|
5777
|
+
const options = {
|
|
5778
|
+
testRunner: TestRunner.VITEST,
|
|
5779
|
+
...userOptions,
|
|
5780
|
+
depsUpgradeOptions: {
|
|
5781
|
+
...userOptions.depsUpgradeOptions,
|
|
5782
|
+
exclude: [...userOptions.depsUpgradeOptions?.exclude ?? [], "astro"]
|
|
5783
|
+
}
|
|
5784
|
+
};
|
|
5785
|
+
super(options);
|
|
5786
|
+
const astroVersion = options.astroVersion ?? VERSION.ASTRO_VERSION;
|
|
5787
|
+
const astroTsconfigExtends = options.astroTsconfigExtends ?? "astro/tsconfigs/strict";
|
|
5788
|
+
this.package.addField("type", "module");
|
|
5789
|
+
this.tsconfig?.file.addOverride("extends", astroTsconfigExtends);
|
|
5790
|
+
this.tsconfig?.addInclude(".astro/types.d.ts");
|
|
5791
|
+
this.tsconfig?.addInclude("src/**/*.astro");
|
|
5792
|
+
this.compileTask.reset();
|
|
5793
|
+
this.compileTask.exec("astro check");
|
|
5794
|
+
this.compileTask.exec("astro build");
|
|
5795
|
+
this.tasks.tryFind("watch")?.reset("astro dev");
|
|
5796
|
+
this.packageTask.reset();
|
|
5797
|
+
if (!this.tasks.tryFind("dev")) {
|
|
5798
|
+
this.addTask("dev", {
|
|
5799
|
+
description: "Start the Astro dev server",
|
|
5800
|
+
exec: "astro dev",
|
|
5801
|
+
receiveArgs: true
|
|
5802
|
+
});
|
|
5803
|
+
}
|
|
5804
|
+
if (!this.tasks.tryFind("preview")) {
|
|
5805
|
+
this.addTask("preview", {
|
|
5806
|
+
description: "Preview the built site locally",
|
|
5807
|
+
exec: "astro preview",
|
|
5808
|
+
receiveArgs: true
|
|
5809
|
+
});
|
|
5810
|
+
}
|
|
5811
|
+
if (!this.tasks.tryFind("check")) {
|
|
5812
|
+
this.addTask("check", {
|
|
5813
|
+
description: "Run Astro's type and content checks",
|
|
5814
|
+
exec: "astro check"
|
|
5815
|
+
});
|
|
5816
|
+
}
|
|
5817
|
+
this.addDeps(`astro@${astroVersion}`);
|
|
5818
|
+
this.addDevDeps(
|
|
5819
|
+
"@astrojs/check",
|
|
5820
|
+
"astro-eslint-parser",
|
|
5821
|
+
"eslint-plugin-astro",
|
|
5822
|
+
"prettier-plugin-astro"
|
|
5823
|
+
);
|
|
5824
|
+
const prettierConfig = this.tryFindObjectFile(".prettierrc.json");
|
|
5825
|
+
prettierConfig?.addOverride("plugins", ["prettier-plugin-astro"]);
|
|
5826
|
+
prettierConfig?.addOverride("overrides", [
|
|
5827
|
+
{ files: "*.astro", options: { parser: "astro" } }
|
|
5828
|
+
]);
|
|
5829
|
+
this.eslint?.addPlugins("astro");
|
|
5830
|
+
this.eslint?.addExtends("plugin:astro/recommended");
|
|
5831
|
+
this.eslint?.addOverride({
|
|
5832
|
+
files: ["*.astro"],
|
|
5833
|
+
parser: "astro-eslint-parser"
|
|
5834
|
+
});
|
|
5835
|
+
this.eslint?.addLintPattern("src/**/*.astro");
|
|
5836
|
+
this.gitignore.addPatterns(".astro", ".vercel", ".netlify");
|
|
5837
|
+
const turbo = TurboRepo.of(this);
|
|
5838
|
+
if (turbo?.compileTask) {
|
|
5839
|
+
turbo.compileTask.inputs.push("public/**", "astro.config.mjs");
|
|
5840
|
+
}
|
|
5841
|
+
const integrations = options.integrations ?? [];
|
|
5842
|
+
this.astroConfig = new AstroConfig(this, {
|
|
5843
|
+
site: options.site,
|
|
5844
|
+
base: options.base,
|
|
5845
|
+
output: options.output,
|
|
5846
|
+
integrations,
|
|
5847
|
+
adapter: options.adapter
|
|
5848
|
+
});
|
|
5849
|
+
if (options.sampleCode === true) {
|
|
5850
|
+
new SampleFile(this, "src/pages/index.astro", {
|
|
5851
|
+
contents: DEFAULT_INDEX_ASTRO
|
|
5852
|
+
});
|
|
5853
|
+
new SampleFile(this, "public/favicon.svg", {
|
|
5854
|
+
contents: DEFAULT_FAVICON_SVG
|
|
5855
|
+
});
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5858
|
+
};
|
|
5859
|
+
var DEFAULT_INDEX_ASTRO = `---
|
|
5860
|
+
// Welcome to Astro!
|
|
5861
|
+
---
|
|
5862
|
+
<html lang="en">
|
|
5863
|
+
<head>
|
|
5864
|
+
<meta charset="utf-8" />
|
|
5865
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
5866
|
+
<meta name="viewport" content="width=device-width" />
|
|
5867
|
+
<title>Astro</title>
|
|
5868
|
+
</head>
|
|
5869
|
+
<body>
|
|
5870
|
+
<h1>Hello, Astro!</h1>
|
|
5871
|
+
</body>
|
|
5872
|
+
</html>
|
|
5873
|
+
`;
|
|
5874
|
+
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>
|
|
5875
|
+
`;
|
|
5876
|
+
|
|
5686
5877
|
// src/typescript/typescript-config.ts
|
|
5687
5878
|
import { relative as relative4 } from "path";
|
|
5688
|
-
import { Component as
|
|
5879
|
+
import { Component as Component16 } from "projen";
|
|
5689
5880
|
import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
|
|
5690
|
-
var TypeScriptConfig = class extends
|
|
5881
|
+
var TypeScriptConfig = class extends Component16 {
|
|
5691
5882
|
constructor(project) {
|
|
5692
5883
|
super(project);
|
|
5693
5884
|
let tsPaths = {};
|
|
@@ -5715,12 +5906,12 @@ var TypeScriptConfig = class extends Component15 {
|
|
|
5715
5906
|
|
|
5716
5907
|
// src/workflows/aws-deploy-workflow.ts
|
|
5717
5908
|
var import_utils11 = __toESM(require_lib());
|
|
5718
|
-
import { Component as
|
|
5909
|
+
import { Component as Component17 } from "projen";
|
|
5719
5910
|
import { BuildWorkflow } from "projen/lib/build";
|
|
5720
5911
|
import { GitHub as GitHub2 } from "projen/lib/github";
|
|
5721
5912
|
import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
|
|
5722
5913
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
5723
|
-
var AwsDeployWorkflow = class _AwsDeployWorkflow extends
|
|
5914
|
+
var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component17 {
|
|
5724
5915
|
constructor(project, options = {}) {
|
|
5725
5916
|
super(project);
|
|
5726
5917
|
this.project = project;
|
|
@@ -5988,6 +6179,9 @@ export {
|
|
|
5988
6179
|
AGENT_PLATFORM,
|
|
5989
6180
|
AGENT_RULE_SCOPE,
|
|
5990
6181
|
AgentConfig,
|
|
6182
|
+
AstroConfig,
|
|
6183
|
+
AstroOutput,
|
|
6184
|
+
AstroProject,
|
|
5991
6185
|
AwsDeployWorkflow,
|
|
5992
6186
|
AwsDeploymentConfig,
|
|
5993
6187
|
AwsDeploymentTarget,
|