@ckeditor/ckeditor5-dev-changelog 55.4.0 → 55.5.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.
@@ -11,5 +11,5 @@ interface GenerateTemplateOptions {
11
11
  /**
12
12
  * Generates a template file for the changelog in the specified directory.
13
13
  */
14
- export declare function generateTemplate(args?: Partial<GenerateTemplateOptions>, retries?: number): Promise<void>;
14
+ export declare function generateTemplate(args?: Partial<GenerateTemplateOptions> | undefined, retries?: number): Promise<void>;
15
15
  export {};
package/dist/template.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { mkdir, copyFile, constants } from 'node:fs/promises';
2
- import { styleText, promisify, parseArgs } from 'node:util';
2
+ import { styleText, promisify } from 'node:util';
3
3
  import { exec } from 'node:child_process';
4
+ import { cac } from 'cac';
4
5
  import path from 'upath';
5
6
  import { format } from 'date-fns';
6
7
 
@@ -34,16 +35,19 @@ const PROTECTED_BRANCHES = [
34
35
  * Reads CLI arguments and turn the keys into camelcase.
35
36
  */
36
37
  function getCliArguments() {
37
- const { values } = parseArgs({
38
- options: {
39
- directory: { type: 'string' }
40
- },
41
- // Skip `node ckeditor5-dev-changelog`.
42
- args: process.argv.slice(2),
43
- // Fail when unknown argument is used.
44
- strict: true
45
- });
46
- return values;
38
+ const cli = cac('ckeditor5-dev-changelog-create-entry');
39
+ cli.usage('[options]');
40
+ cli.option('--directory <path>', 'Directory where the changelog entry will be created.', { default: DEFAULT_OPTIONS.directory });
41
+ cli.help();
42
+ const { options } = cli.parse(process.argv);
43
+ if (options.help) {
44
+ return;
45
+ }
46
+ cli.globalCommand.checkUnknownOptions();
47
+ cli.globalCommand.checkOptionValue();
48
+ cli.globalCommand.checkRequiredArgs();
49
+ cli.globalCommand.checkUnusedArgs();
50
+ return options;
47
51
  }
48
52
  /**
49
53
  * Returns normalized options object for the `generateTemplate` function.
@@ -82,6 +86,9 @@ function getFileName(gitBranchName) {
82
86
  * Generates a template file for the changelog in the specified directory.
83
87
  */
84
88
  async function generateTemplate(args = getCliArguments(), retries = 5) {
89
+ if (!args) {
90
+ return;
91
+ }
85
92
  const options = normalizeOptions(args);
86
93
  const gitBranchName = await getFormattedGitBranchName();
87
94
  const filename = getFileName(gitBranchName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-changelog",
3
- "version": "55.4.0",
3
+ "version": "55.5.0",
4
4
  "description": "A CKEditor 5 development tool for handling changelogs.",
5
5
  "keywords": [],
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -28,7 +28,8 @@
28
28
  "ckeditor5-dev-changelog-create-entry": "bin/generate-template.js"
29
29
  },
30
30
  "dependencies": {
31
- "@ckeditor/ckeditor5-dev-utils": "^55.4.0",
31
+ "@ckeditor/ckeditor5-dev-utils": "^55.5.0",
32
+ "cac": "^7.0.0",
32
33
  "date-fns": "^4.0.0",
33
34
  "glob": "^13.0.0",
34
35
  "gray-matter": "^4.0.3",