@codedrifters/configulator 0.0.314 → 0.0.316

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
@@ -27576,16 +27576,32 @@ var _TurboRepo = class _TurboRepo extends Component4 {
27576
27576
  this.globalEnv.push(name);
27577
27577
  }
27578
27578
  }
27579
- /**
27580
- * Sets GIT_BRANCH_NAME so root tasks (e.g. build:all) pass the current branch.
27581
- * Value must be exactly $(...) so Projen's task runtime expands it; the shell
27582
- * then expands ${GIT_BRANCH_NAME:-$(git rev-parse --abbrev-ref HEAD)}.
27583
- */
27584
- activateBranchNameEnvVar() {
27585
- this.addGlobalEnvVar(
27586
- "GIT_BRANCH_NAME",
27587
- '$(echo "${GIT_BRANCH_NAME:-$(git rev-parse --abbrev-ref HEAD)}")'
27579
+ activateBranchNameEnvVar(options) {
27580
+ const value = '$(echo "${GIT_BRANCH_NAME:-$(git rev-parse --abbrev-ref HEAD)}")';
27581
+ if (options === void 0) {
27582
+ this.project.logger.warn(
27583
+ "TurboRepo.activateBranchNameEnvVar() with no arguments is deprecated. It writes GIT_BRANCH_NAME to the root `globalEnv`, which forces every task in the monorepo to miss cache on every branch switch. Pass `{ tasks: [...] }` and name only the tasks that actually consume the branch (e.g. CDK synth/package) to preserve cross-branch cache hits for everything else."
27584
+ );
27585
+ this.addGlobalEnvVar("GIT_BRANCH_NAME", value);
27586
+ return;
27587
+ }
27588
+ const knownTaskNames = this.tasks.map((task) => task.name);
27589
+ const unknown = options.tasks.filter(
27590
+ (name) => !knownTaskNames.includes(name)
27588
27591
  );
27592
+ if (unknown.length > 0) {
27593
+ throw new Error(
27594
+ `TurboRepo.activateBranchNameEnvVar: unknown task name(s) ${JSON.stringify(
27595
+ unknown
27596
+ )}. Known tasks on this TurboRepo: ${JSON.stringify(knownTaskNames)}.`
27597
+ );
27598
+ }
27599
+ for (const name of options.tasks) {
27600
+ const task = this.tasks.find((t) => t.name === name);
27601
+ if (task && !task.env.includes("GIT_BRANCH_NAME")) {
27602
+ task.env.push("GIT_BRANCH_NAME");
27603
+ }
27604
+ }
27589
27605
  }
27590
27606
  preSynthesize() {
27591
27607
  let nextDependsOn = this.project.deps.all.filter((d) => d.version === "workspace:*").map((d) => [d.name, ROOT_TURBO_TASK_NAME].join("#"));
@@ -27619,7 +27635,6 @@ var _TurboRepo = class _TurboRepo extends Component4 {
27619
27635
  ui: this.isRootProject ? this.ui : void 0,
27620
27636
  dangerouslyDisablePackageManagerCheck: this.isRootProject ? this.dangerouslyDisablePackageManagerCheck : void 0,
27621
27637
  cacheDir: this.isRootProject ? this.cacheDir : void 0,
27622
- daemon: this.isRootProject ? this.daemon : void 0,
27623
27638
  envMode: this.isRootProject ? this.envMode : void 0,
27624
27639
  /**
27625
27640
  * All tasks
@@ -34008,6 +34023,92 @@ var MonorepoProject = class extends TypeScriptAppProject {
34008
34023
  }
34009
34024
  };
34010
34025
 
34026
+ // src/typescript/tsdoc-config.ts
34027
+ import { Component as Component18, JsonFile as JsonFile6 } from "projen";
34028
+ var STANDARD_MODIFIER_TAGS = [
34029
+ "@default",
34030
+ "@defaultValue",
34031
+ "@experimental",
34032
+ "@internal"
34033
+ ];
34034
+ var ALWAYS_ON_SCOPES = ["@codedrifters"];
34035
+ var TsdocConfig = class _TsdocConfig extends Component18 {
34036
+ /**
34037
+ * Derive a workspace scope from a scoped package name (`@scope/name`).
34038
+ * Returns `undefined` when the name is unscoped.
34039
+ *
34040
+ * @internal
34041
+ */
34042
+ static scopeFromPackageName(packageName) {
34043
+ if (!packageName || !packageName.startsWith("@")) {
34044
+ return void 0;
34045
+ }
34046
+ const slash = packageName.indexOf("/");
34047
+ if (slash <= 1) {
34048
+ return void 0;
34049
+ }
34050
+ return packageName.slice(0, slash);
34051
+ }
34052
+ constructor(project, options = {}) {
34053
+ super(project);
34054
+ const scopeFromName = _TsdocConfig.scopeFromPackageName(
34055
+ project.package.packageName
34056
+ );
34057
+ const scopeSet = /* @__PURE__ */ new Set([
34058
+ ...ALWAYS_ON_SCOPES,
34059
+ ...scopeFromName ? [scopeFromName] : [],
34060
+ ...options.workspaceScopes ?? []
34061
+ ]);
34062
+ const tagSet = /* @__PURE__ */ new Set([
34063
+ ...STANDARD_MODIFIER_TAGS,
34064
+ ...Array.from(scopeSet),
34065
+ ...options.additionalModifierTags ?? []
34066
+ ]);
34067
+ const tagDefinitions = Array.from(tagSet).sort((a, b) => a.localeCompare(b)).map((tagName) => ({
34068
+ tagName,
34069
+ syntaxKind: "modifier",
34070
+ allowMultiple: true
34071
+ }));
34072
+ new JsonFile6(project, "tsdoc.json", {
34073
+ obj: {
34074
+ $schema: "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
34075
+ tagDefinitions
34076
+ }
34077
+ });
34078
+ project.addPackageIgnore("tsdoc.json");
34079
+ }
34080
+ };
34081
+
34082
+ // src/typescript/typescript-config.ts
34083
+ import { relative as relative7 } from "path";
34084
+ import { Component as Component19 } from "projen";
34085
+ import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
34086
+ var TypeScriptConfig = class extends Component19 {
34087
+ constructor(project) {
34088
+ super(project);
34089
+ let tsPaths = {};
34090
+ const workspaceDeps = project.deps.all.filter(
34091
+ (d) => d.version === "workspace:*"
34092
+ );
34093
+ workspaceDeps.forEach((dep) => {
34094
+ const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
34095
+ if (!subproject) {
34096
+ throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
34097
+ }
34098
+ tsPaths = {
34099
+ ...tsPaths,
34100
+ [dep.name]: [
34101
+ ensureRelativePathStartsWithDot(
34102
+ relative7(project.outdir, subproject.outdir)
34103
+ )
34104
+ ]
34105
+ };
34106
+ });
34107
+ project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
34108
+ project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
34109
+ }
34110
+ };
34111
+
34011
34112
  // src/projects/typescript-project.ts
34012
34113
  var TestRunner = {
34013
34114
  JEST: "jest",
@@ -34143,34 +34244,46 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
34143
34244
  this.eslint?.addRules({
34144
34245
  "tsdoc/syntax": "warn"
34145
34246
  });
34146
- this.eslint?.addOverride({
34147
- files: ["src/**/*.ts"],
34148
- excludedFiles: ["**/*.test.*", "**/*.spec.*", "**/*.generated.ts"],
34149
- rules: {
34150
- "jsdoc/require-jsdoc": [
34151
- "warn",
34152
- {
34153
- publicOnly: true,
34154
- require: {
34155
- FunctionDeclaration: true,
34156
- ClassDeclaration: true
34157
- },
34158
- contexts: [
34159
- "ExportNamedDeclaration > FunctionDeclaration",
34160
- "ExportNamedDeclaration > ClassDeclaration",
34161
- "ExportNamedDeclaration > VariableDeclaration",
34162
- "ExportNamedDeclaration > TSInterfaceDeclaration",
34163
- "ExportNamedDeclaration > TSTypeAliasDeclaration",
34164
- "ExportNamedDeclaration > TSEnumDeclaration"
34165
- ],
34166
- checkConstructors: false,
34167
- checkGetters: false,
34168
- checkSetters: false,
34169
- enableFixer: false
34170
- }
34171
- ]
34172
- }
34173
- });
34247
+ const requireJsdoc = options.requireJsdoc ?? "off";
34248
+ if (requireJsdoc !== "off") {
34249
+ const publicOnly = requireJsdoc === "public";
34250
+ this.eslint?.addOverride({
34251
+ files: ["src/**/*.ts"],
34252
+ excludedFiles: ["**/*.test.*", "**/*.spec.*", "**/*.generated.ts"],
34253
+ rules: {
34254
+ "jsdoc/require-jsdoc": [
34255
+ "warn",
34256
+ {
34257
+ publicOnly,
34258
+ require: {
34259
+ FunctionDeclaration: true,
34260
+ ClassDeclaration: true
34261
+ },
34262
+ ...publicOnly ? {
34263
+ contexts: [
34264
+ "ExportNamedDeclaration > FunctionDeclaration",
34265
+ "ExportNamedDeclaration > ClassDeclaration",
34266
+ "ExportNamedDeclaration > VariableDeclaration",
34267
+ "ExportNamedDeclaration > TSInterfaceDeclaration",
34268
+ "ExportNamedDeclaration > TSTypeAliasDeclaration",
34269
+ "ExportNamedDeclaration > TSEnumDeclaration"
34270
+ ]
34271
+ } : {},
34272
+ checkConstructors: false,
34273
+ checkGetters: false,
34274
+ checkSetters: false,
34275
+ enableFixer: false
34276
+ }
34277
+ ]
34278
+ }
34279
+ });
34280
+ }
34281
+ if (options.tsdocConfig !== false) {
34282
+ new TsdocConfig(
34283
+ this,
34284
+ typeof options.tsdocConfig === "object" ? options.tsdocConfig : {}
34285
+ );
34286
+ }
34174
34287
  if (options.apiExtractor !== false) {
34175
34288
  new ApiExtractor(
34176
34289
  this,
@@ -34362,12 +34475,12 @@ import { merge as merge4 } from "ts-deepmerge";
34362
34475
 
34363
34476
  // src/workflows/aws-deploy-workflow.ts
34364
34477
  var import_utils11 = __toESM(require_lib());
34365
- import { Component as Component18 } from "projen";
34478
+ import { Component as Component20 } from "projen";
34366
34479
  import { BuildWorkflow } from "projen/lib/build";
34367
34480
  import { GitHub as GitHub4, WorkflowSteps as WorkflowSteps2 } from "projen/lib/github";
34368
34481
  import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
34369
34482
  var PROD_DEPLOY_NAME = "prod-deploy";
34370
- var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component18 {
34483
+ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component20 {
34371
34484
  constructor(project, options = {}) {
34372
34485
  super(project);
34373
34486
  this.project = project;
@@ -34631,7 +34744,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component18 {
34631
34744
  };
34632
34745
 
34633
34746
  // src/workflows/aws-teardown-workflow.ts
34634
- import { Component as Component19 } from "projen";
34747
+ import { Component as Component21 } from "projen";
34635
34748
  import { GitHub as GitHub5, GithubWorkflow } from "projen/lib/github";
34636
34749
  import { JobPermission as JobPermission6 } from "projen/lib/github/workflows-model";
34637
34750
  var DEFAULT_TEARDOWN_BRANCH_PATTERNS = [
@@ -34653,7 +34766,7 @@ var resolveBranchPatterns = (explicit, targets) => {
34653
34766
  }
34654
34767
  return [...DEFAULT_TEARDOWN_BRANCH_PATTERNS];
34655
34768
  };
34656
- var AwsTeardownWorkflow = class extends Component19 {
34769
+ var AwsTeardownWorkflow = class extends Component21 {
34657
34770
  constructor(rootProject, options) {
34658
34771
  super(rootProject);
34659
34772
  this.rootProject = rootProject;
@@ -35470,36 +35583,6 @@ export const collections = {
35470
35583
  docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
35471
35584
  };
35472
35585
  `;
35473
-
35474
- // src/typescript/typescript-config.ts
35475
- import { relative as relative7 } from "path";
35476
- import { Component as Component20 } from "projen";
35477
- import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
35478
- var TypeScriptConfig = class extends Component20 {
35479
- constructor(project) {
35480
- super(project);
35481
- let tsPaths = {};
35482
- const workspaceDeps = project.deps.all.filter(
35483
- (d) => d.version === "workspace:*"
35484
- );
35485
- workspaceDeps.forEach((dep) => {
35486
- const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
35487
- if (!subproject) {
35488
- throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
35489
- }
35490
- tsPaths = {
35491
- ...tsPaths,
35492
- [dep.name]: [
35493
- ensureRelativePathStartsWithDot(
35494
- relative7(project.outdir, subproject.outdir)
35495
- )
35496
- ]
35497
- };
35498
- });
35499
- project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
35500
- project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
35501
- }
35502
- };
35503
35586
  export {
35504
35587
  AGENT_MODEL,
35505
35588
  AGENT_PLATFORM,
@@ -35612,6 +35695,7 @@ export {
35612
35695
  TIER_AWARE_BUNDLE_NAMES,
35613
35696
  TestRunner,
35614
35697
  TsDocCoverageKind,
35698
+ TsdocConfig,
35615
35699
  TurboRepo,
35616
35700
  TurboRepoTask,
35617
35701
  TypeScriptConfig,