@dbx-tools/projen 0.6.63 → 0.6.65

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/README.md CHANGED
@@ -37,6 +37,12 @@ project.synth();
37
37
  Every `src`-bearing folder under the configured roots becomes a
38
38
  `DBXToolsTypeScriptProject`. Folder path drives package name and runtime tags.
39
39
 
40
+ Dependency installation runs once from this root. The default-on
41
+ `ROOT_INSTALL_ONLY_MIXIN` clears child `install` / `install:ci` task steps during
42
+ root pre-synthesis, including packages attached after root construction. Set
43
+ `rootInstallOnly: false` only when a repository intentionally wants projen's
44
+ per-project installation behavior.
45
+
40
46
  The engine treats generated barrels, tests, declaration files, and folders
41
47
  without exported source modules as implementation details. They do not create
42
48
  new package membership.
package/package.json CHANGED
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@clack/prompts": "^1.7.0",
29
- "@dbx-tools/core": "0.6.63",
30
- "@dbx-tools/path": "0.6.63",
31
- "@dbx-tools/shared-core": "0.6.63",
29
+ "@dbx-tools/core": "0.6.65",
30
+ "@dbx-tools/path": "0.6.65",
31
+ "@dbx-tools/shared-core": "0.6.65",
32
32
  "commander": "^15.0.0",
33
33
  "concurrently": "^10.0.3",
34
34
  "constructs": "^10.6.0",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "main": "index.ts",
49
49
  "license": "Apache-2.0",
50
- "version": "0.6.63",
50
+ "version": "0.6.65",
51
51
  "types": "index.ts",
52
52
  "type": "module",
53
53
  "exports": {
package/src/bun-app.ts CHANGED
@@ -141,6 +141,7 @@ import tailwind from "bun-plugin-tailwind";
141
141
  let options: Bun.BuildConfig = {
142
142
  entrypoints: ["./index.html"],
143
143
  outdir: "./dist",
144
+ define: { "process.env.NODE_ENV": JSON.stringify("production") },
144
145
  minify: true,
145
146
  splitting: true,
146
147
  publicPath: "/",
package/src/project.ts CHANGED
@@ -519,6 +519,12 @@ export interface DBXToolsProjectOptions
519
519
  * is a member of the single bun workspace, so the root links it from source.
520
520
  */
521
521
  readonly extraWorkspaceMembers?: readonly string[];
522
+ /**
523
+ * Install workspace dependencies once from the custom root instead of once
524
+ * per child project during post-synthesis. Defaults to `true`; set `false` to
525
+ * preserve projen's native per-project install tasks.
526
+ */
527
+ readonly rootInstallOnly?: boolean;
522
528
  }
523
529
 
524
530
  /** Options for {@link DBXToolsTypeScriptProject} (a package, or a compiling root). */
@@ -540,6 +546,7 @@ export class DBXToolsNodeProject extends javascript.NodeProject implements DBXTo
540
546
  rootTsconfig?: DBXToolsRootTsconfig;
541
547
  vsCode?: DBXToolsVsCode;
542
548
  private readonly extraWorkspaceMembers: readonly string[];
549
+ private readonly rootInstallOnly: boolean;
543
550
 
544
551
  constructor(options: DBXToolsProjectOptions = {}) {
545
552
  const { name, scope } = resolveIdentity(options);
@@ -571,11 +578,13 @@ export class DBXToolsNodeProject extends javascript.NodeProject implements DBXTo
571
578
  pnpmWorkspace.attachWorkspaceFile(this);
572
579
  this.scope = scope;
573
580
  this.extraWorkspaceMembers = options.extraWorkspaceMembers ?? [];
581
+ this.rootInstallOnly = options.rootInstallOnly !== false;
574
582
  this.dbxToolsConfig = new DBXToolsConfig(this, options);
575
583
  initProject(this, options);
576
584
  }
577
585
 
578
586
  public override preSynthesize(): void {
587
+ if (this.rootInstallOnly) this.with(ROOT_INSTALL_ONLY_MIXIN);
579
588
  super.preSynthesize();
580
589
  // Members come from the attached subprojects, which the root's scan appends
581
590
  // after construction - so the list is filled here, not in the constructor.
@@ -585,6 +594,25 @@ export class DBXToolsNodeProject extends javascript.NodeProject implements DBXTo
585
594
  }
586
595
  }
587
596
 
597
+ /**
598
+ * Root-owned workspace install policy.
599
+ *
600
+ * Every projen child has its own `NodePackage` post-synth hook, which otherwise
601
+ * runs `bun install` against the same root workspace once per package. Clear the
602
+ * child install tasks while leaving the root's real install/install:ci tasks
603
+ * intact. Applied in root `preSynthesize` so manually attached late children are
604
+ * included and repeated synths remain idempotent.
605
+ */
606
+ export const ROOT_INSTALL_ONLY_MIXIN = mixin.create(
607
+ (construct: IConstruct): construct is DBXToolsNodeProject | DBXToolsTypeScriptProject =>
608
+ (construct instanceof DBXToolsNodeProject || construct instanceof DBXToolsTypeScriptProject) &&
609
+ construct.parent !== undefined,
610
+ (child) => {
611
+ child.package.installTask.reset();
612
+ child.package.installCiTask.reset();
613
+ },
614
+ );
615
+
588
616
  /**
589
617
  * A single package (usually created by a root's scan), or a standalone
590
618
  * compiling root. The agnostic tsconfig floor is applied at construction; the
@@ -1006,6 +1034,10 @@ function initProject(
1006
1034
  // node:test `describe`/`it` return promises by design.
1007
1035
  rules: { "@typescript-eslint/no-floating-promises": "off" },
1008
1036
  });
1037
+ if (eslint.config?.settings) {
1038
+ // eslint-plugin-import knows Node built-ins but not Bun's test module.
1039
+ eslint.config.settings["import/core-modules"] = ["bun:test"];
1040
+ }
1009
1041
  // Point the TS import resolver at every package tsconfig, not just the root's
1010
1042
  // (which only includes `.projenrc.ts`), so `import/no-unresolved` resolves
1011
1043
  // cross-package imports.