@dbx-tools/projen 0.6.61 → 0.6.62

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/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.61",
30
- "@dbx-tools/path": "0.6.61",
31
- "@dbx-tools/shared-core": "0.6.61",
29
+ "@dbx-tools/core": "0.6.62",
30
+ "@dbx-tools/path": "0.6.62",
31
+ "@dbx-tools/shared-core": "0.6.62",
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.61",
50
+ "version": "0.6.62",
51
51
  "types": "index.ts",
52
52
  "type": "module",
53
53
  "exports": {
package/src/codegen.ts CHANGED
@@ -46,10 +46,10 @@
46
46
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
47
47
  import { createRequire } from "node:module";
48
48
  import { basename, dirname, join, resolve } from "node:path";
49
+ import { log, object } from "@dbx-tools/shared-core";
49
50
  import type * as ts from "typescript";
50
51
  import { lazyRequire } from "./_lazy-require.ts";
51
52
  import { header, isReadonly, makeReadonly, makeWritable } from "./generated.ts";
52
- import { log, object } from "@dbx-tools/shared-core";
53
53
  import { readPackageManifest, repoRoot, recordedPackages } from "./packages.ts";
54
54
 
55
55
  const logger = log.logger("projen:codegen");
@@ -31,11 +31,12 @@ function readDBXToolsConfig(pkg: javascript.NodePackage): Record<string, unknown
31
31
 
32
32
  function loadConfig(dbxToolsConfig: DBXToolsConfig, pkg: javascript.NodePackage) {
33
33
  const { tags, ...config } = readDBXToolsConfig(pkg);
34
- if (Array.isArray(tags))
34
+ if (Array.isArray(tags)) {
35
35
  object
36
36
  .sequence(tags)
37
37
  .filter((v: unknown) => typeof v === "string")
38
38
  .forEach((v: string) => dbxToolsConfig.tags.push(v));
39
+ }
39
40
  Object.entries(config).forEach(([key, value]) => {
40
41
  dbxToolsConfig[key] = value;
41
42
  });
package/src/openapi.ts CHANGED
@@ -23,11 +23,11 @@
23
23
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
24
24
  import { createRequire } from "node:module";
25
25
  import { join } from "node:path";
26
- import type * as ts from "typescript";
27
26
  import { find } from "@dbx-tools/path";
27
+ import { log } from "@dbx-tools/shared-core";
28
+ import type * as ts from "typescript";
28
29
  import { lazyRequire } from "./_lazy-require.ts";
29
30
  import { makeReadonly, makeWritable, stampGenerated } from "./generated.ts";
30
- import { log } from "@dbx-tools/shared-core";
31
31
  import {
32
32
  type RecordedPackage,
33
33
  isModuleFile,
package/src/packages.ts CHANGED
@@ -26,8 +26,8 @@
26
26
  import { existsSync, readFileSync } from "node:fs";
27
27
  import { extname, relative, resolve, sep } from "node:path";
28
28
  import { project as coreProject } from "@dbx-tools/core";
29
- import { json, object, string } from "@dbx-tools/shared-core";
30
29
  import { find } from "@dbx-tools/path";
30
+ import { json, object, string } from "@dbx-tools/shared-core";
31
31
  import { parse } from "yaml";
32
32
 
33
33
  /**
@@ -1,3 +1,5 @@
1
+ import { relative } from "node:path";
2
+ import { match, PathMatchInput, PathMatchPredicate } from "@dbx-tools/path";
1
3
  import {
2
4
  object,
3
5
  predicate,
@@ -7,11 +9,9 @@ import {
7
9
  } from "@dbx-tools/shared-core";
8
10
  import { IConstruct } from "constructs";
9
11
  import { Project } from "projen";
10
- import { DBXToolsProject, DBXToolsNodeProject, DBXToolsTypeScriptProject } from "./project.ts";
11
- import { toPosix } from "./packages.ts";
12
- import { relative } from "node:path";
13
- import { match, PathMatchInput, PathMatchPredicate } from "@dbx-tools/path";
14
12
  import { project } from "..";
13
+ import { toPosix } from "./packages.ts";
14
+ import { DBXToolsProject, DBXToolsNodeProject, DBXToolsTypeScriptProject } from "./project.ts";
15
15
 
16
16
  /**
17
17
  * Guard: the construct is a projen {@link Project} - the base every builder here
package/src/project.ts CHANGED
@@ -6,22 +6,16 @@
6
6
  * {@link DBXToolsNodeProject} (monorepo root) and {@link DBXToolsTypeScriptProject}
7
7
  * (a package, or a standalone compiling root) both implement {@link DBXToolsProject}.
8
8
  */
9
- import { object, string, type OneOrMany } from "@dbx-tools/shared-core";
10
- import { ignore, match, PathMatchInput } from "@dbx-tools/path";
11
- import { project as coreProject } from "@dbx-tools/core";
12
9
  import { existsSync, readdirSync } from "node:fs";
13
10
  import { dirname, join, relative, resolve } from "node:path";
11
+ import { project as coreProject } from "@dbx-tools/core";
12
+ import { ignore, match, PathMatchInput } from "@dbx-tools/path";
13
+ import { object, string, type OneOrMany } from "@dbx-tools/shared-core";
14
+ import { IConstruct } from "constructs";
14
15
  import { Component, IgnoreFile, Project, type TaskOptions, javascript, typescript } from "projen";
15
16
  import { ReleaseTrigger } from "projen/lib/release";
17
+ import { mixin, projectPredicate } from "..";
16
18
  import { generateBarrels } from "./barrels.ts";
17
- import { codegenModulePaths, generateCodegen } from "./codegen.ts";
18
- import { DBXToolsConfig, type DBXToolsConfigOptions } from "./dbx-tools-config.ts";
19
- import { resolvePkgRoot } from "./engine-root.ts";
20
- import { PnpmWorkspaceState, type DBXToolsPNPMWorkspaceOptions } from "./pnpm-workspace.ts";
21
- import { applyCompiledPublish } from "./publish.ts";
22
- import { DBXToolsRelease, type StandaloneRelease } from "./release.ts";
23
- import { AGNOSTIC_COMPILER_OPTIONS, PACKAGE_TAG_MIXINS, type PackageTag } from "./tags.ts";
24
- import { DBXToolsRootTsconfig } from "./tsconfig.ts";
25
19
  import {
26
20
  BUN_APP_OVERRIDES,
27
21
  BunBuildFile,
@@ -29,7 +23,9 @@ import {
29
23
  BunfigFile,
30
24
  RootBunfigFile,
31
25
  } from "./bun-app.ts";
32
- import { DBXToolsVsCode } from "./vscode.ts";
26
+ import { codegenModulePaths, generateCodegen } from "./codegen.ts";
27
+ import { DBXToolsConfig, type DBXToolsConfigOptions } from "./dbx-tools-config.ts";
28
+ import { resolvePkgRoot } from "./engine-root.ts";
33
29
  import {
34
30
  DEFAULT_PACKAGE_ROOTS,
35
31
  type DiscoveredPackage,
@@ -39,8 +35,12 @@ import {
39
35
  scanPackages,
40
36
  toPosix,
41
37
  } from "./packages.ts";
42
- import { mixin, projectPredicate } from "..";
43
- import { IConstruct } from "constructs";
38
+ import { PnpmWorkspaceState, type DBXToolsPNPMWorkspaceOptions } from "./pnpm-workspace.ts";
39
+ import { applyCompiledPublish } from "./publish.ts";
40
+ import { DBXToolsRelease, type StandaloneRelease } from "./release.ts";
41
+ import { AGNOSTIC_COMPILER_OPTIONS, PACKAGE_TAG_MIXINS, type PackageTag } from "./tags.ts";
42
+ import { DBXToolsRootTsconfig } from "./tsconfig.ts";
43
+ import { DBXToolsVsCode } from "./vscode.ts";
44
44
 
45
45
  /**
46
46
  * The dbx-tools project surface, backed by projen's Node toolchain. A single
@@ -953,14 +953,20 @@ function initProject(
953
953
  // each file to its own package tsconfig (so type-aware rules work tree-wide), and
954
954
  // `import/no-extraneous-dependencies` still checks each file against its nearest
955
955
  // package.json. Formatting defers to the root Prettier to avoid rule/formatter
956
- // conflicts (e.g. quote style). Spawned from `test`, so ignorePatterns must cover
957
- // every read-only generated path - `--fix` EACCES-crashes on them otherwise.
956
+ // conflicts (e.g. quote style). The normal task is check-only so CI never
957
+ // repairs the worktree it is meant to validate; `eslint:fix` is the explicit
958
+ // local mutation path.
958
959
  const eslint = new javascript.Eslint(project, {
959
- dirs: [...roots],
960
+ dirs: [...roots, "projen"],
960
961
  fileExtensions: [".ts", ".tsx"],
961
962
  projectService: true,
962
963
  prettier: Boolean(project.prettier),
963
964
  tsconfigPath: "./tsconfig.json",
965
+ commandOptions: { fix: false },
966
+ });
967
+ project.addTask("eslint:fix", {
968
+ description: "Fix ESLint issues across the codebase",
969
+ exec: "bun run eslint -- --fix",
964
970
  });
965
971
  // Generated read-only outputs (barrels, openapi clients, app scripts, codegen).
966
972
  // ESLint --fix cannot rewrite them; they are stamped by the barrel generator /
@@ -969,6 +975,7 @@ function initProject(
969
975
  eslint.addIgnorePattern(`${root}/openapi/**`);
970
976
  eslint.addIgnorePattern(`${root}/**/index.ts`);
971
977
  }
978
+ eslint.addIgnorePattern("projen/index.ts");
972
979
  // The generated bun app scripts + unmanaged overrides live at the package root,
973
980
  // outside any `src/**` tsconfig include, so the type-aware parser cannot resolve
974
981
  // them to a project. ESLint still cannot parse them.
@@ -1242,21 +1249,24 @@ export function applyToProjects<P extends Project>(
1242
1249
  let pred = projectPredicate.isProject();
1243
1250
  if (!options?.includeNonDBXToolsProjects) pred = pred.and(projectPredicate.isDBXToolsProject());
1244
1251
  if (!options?.includeRoots) pred = pred.and((p) => p.parent != null);
1245
- if (options?.identifierPackageName)
1252
+ if (options?.identifierPackageName) {
1246
1253
  pred = pred.and(
1247
1254
  projectPredicate.hasIdentifierPackageName(
1248
1255
  ...object.toOneOrMany(options.identifierPackageName),
1249
1256
  ),
1250
1257
  );
1258
+ }
1251
1259
  if (options?.name) pred = pred.and(projectPredicate.hasName(...object.toOneOrMany(options.name)));
1252
- if (options?.identifierScope)
1260
+ if (options?.identifierScope) {
1253
1261
  pred = pred.and(
1254
1262
  projectPredicate.hasIdentifierScope(...object.toOneOrMany(options.identifierScope)),
1255
1263
  );
1256
- if (options?.identifierName)
1264
+ }
1265
+ if (options?.identifierName) {
1257
1266
  pred = pred.and(
1258
1267
  projectPredicate.hasIdentifierName(...object.toOneOrMany(options.identifierName)),
1259
1268
  );
1269
+ }
1260
1270
  if (options?.tags) pred = pred.and(projectPredicate.hasTag(...object.toOneOrMany(options.tags)));
1261
1271
  if (options?.path) pred = pred.and(projectPredicate.hasPath(...object.toOneOrMany(options.path)));
1262
1272
  const projectMixin = mixin.create(pred, (p) => {
package/src/publish.ts CHANGED
@@ -29,8 +29,8 @@
29
29
  */
30
30
  import type { javascript } from "projen";
31
31
  import { typescript } from "projen";
32
- import { addPackageFiles, applyCompilerOptions, applyIncludes } from "./project.ts";
33
32
  import { isDBXToolsProject } from "./project-predicate.ts";
33
+ import { addPackageFiles, applyCompilerOptions, applyIncludes } from "./project.ts";
34
34
 
35
35
  /** Directory `tsc` emits into, and the root of every published entry point. */
36
36
  export const COMPILED_DIR = "lib";
package/src/tags.ts CHANGED
@@ -17,6 +17,7 @@ import type { IMixin as ConstructsMixin } from "constructs";
17
17
  import { javascript } from "projen";
18
18
  import { BunBuildFile, BunDevServerFile, BunfigFile } from "./bun-app.ts";
19
19
  import { create } from "./mixin.ts";
20
+ import * as projectPredicate from "./project-predicate.ts";
20
21
  import {
21
22
  addPackageFiles,
22
23
  applyCompilerOptions,
@@ -25,7 +26,6 @@ import {
25
26
  applyTasks,
26
27
  srcModuleExports,
27
28
  } from "./project.ts";
28
- import * as projectPredicate from "./project-predicate.ts";
29
29
 
30
30
  /** Node compiler options: ES2022 lib + node types, deliberately no DOM. */
31
31
  const NODE_COMPILER_OPTIONS: javascript.TypeScriptCompilerOptions = {
@@ -137,7 +137,7 @@ export const PACKAGE_TAG_MIXINS = {
137
137
  // register and no launcher shim to generate. In a WORKSPACE checkout the
138
138
  // manifest still points at the `.ts` entry, which Node type-strips on its own
139
139
  // because the package is not under `node_modules`.
140
- p.addDeps("commander@catalog:", "@clack/prompts@catalog:");
140
+ p.addDeps("commander@catalog:");
141
141
  p.addDevDeps("@types/node@catalog:");
142
142
  // A CLI compiles code OUTSIDE `src/` - its root `index.ts` barrel and the
143
143
  // `bin/` entries - which the src-only tag default doesn't reach.
package/tasks/barrels.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env -S bun
2
2
  import { sep } from "node:path";
3
- import { generateBarrels } from "../src/barrels.ts";
4
3
  import { log, string } from "@dbx-tools/shared-core";
5
- import { watchLoop, watchRoots } from "../src/watch.ts";
4
+ import { generateBarrels } from "../src/barrels.ts";
6
5
  import { recordedPackages } from "../src/packages.ts";
6
+ import { watchLoop, watchRoots } from "../src/watch.ts";
7
7
 
8
8
  const logger = log.logger("projen:barrels");
9
9
 
package/tasks/bump.ts CHANGED
@@ -39,12 +39,12 @@
39
39
  * - `false`: never publish locally.
40
40
  * - a URL: always publish to that registry.
41
41
  */
42
- import { exec, project } from "@dbx-tools/core";
43
- import { log, net } from "@dbx-tools/shared-core";
44
- import { Command, Option } from "commander";
45
42
  import { chmodSync, existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
46
43
  import { resolve } from "node:path";
47
44
  import { fileURLToPath } from "node:url";
45
+ import { exec, project } from "@dbx-tools/core";
46
+ import { log, net } from "@dbx-tools/shared-core";
47
+ import { Command, Option } from "commander";
48
48
 
49
49
  const logger = log.logger("projen:bump");
50
50
  const LEVELS = ["patch", "minor", "major"] as const;
package/tasks/clean.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env -S bun
2
2
  import { relative } from "node:path";
3
- import { listGeneratedFiles, listNodeModulesDirs, removePaths } from "../src/clean.ts";
4
3
  import { log, string } from "@dbx-tools/shared-core";
4
+ import { listGeneratedFiles, listNodeModulesDirs, removePaths } from "../src/clean.ts";
5
5
  import { repoRoot, toPosix } from "../src/packages.ts";
6
6
 
7
7
  const logger = log.logger("projen:clean");
package/tasks/openapi.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S bun
2
- import { generateBarrels } from "../src/barrels.ts";
3
2
  import { log, string } from "@dbx-tools/shared-core";
3
+ import { generateBarrels } from "../src/barrels.ts";
4
4
  import { generateOpenapi, isTsoaController } from "../src/openapi.ts";
5
5
  import { runSynth } from "../src/scaffold.ts";
6
6
  import { watchLoop, watchRoots } from "../src/watch.ts";
package/tasks/projenrc.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env -S bun
2
2
  import { resolve } from "node:path";
3
3
  import { log } from "@dbx-tools/shared-core";
4
+ import { repoRoot, syncResynthPaths } from "../src/packages.ts";
4
5
  import { runSynth } from "../src/scaffold.ts";
5
6
  import { watchLoop } from "../src/watch.ts";
6
- import { repoRoot, syncResynthPaths } from "../src/packages.ts";
7
7
 
8
8
  const logger = log.logger("projen:projenrc");
9
9
 
package/tasks/sync.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env -S bun
2
2
  import { fileURLToPath } from "node:url";
3
- import concurrently from "concurrently";
4
3
  import { log } from "@dbx-tools/shared-core";
4
+ import concurrently from "concurrently";
5
5
  import { runSynth } from "../src/scaffold.ts";
6
6
 
7
7
  const logger = log.logger("projen:sync");