@ankhorage/devtools 2.0.18 → 2.0.20

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
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/devtools
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v2.0.18](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v2.0.20](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects
9
9
 
@@ -77,6 +77,7 @@ export default defineParadoxConfig({
77
77
  - [Architecture overview](././paradox/diagrams/architecture-overview.mmd)
78
78
  - [Module relationships](././paradox/diagrams/module-relationships.mmd)
79
79
  - [Export graph](././paradox/diagrams/export-graph.mmd)
80
+ - [createKnipConfig sequence](././paradox/diagrams/sequences/create-knip-config.mmd)
80
81
  - [createKnipMonorepoConfig sequence](././paradox/diagrams/sequences/create-knip-monorepo-config.mmd)
81
82
 
82
83
  ## Public API
@@ -0,0 +1 @@
1
+ export declare const EXAMPLES_ESLINT_OWNERSHIP_MARKER = "// This file is managed by @ankhorage/devtools.\n";
@@ -0,0 +1 @@
1
+ export const EXAMPLES_ESLINT_OWNERSHIP_MARKER = '// This file is managed by @ankhorage/devtools.\n';
@@ -1,5 +1,6 @@
1
1
  import { readdir, readFile } from 'node:fs/promises';
2
2
  import { resolve } from 'node:path';
3
+ import { EXAMPLES_ESLINT_OWNERSHIP_MARKER } from '../../constants/eslint.js';
3
4
  const ESLINT_CONFIG = `import { createConfig } from '@ankhorage/devtools/eslint';
4
5
  import localConfig from './eslint.local.config.mjs';
5
6
 
@@ -16,7 +17,6 @@ export default [
16
17
  `;
17
18
  const EMPTY_LOCAL_CONFIG = `export default [];
18
19
  `;
19
- const EXAMPLES_OWNERSHIP_MARKER = '// This file is managed by @ankhorage/devtools.\n';
20
20
  const IGNORED_EXAMPLE_DIRECTORY_NAMES = new Set([
21
21
  '.expo',
22
22
  '.next',
@@ -28,7 +28,7 @@ const IGNORED_EXAMPLE_DIRECTORY_NAMES = new Set([
28
28
  'node_modules',
29
29
  'templates',
30
30
  ]);
31
- const ESLINT_EXAMPLES_CONFIG = `${EXAMPLES_OWNERSHIP_MARKER}import { existsSync } from 'node:fs';
31
+ const ESLINT_EXAMPLES_CONFIG = `${EXAMPLES_ESLINT_OWNERSHIP_MARKER}import { existsSync } from 'node:fs';
32
32
 
33
33
  import { createConfig } from '@ankhorage/devtools/eslint';
34
34
  import localConfig from './eslint.local.config.mjs';
@@ -114,7 +114,7 @@ async function assertExamplesConfigOwnershipAsync(targetDirectory) {
114
114
  return;
115
115
  throw error;
116
116
  }
117
- if (!contents.startsWith(EXAMPLES_OWNERSHIP_MARKER)) {
117
+ if (!contents.startsWith(EXAMPLES_ESLINT_OWNERSHIP_MARKER)) {
118
118
  throw new Error('Cannot replace consumer-owned eslint.examples.config.mjs. ' +
119
119
  'Move its repository-specific overrides into eslint.local.config.mjs, keeping their ' +
120
120
  'examples file scope and preserving existing local entries. Then remove the old examples ' +
@@ -1,15 +1,3 @@
1
- /***
2
- * Build shared Knip configuration while preserving repository-specific discovery.
3
- *
4
- * `createKnipConfig` keeps Knip zero-config discovery. Repositories can add narrow entries, project globs, ignored files,
5
- * binaries, dependencies, and workspace overrides without duplicating the shared Knip version.
6
- *
7
- * `createKnipMonorepoConfig` adds a root workspace plus conventional `packages/*` and `apps/*`
8
- * workspace globs. Callers can override those globs, provide workspace defaults, and replace or
9
- * extend individual workspace configuration deterministically.
10
- *
11
- * @readme
12
- */
13
1
  import type { KnipConfig } from 'knip';
14
2
  export interface DevtoolsKnipWorkspaceConfigOptions {
15
3
  readonly entry?: string[];
@@ -1,6 +1,25 @@
1
+ /***
2
+ * Build shared Knip configuration while preserving repository-specific discovery.
3
+ *
4
+ * `createKnipConfig` keeps Knip zero-config discovery. Repositories can add narrow entries, project globs, ignored files,
5
+ * binaries, dependencies, and workspace overrides without duplicating the shared Knip version.
6
+ *
7
+ * `createKnipMonorepoConfig` adds a root workspace plus conventional `packages/*` and `apps/*`
8
+ * workspace globs. Callers can override those globs, provide workspace defaults, and replace or
9
+ * extend individual workspace configuration deterministically.
10
+ *
11
+ * @readme
12
+ */
13
+ import { existsSync, readFileSync } from 'node:fs';
14
+ import { EXAMPLES_ESLINT_OWNERSHIP_MARKER } from '../../constants/eslint.js';
1
15
  const DEFAULT_MONOREPO_WORKSPACE_GLOBS = ['packages/*', 'apps/*'];
16
+ const MANAGED_EXAMPLES_ESLINT_CONFIG = 'eslint.examples.config.mjs';
2
17
  /*** Build shared Knip configuration while preserving repository-specific discovery. */
3
18
  export function createKnipConfig(options = {}) {
19
+ const ignoredFiles = [
20
+ ...(options.ignoreFiles ?? []),
21
+ ...(hasManagedExamplesEslintConfig() ? [MANAGED_EXAMPLES_ESLINT_CONFIG] : []),
22
+ ];
4
23
  return {
5
24
  ...(options.entry === undefined ? {} : { entry: options.entry }),
6
25
  ...(options.project === undefined ? {} : { project: options.project }),
@@ -9,7 +28,7 @@ export function createKnipConfig(options = {}) {
9
28
  ...(options.ignoreDependencies === undefined
10
29
  ? {}
11
30
  : { ignoreDependencies: options.ignoreDependencies }),
12
- ...(options.ignoreFiles === undefined ? {} : { ignoreFiles: options.ignoreFiles }),
31
+ ...(ignoredFiles.length === 0 ? {} : { ignoreFiles: [...new Set(ignoredFiles)] }),
13
32
  ...(options.workspaces === undefined ? {} : { workspaces: options.workspaces }),
14
33
  };
15
34
  }
@@ -31,3 +50,8 @@ export function createKnipMonorepoConfig(options = {}) {
31
50
  }
32
51
  return createKnipConfig({ workspaces });
33
52
  }
53
+ /*** Report whether the examples ESLint config is owned by Devtools. */
54
+ function hasManagedExamplesEslintConfig() {
55
+ return (existsSync(MANAGED_EXAMPLES_ESLINT_CONFIG) &&
56
+ readFileSync(MANAGED_EXAMPLES_ESLINT_CONFIG, 'utf8').startsWith(EXAMPLES_ESLINT_OWNERSHIP_MARKER));
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
4
4
  "description": "Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankhorage/devtools#readme",