-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathchangelogs.ts
49 lines (40 loc) · 2.03 KB
/
changelogs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { Args, Flags } from '@oclif/core';
import BaseCommand from '../lib/baseCommand.js';
import { githubFlag, keyFlag } from '../lib/flags.js';
import syncDocsPath from '../lib/syncDocsPath.legacy.js';
export default class ChangelogsCommand extends BaseCommand<typeof ChangelogsCommand> {
// we need this as a const for syncDocsPath
id = 'changelogs' as const;
// needed for unit tests, even though we also specify this in src/index.ts
static id = 'changelogs' as const;
static summary = 'Upload Markdown files to your ReadMe project as Changelog posts.';
static description =
'Syncs Markdown files to the Changelog section of your ReadMe project. The path can either be a directory or a single Markdown file. The Markdown files will require YAML frontmatter with certain ReadMe documentation attributes. Check out our docs for more info on setting up your frontmatter: https://docs.readme.com/main/docs/rdme#markdown-file-setup';
static args = {
path: Args.string({ description: 'Path to a local Markdown file or folder of Markdown files.', required: true }),
};
static examples = [
{
description:
'Passing in a path to a directory will also upload any Markdown files that are located in subdirectories. The path input can also be individual Markdown files:',
command: '<%= config.bin %> <%= command.id %> [path] --version={project-version}',
},
{
description:
'This command also has a dry run mode, which can be useful for initial setup and debugging. You can read more about dry run mode in our docs: https://docs.readme.com/main/docs/rdme#dry-run-mode',
command: '<%= config.bin %> <%= command.id %> [path] --version={project-version} --dryRun',
},
];
static flags = {
github: githubFlag,
key: keyFlag,
dryRun: Flags.boolean({
description: 'Runs the command without creating nor updating any changelogs in ReadMe. Useful for debugging.',
}),
};
async run() {
return this.runCreateGHAHook({
result: await syncDocsPath.call(this),
});
}
}