@textmode/docs 0.2.2 → 0.3.0

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
@@ -78,6 +78,10 @@ The `typedoc` object can override registered TypeDoc options except
78
78
  `treatWarningsAsErrors`, `treatValidationWarningsAsErrors`, and options whose
79
79
  names begin with `textmode`.
80
80
 
81
+ `editLink: true` enables the "Edit this page on GitHub" link on generated
82
+ API pages for the package. The default (`false`) omits the link because API
83
+ reference is generated and should not be edited in place via the docs site.
84
+
81
85
  ### Defaults
82
86
 
83
87
  | Setting | Default |
@@ -90,6 +94,7 @@ names begin with `textmode`.
90
94
  | Hosted API URL | `https://code.textmode.art/api/<package-name>` |
91
95
  | Member pages | Methods, properties, and accessors |
92
96
  | Self-link stripping | `full` |
97
+ | Edit link on API pages | Disabled (opt in per package with `editLink: true`) |
93
98
  | Sorting | Kind, instance-first, alphabetical (except documents) |
94
99
  | API-link kinds | All supported reflection kinds |
95
100
  | Required docstrings | All supported reflection kinds |
package/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export interface TextmodeDocsConfig {
28
28
  tsconfig?: string;
29
29
  memberPageKinds?: MemberPageKind[];
30
30
  stripApiSelfLinks?: 'minimal' | 'full';
31
+ editLink?: boolean;
31
32
  checks?: DocsChecks;
32
33
  examples?: false | ExamplesPolicy;
33
34
  typedoc?: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textmode/docs",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Shared documentation generation and validation for the textmode.js ecosystem",
5
5
  "keywords": [
6
6
  "textmode",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "type": "module",
20
20
  "engines": {
21
- "node": ">=20.8.1"
21
+ "node": ">=24 <25"
22
22
  },
23
23
  "exports": {
24
24
  ".": {
@@ -47,7 +47,7 @@
47
47
  "typescript": "^6.0.3"
48
48
  },
49
49
  "scripts": {
50
- "check": "npm run check:format && npm run lint && npm run test && npm run check:package && npm run check:pack",
50
+ "check": "pnpm run check:format && pnpm run lint && pnpm run test && pnpm run check:package && pnpm run check:pack",
51
51
  "check:format": "prettier --check .",
52
52
  "check:package": "node scripts/check-package.mjs",
53
53
  "check:pack": "node scripts/pack-smoke.mjs",
@@ -12,6 +12,7 @@ const TOP_LEVEL_KEYS = new Set([
12
12
  'tsconfig',
13
13
  'memberPageKinds',
14
14
  'stripApiSelfLinks',
15
+ 'editLink',
15
16
  'checks',
16
17
  'examples',
17
18
  'typedoc',
@@ -203,6 +204,9 @@ export function validateDocsConfig(config) {
203
204
  ) {
204
205
  throw new Error('stripApiSelfLinks must be "minimal" or "full".');
205
206
  }
207
+ if (config.editLink !== undefined && typeof config.editLink !== 'boolean') {
208
+ throw new Error('editLink must be a boolean.');
209
+ }
206
210
  if (config.checks !== undefined) {
207
211
  validateChecks(config.checks);
208
212
  }
@@ -311,6 +315,7 @@ export async function resolveDocsConfig({ cwd = process.cwd(), configPath: reque
311
315
  tsconfig: resolveProjectPath(projectRoot, tsconfig),
312
316
  memberPageKinds: config.memberPageKinds ?? DEFAULT_MEMBER_PAGE_KINDS,
313
317
  stripApiSelfLinks: config.stripApiSelfLinks ?? 'full',
318
+ editLink: config.editLink ?? false,
314
319
  checks,
315
320
  examples,
316
321
  typedoc: { ...DEFAULT_TYPEDOC_OPTIONS, ...(config.typedoc ?? {}) },
@@ -328,6 +333,7 @@ export async function resolveDocsConfig({ cwd = process.cwd(), configPath: reque
328
333
  tsconfig: origin(config, 'tsconfig', 'default'),
329
334
  memberPageKinds: origin(config, 'memberPageKinds', 'default'),
330
335
  stripApiSelfLinks: origin(config, 'stripApiSelfLinks', 'default'),
336
+ editLink: origin(config, 'editLink', 'default'),
331
337
  checks: {
332
338
  apiLinks: config.checks?.apiLinks ? 'textmode.docs.config.mjs' : 'default',
333
339
  docstrings: config.checks?.docstrings ? 'textmode.docs.config.mjs' : 'default',
@@ -372,6 +378,7 @@ export function formatResolvedConfig(config) {
372
378
  tsconfig: displayPath(config.projectRoot, config.tsconfig),
373
379
  memberPageKinds: config.memberPageKinds,
374
380
  stripApiSelfLinks: config.stripApiSelfLinks,
381
+ editLink: config.editLink,
375
382
  checks: config.checks,
376
383
  examples: config.examples,
377
384
  typedoc: config.typedoc,
@@ -28,10 +28,6 @@ const BASE_TYPEDOC_OPTIONS = {
28
28
  exclude: ['**/node_modules/**'],
29
29
  ...DEFAULT_TYPEDOC_OPTIONS,
30
30
  logLevel: 'Verbose',
31
- frontmatterGlobals: {
32
- layout: 'doc',
33
- editLink: true,
34
- },
35
31
  frontmatterCommentTags: ['author', 'since', 'deprecated'],
36
32
  preserveFrontmatterCommentTags: false,
37
33
  frontmatterNamingConvention: 'camelCase',
@@ -100,6 +96,10 @@ function applicationOptions(config, { outputDir, strict = false, watch = false }
100
96
  const { compilerOptions = {}, ...typedocOptions } = config.typedoc;
101
97
  return {
102
98
  ...BASE_TYPEDOC_OPTIONS,
99
+ frontmatterGlobals: {
100
+ layout: 'doc',
101
+ editLink: config.editLink ?? false,
102
+ },
103
103
  ...typedocOptions,
104
104
  entryPoints: config.entryPoints,
105
105
  entryPointStrategy: 'resolve',