@codedrifters/configulator 0.0.239 → 0.0.241
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 +27 -1
- package/lib/index.d.ts +27 -1
- package/lib/index.js +133 -4
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +131 -4
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -767,6 +767,91 @@ var baseBundle = {
|
|
|
767
767
|
].join("\n"),
|
|
768
768
|
tags: ["workflow"]
|
|
769
769
|
},
|
|
770
|
+
{
|
|
771
|
+
name: "monorepo-layout",
|
|
772
|
+
description: "Canonical monorepo top-level folders (docs, apps, packages, sites), the @ownerscope/<name> scoping rule, the docs-singleton carve-out, and the scaffolding skills that place new sub-projects",
|
|
773
|
+
scope: AGENT_RULE_SCOPE.ALWAYS,
|
|
774
|
+
content: [
|
|
775
|
+
"# Monorepo Layout",
|
|
776
|
+
"",
|
|
777
|
+
"Every monorepo built with `@codedrifters/configulator` uses a single,",
|
|
778
|
+
"fixed top-level folder layout. Agents, scaffolding skills, pnpm-workspace",
|
|
779
|
+
"globs, Turbo filters, and CI cache keys all assume these roots.",
|
|
780
|
+
"",
|
|
781
|
+
"## Four Canonical Top-Level Folders",
|
|
782
|
+
"",
|
|
783
|
+
"| Folder | Purpose | Examples |",
|
|
784
|
+
"|--------|---------|----------|",
|
|
785
|
+
"| `/docs` | **Single** Starlight site covering the entire monorepo. The one site that lives outside `/sites`. | Monorepo-wide developer docs, ADRs, how-to guides. |",
|
|
786
|
+
"| `/apps/@scope/<name>` | Deployable applications \u2014 anything that runs or ships as a running process. | AWS CDK stacks, mobile apps (iOS/Android), backend services. |",
|
|
787
|
+
"| `/packages/@scope/<name>` | Shared libraries \u2014 published npm packages and workspace-internal libraries. | `@codedrifters/configulator`, `@codedrifters/constructs`, `@codedrifters/utils`. |",
|
|
788
|
+
"| `/sites/@scope/<name>` | User-facing web front ends that are **not** the monorepo-wide docs site. | Marketing sites, SPAs, per-client static sites. |",
|
|
789
|
+
"",
|
|
790
|
+
"No other top-level folder is part of this contract. Generated roots",
|
|
791
|
+
"(`.projen/`, `.github/`, `node_modules/`, `.turbo/`, etc.) are orthogonal",
|
|
792
|
+
"and unchanged.",
|
|
793
|
+
"",
|
|
794
|
+
"## Scoping Rule",
|
|
795
|
+
"",
|
|
796
|
+
"Every sub-project under `apps/`, `packages/`, or `sites/` is named",
|
|
797
|
+
"`@ownerscope/<name>`, where **scope is the owning party** (not a category).",
|
|
798
|
+
"",
|
|
799
|
+
"- `@codedrifters/configulator` \u2014 a shared library owned by CodeDrifters \u2192 `packages/@codedrifters/configulator`",
|
|
800
|
+
"- `@codedrifters/infrastructure-stack` \u2014 an AWS CDK app owned by CodeDrifters \u2192 `apps/@codedrifters/infrastructure-stack`",
|
|
801
|
+
"- `@clientA/iphone-app` \u2014 a mobile app owned by Client A \u2192 `apps/@clientA/iphone-app`",
|
|
802
|
+
"- `@clientB/marketing-site` \u2014 a marketing site owned by Client B \u2192 `sites/@clientB/marketing-site`",
|
|
803
|
+
"",
|
|
804
|
+
"The scope identifies **who owns the sub-project**, not what kind of",
|
|
805
|
+
"sub-project it is. Kind is captured by the top-level folder (`apps/`,",
|
|
806
|
+
"`packages/`, `sites/`). Never scope by category (e.g. `@apps/foo`,",
|
|
807
|
+
"`@libs/bar`) \u2014 the top-level folder already carries that information.",
|
|
808
|
+
"",
|
|
809
|
+
"## Docs-Singleton Carve-Out",
|
|
810
|
+
"",
|
|
811
|
+
"There is **exactly one** Starlight docs site per monorepo, and it lives",
|
|
812
|
+
"at `/docs`. It is **not** `sites/@scope/docs`.",
|
|
813
|
+
"",
|
|
814
|
+
"- The docs site is monorepo-wide. Sub-project documentation belongs",
|
|
815
|
+
" inside that single site (under `docs/content/`), not in a per-package",
|
|
816
|
+
" `docs/` folder.",
|
|
817
|
+
"- Configulator's `StarlightProject` defaults its `outdir` to `/docs`.",
|
|
818
|
+
"- `/sites` is reserved for end-user-facing web front ends (marketing",
|
|
819
|
+
" sites, SPAs, client-facing apps). It deliberately does not host the",
|
|
820
|
+
" dev-docs site.",
|
|
821
|
+
"",
|
|
822
|
+
"## Project-Type \u2192 `outdir` Mapping",
|
|
823
|
+
"",
|
|
824
|
+
"Configulator project types default their `outdir` according to the",
|
|
825
|
+
"following table. Override `outdir` explicitly only when you have a",
|
|
826
|
+
"genuine reason \u2014 the defaults cover the common path.",
|
|
827
|
+
"",
|
|
828
|
+
"| Configulator project type | Default `outdir` |",
|
|
829
|
+
"|---------------------------|------------------|",
|
|
830
|
+
"| `TypeScriptProject` | `packages/<scope>/<name>` |",
|
|
831
|
+
"| `AwsCdkProject` | `apps/<scope>/<name>` |",
|
|
832
|
+
"| `AstroProject` | `sites/<scope>/<name>` |",
|
|
833
|
+
"| `StarlightProject` (role = docs) | `docs/` |",
|
|
834
|
+
"",
|
|
835
|
+
"`<scope>` is parsed from the sub-project's package name (everything",
|
|
836
|
+
"after `@` and before `/`). `<name>` is the unscoped part of the",
|
|
837
|
+
"package name.",
|
|
838
|
+
"",
|
|
839
|
+
"## Placing New Sub-Projects",
|
|
840
|
+
"",
|
|
841
|
+
"Never hand-roll a sub-project path. Use one of the scaffolding skills,",
|
|
842
|
+
"which take `@scope/<name>` as input, validate it, and place the new",
|
|
843
|
+
"project in the correct folder:",
|
|
844
|
+
"",
|
|
845
|
+
"- `/create-package` \u2014 scaffolds a new `TypeScriptProject` under `packages/<scope>/<name>`",
|
|
846
|
+
"- `/create-app` \u2014 scaffolds a new `AwsCdkProject` under `apps/<scope>/<name>`",
|
|
847
|
+
"- `/create-site` \u2014 scaffolds a new `AstroProject` under `sites/<scope>/<name>`",
|
|
848
|
+
"",
|
|
849
|
+
"The monorepo-wide docs site at `/docs` is a singleton and is created",
|
|
850
|
+
"once per repo via `StarlightProject` \u2014 it is not scaffolded per",
|
|
851
|
+
"sub-project."
|
|
852
|
+
].join("\n"),
|
|
853
|
+
tags: ["project"]
|
|
854
|
+
},
|
|
770
855
|
{
|
|
771
856
|
name: "issue-conventions",
|
|
772
857
|
description: "Issue title prefixes, GitHub issue type mapping, prerequisite issues",
|
|
@@ -16333,6 +16418,40 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
16333
16418
|
}
|
|
16334
16419
|
};
|
|
16335
16420
|
|
|
16421
|
+
// src/projects/resolve-outdir.ts
|
|
16422
|
+
function parseScopedName(input) {
|
|
16423
|
+
if (!input.startsWith("@")) {
|
|
16424
|
+
return void 0;
|
|
16425
|
+
}
|
|
16426
|
+
const slashIndex = input.indexOf("/");
|
|
16427
|
+
if (slashIndex < 2) {
|
|
16428
|
+
return void 0;
|
|
16429
|
+
}
|
|
16430
|
+
const scope = input.slice(0, slashIndex);
|
|
16431
|
+
const name = input.slice(slashIndex + 1);
|
|
16432
|
+
if (name.length === 0 || name.includes("/")) {
|
|
16433
|
+
return void 0;
|
|
16434
|
+
}
|
|
16435
|
+
return { scope, name };
|
|
16436
|
+
}
|
|
16437
|
+
function resolveOutdirFromPackageName(packageName, root) {
|
|
16438
|
+
if (packageName === void 0 || packageName.length === 0) {
|
|
16439
|
+
throw new Error(
|
|
16440
|
+
"Cannot derive outdir: packageName (or name) is required when outdir is omitted. Either pass a scoped `packageName` / `name` like `@scope/foo`, or set `outdir` explicitly."
|
|
16441
|
+
);
|
|
16442
|
+
}
|
|
16443
|
+
const parsed = parseScopedName(packageName);
|
|
16444
|
+
if (parsed === void 0) {
|
|
16445
|
+
throw new Error(
|
|
16446
|
+
`Cannot derive outdir from unscoped packageName "${packageName}". Either use a scoped name like \`@scope/foo\`, or set \`outdir\` explicitly. Configulator places sub-projects at "${root}/<scope>/<name>".`
|
|
16447
|
+
);
|
|
16448
|
+
}
|
|
16449
|
+
return `${root}/${parsed.scope}/${parsed.name}`;
|
|
16450
|
+
}
|
|
16451
|
+
function resolveTypeScriptProjectOutdir(packageName) {
|
|
16452
|
+
return resolveOutdirFromPackageName(packageName, MONOREPO_LAYOUT.PACKAGES);
|
|
16453
|
+
}
|
|
16454
|
+
|
|
16336
16455
|
// src/projects/typescript-project.ts
|
|
16337
16456
|
var TestRunner = {
|
|
16338
16457
|
JEST: "jest",
|
|
@@ -16348,6 +16467,9 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
|
|
|
16348
16467
|
const parent = userOptions.parent;
|
|
16349
16468
|
const pnpmVersion = parent.pnpmVersion;
|
|
16350
16469
|
const pnpmWorkspace = PnpmWorkspace.of(parent);
|
|
16470
|
+
const resolvedOutdir = userOptions.outdir ?? resolveTypeScriptProjectOutdir(
|
|
16471
|
+
userOptions.packageName ?? userOptions.name
|
|
16472
|
+
);
|
|
16351
16473
|
const testRunner = userOptions.testRunner ?? TestRunner.JEST;
|
|
16352
16474
|
const useJest = testRunner === TestRunner.JEST;
|
|
16353
16475
|
const defaultOptions = {
|
|
@@ -16355,6 +16477,12 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
|
|
|
16355
16477
|
* This is a standard, so don't require it to passed in everywhere.
|
|
16356
16478
|
*/
|
|
16357
16479
|
defaultReleaseBranch: "main",
|
|
16480
|
+
/**
|
|
16481
|
+
* Outdir defaults to `packages/<scope>/<name>` when the caller
|
|
16482
|
+
* omits it. Explicit overrides in `userOptions` always win via
|
|
16483
|
+
* the merge below.
|
|
16484
|
+
*/
|
|
16485
|
+
outdir: resolvedOutdir,
|
|
16358
16486
|
/**
|
|
16359
16487
|
* Enable reset task by default.
|
|
16360
16488
|
*/
|
|
@@ -16425,10 +16553,7 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
|
|
|
16425
16553
|
* (version, dependencies) changes.
|
|
16426
16554
|
*/
|
|
16427
16555
|
releaseTrigger: ReleaseTrigger.continuous({
|
|
16428
|
-
paths: [
|
|
16429
|
-
`${userOptions.outdir}/src/**`,
|
|
16430
|
-
`${userOptions.outdir}/package.json`
|
|
16431
|
-
]
|
|
16556
|
+
paths: [`${resolvedOutdir}/src/**`, `${resolvedOutdir}/package.json`]
|
|
16432
16557
|
})
|
|
16433
16558
|
};
|
|
16434
16559
|
const options = merge2(defaultOptions, userOptions);
|
|
@@ -17475,7 +17600,9 @@ export {
|
|
|
17475
17600
|
requirementsWriterBundle,
|
|
17476
17601
|
researchPipelineBundle,
|
|
17477
17602
|
resolveModelAlias,
|
|
17603
|
+
resolveOutdirFromPackageName,
|
|
17478
17604
|
resolveTemplateVariables,
|
|
17605
|
+
resolveTypeScriptProjectOutdir,
|
|
17479
17606
|
slackBundle,
|
|
17480
17607
|
softwareProfileBundle,
|
|
17481
17608
|
turborepoBundle,
|