@versatiles/release-tool 1.2.4 → 1.2.6
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 +0 -21
- package/dist/commands/command.js +1 -2
- package/dist/commands/markdown.js +5 -5
- package/dist/commands/release.js +12 -11
- package/dist/commands/typedoc.js +4 -2
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -43,14 +43,8 @@ Have a look at this [package.json](https://github.com/versatiles-org/node-releas
|
|
|
43
43
|
|
|
44
44
|
<!--- This chapter is generated automatically --->
|
|
45
45
|
|
|
46
|
-
> @versatiles/release-tool@1.2.4 npx
|
|
47
|
-
> vrt cmd2md vrt
|
|
48
|
-
|
|
49
46
|
```console
|
|
50
47
|
$ vrt
|
|
51
|
-
> @versatiles/release-tool@1.2.4 npx
|
|
52
|
-
> vrt --help
|
|
53
|
-
|
|
54
48
|
Usage: vrt [options] [command]
|
|
55
49
|
|
|
56
50
|
versatiles release and documentaion tool
|
|
@@ -71,9 +65,6 @@ Commands:
|
|
|
71
65
|
|
|
72
66
|
```console
|
|
73
67
|
$ vrt ts2md
|
|
74
|
-
> @versatiles/release-tool@1.2.4 npx
|
|
75
|
-
> vrt ts2md --help
|
|
76
|
-
|
|
77
68
|
Usage: vrt ts2md [options] <typescript> <tsconfig>
|
|
78
69
|
|
|
79
70
|
documents a TypeScript file and outputs it to stdout
|
|
@@ -90,9 +81,6 @@ Options:
|
|
|
90
81
|
|
|
91
82
|
```console
|
|
92
83
|
$ vrt cmd2md
|
|
93
|
-
> @versatiles/release-tool@1.2.4 npx
|
|
94
|
-
> vrt cmd2md --help
|
|
95
|
-
|
|
96
84
|
Usage: vrt cmd2md [options] <command>
|
|
97
85
|
|
|
98
86
|
documents a runnable command and outputs it to stdout
|
|
@@ -108,9 +96,6 @@ Options:
|
|
|
108
96
|
|
|
109
97
|
```console
|
|
110
98
|
$ vrt insertmd
|
|
111
|
-
> @versatiles/release-tool@1.2.4 npx
|
|
112
|
-
> vrt insertmd --help
|
|
113
|
-
|
|
114
99
|
Usage: vrt insertmd [options] <readme> [heading] [foldable]
|
|
115
100
|
|
|
116
101
|
takes Markdown from stdin and insert it into a Markdown file
|
|
@@ -128,9 +113,6 @@ Options:
|
|
|
128
113
|
|
|
129
114
|
```console
|
|
130
115
|
$ vrt inserttoc
|
|
131
|
-
> @versatiles/release-tool@1.2.4 npx
|
|
132
|
-
> vrt inserttoc --help
|
|
133
|
-
|
|
134
116
|
Usage: vrt inserttoc [options] <readme> [heading]
|
|
135
117
|
|
|
136
118
|
updates the TOC in a Markdown file
|
|
@@ -147,9 +129,6 @@ Options:
|
|
|
147
129
|
|
|
148
130
|
```console
|
|
149
131
|
$ vrt release-npm
|
|
150
|
-
> @versatiles/release-tool@1.2.4 npx
|
|
151
|
-
> vrt release-npm --help
|
|
152
|
-
|
|
153
132
|
Usage: vrt release-npm [options] [path]
|
|
154
133
|
|
|
155
134
|
release a npm package
|
package/dist/commands/command.js
CHANGED
|
@@ -31,7 +31,6 @@ export async function generateCommandDocumentation(command) {
|
|
|
31
31
|
*/
|
|
32
32
|
async function getCommandResults(command) {
|
|
33
33
|
return new Promise((resolve, reject) => {
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
34
|
const env = { ...process.env, NODE_ENV: undefined };
|
|
36
35
|
// Spawn a child process to run the command with the '--help' flag.
|
|
37
36
|
const childProcess = cp.spawn('npx', [...command.split(' '), '--help'], { env });
|
|
@@ -72,7 +71,7 @@ function extractSubcommands(result) {
|
|
|
72
71
|
.split('\n') // Split by newline to process each line.
|
|
73
72
|
.flatMap((line) => {
|
|
74
73
|
// Extract subcommand names from each line.
|
|
75
|
-
const extract = /^
|
|
74
|
+
const extract = /^ {2}([^ ]{2,})/.exec(line);
|
|
76
75
|
if (!extract)
|
|
77
76
|
return [];
|
|
78
77
|
const [, subcommand] = extract;
|
|
@@ -10,7 +10,6 @@ import { getErrorMessage } from '../lib/utils.js';
|
|
|
10
10
|
* @param foldable If true, makes the segment foldable.
|
|
11
11
|
* @returns The modified Markdown document.
|
|
12
12
|
*/
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
14
13
|
export function injectMarkdown(document, segment, heading, foldable) {
|
|
15
14
|
// Parse the input strings into Abstract Syntax Trees (ASTs).
|
|
16
15
|
const documentAst = parseMarkdown(document);
|
|
@@ -145,7 +144,6 @@ function indentSegmentToDepth(segmentAst, depth) {
|
|
|
145
144
|
* @param startIndex The start index in the main AST.
|
|
146
145
|
* @param endIndex The end index in the main AST.
|
|
147
146
|
*/
|
|
148
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
149
147
|
function mergeSegments(mainAst, segmentAst, startIndex, endIndex) {
|
|
150
148
|
mainAst.children.splice(startIndex, endIndex - startIndex, ...segmentAst.children);
|
|
151
149
|
}
|
|
@@ -181,11 +179,12 @@ function getMDAnchor(node) {
|
|
|
181
179
|
for (const c of node.children) {
|
|
182
180
|
// Handle different types of child nodes to construct the anchor text.
|
|
183
181
|
switch (c.type) {
|
|
184
|
-
case 'html':
|
|
182
|
+
case 'html': {
|
|
185
183
|
const match = /<a\s.*id\s*=\s*['"]([^'"]+)/i.exec(c.value);
|
|
186
184
|
if (match)
|
|
187
185
|
return match[1];
|
|
188
186
|
break;
|
|
187
|
+
}
|
|
189
188
|
case 'text':
|
|
190
189
|
case 'inlineCode':
|
|
191
190
|
text += c.value;
|
|
@@ -199,7 +198,7 @@ function getMDAnchor(node) {
|
|
|
199
198
|
text = text.toLowerCase()
|
|
200
199
|
.replace(/[()]+/g, '')
|
|
201
200
|
.replace(/[^a-z0-9]+/g, '-')
|
|
202
|
-
.replace(
|
|
201
|
+
.replace(/^-+|-+$/g, '');
|
|
203
202
|
return text;
|
|
204
203
|
}
|
|
205
204
|
/**
|
|
@@ -256,13 +255,14 @@ export function nodeToHtml(node) {
|
|
|
256
255
|
return `<strong>${nodesToHtml(node.children)}</strong>`;
|
|
257
256
|
case 'link':
|
|
258
257
|
return `<a href="${node.url}"${node.title == null ? '' : ` title="${node.title}"`}>${nodesToHtml(node.children)}</a>`;
|
|
259
|
-
case 'image':
|
|
258
|
+
case 'image': {
|
|
260
259
|
const attributes = [`src="${node.url}"`];
|
|
261
260
|
if (node.alt ?? '')
|
|
262
261
|
attributes.push(`alt="${node.alt}"`);
|
|
263
262
|
if (node.title ?? '')
|
|
264
263
|
attributes.push(`title="${node.title}"`);
|
|
265
264
|
return `<img ${attributes.join(' ')} />`;
|
|
265
|
+
}
|
|
266
266
|
case 'footnoteReference': throw new Error('Not implemented yet: "footnoteReference" case');
|
|
267
267
|
case 'imageReference': throw new Error('Not implemented yet: "imageReference" case');
|
|
268
268
|
case 'linkReference': throw new Error('Not implemented yet: "linkReference" case');
|
package/dist/commands/release.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env npx tsx
|
|
2
2
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import
|
|
3
|
+
import select from '@inquirer/select';
|
|
4
4
|
import { check, info, panic, warn } from '../lib/log.js';
|
|
5
5
|
import { getShell } from '../lib/shell.js';
|
|
6
6
|
import { getGit } from '../lib/git.js';
|
|
@@ -46,7 +46,7 @@ export async function release(directory, branch = 'main') {
|
|
|
46
46
|
await check('update version', setNextVersion(nextVersion));
|
|
47
47
|
// prepare release notes
|
|
48
48
|
const releaseNotes = await check('prepare release notes', getReleaseNotes(nextVersion, shaLast, shaCurrent));
|
|
49
|
-
if (!('private' in pkg) || !
|
|
49
|
+
if (!('private' in pkg) || !pkg.private) {
|
|
50
50
|
// npm publish
|
|
51
51
|
await check('npm publish', shell.run('npm publish --access public'));
|
|
52
52
|
}
|
|
@@ -72,7 +72,6 @@ export async function release(directory, branch = 'main') {
|
|
|
72
72
|
}
|
|
73
73
|
async function setNextVersion(version) {
|
|
74
74
|
// set new version in package.json
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
76
75
|
const packageJSON = JSON.parse(readFileSync(resolve(directory, 'package.json'), 'utf8'));
|
|
77
76
|
packageJSON.version = version;
|
|
78
77
|
writeFileSync(resolve(directory, 'package.json'), JSON.stringify(packageJSON, null, ' ') + '\n');
|
|
@@ -89,15 +88,17 @@ export async function release(directory, branch = 'main') {
|
|
|
89
88
|
}
|
|
90
89
|
async function getNewVersion(versionPackage) {
|
|
91
90
|
// ask for new version
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
const choices = [
|
|
92
|
+
{ value: versionPackage },
|
|
93
|
+
{ ...bump(2) },
|
|
94
|
+
{ ...bump(1) },
|
|
95
|
+
{ ...bump(0) }
|
|
96
|
+
];
|
|
97
|
+
const versionNew = (await select({
|
|
94
98
|
message: 'What should be the new version?',
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
default: 1,
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
100
|
-
})).versionNew;
|
|
99
|
+
choices,
|
|
100
|
+
default: choices[1].value,
|
|
101
|
+
}));
|
|
101
102
|
if (!versionNew)
|
|
102
103
|
throw Error();
|
|
103
104
|
return versionNew;
|
package/dist/commands/typedoc.js
CHANGED
|
@@ -18,7 +18,8 @@ function* documentProject(project) {
|
|
|
18
18
|
}
|
|
19
19
|
for (const group of project.groups) {
|
|
20
20
|
yield '\n# ' + group.title;
|
|
21
|
-
for (const
|
|
21
|
+
for (const d of group.children) {
|
|
22
|
+
const declaration = d;
|
|
22
23
|
switch (declaration.kind) {
|
|
23
24
|
case ReflectionKind.Class:
|
|
24
25
|
yield* documentClass(declaration);
|
|
@@ -201,7 +202,7 @@ function formatTypeDeclaration(someType) {
|
|
|
201
202
|
return some.name;
|
|
202
203
|
case 'literal':
|
|
203
204
|
return JSON.stringify(some.value);
|
|
204
|
-
case 'reference':
|
|
205
|
+
case 'reference': {
|
|
205
206
|
let result = some.name;
|
|
206
207
|
if (some.reflection)
|
|
207
208
|
result = `[${result}](#${createAnchorId(some.reflection)})`;
|
|
@@ -211,6 +212,7 @@ function formatTypeDeclaration(someType) {
|
|
|
211
212
|
.map(getTypeRec).join(',')
|
|
212
213
|
+ '>';
|
|
213
214
|
return result;
|
|
215
|
+
}
|
|
214
216
|
case 'reflection':
|
|
215
217
|
switch (some.declaration.kind) {
|
|
216
218
|
case ReflectionKind.TypeLiteral: return decodeReflectionTypeLiteral(some.declaration);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/release-tool",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "VersaTiles release and documentation tools",
|
|
5
5
|
"bin": {
|
|
6
6
|
"vrt": "./dist/index.js"
|
|
@@ -30,23 +30,24 @@
|
|
|
30
30
|
"homepage": "https://github.com/versatiles-org/node-versatiles/blob/main/versatiles-release-tool/README.md",
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/inquirer": "^9.0.7",
|
|
33
|
-
"@types/jest": "^29.5.
|
|
34
|
-
"@types/node": "^
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
36
|
-
"@typescript-eslint/parser": "^
|
|
37
|
-
"eslint": "^
|
|
33
|
+
"@types/jest": "^29.5.13",
|
|
34
|
+
"@types/node": "^22.5.5",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
|
36
|
+
"@typescript-eslint/parser": "^8.6.0",
|
|
37
|
+
"eslint": "^9.11.0",
|
|
38
38
|
"jest": "^29.7.0",
|
|
39
|
-
"npm-check-updates": "^
|
|
40
|
-
"ts-jest": "^29.
|
|
39
|
+
"npm-check-updates": "^17.1.3",
|
|
40
|
+
"ts-jest": "^29.2.5",
|
|
41
41
|
"ts-node": "^10.9.2",
|
|
42
|
-
"tsx": "^4.
|
|
43
|
-
"typescript": "^5.
|
|
42
|
+
"tsx": "^4.19.1",
|
|
43
|
+
"typescript": "^5.6.2",
|
|
44
|
+
"typescript-eslint": "^8.6.0"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
47
|
+
"@inquirer/select": "^3.0.1",
|
|
46
48
|
"commander": "^12.1.0",
|
|
47
|
-
"inquirer": "^9.2.23",
|
|
48
49
|
"remark": "^15.0.1",
|
|
49
50
|
"remark-gfm": "^4.0.0",
|
|
50
|
-
"typedoc": "^0.
|
|
51
|
+
"typedoc": "^0.26.7"
|
|
51
52
|
}
|
|
52
53
|
}
|