@codedrifters/configulator 0.0.240 → 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.mjs CHANGED
@@ -16418,6 +16418,40 @@ var MonorepoProject = class extends TypeScriptAppProject {
16418
16418
  }
16419
16419
  };
16420
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
+
16421
16455
  // src/projects/typescript-project.ts
16422
16456
  var TestRunner = {
16423
16457
  JEST: "jest",
@@ -16433,6 +16467,9 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
16433
16467
  const parent = userOptions.parent;
16434
16468
  const pnpmVersion = parent.pnpmVersion;
16435
16469
  const pnpmWorkspace = PnpmWorkspace.of(parent);
16470
+ const resolvedOutdir = userOptions.outdir ?? resolveTypeScriptProjectOutdir(
16471
+ userOptions.packageName ?? userOptions.name
16472
+ );
16436
16473
  const testRunner = userOptions.testRunner ?? TestRunner.JEST;
16437
16474
  const useJest = testRunner === TestRunner.JEST;
16438
16475
  const defaultOptions = {
@@ -16440,6 +16477,12 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
16440
16477
  * This is a standard, so don't require it to passed in everywhere.
16441
16478
  */
16442
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,
16443
16486
  /**
16444
16487
  * Enable reset task by default.
16445
16488
  */
@@ -16510,10 +16553,7 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
16510
16553
  * (version, dependencies) changes.
16511
16554
  */
16512
16555
  releaseTrigger: ReleaseTrigger.continuous({
16513
- paths: [
16514
- `${userOptions.outdir}/src/**`,
16515
- `${userOptions.outdir}/package.json`
16516
- ]
16556
+ paths: [`${resolvedOutdir}/src/**`, `${resolvedOutdir}/package.json`]
16517
16557
  })
16518
16558
  };
16519
16559
  const options = merge2(defaultOptions, userOptions);
@@ -17560,7 +17600,9 @@ export {
17560
17600
  requirementsWriterBundle,
17561
17601
  researchPipelineBundle,
17562
17602
  resolveModelAlias,
17603
+ resolveOutdirFromPackageName,
17563
17604
  resolveTemplateVariables,
17605
+ resolveTypeScriptProjectOutdir,
17564
17606
  slackBundle,
17565
17607
  softwareProfileBundle,
17566
17608
  turborepoBundle,