@codedrifters/configulator 0.0.237 → 0.0.239
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 +103 -1
- package/lib/index.d.ts +104 -2
- package/lib/index.js +126 -13
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +121 -13
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -459,7 +459,7 @@ var baseBundle = {
|
|
|
459
459
|
"## Important Notes",
|
|
460
460
|
"",
|
|
461
461
|
"- **Never edit generated files** \u2014 they are marked with `// ~~ Generated by projen`",
|
|
462
|
-
"- **After modifying Projen configuration**, run `
|
|
462
|
+
"- **After modifying Projen configuration**, run `pnpm exec projen` to regenerate files, then `pnpm install` to update the lockfile.",
|
|
463
463
|
"- **Configure dependencies through Projen** \u2014 never use `npm install`, `pnpm add`, or `yarn add`. Add them to `deps` or `devDeps` in Projen config.",
|
|
464
464
|
"- **Export from index.ts** to maintain clean public APIs"
|
|
465
465
|
].join("\n"),
|
|
@@ -476,7 +476,7 @@ var baseBundle = {
|
|
|
476
476
|
"",
|
|
477
477
|
"## Prohibited Commands",
|
|
478
478
|
"",
|
|
479
|
-
"- `
|
|
479
|
+
"- `pnpm exec projen` \u2014 synthesize project files",
|
|
480
480
|
"- `pnpm install` / `pnpm i` \u2014 install dependencies",
|
|
481
481
|
"- `pnpm build` / `pnpm build:all` \u2014 build the project",
|
|
482
482
|
"- `pnpm test` / `pnpm --filter ... test` \u2014 run tests",
|
|
@@ -489,7 +489,7 @@ var baseBundle = {
|
|
|
489
489
|
"",
|
|
490
490
|
"After making changes that need validation, tell the user the specific commands to run:",
|
|
491
491
|
"",
|
|
492
|
-
"1. **After projen config changes** \u2014 tell the user to run `
|
|
492
|
+
"1. **After projen config changes** \u2014 tell the user to run `pnpm exec projen && pnpm install`",
|
|
493
493
|
"2. **After source code changes** \u2014 tell the user to run `pnpm --filter @codedrifters/<package> test`",
|
|
494
494
|
"3. **After multi-package changes** \u2014 tell the user to run `pnpm build:all`"
|
|
495
495
|
].join("\n"),
|
|
@@ -2447,7 +2447,7 @@ var githubWorkflowBundle = {
|
|
|
2447
2447
|
"",
|
|
2448
2448
|
"When the user says **open a PR** (or similar), follow these steps exactly:",
|
|
2449
2449
|
"",
|
|
2450
|
-
"1. **Regenerate project files** \u2014 run `
|
|
2450
|
+
"1. **Regenerate project files** \u2014 run `pnpm exec projen` then `pnpm install` to ensure all generated files are up to date. Check `git diff` \u2014 if there are changes, commit them before proceeding.",
|
|
2451
2451
|
"2. **Run the full monorepo build** \u2014 run `pnpm build:all` to compile, lint, and test all packages (mirrors the CI pipeline). This command requires the user to be authenticated to AWS on the prod account used for Turborepo remote caching (`readonlyaccess-prod-525259625215-us-east-1` profile). If the command fails due to AWS credentials, ask the user to authenticate first. If the build produces changes to turbo inputs (typically snapshot files or ESLint auto-fixes), commit those changes and run `pnpm build:all` again \u2014 the build must complete cleanly with no uncommitted changes.",
|
|
2452
2452
|
"3. **Check for uncommitted changes** \u2014 if any exist, commit them with a conventional commit message",
|
|
2453
2453
|
"4. **Pull and rebase from the default branch** \u2014 run `git pull origin {{repository.defaultBranch}} --rebase` to incorporate the latest changes and resolve any conflicts before pushing",
|
|
@@ -4593,7 +4593,7 @@ var issueWorkerSubAgent = {
|
|
|
4593
4593
|
"",
|
|
4594
4594
|
"Run the appropriate verification commands depending on what changed:",
|
|
4595
4595
|
"",
|
|
4596
|
-
"1. If Projen config was changed: `
|
|
4596
|
+
"1. If Projen config was changed: `pnpm exec projen && pnpm install`",
|
|
4597
4597
|
"2. Compile the affected package: `pnpm --filter @codedrifters/<package> compile`",
|
|
4598
4598
|
"3. Test the affected package: `pnpm --filter @codedrifters/<package> test`",
|
|
4599
4599
|
"4. If changes span multiple packages: `pnpm build:all`",
|
|
@@ -5586,7 +5586,7 @@ var pnpmBundle = {
|
|
|
5586
5586
|
"- Configure dependencies in Projen configuration files (`.projenrc.ts` or `projenrc/*.ts`)",
|
|
5587
5587
|
"- Add dependencies to `deps`, `devDeps`, or `peerDeps` arrays in project configuration",
|
|
5588
5588
|
'- Use catalog dependencies when available (e.g., `"aws-cdk-lib@catalog:"`)',
|
|
5589
|
-
"- Ask the user to run `
|
|
5589
|
+
"- Ask the user to run `pnpm exec projen` and `pnpm install` after updating dependency configuration",
|
|
5590
5590
|
"",
|
|
5591
5591
|
"**DO NOT:**",
|
|
5592
5592
|
"- Run `npm install some-package`",
|
|
@@ -7015,11 +7015,11 @@ var projenBundle = {
|
|
|
7015
7015
|
"After modifying any file in `projenrc/` or `.projenrc.ts`, regenerate project files:",
|
|
7016
7016
|
"",
|
|
7017
7017
|
"```sh",
|
|
7018
|
-
"
|
|
7018
|
+
"pnpm exec projen",
|
|
7019
7019
|
"pnpm install",
|
|
7020
7020
|
"```",
|
|
7021
7021
|
"",
|
|
7022
|
-
"Both steps are required \u2014 `
|
|
7022
|
+
"Both steps are required \u2014 `pnpm exec projen` regenerates files, `pnpm install` updates the lockfile to match.",
|
|
7023
7023
|
"",
|
|
7024
7024
|
"## Building",
|
|
7025
7025
|
"",
|
|
@@ -7100,7 +7100,7 @@ var projenBundle = {
|
|
|
7100
7100
|
"After finishing implementation work, validate that changes are correct by running the appropriate commands depending on what was changed:",
|
|
7101
7101
|
"",
|
|
7102
7102
|
"1. **Projen config changes** (`projenrc/`, `.projenrc.ts`):",
|
|
7103
|
-
" - Run `
|
|
7103
|
+
" - Run `pnpm exec projen` then `pnpm install`",
|
|
7104
7104
|
" - Verify no unexpected generated file changes with `git diff`",
|
|
7105
7105
|
"",
|
|
7106
7106
|
"2. **Source code changes** (in a sub-package):",
|
|
@@ -7117,7 +7117,7 @@ var projenBundle = {
|
|
|
7117
7117
|
"",
|
|
7118
7118
|
"| Task | Command |",
|
|
7119
7119
|
"|------|---------|",
|
|
7120
|
-
"| Synthesize projen | `
|
|
7120
|
+
"| Synthesize projen | `pnpm exec projen` |",
|
|
7121
7121
|
"| Install deps | `pnpm install` |",
|
|
7122
7122
|
"| Full monorepo build | `pnpm build:all` |",
|
|
7123
7123
|
"| Root build only | `pnpm build` |",
|
|
@@ -7143,7 +7143,7 @@ var projenBundle = {
|
|
|
7143
7143
|
content: [
|
|
7144
7144
|
"# Customizing Agent Rules",
|
|
7145
7145
|
"",
|
|
7146
|
-
"Agent rules for Claude and Cursor are **generated** by configulator's `AgentConfig` component. The generated output files (`.claude/rules/`, `.cursor/rules/`, `CLAUDE.md`) must not be edited directly \u2014 they are overwritten on every `
|
|
7146
|
+
"Agent rules for Claude and Cursor are **generated** by configulator's `AgentConfig` component. The generated output files (`.claude/rules/`, `.cursor/rules/`, `CLAUDE.md`) must not be edited directly \u2014 they are overwritten on every `pnpm exec projen` run.",
|
|
7147
7147
|
"",
|
|
7148
7148
|
"## Adding Repo-Specific Rules",
|
|
7149
7149
|
"",
|
|
@@ -7176,7 +7176,7 @@ var projenBundle = {
|
|
|
7176
7176
|
"",
|
|
7177
7177
|
"## After Any Change",
|
|
7178
7178
|
"",
|
|
7179
|
-
"Run `
|
|
7179
|
+
"Run `pnpm exec projen` then `pnpm install` to regenerate the output files."
|
|
7180
7180
|
].join("\n"),
|
|
7181
7181
|
tags: ["workflow"]
|
|
7182
7182
|
},
|
|
@@ -7194,7 +7194,7 @@ var projenBundle = {
|
|
|
7194
7194
|
"- Edit Projen configuration in:",
|
|
7195
7195
|
" - `.projenrc.ts` (root)",
|
|
7196
7196
|
" - `projenrc/*.ts` (package-specific)",
|
|
7197
|
-
"- After making Projen changes, run `
|
|
7197
|
+
"- After making Projen changes, run `pnpm exec projen` to synthesize",
|
|
7198
7198
|
"",
|
|
7199
7199
|
"## Workspace Dependencies",
|
|
7200
7200
|
"",
|
|
@@ -15487,6 +15487,77 @@ import {
|
|
|
15487
15487
|
} from "projen/lib/typescript";
|
|
15488
15488
|
import { merge } from "ts-deepmerge";
|
|
15489
15489
|
|
|
15490
|
+
// src/projects/monorepo-layout.ts
|
|
15491
|
+
var MONOREPO_LAYOUT = {
|
|
15492
|
+
DOCS: "docs",
|
|
15493
|
+
APPS: "apps",
|
|
15494
|
+
PACKAGES: "packages",
|
|
15495
|
+
SITES: "sites"
|
|
15496
|
+
};
|
|
15497
|
+
var LAYOUT_ENFORCEMENT = {
|
|
15498
|
+
OFF: "off",
|
|
15499
|
+
WARN: "warn",
|
|
15500
|
+
ERROR: "error"
|
|
15501
|
+
};
|
|
15502
|
+
var LAYOUT_ROOT_BY_PROJECT_TYPE = {
|
|
15503
|
+
TypeScriptProject: MONOREPO_LAYOUT.PACKAGES,
|
|
15504
|
+
AwsCdkProject: MONOREPO_LAYOUT.APPS,
|
|
15505
|
+
AstroProject: MONOREPO_LAYOUT.SITES,
|
|
15506
|
+
StarlightProject: MONOREPO_LAYOUT.DOCS
|
|
15507
|
+
};
|
|
15508
|
+
function validateMonorepoLayout(root) {
|
|
15509
|
+
const violations = [];
|
|
15510
|
+
const rootOutdir = toPosix(root.outdir);
|
|
15511
|
+
for (const sub of root.subprojects) {
|
|
15512
|
+
const className = sub.constructor.name;
|
|
15513
|
+
const expectedRoot = LAYOUT_ROOT_BY_PROJECT_TYPE[className];
|
|
15514
|
+
if (expectedRoot === void 0) {
|
|
15515
|
+
continue;
|
|
15516
|
+
}
|
|
15517
|
+
const relOutdir = relativeOutdir(rootOutdir, toPosix(sub.outdir));
|
|
15518
|
+
if (!outdirMatchesRoot(relOutdir, expectedRoot)) {
|
|
15519
|
+
violations.push({
|
|
15520
|
+
projectName: sub.name,
|
|
15521
|
+
projectType: className,
|
|
15522
|
+
outdir: relOutdir,
|
|
15523
|
+
expectedRoot
|
|
15524
|
+
});
|
|
15525
|
+
}
|
|
15526
|
+
}
|
|
15527
|
+
return violations;
|
|
15528
|
+
}
|
|
15529
|
+
function formatLayoutViolation(violation) {
|
|
15530
|
+
const { projectName, projectType, outdir, expectedRoot } = violation;
|
|
15531
|
+
const expectedExample = expectedRoot === MONOREPO_LAYOUT.DOCS ? "docs/" : `${expectedRoot}/<scope>/<name>`;
|
|
15532
|
+
return `[monorepo-layout] ${projectType} "${projectName}" has outdir "${outdir}", which is outside the expected root "${expectedRoot}/" (expected e.g. "${expectedExample}"). See docs/requirements/architectural-decisions/ADR-006-monorepo-layout.md.`;
|
|
15533
|
+
}
|
|
15534
|
+
function outdirMatchesRoot(relOutdir, expectedRoot) {
|
|
15535
|
+
const segments = relOutdir.split("/").filter((s) => s.length > 0);
|
|
15536
|
+
if (segments.length === 0) {
|
|
15537
|
+
return false;
|
|
15538
|
+
}
|
|
15539
|
+
if (segments[0] !== expectedRoot) {
|
|
15540
|
+
return false;
|
|
15541
|
+
}
|
|
15542
|
+
if (expectedRoot === MONOREPO_LAYOUT.DOCS) {
|
|
15543
|
+
return true;
|
|
15544
|
+
}
|
|
15545
|
+
return segments.length >= 2;
|
|
15546
|
+
}
|
|
15547
|
+
function toPosix(p) {
|
|
15548
|
+
return p.replace(/\\/g, "/");
|
|
15549
|
+
}
|
|
15550
|
+
function relativeOutdir(rootOutdir, subOutdir) {
|
|
15551
|
+
if (subOutdir === rootOutdir) {
|
|
15552
|
+
return "";
|
|
15553
|
+
}
|
|
15554
|
+
const prefix2 = rootOutdir.endsWith("/") ? rootOutdir : `${rootOutdir}/`;
|
|
15555
|
+
if (subOutdir.startsWith(prefix2)) {
|
|
15556
|
+
return subOutdir.slice(prefix2.length);
|
|
15557
|
+
}
|
|
15558
|
+
return subOutdir;
|
|
15559
|
+
}
|
|
15560
|
+
|
|
15490
15561
|
// src/tasks/reset-task.ts
|
|
15491
15562
|
import { Component as Component13 } from "projen";
|
|
15492
15563
|
var ResetTask = class _ResetTask extends Component13 {
|
|
@@ -15995,6 +16066,11 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
15995
16066
|
* By default treat as a registry consumer (upgrade workflow syncs configulator).
|
|
15996
16067
|
*/
|
|
15997
16068
|
configulatorRegistryConsumer: true,
|
|
16069
|
+
/**
|
|
16070
|
+
* ADR-006 layout enforcement defaults to "warn" during rollout so
|
|
16071
|
+
* legacy outdirs log actionable warnings but do not break synth.
|
|
16072
|
+
*/
|
|
16073
|
+
layoutEnforcement: LAYOUT_ENFORCEMENT.WARN,
|
|
15998
16074
|
/**
|
|
15999
16075
|
* We don't want sample code generated for the root project.
|
|
16000
16076
|
*/
|
|
@@ -16108,6 +16184,7 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
16108
16184
|
this.tsconfig?.removeInclude(`${this.srcdir}/**/*.ts`);
|
|
16109
16185
|
this.pnpmVersion = options.pnpmVersion;
|
|
16110
16186
|
this.configulatorRegistryConsumer = options.configulatorRegistryConsumer ?? true;
|
|
16187
|
+
this.layoutEnforcement = options.layoutEnforcement ?? LAYOUT_ENFORCEMENT.WARN;
|
|
16111
16188
|
new VSCodeConfig(this);
|
|
16112
16189
|
new PnpmWorkspace(this, options.pnpmOptions?.pnpmWorkspaceOptions);
|
|
16113
16190
|
if (options.turbo) {
|
|
@@ -16202,6 +16279,32 @@ var MonorepoProject = class extends TypeScriptAppProject {
|
|
|
16202
16279
|
);
|
|
16203
16280
|
}
|
|
16204
16281
|
}
|
|
16282
|
+
/**
|
|
16283
|
+
* Validate sub-project `outdir` values against the ADR-006 monorepo
|
|
16284
|
+
* layout contract. Runs in `preSynthesize` so all sub-projects are
|
|
16285
|
+
* attached by the time we inspect the tree.
|
|
16286
|
+
*
|
|
16287
|
+
* Behavior is controlled by `layoutEnforcement`:
|
|
16288
|
+
* - `"off"` — skip validation.
|
|
16289
|
+
* - `"warn"` — log a `console.warn` per violation; continue.
|
|
16290
|
+
* - `"error"` — throw on the first violation.
|
|
16291
|
+
*/
|
|
16292
|
+
preSynthesize() {
|
|
16293
|
+
super.preSynthesize();
|
|
16294
|
+
if (this.layoutEnforcement === LAYOUT_ENFORCEMENT.OFF) {
|
|
16295
|
+
return;
|
|
16296
|
+
}
|
|
16297
|
+
const violations = validateMonorepoLayout(this);
|
|
16298
|
+
if (violations.length === 0) {
|
|
16299
|
+
return;
|
|
16300
|
+
}
|
|
16301
|
+
if (this.layoutEnforcement === LAYOUT_ENFORCEMENT.ERROR) {
|
|
16302
|
+
throw new Error(formatLayoutViolation(violations[0]));
|
|
16303
|
+
}
|
|
16304
|
+
for (const violation of violations) {
|
|
16305
|
+
console.warn(formatLayoutViolation(violation));
|
|
16306
|
+
}
|
|
16307
|
+
}
|
|
16205
16308
|
/**
|
|
16206
16309
|
* Allows a sub project to request installation of dependency at the Monorepo root
|
|
16207
16310
|
* They must provide a function that is executed after dependencies have been installed
|
|
@@ -17322,10 +17425,13 @@ export {
|
|
|
17322
17425
|
DEFAULT_TEARDOWN_BRANCH_PATTERNS,
|
|
17323
17426
|
DEFAULT_TYPE_LABELS,
|
|
17324
17427
|
JsiiFaker,
|
|
17428
|
+
LAYOUT_ENFORCEMENT,
|
|
17429
|
+
LAYOUT_ROOT_BY_PROJECT_TYPE,
|
|
17325
17430
|
MCP_TRANSPORT,
|
|
17326
17431
|
MERGE_METHODS,
|
|
17327
17432
|
MIMIMUM_RELEASE_AGE,
|
|
17328
17433
|
MINIMUM_RELEASE_AGE,
|
|
17434
|
+
MONOREPO_LAYOUT,
|
|
17329
17435
|
MonorepoProject,
|
|
17330
17436
|
PROD_DEPLOY_NAME,
|
|
17331
17437
|
PnpmWorkspace,
|
|
@@ -17352,6 +17458,7 @@ export {
|
|
|
17352
17458
|
baseBundle,
|
|
17353
17459
|
bcmWriterBundle,
|
|
17354
17460
|
companyProfileBundle,
|
|
17461
|
+
formatLayoutViolation,
|
|
17355
17462
|
getLatestEligibleVersion,
|
|
17356
17463
|
githubWorkflowBundle,
|
|
17357
17464
|
industryDiscoveryBundle,
|
|
@@ -17373,6 +17480,7 @@ export {
|
|
|
17373
17480
|
softwareProfileBundle,
|
|
17374
17481
|
turborepoBundle,
|
|
17375
17482
|
typescriptBundle,
|
|
17483
|
+
validateMonorepoLayout,
|
|
17376
17484
|
vitestBundle
|
|
17377
17485
|
};
|
|
17378
17486
|
//# sourceMappingURL=index.mjs.map
|