@versatiles/release-tool 2.1.0 → 2.2.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
@@ -5,12 +5,12 @@
5
5
 
6
6
  Tools used for:
7
7
 
8
- * creating a graph of the source code as mermaid: [`vrt deps-graph`](#subcommand-vrt-deps-graph)
9
- * upgrading all package dependencies: [`vrt deps-upgrade`](#subcommand-vrt-deps-upgrade)
10
- * creating Markdown documentation of executables: [`vrt doc-command`](#subcommand-vrt-doc-command)
11
- * inserting Markdown into documents: [`vrt doc-insert`](#subcommand-vrt-doc-insert)
12
- * updating "Table of Content" in Markdown files: [`vrt doc-toc`](#subcommand-vrt-doc-toc)
13
- * releasing the project as npm package: [`vrt release-npm`](#subcommand-vrt-release-npm)
8
+ - creating a graph of the source code as mermaid: [`vrt deps-graph`](#subcommand-vrt-deps-graph)
9
+ - upgrading all package dependencies: [`vrt deps-upgrade`](#subcommand-vrt-deps-upgrade)
10
+ - creating Markdown documentation of executables: [`vrt doc-command`](#subcommand-vrt-doc-command)
11
+ - inserting Markdown into documents: [`vrt doc-insert`](#subcommand-vrt-doc-insert)
12
+ - updating "Table of Content" in Markdown files: [`vrt doc-toc`](#subcommand-vrt-doc-toc)
13
+ - releasing the project as npm package: [`vrt release-npm`](#subcommand-vrt-release-npm)
14
14
 
15
15
  # Installation
16
16
 
@@ -34,9 +34,9 @@ You need to configure the scripts in the package.json:
34
34
  }
35
35
  ```
36
36
 
37
- * `scripts.check` is **required** by the release command. Here you can lint, build and test your code.
38
- * `scripts.prepack` is **recommended** to ensure that all files are up-to-date before releasing. Here you can build code and documentation.
39
- * `scripts.release` is **recommended** to make it easy to release a new version.
37
+ - `scripts.check` is **required** by the release command. Here you can lint, build and test your code.
38
+ - `scripts.prepack` is **recommended** to ensure that all files are up-to-date before releasing. Here you can build code and documentation.
39
+ - `scripts.release` is **recommended** to make it easy to release a new version.
40
40
 
41
41
  # Command `vrt`
42
42
 
@@ -160,11 +160,13 @@ Usage: vrt doc-typescript [options]
160
160
  Generate documentation for a TypeScript project.
161
161
 
162
162
  Options:
163
- -h, --help display help for command
164
- -i <entryPoint> Entry point of the TypeScript project. Default is
165
- "./src/index.ts".
166
- -o <outputPath> Output path for the generated documentation. Default is
167
- "./docs".
163
+ -f, --format <format> Allowed are "markdown", "wiki" and "html". Default
164
+ is "markdown".
165
+ -h, --help display help for command
166
+ -i, --input <entryPoint> Entry point of the TypeScript project. Default is
167
+ "./src/index.ts".
168
+ -o, --output <outputPath> Output path for the generated documentation.
169
+ Default is "./docs".
168
170
  ```
169
171
 
170
172
  ## Subcommand: `vrt release-npm`
@@ -21,7 +21,7 @@ export async function upgradeDependencies(directory) {
21
21
  await check('Upgrade all versions', async () => {
22
22
  const { stdout } = await shell.run('npm outdated --all --json', false);
23
23
  const outdated = JSON.parse(stdout);
24
- const latestVersion = new Map();
24
+ const latestVersions = new Map();
25
25
  // Collect the latest version for each dependency
26
26
  for (const [name, entry] of Object.entries(outdated)) {
27
27
  let version = '0.0.0';
@@ -34,7 +34,7 @@ export async function upgradeDependencies(directory) {
34
34
  else {
35
35
  version = entry.latest;
36
36
  }
37
- latestVersion.set(name, version);
37
+ latestVersions.set(name, version);
38
38
  }
39
39
  // Load package.json
40
40
  const pack = JSON.parse(readFileSync('package.json', 'utf8'));
@@ -55,7 +55,9 @@ export async function upgradeDependencies(directory) {
55
55
  if (!dependencies)
56
56
  return;
57
57
  for (const name of Object.keys(dependencies)) {
58
- dependencies[name] = latestVersion.get(name) ?? dependencies[name];
58
+ const version = latestVersions.get(name);
59
+ if (version)
60
+ dependencies[name] = '^' + version;
59
61
  }
60
62
  }
61
63
  });
@@ -1,4 +1,6 @@
1
1
  export declare function generateTypescriptDocs(options: {
2
2
  entryPoint?: string;
3
3
  outputPath?: string;
4
+ format?: 'markdown' | 'wiki' | 'html';
5
+ quiet?: boolean;
4
6
  }): Promise<void>;
@@ -1,31 +1,37 @@
1
1
  import * as td from 'typedoc';
2
- import * as tdMarkdown from 'typedoc-plugin-markdown';
3
- import * as tdTheme from 'typedoc-github-wiki-theme';
4
2
  import { panic, warn } from '../lib/log.js';
5
3
  export async function generateTypescriptDocs(options) {
4
+ const { entryPoint, outputPath, quiet } = options;
5
+ const format = options.format ?? 'markdown';
6
+ const isMarkdown = format !== 'html';
7
+ const plugin = [
8
+ isMarkdown && 'typedoc-plugin-markdown',
9
+ format === 'wiki' && 'typedoc-github-wiki-theme',
10
+ format === 'html' && 'typedoc-unhoax-theme',
11
+ ].filter(Boolean);
6
12
  const app = await td.Application.bootstrapWithPlugins({
7
- entryPoints: [options.entryPoint ?? './src/index.ts'],
13
+ entryPoints: [entryPoint ?? './src/index.ts'],
8
14
  gitRevision: 'main',
9
- outputs: [{ name: 'markdown', path: options.outputPath ?? './docs' }],
15
+ out: outputPath ?? './docs',
16
+ plugin,
17
+ logLevel: quiet ? 'Warn' : 'Info',
10
18
  }, [
11
- new td.ArgumentsReader(0),
12
19
  new td.TypeDocReader(),
13
20
  new td.PackageJsonReader(),
14
21
  new td.TSConfigReader(),
15
- new td.ArgumentsReader(300),
16
22
  ]);
17
- tdMarkdown.load(app);
18
- tdTheme.load(app);
19
23
  app.options.setValue('readme', 'none');
20
- app.options.setValue('hidePageHeader', true);
21
- app.options.setValue('classPropertiesFormat', 'table');
22
- app.options.setValue('enumMembersFormat', 'table');
23
- app.options.setValue('indexFormat', 'table');
24
- app.options.setValue('interfacePropertiesFormat', 'table');
25
- app.options.setValue('parametersFormat', 'table');
26
- app.options.setValue('propertiesFormat', 'table');
27
- app.options.setValue('propertyMembersFormat', 'table');
28
- app.options.setValue('typeDeclarationFormat', 'table');
24
+ if (isMarkdown) {
25
+ app.options.setValue('hidePageHeader', true);
26
+ app.options.setValue('classPropertiesFormat', 'table');
27
+ app.options.setValue('enumMembersFormat', 'table');
28
+ app.options.setValue('indexFormat', 'table');
29
+ app.options.setValue('interfacePropertiesFormat', 'table');
30
+ app.options.setValue('parametersFormat', 'table');
31
+ app.options.setValue('propertiesFormat', 'table');
32
+ app.options.setValue('propertyMembersFormat', 'table');
33
+ app.options.setValue('typeDeclarationFormat', 'table');
34
+ }
29
35
  const project = await app.convert();
30
36
  if (!project)
31
37
  panic('Failed to convert project');
@@ -1,5 +1,6 @@
1
1
  import { remark } from 'remark';
2
2
  import remarkGfm from 'remark-gfm';
3
+ import remarkStringify from 'remark-stringify';
3
4
  import { getErrorMessage } from '../lib/utils.js';
4
5
  /**
5
6
  * Injects a Markdown segment under a specified heading in a Markdown document.
@@ -37,7 +38,16 @@ export function injectMarkdown(document, segment, heading, foldable) {
37
38
  // Merge the original document AST with the new segment AST.
38
39
  mergeSegments(documentAst, segmentAst, startIndex + 1, endIndex);
39
40
  // Convert the modified AST back to a Markdown string and return.
40
- return remark().stringify(documentAst);
41
+ const result = remark()
42
+ .use(remarkGfm, {
43
+ tableCellPadding: true,
44
+ })
45
+ .use(remarkStringify, {
46
+ bullet: '-',
47
+ rule: '-',
48
+ })
49
+ .stringify(documentAst);
50
+ return result;
41
51
  }
42
52
  /**
43
53
  * Updates the Table of Contents (TOC) of a Markdown document.
package/dist/index.js CHANGED
@@ -106,8 +106,9 @@ program.command('doc-toc')
106
106
  */
107
107
  program.command('doc-typescript')
108
108
  .description('Generate documentation for a TypeScript project.')
109
- .option('-i <entryPoint>', 'Entry point of the TypeScript project. Default is "./src/index.ts".')
110
- .option('-o <outputPath>', 'Output path for the generated documentation. Default is "./docs".')
109
+ .option('-i, --input <entryPoint>', 'Entry point of the TypeScript project. Default is "./src/index.ts".')
110
+ .option('-o, --output <outputPath>', 'Output path for the generated documentation. Default is "./docs".')
111
+ .option('-f, --format <format>', 'Allowed are "markdown", "wiki" and "html". Default is "markdown".')
111
112
  .action(async (options) => {
112
113
  await generateTypescriptDocs(options);
113
114
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/release-tool",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "VersaTiles release and documentation tools",
5
5
  "bin": {
6
6
  "vrt": "./dist/index.js"
@@ -53,6 +53,7 @@
53
53
  "remark-gfm": "^4.0.1",
54
54
  "typedoc": "^0.27.8",
55
55
  "typedoc-github-wiki-theme": "^2.1.0",
56
- "typedoc-plugin-markdown": "^4.4.2"
56
+ "typedoc-plugin-markdown": "^4.4.2",
57
+ "typedoc-unhoax-theme": "^0.4.6"
57
58
  }
58
59
  }