@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.js
CHANGED
|
@@ -179,6 +179,9 @@ __export(index_exports, {
|
|
|
179
179
|
AGENT_PLATFORM: () => AGENT_PLATFORM,
|
|
180
180
|
AGENT_RULE_SCOPE: () => AGENT_RULE_SCOPE,
|
|
181
181
|
AgentConfig: () => AgentConfig,
|
|
182
|
+
AstroConfig: () => AstroConfig,
|
|
183
|
+
AstroOutput: () => AstroOutput,
|
|
184
|
+
AstroProject: () => AstroProject,
|
|
182
185
|
AwsDeployWorkflow: () => AwsDeployWorkflow,
|
|
183
186
|
AwsDeploymentConfig: () => AwsDeploymentConfig,
|
|
184
187
|
AwsDeploymentTarget: () => AwsDeploymentTarget,
|
|
@@ -3038,6 +3041,10 @@ var import_textfile = require("projen/lib/textfile");
|
|
|
3038
3041
|
|
|
3039
3042
|
// src/versions.ts
|
|
3040
3043
|
var VERSION = {
|
|
3044
|
+
/**
|
|
3045
|
+
* Version of Astro to pin for AstroProject scaffolding.
|
|
3046
|
+
*/
|
|
3047
|
+
ASTRO_VERSION: "5.14.1",
|
|
3041
3048
|
/**
|
|
3042
3049
|
* CDK CLI for workflows and command line operations.
|
|
3043
3050
|
*
|
|
@@ -4421,11 +4428,91 @@ ${extra}`
|
|
|
4421
4428
|
}
|
|
4422
4429
|
};
|
|
4423
4430
|
|
|
4431
|
+
// src/astro/astro-config.ts
|
|
4432
|
+
var import_projen9 = require("projen");
|
|
4433
|
+
var import_textfile4 = require("projen/lib/textfile");
|
|
4434
|
+
var AstroConfig = class _AstroConfig extends import_projen9.Component {
|
|
4435
|
+
constructor(project, options = {}) {
|
|
4436
|
+
super(project);
|
|
4437
|
+
this.project = project;
|
|
4438
|
+
this.configFilePath = "astro.config.mjs";
|
|
4439
|
+
this.site = options.site;
|
|
4440
|
+
this.base = options.base;
|
|
4441
|
+
this.output = options.output;
|
|
4442
|
+
this.integrations = options.integrations ?? [];
|
|
4443
|
+
this.adapter = options.adapter;
|
|
4444
|
+
this.synthesizeConfig();
|
|
4445
|
+
}
|
|
4446
|
+
/**
|
|
4447
|
+
* Find the AstroConfig component on a project.
|
|
4448
|
+
*/
|
|
4449
|
+
static of(project) {
|
|
4450
|
+
const isAstroConfig = (c) => c instanceof _AstroConfig;
|
|
4451
|
+
return project.components.find(isAstroConfig);
|
|
4452
|
+
}
|
|
4453
|
+
/**
|
|
4454
|
+
* Render the config file contents as an array of lines.
|
|
4455
|
+
*
|
|
4456
|
+
* Exposed for unit testing — `synthesizeConfig` writes these to disk.
|
|
4457
|
+
*/
|
|
4458
|
+
renderConfig() {
|
|
4459
|
+
const imports = [
|
|
4460
|
+
'import { defineConfig } from "astro/config";'
|
|
4461
|
+
];
|
|
4462
|
+
const specs = [
|
|
4463
|
+
...this.integrations,
|
|
4464
|
+
...this.adapter ? [this.adapter] : []
|
|
4465
|
+
];
|
|
4466
|
+
for (const spec2 of specs) {
|
|
4467
|
+
imports.push(renderImport(spec2));
|
|
4468
|
+
}
|
|
4469
|
+
const body = [];
|
|
4470
|
+
if (this.site !== void 0) {
|
|
4471
|
+
body.push(` site: ${JSON.stringify(this.site)},`);
|
|
4472
|
+
}
|
|
4473
|
+
if (this.base !== void 0) {
|
|
4474
|
+
body.push(` base: ${JSON.stringify(this.base)},`);
|
|
4475
|
+
}
|
|
4476
|
+
if (this.output !== void 0) {
|
|
4477
|
+
body.push(` output: ${JSON.stringify(this.output)},`);
|
|
4478
|
+
}
|
|
4479
|
+
if (this.integrations.length > 0) {
|
|
4480
|
+
const calls = this.integrations.map(renderCall).join(", ");
|
|
4481
|
+
body.push(` integrations: [${calls}],`);
|
|
4482
|
+
}
|
|
4483
|
+
if (this.adapter) {
|
|
4484
|
+
body.push(` adapter: ${renderCall(this.adapter)},`);
|
|
4485
|
+
}
|
|
4486
|
+
return [...imports, "", "export default defineConfig({", ...body, "});"];
|
|
4487
|
+
}
|
|
4488
|
+
synthesizeConfig() {
|
|
4489
|
+
this.project.tryRemoveFile(this.configFilePath);
|
|
4490
|
+
new import_textfile4.TextFile(this, this.configFilePath, {
|
|
4491
|
+
lines: this.renderConfig()
|
|
4492
|
+
});
|
|
4493
|
+
}
|
|
4494
|
+
};
|
|
4495
|
+
function renderImport(spec2) {
|
|
4496
|
+
const asDefault = spec2.defaultImport ?? true;
|
|
4497
|
+
const binding = asDefault ? spec2.name : `{ ${spec2.name} }`;
|
|
4498
|
+
return `import ${binding} from ${JSON.stringify(spec2.importPath)};`;
|
|
4499
|
+
}
|
|
4500
|
+
function renderCall(spec2) {
|
|
4501
|
+
return `${spec2.name}(${spec2.args ?? ""})`;
|
|
4502
|
+
}
|
|
4503
|
+
|
|
4504
|
+
// src/astro/astro-config-options.ts
|
|
4505
|
+
var AstroOutput = {
|
|
4506
|
+
STATIC: "static",
|
|
4507
|
+
SERVER: "server",
|
|
4508
|
+
HYBRID: "hybrid"
|
|
4509
|
+
};
|
|
4510
|
+
|
|
4424
4511
|
// src/aws/aws-deployment-config.ts
|
|
4425
4512
|
var import_node_path = require("path");
|
|
4426
4513
|
var import_utils9 = __toESM(require_lib());
|
|
4427
|
-
var
|
|
4428
|
-
var AwsDeploymentConfig = class _AwsDeploymentConfig extends
|
|
4514
|
+
var import_projen10 = require("projen");
|
|
4515
|
+
var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen10.Component {
|
|
4429
4516
|
constructor(project) {
|
|
4430
4517
|
super(project);
|
|
4431
4518
|
/**
|
|
@@ -4542,8 +4629,8 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen9.Comp
|
|
|
4542
4629
|
|
|
4543
4630
|
// src/aws/aws-deployment-target.ts
|
|
4544
4631
|
var import_utils10 = __toESM(require_lib());
|
|
4545
|
-
var
|
|
4546
|
-
var AwsDeploymentTarget = class _AwsDeploymentTarget extends
|
|
4632
|
+
var import_projen11 = require("projen");
|
|
4633
|
+
var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen11.Component {
|
|
4547
4634
|
constructor(project, options) {
|
|
4548
4635
|
super(project);
|
|
4549
4636
|
/**
|
|
@@ -4741,6 +4828,7 @@ async function getLatestEligibleVersion(packageName, minimumReleaseAgeMinutes) {
|
|
|
4741
4828
|
|
|
4742
4829
|
// src/version-package-map.ts
|
|
4743
4830
|
var VERSION_NPM_PACKAGES = [
|
|
4831
|
+
{ key: "ASTRO_VERSION", npmPackage: "astro" },
|
|
4744
4832
|
{ key: "AWS_CDK_CLI_VERSION", npmPackage: "aws-cdk" },
|
|
4745
4833
|
{ key: "AWS_CDK_LIB_VERSION", npmPackage: "aws-cdk-lib" },
|
|
4746
4834
|
{ key: "AWS_CONSTRUCTS_VERSION", npmPackage: "constructs" },
|
|
@@ -4759,12 +4847,12 @@ var VERSION_KEYS_SKIP = [
|
|
|
4759
4847
|
|
|
4760
4848
|
// src/jsii/jsii-faker.ts
|
|
4761
4849
|
var spec = __toESM(require("@jsii/spec"));
|
|
4762
|
-
var
|
|
4850
|
+
var import_projen12 = require("projen");
|
|
4763
4851
|
var ProjenBaseFqn = {
|
|
4764
4852
|
TYPESCRIPT_PROJECT: "projen.typescript.TypeScriptProject",
|
|
4765
4853
|
TYPESCRIPT_PROJECT_OPTIONS: "projen.typescript.TypeScriptProjectOptions"
|
|
4766
4854
|
};
|
|
4767
|
-
var JsiiFaker = class _JsiiFaker extends
|
|
4855
|
+
var JsiiFaker = class _JsiiFaker extends import_projen12.Component {
|
|
4768
4856
|
constructor(project) {
|
|
4769
4857
|
super(project);
|
|
4770
4858
|
this.project = project;
|
|
@@ -4775,7 +4863,7 @@ var JsiiFaker = class _JsiiFaker extends import_projen11.Component {
|
|
|
4775
4863
|
};
|
|
4776
4864
|
};
|
|
4777
4865
|
this._assemblyName = this.project.package.packageName;
|
|
4778
|
-
new
|
|
4866
|
+
new import_projen12.JsonFile(project, ".jsii", {
|
|
4779
4867
|
obj: () => {
|
|
4780
4868
|
return {
|
|
4781
4869
|
name: this._assemblyName,
|
|
@@ -4812,190 +4900,22 @@ var JsiiFaker = class _JsiiFaker extends import_projen11.Component {
|
|
|
4812
4900
|
}
|
|
4813
4901
|
};
|
|
4814
4902
|
|
|
4815
|
-
// src/projects/
|
|
4903
|
+
// src/projects/astro-project.ts
|
|
4904
|
+
var import_projen17 = require("projen");
|
|
4905
|
+
|
|
4906
|
+
// src/projects/typescript-project.ts
|
|
4907
|
+
var import_projen16 = require("projen");
|
|
4816
4908
|
var import_javascript4 = require("projen/lib/javascript");
|
|
4817
|
-
var
|
|
4909
|
+
var import_release = require("projen/lib/release");
|
|
4818
4910
|
var import_ts_deepmerge2 = require("ts-deepmerge");
|
|
4819
4911
|
|
|
4820
|
-
// src/
|
|
4821
|
-
var import_projen13 = require("projen");
|
|
4822
|
-
|
|
4823
|
-
// src/projects/typescript-project.ts
|
|
4824
|
-
var import_projen12 = require("projen");
|
|
4912
|
+
// src/projects/monorepo-project.ts
|
|
4825
4913
|
var import_javascript3 = require("projen/lib/javascript");
|
|
4826
|
-
var
|
|
4914
|
+
var import_typescript3 = require("projen/lib/typescript");
|
|
4827
4915
|
var import_ts_deepmerge = require("ts-deepmerge");
|
|
4828
|
-
var TestRunner = {
|
|
4829
|
-
JEST: "jest",
|
|
4830
|
-
VITEST: "vitest"
|
|
4831
|
-
};
|
|
4832
|
-
var TypeScriptProject = class extends import_projen12.typescript.TypeScriptProject {
|
|
4833
|
-
constructor(userOptions) {
|
|
4834
|
-
const pnpmVersion = userOptions.parent && userOptions.parent instanceof MonorepoProject ? userOptions.parent.pnpmVersion : VERSION.PNPM_VERSION;
|
|
4835
|
-
const pnpmWorkspace = userOptions.parent && userOptions.parent instanceof MonorepoProject ? PnpmWorkspace.of(userOptions.parent) : void 0;
|
|
4836
|
-
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
4837
|
-
const useJest = testRunner === TestRunner.JEST;
|
|
4838
|
-
const defaultOptions = {
|
|
4839
|
-
/**
|
|
4840
|
-
* This is a standard, so don't require it to passed in everywhere.
|
|
4841
|
-
*/
|
|
4842
|
-
defaultReleaseBranch: "main",
|
|
4843
|
-
/**
|
|
4844
|
-
* Enable reset task by default.
|
|
4845
|
-
*/
|
|
4846
|
-
resetTask: true,
|
|
4847
|
-
/**
|
|
4848
|
-
* Packaging options
|
|
4849
|
-
*/
|
|
4850
|
-
packageManager: import_javascript3.NodePackageManager.PNPM,
|
|
4851
|
-
pnpmVersion,
|
|
4852
|
-
licensed: userOptions.license !== void 0 || false,
|
|
4853
|
-
copyrightOwner: "CodeDrifters",
|
|
4854
|
-
release: false,
|
|
4855
|
-
/**
|
|
4856
|
-
* Don't add sample code.
|
|
4857
|
-
*/
|
|
4858
|
-
sampleCode: false,
|
|
4859
|
-
...useJest ? {
|
|
4860
|
-
/**
|
|
4861
|
-
* Make sure jest config is stored outside of package.json
|
|
4862
|
-
*/
|
|
4863
|
-
jestOptions: {
|
|
4864
|
-
configFilePath: "jest.config.json",
|
|
4865
|
-
jestConfig: {
|
|
4866
|
-
roots: [`<rootDir>/src`],
|
|
4867
|
-
transform: {
|
|
4868
|
-
["^.+\\.[t]sx?$"]: new import_javascript3.Transform("@swc/jest")
|
|
4869
|
-
},
|
|
4870
|
-
moduleFileExtensions: ["js", "ts"]
|
|
4871
|
-
}
|
|
4872
|
-
},
|
|
4873
|
-
/**
|
|
4874
|
-
* SWC for faster testing
|
|
4875
|
-
*/
|
|
4876
|
-
devDeps: ["@swc/jest", "@swc/core"]
|
|
4877
|
-
} : {
|
|
4878
|
-
jest: false,
|
|
4879
|
-
devDeps: []
|
|
4880
|
-
},
|
|
4881
|
-
/**
|
|
4882
|
-
* Turn on prettier formatting
|
|
4883
|
-
*/
|
|
4884
|
-
prettier: true,
|
|
4885
|
-
/**
|
|
4886
|
-
* Don't package test files.
|
|
4887
|
-
*/
|
|
4888
|
-
npmIgnoreOptions: {
|
|
4889
|
-
ignorePatterns: ["*.spec.*", "*.test.*"]
|
|
4890
|
-
},
|
|
4891
|
-
/**
|
|
4892
|
-
* Options for the automated dependency upgrade task / workflow
|
|
4893
|
-
* Automatically exclude any packages that are managed by the root
|
|
4894
|
-
* project as default catalog dependencies since we want to let the
|
|
4895
|
-
* catalog manage those dependencies.
|
|
4896
|
-
*/
|
|
4897
|
-
depsUpgrade: true,
|
|
4898
|
-
depsUpgradeOptions: {
|
|
4899
|
-
workflow: false,
|
|
4900
|
-
exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
|
|
4901
|
-
...userOptions.parent && userOptions.parent instanceof MonorepoProject ? {
|
|
4902
|
-
workflowOptions: {
|
|
4903
|
-
schedule: import_javascript3.UpgradeDependenciesSchedule.WEEKLY
|
|
4904
|
-
},
|
|
4905
|
-
cooldown: 1
|
|
4906
|
-
} : {}
|
|
4907
|
-
},
|
|
4908
|
-
/**
|
|
4909
|
-
* Only release when the package folder source content or package.json
|
|
4910
|
-
* (version, dependencies) changes.
|
|
4911
|
-
*/
|
|
4912
|
-
releaseTrigger: import_release.ReleaseTrigger.continuous({
|
|
4913
|
-
paths: [
|
|
4914
|
-
`${userOptions.outdir}/src/**`,
|
|
4915
|
-
`${userOptions.outdir}/package.json`
|
|
4916
|
-
]
|
|
4917
|
-
})
|
|
4918
|
-
};
|
|
4919
|
-
const options = (0, import_ts_deepmerge.merge)(defaultOptions, userOptions);
|
|
4920
|
-
super(options);
|
|
4921
|
-
this.addDevDeps("@types/node@catalog:");
|
|
4922
|
-
this.tsconfig?.addExclude("**/*.test.*");
|
|
4923
|
-
this.tsconfig?.addExclude("**/*.spec.*");
|
|
4924
|
-
if (options.testRunner === TestRunner.VITEST) {
|
|
4925
|
-
new Vitest(this, {
|
|
4926
|
-
config: {
|
|
4927
|
-
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
|
|
4928
|
-
...options.vitestOptions?.config
|
|
4929
|
-
},
|
|
4930
|
-
...options.vitestOptions
|
|
4931
|
-
});
|
|
4932
|
-
} else {
|
|
4933
|
-
this.deps.removeDependency("ts-jest");
|
|
4934
|
-
}
|
|
4935
|
-
this.package.file.addOverride(
|
|
4936
|
-
"packageManager",
|
|
4937
|
-
`pnpm@${options.pnpmVersion}`
|
|
4938
|
-
);
|
|
4939
|
-
this.eslint?.addOverride({
|
|
4940
|
-
files: ["**/*.test.*", "**/*.spec.*"],
|
|
4941
|
-
rules: {
|
|
4942
|
-
"import/no-extraneous-dependencies": "off"
|
|
4943
|
-
}
|
|
4944
|
-
});
|
|
4945
|
-
this.gitignore?.addPatterns(".DS_Store", "test-reports");
|
|
4946
|
-
this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
|
|
4947
|
-
const turboActive = userOptions.parent && TurboRepo.of(userOptions.parent) !== void 0;
|
|
4948
|
-
if (turboActive) {
|
|
4949
|
-
const turbo = new TurboRepo(this);
|
|
4950
|
-
turbo.compileTask?.outputs.push("dist/**");
|
|
4951
|
-
turbo.compileTask?.outputs.push("lib/**");
|
|
4952
|
-
}
|
|
4953
|
-
if (options.agentConfig === true || typeof options.agentConfig === "object") {
|
|
4954
|
-
new AgentConfig(
|
|
4955
|
-
this,
|
|
4956
|
-
typeof options.agentConfig === "object" ? options.agentConfig : {}
|
|
4957
|
-
);
|
|
4958
|
-
}
|
|
4959
|
-
if (options.resetTask !== false) {
|
|
4960
|
-
const defaultResetTaskOptions = {
|
|
4961
|
-
pathsToRemove: [
|
|
4962
|
-
"node_modules",
|
|
4963
|
-
"dist",
|
|
4964
|
-
"lib",
|
|
4965
|
-
"coverage",
|
|
4966
|
-
"test-reports",
|
|
4967
|
-
".turbo",
|
|
4968
|
-
"tsconfig.tsbuildinfo",
|
|
4969
|
-
this.artifactsDirectory
|
|
4970
|
-
]
|
|
4971
|
-
};
|
|
4972
|
-
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
4973
|
-
const resetTaskOptions = (0, import_ts_deepmerge.merge)(
|
|
4974
|
-
defaultResetTaskOptions,
|
|
4975
|
-
{
|
|
4976
|
-
...userResetTaskOptions,
|
|
4977
|
-
pathsToRemove: [
|
|
4978
|
-
...defaultResetTaskOptions.pathsToRemove ?? [],
|
|
4979
|
-
...userResetTaskOptions.pathsToRemove ?? []
|
|
4980
|
-
]
|
|
4981
|
-
}
|
|
4982
|
-
);
|
|
4983
|
-
new ResetTask(this, resetTaskOptions);
|
|
4984
|
-
}
|
|
4985
|
-
if (options.parent && options.parent instanceof MonorepoProject) {
|
|
4986
|
-
const originalResolve = this.package.resolveDepsAndWritePackageJson;
|
|
4987
|
-
this.package.installDependencies = () => {
|
|
4988
|
-
options.parent.requestInstallDependencies({
|
|
4989
|
-
resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
|
|
4990
|
-
});
|
|
4991
|
-
};
|
|
4992
|
-
this.package.resolveDepsAndWritePackageJson = () => {
|
|
4993
|
-
};
|
|
4994
|
-
}
|
|
4995
|
-
}
|
|
4996
|
-
};
|
|
4997
4916
|
|
|
4998
4917
|
// src/tasks/reset-task.ts
|
|
4918
|
+
var import_projen13 = require("projen");
|
|
4999
4919
|
var ResetTask = class _ResetTask extends import_projen13.Component {
|
|
5000
4920
|
constructor(project, options = {}) {
|
|
5001
4921
|
super(project);
|
|
@@ -5518,7 +5438,7 @@ var MonorepoProject = class extends import_typescript3.TypeScriptAppProject {
|
|
|
5518
5438
|
depsUpgradeOptions: {
|
|
5519
5439
|
exclude: ["@codedrifters/configulator"],
|
|
5520
5440
|
workflowOptions: {
|
|
5521
|
-
schedule:
|
|
5441
|
+
schedule: import_javascript3.UpgradeDependenciesSchedule.DAILY
|
|
5522
5442
|
},
|
|
5523
5443
|
cooldown: 1
|
|
5524
5444
|
},
|
|
@@ -5579,7 +5499,7 @@ var MonorepoProject = class extends import_typescript3.TypeScriptAppProject {
|
|
|
5579
5499
|
* Use PNPM instead of the default (Yarn). Much of the ecosystem depends
|
|
5580
5500
|
* on PNPM and making monorepos PNPM only simplifies many configurations.
|
|
5581
5501
|
*/
|
|
5582
|
-
packageManager:
|
|
5502
|
+
packageManager: import_javascript3.NodePackageManager.PNPM,
|
|
5583
5503
|
/**
|
|
5584
5504
|
* Some additional pre-build steps if we're using turbo's remote cache.
|
|
5585
5505
|
* Set GIT_BRANCH_NAME so Turborepo remote cache hashes match between local and CI.
|
|
@@ -5600,7 +5520,7 @@ var MonorepoProject = class extends import_typescript3.TypeScriptAppProject {
|
|
|
5600
5520
|
]
|
|
5601
5521
|
}
|
|
5602
5522
|
};
|
|
5603
|
-
const options = (0,
|
|
5523
|
+
const options = (0, import_ts_deepmerge.merge)(
|
|
5604
5524
|
defaultOptions,
|
|
5605
5525
|
userOptions,
|
|
5606
5526
|
requiredOptions
|
|
@@ -5636,7 +5556,7 @@ var MonorepoProject = class extends import_typescript3.TypeScriptAppProject {
|
|
|
5636
5556
|
pathsToRemove: ["node_modules", ".turbo", "dist", "lib"]
|
|
5637
5557
|
};
|
|
5638
5558
|
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
5639
|
-
const resetTaskOptions = (0,
|
|
5559
|
+
const resetTaskOptions = (0, import_ts_deepmerge.merge)(
|
|
5640
5560
|
defaultResetTaskOptions,
|
|
5641
5561
|
{
|
|
5642
5562
|
...userResetTaskOptions,
|
|
@@ -5733,11 +5653,285 @@ var MonorepoProject = class extends import_typescript3.TypeScriptAppProject {
|
|
|
5733
5653
|
}
|
|
5734
5654
|
};
|
|
5735
5655
|
|
|
5656
|
+
// src/projects/typescript-project.ts
|
|
5657
|
+
var TestRunner = {
|
|
5658
|
+
JEST: "jest",
|
|
5659
|
+
VITEST: "vitest"
|
|
5660
|
+
};
|
|
5661
|
+
var TypeScriptProject = class extends import_projen16.typescript.TypeScriptProject {
|
|
5662
|
+
constructor(userOptions) {
|
|
5663
|
+
const pnpmVersion = userOptions.parent && userOptions.parent instanceof MonorepoProject ? userOptions.parent.pnpmVersion : VERSION.PNPM_VERSION;
|
|
5664
|
+
const pnpmWorkspace = userOptions.parent && userOptions.parent instanceof MonorepoProject ? PnpmWorkspace.of(userOptions.parent) : void 0;
|
|
5665
|
+
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
5666
|
+
const useJest = testRunner === TestRunner.JEST;
|
|
5667
|
+
const defaultOptions = {
|
|
5668
|
+
/**
|
|
5669
|
+
* This is a standard, so don't require it to passed in everywhere.
|
|
5670
|
+
*/
|
|
5671
|
+
defaultReleaseBranch: "main",
|
|
5672
|
+
/**
|
|
5673
|
+
* Enable reset task by default.
|
|
5674
|
+
*/
|
|
5675
|
+
resetTask: true,
|
|
5676
|
+
/**
|
|
5677
|
+
* Packaging options
|
|
5678
|
+
*/
|
|
5679
|
+
packageManager: import_javascript4.NodePackageManager.PNPM,
|
|
5680
|
+
pnpmVersion,
|
|
5681
|
+
licensed: userOptions.license !== void 0 || false,
|
|
5682
|
+
copyrightOwner: "CodeDrifters",
|
|
5683
|
+
release: false,
|
|
5684
|
+
/**
|
|
5685
|
+
* Don't add sample code.
|
|
5686
|
+
*/
|
|
5687
|
+
sampleCode: false,
|
|
5688
|
+
...useJest ? {
|
|
5689
|
+
/**
|
|
5690
|
+
* Make sure jest config is stored outside of package.json
|
|
5691
|
+
*/
|
|
5692
|
+
jestOptions: {
|
|
5693
|
+
configFilePath: "jest.config.json",
|
|
5694
|
+
jestConfig: {
|
|
5695
|
+
roots: [`<rootDir>/src`],
|
|
5696
|
+
transform: {
|
|
5697
|
+
["^.+\\.[t]sx?$"]: new import_javascript4.Transform("@swc/jest")
|
|
5698
|
+
},
|
|
5699
|
+
moduleFileExtensions: ["js", "ts"]
|
|
5700
|
+
}
|
|
5701
|
+
},
|
|
5702
|
+
/**
|
|
5703
|
+
* SWC for faster testing
|
|
5704
|
+
*/
|
|
5705
|
+
devDeps: ["@swc/jest", "@swc/core"]
|
|
5706
|
+
} : {
|
|
5707
|
+
jest: false,
|
|
5708
|
+
devDeps: []
|
|
5709
|
+
},
|
|
5710
|
+
/**
|
|
5711
|
+
* Turn on prettier formatting
|
|
5712
|
+
*/
|
|
5713
|
+
prettier: true,
|
|
5714
|
+
/**
|
|
5715
|
+
* Don't package test files.
|
|
5716
|
+
*/
|
|
5717
|
+
npmIgnoreOptions: {
|
|
5718
|
+
ignorePatterns: ["*.spec.*", "*.test.*"]
|
|
5719
|
+
},
|
|
5720
|
+
/**
|
|
5721
|
+
* Options for the automated dependency upgrade task / workflow
|
|
5722
|
+
* Automatically exclude any packages that are managed by the root
|
|
5723
|
+
* project as default catalog dependencies since we want to let the
|
|
5724
|
+
* catalog manage those dependencies.
|
|
5725
|
+
*/
|
|
5726
|
+
depsUpgrade: true,
|
|
5727
|
+
depsUpgradeOptions: {
|
|
5728
|
+
workflow: false,
|
|
5729
|
+
exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
|
|
5730
|
+
...userOptions.parent && userOptions.parent instanceof MonorepoProject ? {
|
|
5731
|
+
workflowOptions: {
|
|
5732
|
+
schedule: import_javascript4.UpgradeDependenciesSchedule.WEEKLY
|
|
5733
|
+
},
|
|
5734
|
+
cooldown: 1
|
|
5735
|
+
} : {}
|
|
5736
|
+
},
|
|
5737
|
+
/**
|
|
5738
|
+
* Only release when the package folder source content or package.json
|
|
5739
|
+
* (version, dependencies) changes.
|
|
5740
|
+
*/
|
|
5741
|
+
releaseTrigger: import_release.ReleaseTrigger.continuous({
|
|
5742
|
+
paths: [
|
|
5743
|
+
`${userOptions.outdir}/src/**`,
|
|
5744
|
+
`${userOptions.outdir}/package.json`
|
|
5745
|
+
]
|
|
5746
|
+
})
|
|
5747
|
+
};
|
|
5748
|
+
const options = (0, import_ts_deepmerge2.merge)(defaultOptions, userOptions);
|
|
5749
|
+
super(options);
|
|
5750
|
+
this.addDevDeps("@types/node@catalog:");
|
|
5751
|
+
this.tsconfig?.addExclude("**/*.test.*");
|
|
5752
|
+
this.tsconfig?.addExclude("**/*.spec.*");
|
|
5753
|
+
if (options.testRunner === TestRunner.VITEST) {
|
|
5754
|
+
new Vitest(this, {
|
|
5755
|
+
config: {
|
|
5756
|
+
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
|
|
5757
|
+
...options.vitestOptions?.config
|
|
5758
|
+
},
|
|
5759
|
+
...options.vitestOptions
|
|
5760
|
+
});
|
|
5761
|
+
} else {
|
|
5762
|
+
this.deps.removeDependency("ts-jest");
|
|
5763
|
+
}
|
|
5764
|
+
this.package.file.addOverride(
|
|
5765
|
+
"packageManager",
|
|
5766
|
+
`pnpm@${options.pnpmVersion}`
|
|
5767
|
+
);
|
|
5768
|
+
this.eslint?.addOverride({
|
|
5769
|
+
files: ["**/*.test.*", "**/*.spec.*"],
|
|
5770
|
+
rules: {
|
|
5771
|
+
"import/no-extraneous-dependencies": "off"
|
|
5772
|
+
}
|
|
5773
|
+
});
|
|
5774
|
+
this.gitignore?.addPatterns(".DS_Store", "test-reports");
|
|
5775
|
+
this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
|
|
5776
|
+
const turboActive = userOptions.parent && TurboRepo.of(userOptions.parent) !== void 0;
|
|
5777
|
+
if (turboActive) {
|
|
5778
|
+
const turbo = new TurboRepo(this);
|
|
5779
|
+
turbo.compileTask?.outputs.push("dist/**");
|
|
5780
|
+
turbo.compileTask?.outputs.push("lib/**");
|
|
5781
|
+
}
|
|
5782
|
+
if (options.agentConfig === true || typeof options.agentConfig === "object") {
|
|
5783
|
+
new AgentConfig(
|
|
5784
|
+
this,
|
|
5785
|
+
typeof options.agentConfig === "object" ? options.agentConfig : {}
|
|
5786
|
+
);
|
|
5787
|
+
}
|
|
5788
|
+
if (options.resetTask !== false) {
|
|
5789
|
+
const defaultResetTaskOptions = {
|
|
5790
|
+
pathsToRemove: [
|
|
5791
|
+
"node_modules",
|
|
5792
|
+
"dist",
|
|
5793
|
+
"lib",
|
|
5794
|
+
"coverage",
|
|
5795
|
+
"test-reports",
|
|
5796
|
+
".turbo",
|
|
5797
|
+
"tsconfig.tsbuildinfo",
|
|
5798
|
+
this.artifactsDirectory
|
|
5799
|
+
]
|
|
5800
|
+
};
|
|
5801
|
+
const userResetTaskOptions = options.resetTaskOptions ?? {};
|
|
5802
|
+
const resetTaskOptions = (0, import_ts_deepmerge2.merge)(
|
|
5803
|
+
defaultResetTaskOptions,
|
|
5804
|
+
{
|
|
5805
|
+
...userResetTaskOptions,
|
|
5806
|
+
pathsToRemove: [
|
|
5807
|
+
...defaultResetTaskOptions.pathsToRemove ?? [],
|
|
5808
|
+
...userResetTaskOptions.pathsToRemove ?? []
|
|
5809
|
+
]
|
|
5810
|
+
}
|
|
5811
|
+
);
|
|
5812
|
+
new ResetTask(this, resetTaskOptions);
|
|
5813
|
+
}
|
|
5814
|
+
if (options.parent && options.parent instanceof MonorepoProject) {
|
|
5815
|
+
const originalResolve = this.package.resolveDepsAndWritePackageJson;
|
|
5816
|
+
this.package.installDependencies = () => {
|
|
5817
|
+
options.parent.requestInstallDependencies({
|
|
5818
|
+
resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
|
|
5819
|
+
});
|
|
5820
|
+
};
|
|
5821
|
+
this.package.resolveDepsAndWritePackageJson = () => {
|
|
5822
|
+
};
|
|
5823
|
+
}
|
|
5824
|
+
}
|
|
5825
|
+
};
|
|
5826
|
+
|
|
5827
|
+
// src/projects/astro-project.ts
|
|
5828
|
+
var AstroProject = class extends TypeScriptProject {
|
|
5829
|
+
constructor(userOptions) {
|
|
5830
|
+
const options = {
|
|
5831
|
+
testRunner: TestRunner.VITEST,
|
|
5832
|
+
...userOptions,
|
|
5833
|
+
depsUpgradeOptions: {
|
|
5834
|
+
...userOptions.depsUpgradeOptions,
|
|
5835
|
+
exclude: [...userOptions.depsUpgradeOptions?.exclude ?? [], "astro"]
|
|
5836
|
+
}
|
|
5837
|
+
};
|
|
5838
|
+
super(options);
|
|
5839
|
+
const astroVersion = options.astroVersion ?? VERSION.ASTRO_VERSION;
|
|
5840
|
+
const astroTsconfigExtends = options.astroTsconfigExtends ?? "astro/tsconfigs/strict";
|
|
5841
|
+
this.package.addField("type", "module");
|
|
5842
|
+
this.tsconfig?.file.addOverride("extends", astroTsconfigExtends);
|
|
5843
|
+
this.tsconfig?.addInclude(".astro/types.d.ts");
|
|
5844
|
+
this.tsconfig?.addInclude("src/**/*.astro");
|
|
5845
|
+
this.compileTask.reset();
|
|
5846
|
+
this.compileTask.exec("astro check");
|
|
5847
|
+
this.compileTask.exec("astro build");
|
|
5848
|
+
this.tasks.tryFind("watch")?.reset("astro dev");
|
|
5849
|
+
this.packageTask.reset();
|
|
5850
|
+
if (!this.tasks.tryFind("dev")) {
|
|
5851
|
+
this.addTask("dev", {
|
|
5852
|
+
description: "Start the Astro dev server",
|
|
5853
|
+
exec: "astro dev",
|
|
5854
|
+
receiveArgs: true
|
|
5855
|
+
});
|
|
5856
|
+
}
|
|
5857
|
+
if (!this.tasks.tryFind("preview")) {
|
|
5858
|
+
this.addTask("preview", {
|
|
5859
|
+
description: "Preview the built site locally",
|
|
5860
|
+
exec: "astro preview",
|
|
5861
|
+
receiveArgs: true
|
|
5862
|
+
});
|
|
5863
|
+
}
|
|
5864
|
+
if (!this.tasks.tryFind("check")) {
|
|
5865
|
+
this.addTask("check", {
|
|
5866
|
+
description: "Run Astro's type and content checks",
|
|
5867
|
+
exec: "astro check"
|
|
5868
|
+
});
|
|
5869
|
+
}
|
|
5870
|
+
this.addDeps(`astro@${astroVersion}`);
|
|
5871
|
+
this.addDevDeps(
|
|
5872
|
+
"@astrojs/check",
|
|
5873
|
+
"astro-eslint-parser",
|
|
5874
|
+
"eslint-plugin-astro",
|
|
5875
|
+
"prettier-plugin-astro"
|
|
5876
|
+
);
|
|
5877
|
+
const prettierConfig = this.tryFindObjectFile(".prettierrc.json");
|
|
5878
|
+
prettierConfig?.addOverride("plugins", ["prettier-plugin-astro"]);
|
|
5879
|
+
prettierConfig?.addOverride("overrides", [
|
|
5880
|
+
{ files: "*.astro", options: { parser: "astro" } }
|
|
5881
|
+
]);
|
|
5882
|
+
this.eslint?.addPlugins("astro");
|
|
5883
|
+
this.eslint?.addExtends("plugin:astro/recommended");
|
|
5884
|
+
this.eslint?.addOverride({
|
|
5885
|
+
files: ["*.astro"],
|
|
5886
|
+
parser: "astro-eslint-parser"
|
|
5887
|
+
});
|
|
5888
|
+
this.eslint?.addLintPattern("src/**/*.astro");
|
|
5889
|
+
this.gitignore.addPatterns(".astro", ".vercel", ".netlify");
|
|
5890
|
+
const turbo = TurboRepo.of(this);
|
|
5891
|
+
if (turbo?.compileTask) {
|
|
5892
|
+
turbo.compileTask.inputs.push("public/**", "astro.config.mjs");
|
|
5893
|
+
}
|
|
5894
|
+
const integrations = options.integrations ?? [];
|
|
5895
|
+
this.astroConfig = new AstroConfig(this, {
|
|
5896
|
+
site: options.site,
|
|
5897
|
+
base: options.base,
|
|
5898
|
+
output: options.output,
|
|
5899
|
+
integrations,
|
|
5900
|
+
adapter: options.adapter
|
|
5901
|
+
});
|
|
5902
|
+
if (options.sampleCode === true) {
|
|
5903
|
+
new import_projen17.SampleFile(this, "src/pages/index.astro", {
|
|
5904
|
+
contents: DEFAULT_INDEX_ASTRO
|
|
5905
|
+
});
|
|
5906
|
+
new import_projen17.SampleFile(this, "public/favicon.svg", {
|
|
5907
|
+
contents: DEFAULT_FAVICON_SVG
|
|
5908
|
+
});
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5911
|
+
};
|
|
5912
|
+
var DEFAULT_INDEX_ASTRO = `---
|
|
5913
|
+
// Welcome to Astro!
|
|
5914
|
+
---
|
|
5915
|
+
<html lang="en">
|
|
5916
|
+
<head>
|
|
5917
|
+
<meta charset="utf-8" />
|
|
5918
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
5919
|
+
<meta name="viewport" content="width=device-width" />
|
|
5920
|
+
<title>Astro</title>
|
|
5921
|
+
</head>
|
|
5922
|
+
<body>
|
|
5923
|
+
<h1>Hello, Astro!</h1>
|
|
5924
|
+
</body>
|
|
5925
|
+
</html>
|
|
5926
|
+
`;
|
|
5927
|
+
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>
|
|
5928
|
+
`;
|
|
5929
|
+
|
|
5736
5930
|
// src/typescript/typescript-config.ts
|
|
5737
5931
|
var import_node_path2 = require("path");
|
|
5738
|
-
var
|
|
5932
|
+
var import_projen18 = require("projen");
|
|
5739
5933
|
var import_path2 = require("projen/lib/util/path");
|
|
5740
|
-
var TypeScriptConfig = class extends
|
|
5934
|
+
var TypeScriptConfig = class extends import_projen18.Component {
|
|
5741
5935
|
constructor(project) {
|
|
5742
5936
|
super(project);
|
|
5743
5937
|
let tsPaths = {};
|
|
@@ -5765,12 +5959,12 @@ var TypeScriptConfig = class extends import_projen16.Component {
|
|
|
5765
5959
|
|
|
5766
5960
|
// src/workflows/aws-deploy-workflow.ts
|
|
5767
5961
|
var import_utils11 = __toESM(require_lib());
|
|
5768
|
-
var
|
|
5962
|
+
var import_projen19 = require("projen");
|
|
5769
5963
|
var import_build = require("projen/lib/build");
|
|
5770
5964
|
var import_github2 = require("projen/lib/github");
|
|
5771
5965
|
var import_workflows_model5 = require("projen/lib/github/workflows-model");
|
|
5772
5966
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
5773
|
-
var AwsDeployWorkflow = class _AwsDeployWorkflow extends
|
|
5967
|
+
var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen19.Component {
|
|
5774
5968
|
constructor(project, options = {}) {
|
|
5775
5969
|
super(project);
|
|
5776
5970
|
this.project = project;
|
|
@@ -6039,6 +6233,9 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen17.Compone
|
|
|
6039
6233
|
AGENT_PLATFORM,
|
|
6040
6234
|
AGENT_RULE_SCOPE,
|
|
6041
6235
|
AgentConfig,
|
|
6236
|
+
AstroConfig,
|
|
6237
|
+
AstroOutput,
|
|
6238
|
+
AstroProject,
|
|
6042
6239
|
AwsDeployWorkflow,
|
|
6043
6240
|
AwsDeploymentConfig,
|
|
6044
6241
|
AwsDeploymentTarget,
|