@textmode/docs 0.1.0 → 0.2.1

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
@@ -60,7 +60,6 @@ export default defineDocs({
60
60
  examples: ['function', 'method', 'accessor'],
61
61
  },
62
62
  examples: {
63
- checkSketches: true,
64
63
  forbidGallerySourceBase: true,
65
64
  },
66
65
  typedoc: {},
@@ -81,28 +80,32 @@ names begin with `textmode`.
81
80
 
82
81
  ### Defaults
83
82
 
84
- | Setting | Default |
85
- | ------------------------------ | ---------------------------------------------- |
86
- | Package name and description | `package.json` |
87
- | Entrypoint and link entrypoint | `src/index.ts` |
88
- | Source roots | Derived from link entrypoints |
89
- | TypeScript config | `tsconfig.json` |
90
- | Output | `api/<package-name>` |
91
- | Hosted API URL | `https://code.textmode.art/api/<package-name>` |
92
- | Member pages | Methods, properties, and accessors |
93
- | Self-link stripping | `full` |
94
- | Sorting | Source order |
95
- | API-link kinds | All supported reflection kinds |
96
- | Required docstrings | All supported reflection kinds |
97
- | Required examples | Functions, methods, and accessors |
98
- | Example checks | Gallery, manifest, and sketch checks enabled |
99
- | Gallery source bases | Hardcoded source bases rejected |
83
+ | Setting | Default |
84
+ | ------------------------------ | ----------------------------------------------------- |
85
+ | Package name and description | `package.json` |
86
+ | Entrypoint and link entrypoint | `src/index.ts` |
87
+ | Source roots | Derived from link entrypoints |
88
+ | TypeScript config | `tsconfig.json` |
89
+ | Output | `api/<package-name>` |
90
+ | Hosted API URL | `https://code.textmode.art/api/<package-name>` |
91
+ | Member pages | Methods, properties, and accessors |
92
+ | Self-link stripping | `full` |
93
+ | Sorting | Kind, instance-first, alphabetical (except documents) |
94
+ | API-link kinds | All supported reflection kinds |
95
+ | Required docstrings | All supported reflection kinds |
96
+ | Required examples | Functions, methods, and accessors |
97
+ | Example checks | Gallery, manifest, and sketch checks enabled |
98
+ | Gallery source bases | Hardcoded source bases rejected |
100
99
 
101
100
  Configuration precedence is shared defaults, derived package metadata,
102
101
  `textmode.docs.config.mjs`, then command-owned overrides such as `--out`,
103
102
  strict checking, and watch mode. Use `--show-config` to inspect the effective
104
103
  values and the origin of every setting.
105
104
 
105
+ The shared sorting policy groups API reflections by kind, lists instance members
106
+ before static members, and alphabetizes non-document reflections. A project can
107
+ override it with `typedoc.sort` when its API needs a different presentation.
108
+
106
109
  ## Commands
107
110
 
108
111
  ```text
package/index.d.ts CHANGED
@@ -16,7 +16,6 @@ export interface DocsChecks {
16
16
  }
17
17
 
18
18
  export interface ExamplesPolicy {
19
- checkSketches?: boolean;
20
19
  forbidGallerySourceBase?: boolean;
21
20
  }
22
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textmode/docs",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Shared documentation generation and validation for the textmode.js ecosystem",
5
5
  "keywords": [
6
6
  "textmode",
@@ -27,7 +27,7 @@
27
27
  }
28
28
  },
29
29
  "bin": {
30
- "textmode-docs": "./src/cli/textmode-docs.mjs"
30
+ "textmode-docs": "src/cli/textmode-docs.mjs"
31
31
  },
32
32
  "files": [
33
33
  "src",
@@ -17,7 +17,7 @@ const TOP_LEVEL_KEYS = new Set([
17
17
  'typedoc',
18
18
  ]);
19
19
  const CHECK_KEYS = new Set(['apiLinks', 'docstrings', 'examples']);
20
- const EXAMPLE_KEYS = new Set(['checkSketches', 'forbidGallerySourceBase']);
20
+ const EXAMPLE_KEYS = new Set(['forbidGallerySourceBase']);
21
21
  const LINK_ENTRY_POINT_KEYS = new Set(['path', 'tsconfig', 'namespaceExportsOnly']);
22
22
  const REFLECTION_KINDS = new Set([
23
23
  'class',
@@ -57,6 +57,9 @@ export const DEFAULT_API_LINK_KINDS = [
57
57
  export const DEFAULT_DOCSTRING_KINDS = [...DEFAULT_API_LINK_KINDS];
58
58
  export const DEFAULT_EXAMPLE_KINDS = ['function', 'method', 'accessor'];
59
59
  export const DEFAULT_MEMBER_PAGE_KINDS = ['method', 'property', 'accessor'];
60
+ export const DEFAULT_TYPEDOC_OPTIONS = {
61
+ sort: ['kind', 'instance-first', 'alphabetical-ignoring-documents'],
62
+ };
60
63
 
61
64
  function isRecord(value) {
62
65
  return value !== null && typeof value === 'object' && !Array.isArray(value);
@@ -286,7 +289,6 @@ export async function resolveDocsConfig({ cwd = process.cwd(), configPath: reque
286
289
  config.examples === false
287
290
  ? false
288
291
  : {
289
- checkSketches: config.examples?.checkSketches ?? true,
290
292
  forbidGallerySourceBase: config.examples?.forbidGallerySourceBase ?? true,
291
293
  };
292
294
  const outputDir = out ?? config.outputDir ?? `api/${packageJson.name}`;
@@ -311,7 +313,7 @@ export async function resolveDocsConfig({ cwd = process.cwd(), configPath: reque
311
313
  stripApiSelfLinks: config.stripApiSelfLinks ?? 'full',
312
314
  checks,
313
315
  examples,
314
- typedoc: config.typedoc ?? {},
316
+ typedoc: { ...DEFAULT_TYPEDOC_OPTIONS, ...(config.typedoc ?? {}) },
315
317
  origins: {
316
318
  packageName: 'package.json#name',
317
319
  packageDescription:
@@ -335,8 +337,6 @@ export async function resolveDocsConfig({ cwd = process.cwd(), configPath: reque
335
337
  config.examples === false
336
338
  ? 'textmode.docs.config.mjs'
337
339
  : {
338
- checkSketches:
339
- config.examples?.checkSketches !== undefined ? 'textmode.docs.config.mjs' : 'default',
340
340
  forbidGallerySourceBase:
341
341
  config.examples?.forbidGallerySourceBase !== undefined
342
342
  ? 'textmode.docs.config.mjs'
@@ -141,10 +141,6 @@ export function examplesCheck(config) {
141
141
 
142
142
  const files = getManifestExamples(manifest).map((example) => example.sourceFile);
143
143
  console.log(`Found ${files.length} manifest examples from examples/manifest.json.`);
144
- if (!config.examples.checkSketches) {
145
- console.log('Sketch convention checks are disabled for this package.');
146
- return true;
147
- }
148
144
 
149
145
  let passedCount = 0;
150
146
  let failedCount = 0;
@@ -8,6 +8,7 @@ import { load as loadMemberPages } from './typedoc-plugins/all-member-pages-rout
8
8
  import { load as loadApiFrontmatter } from './typedoc-plugins/api-frontmatter/index.js';
9
9
  import { load as loadCodeExamples } from './typedoc-plugins/include-code-examples/index.js';
10
10
  import { load as loadSelfLinkStripper } from './typedoc-plugins/strip-api-self-links/index.js';
11
+ import { DEFAULT_TYPEDOC_OPTIONS } from './config.js';
11
12
 
12
13
  const BASE_TYPEDOC_OPTIONS = {
13
14
  readme: 'none',
@@ -22,7 +23,7 @@ const BASE_TYPEDOC_OPTIONS = {
22
23
  exampleTag: false,
23
24
  },
24
25
  exclude: ['**/node_modules/**'],
25
- sort: ['source-order'],
26
+ ...DEFAULT_TYPEDOC_OPTIONS,
26
27
  logLevel: 'Verbose',
27
28
  frontmatterGlobals: {
28
29
  layout: 'doc',