@adinsure-ops/ops-cli 5.4.2-rc1 → 5.5.0-rc1

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.
Files changed (82) hide show
  1. package/README.md +140 -2
  2. package/bin/run.js +2 -6
  3. package/lib/command.base.d.ts +7 -1
  4. package/lib/command.base.jira.d.ts +23 -5
  5. package/lib/command.base.jira.js +47 -12
  6. package/lib/command.base.js +37 -8
  7. package/lib/command.download.d.ts +11 -0
  8. package/lib/command.download.js +27 -0
  9. package/lib/commands/config/get.d.ts +1 -1
  10. package/lib/commands/config/list.js +1 -1
  11. package/lib/commands/config/set.d.ts +2 -2
  12. package/lib/commands/config/set.js +2 -2
  13. package/lib/commands/config/unset.d.ts +1 -1
  14. package/lib/commands/docker/update-image-version.d.ts +31 -3
  15. package/lib/commands/docker/update-image-version.js +112 -6
  16. package/lib/commands/doctor.d.ts +1 -1
  17. package/lib/commands/download/client.d.ts +7 -20
  18. package/lib/commands/download/client.js +12 -47
  19. package/lib/commands/download/identity-server.d.ts +7 -20
  20. package/lib/commands/download/identity-server.js +12 -47
  21. package/lib/commands/download/jmeter.d.ts +3 -3
  22. package/lib/commands/download/jmeter.js +9 -11
  23. package/lib/commands/download/keycloak-scim.d.ts +4 -4
  24. package/lib/commands/download/keycloak-scim.js +9 -11
  25. package/lib/commands/download/platform.d.ts +7 -20
  26. package/lib/commands/download/platform.js +12 -47
  27. package/lib/commands/download/scheduler.d.ts +7 -20
  28. package/lib/commands/download/scheduler.js +12 -47
  29. package/lib/commands/download/server.d.ts +7 -20
  30. package/lib/commands/download/server.js +12 -47
  31. package/lib/commands/download/signalr.d.ts +7 -20
  32. package/lib/commands/download/signalr.js +12 -47
  33. package/lib/commands/download/studio.d.ts +12 -24
  34. package/lib/commands/download/studio.js +14 -48
  35. package/lib/commands/gitlab/get-tag-pipeline.d.ts +7 -7
  36. package/lib/commands/gitlab/get-tag-pipeline.js +5 -5
  37. package/lib/commands/gitlab/next-nightly-tag.d.ts +7 -7
  38. package/lib/commands/gitlab/next-nightly-tag.js +6 -6
  39. package/lib/commands/jira/issue.d.ts +4 -4
  40. package/lib/commands/jira/issue.js +2 -2
  41. package/lib/commands/jira/labels.d.ts +8 -9
  42. package/lib/commands/jira/labels.js +11 -10
  43. package/lib/commands/log/add.d.ts +10 -5
  44. package/lib/commands/log/add.js +42 -13
  45. package/lib/commands/log/generate.d.ts +6 -6
  46. package/lib/commands/log/generate.js +16 -8
  47. package/lib/commands/log/validate.js +2 -2
  48. package/lib/commands/login.d.ts +25 -5
  49. package/lib/commands/login.js +162 -40
  50. package/lib/commands/login.ru.d.ts +2 -2
  51. package/lib/commands/login.ru.js +1 -1
  52. package/lib/commands/npm/check-publish.d.ts +4 -4
  53. package/lib/commands/npm/check-publish.js +1 -1
  54. package/lib/commands/npm/dependency-update.d.ts +17 -4
  55. package/lib/commands/npm/dependency-update.js +64 -41
  56. package/lib/commands/npm/publish.d.ts +5 -5
  57. package/lib/commands/npm/publish.js +2 -2
  58. package/lib/commands/nuget/dependency-update.d.ts +3 -3
  59. package/lib/commands/prepare-content.d.ts +3 -3
  60. package/lib/commands/prepare-content.js +24 -41
  61. package/lib/commands/sql.d.ts +17 -17
  62. package/lib/commands/sql.js +23 -27
  63. package/lib/commands/translate.d.ts +8 -8
  64. package/lib/commands/translate.js +10 -8
  65. package/lib/commands/version.d.ts +10 -10
  66. package/lib/commands/version.js +6 -7
  67. package/lib/lib/command.d.ts +5 -3
  68. package/lib/lib/command.js +44 -44
  69. package/lib/lib/config.js +1 -1
  70. package/lib/lib/gitlab.d.ts +3 -1
  71. package/lib/lib/gitlab.js +13 -7
  72. package/lib/lib/http.d.ts +37 -0
  73. package/lib/lib/http.js +278 -0
  74. package/lib/lib/npm.d.ts +7 -4
  75. package/lib/lib/npm.js +15 -6
  76. package/lib/lib/npmrc.js +3 -3
  77. package/lib/lib/yarnrc.js +3 -3
  78. package/lib/security/cache.js +1 -1
  79. package/lib/security/context.d.ts +10 -8
  80. package/lib/security/context.js +49 -64
  81. package/oclif.manifest.json +533 -532
  82. package/package.json +71 -62
@@ -85,23 +85,23 @@ class GitlabGetTagPipeline extends CommandBase {
85
85
  }
86
86
  hostConfigValidation(config) {
87
87
  return __awaiter(this, void 0, void 0, function* () {
88
- const host = config.get("gitlab_host");
88
+ const host = config.get('gitlab_host');
89
89
  if (host !== undefined) {
90
90
  GitlabGetTagPipeline.flags.host.default = host;
91
91
  return;
92
92
  }
93
93
  GitlabGetTagPipeline.flags.host.default =
94
- "https://git.adacta-fintech.com";
94
+ 'https://git.adacta-fintech.com';
95
95
  });
96
96
  }
97
97
  projectConfigValidation(config) {
98
98
  return __awaiter(this, void 0, void 0, function* () {
99
- const project = config.get("gitlab_project_id");
99
+ const project = config.get('gitlab_project_id');
100
100
  if (project !== undefined) {
101
101
  GitlabGetTagPipeline.flags.project.default = project;
102
102
  return;
103
103
  }
104
- GitlabGetTagPipeline.flags.project.default = "413";
104
+ GitlabGetTagPipeline.flags.project.default = '413';
105
105
  });
106
106
  }
107
107
  run() {
@@ -114,7 +114,7 @@ class GitlabGetTagPipeline extends CommandBase {
114
114
  this.hostConfigValidation(config);
115
115
  this.projectConfigValidation(config);
116
116
  const { args, flags } = yield this.parse(GitlabGetTagPipeline);
117
- const gitlab = new GitLab(flags.host, flags.project, flags.pat);
117
+ const gitlab = new GitLab(flags.host, flags.project, flags.pat, this.http);
118
118
  if (!flags.wait) {
119
119
  const status = yield gitlab.getTagPipelineStatus(args.tag);
120
120
  return this.log(`${chalk.green(status)}`);
@@ -5,15 +5,15 @@ export default class GitlabNextNightlyTag extends CommandBase<typeof GitlabNextN
5
5
  static usage: string;
6
6
  static examples: string[];
7
7
  static args: {
8
- version: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
8
+ version: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
9
9
  };
10
10
  static flags: {
11
- pat: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
- host: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
- project: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
- reference: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
15
- outputVersionOnly: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
16
- dryRun: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
+ pat: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ host: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ reference: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ outputVersionOnly: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ dryRun: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  };
18
18
  hostConfigValidation(config: OpsConfig): Promise<void>;
19
19
  projectConfigValidation(config: OpsConfig): Promise<void>;
@@ -8,23 +8,23 @@ import OpsConfig from '../../lib/config.js';
8
8
  class GitlabNextNightlyTag extends CommandBase {
9
9
  hostConfigValidation(config) {
10
10
  return __awaiter(this, void 0, void 0, function* () {
11
- const host = config.get("gitlab_host");
11
+ const host = config.get('gitlab_host');
12
12
  if (host !== undefined) {
13
13
  GitlabNextNightlyTag.flags.host.default = host;
14
14
  return;
15
15
  }
16
16
  GitlabNextNightlyTag.flags.host.default =
17
- "https://git.adacta-fintech.com";
17
+ 'https://git.adacta-fintech.com';
18
18
  });
19
19
  }
20
20
  projectConfigValidation(config) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
- const project = config.get("gitlab_project_id");
22
+ const project = config.get('gitlab_project_id');
23
23
  if (project !== undefined) {
24
24
  GitlabNextNightlyTag.flags.project.default = project;
25
25
  return;
26
26
  }
27
- GitlabNextNightlyTag.flags.project.default = "413";
27
+ GitlabNextNightlyTag.flags.project.default = '413';
28
28
  });
29
29
  }
30
30
  run() {
@@ -37,7 +37,7 @@ class GitlabNextNightlyTag extends CommandBase {
37
37
  this.hostConfigValidation(config);
38
38
  this.projectConfigValidation(config);
39
39
  const { args, flags } = yield this.parse(GitlabNextNightlyTag);
40
- const gitlab = new GitLab(flags.host, flags.project, flags.pat);
40
+ const gitlab = new GitLab(flags.host, flags.project, flags.pat, this.http);
41
41
  const re = /^release\/(\w+-)?((\d+)(\.\d+)?)$/;
42
42
  let prefix = '';
43
43
  let inputVersion = args.version;
@@ -49,7 +49,7 @@ class GitlabNextNightlyTag extends CommandBase {
49
49
  inputVersion = match[2];
50
50
  }
51
51
  let version = semver.parse(inputVersion);
52
- let nextVersion = null;
52
+ let nextVersion;
53
53
  // if version is not parsable try to find something that starts with this version
54
54
  if (!version) {
55
55
  try {
@@ -4,12 +4,12 @@ export default class JiraLabels extends CommandBaseJira {
4
4
  static usage: string;
5
5
  static examples: string[];
6
6
  static args: {
7
- issue: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
7
+ issue: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
8
8
  };
9
9
  static flags: {
10
- username: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
- password: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
- hostname: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
+ username: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ password: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ hostname: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
13
  };
14
14
  run(): Promise<void>;
15
15
  }
@@ -9,9 +9,9 @@ class JiraLabels extends CommandBaseJira {
9
9
  return __awaiter(this, void 0, void 0, function* () {
10
10
  _super.run.call(this);
11
11
  const { args, flags } = yield this.parse(JiraLabels);
12
- const jira = yield this.jiraInit(flags.hostname, flags.username, flags.password);
12
+ const jira = this.jiraInit(flags.hostname, flags.username, flags.password);
13
13
  try {
14
- const issue = yield jira.findIssue(args.issue);
14
+ const issue = yield this.getJiraIssue(jira, args.issue);
15
15
  this.log(JSON.stringify(issue));
16
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
17
  }
@@ -1,19 +1,18 @@
1
- import JiraApi from 'jira-client';
2
- import CommandBaseJira from '../../command.base.jira.js';
1
+ import CommandBaseJira, { JiraConnection } from '../../command.base.jira.js';
3
2
  export default class JiraLabels extends CommandBaseJira {
4
3
  static description: string;
5
4
  static usage: string;
6
5
  static examples: string[];
7
6
  static args: {
8
- issue: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
7
+ issue: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
9
8
  };
10
9
  static flags: {
11
- add: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
- remove: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
- username: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
- password: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
15
- hostname: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
+ add: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ remove: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ username: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ password: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ hostname: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
15
  };
17
- setLabels(jira: JiraApi, issue: string, add?: string[], remove?: string[]): Promise<JiraApi.JsonResponse>;
16
+ setLabels(jira: JiraConnection, issue: string, add?: string[], remove?: string[]): Promise<unknown>;
18
17
  run(): Promise<void>;
19
18
  }
@@ -18,12 +18,7 @@ class JiraLabels extends CommandBaseJira {
18
18
  };
19
19
  labels.push(remove);
20
20
  }
21
- const edit = {
22
- update: {
23
- labels,
24
- },
25
- };
26
- return jira.updateIssue(issue, edit);
21
+ return this.updateJiraLabels(jira, issue, labels);
27
22
  });
28
23
  }
29
24
  run() {
@@ -33,19 +28,25 @@ class JiraLabels extends CommandBaseJira {
33
28
  return __awaiter(this, void 0, void 0, function* () {
34
29
  _super.run.call(this);
35
30
  const { args, flags } = yield this.parse(JiraLabels);
36
- const jira = yield this.jiraInit(flags.hostname, flags.username, flags.password);
31
+ const jira = this.jiraInit(flags.hostname, flags.username, flags.password);
37
32
  if (flags.remove || flags.add) {
38
- ux.action.start(`adding "${flags.add}" and removing "${flags.remove}" labels to Jira issue ${args.issue}`, undefined, { stdout: true });
33
+ const changes = [
34
+ ...(flags.add ? [`adding "${flags.add}"`] : []),
35
+ ...(flags.remove ? [`removing "${flags.remove}"`] : []),
36
+ ];
37
+ ux.action.start(`${changes.join(' and ')} labels to Jira issue ${args.issue}`, undefined, { stdout: true });
39
38
  try {
40
39
  yield this.setLabels(jira, args.issue, flags.add, flags.remove);
41
40
  ux.action.stop(`${chalk.green('done')}`);
42
41
  }
43
- catch (_a) {
42
+ catch (error) {
44
43
  ux.action.stop(`${chalk.red('error')}`);
44
+ // The exit code stays 0 for compatibility; report why the update failed.
45
+ this.logToStderr(error instanceof Error ? error.message : String(error));
45
46
  }
46
47
  }
47
48
  else {
48
- const issue = yield jira.findIssue(args.issue);
49
+ const issue = yield this.getJiraIssue(jira, args.issue);
49
50
  this.log(JSON.stringify(issue.fields.labels));
50
51
  }
51
52
  });
@@ -5,13 +5,18 @@ export default class Changelog extends CommandBase<typeof Changelog> {
5
5
  static usage: string;
6
6
  static examples: string[];
7
7
  static args: {
8
- issue: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
8
+ issue: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
9
9
  };
10
10
  static flags: {
11
- type: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
- component: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
13
- description: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
- force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
+ type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ component: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ description: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  };
16
+ /**
17
+ * Whether prompts can be answered. Without a terminal (CI, scripts) inquirer fails with ERR_USE_AFTER_CLOSE.
18
+ */
19
+ isInteractive(): boolean;
20
+ private ensureInteractive;
16
21
  run(): Promise<void>;
17
22
  }
@@ -1,11 +1,22 @@
1
1
  import { __awaiter } from "tslib";
2
+ import matter from '@11ty/gray-matter';
2
3
  import { Args, Flags } from '@oclif/core';
3
4
  import fs from 'fs-extra';
4
- import matter from 'gray-matter';
5
5
  import inquirer from 'inquirer';
6
- import path from 'path';
6
+ import path from 'node:path';
7
7
  import CommandBase from '../../command.base.js';
8
8
  class Changelog extends CommandBase {
9
+ /**
10
+ * Whether prompts can be answered. Without a terminal (CI, scripts) inquirer fails with ERR_USE_AFTER_CLOSE.
11
+ */
12
+ isInteractive() {
13
+ return Boolean(process.stdin.isTTY);
14
+ }
15
+ ensureInteractive(hint) {
16
+ if (!this.isInteractive()) {
17
+ this.error(`Missing input and no interactive terminal is available. ${hint}`);
18
+ }
19
+ }
9
20
  run() {
10
21
  const _super = Object.create(null, {
11
22
  run: { get: () => super.run }
@@ -16,7 +27,10 @@ class Changelog extends CommandBase {
16
27
  // Validation of input parameters
17
28
  const changelogFolderBase = yield this.getChangelogsRoot();
18
29
  const possibleComponents = [];
19
- if (flags.force && !(yield fs.pathExists(changelogFolderBase))) {
30
+ if (!(yield fs.pathExists(changelogFolderBase))) {
31
+ if (!flags.force) {
32
+ this.error(`Changelogs folder '${changelogFolderBase}' does not exist. Use -f to create it.`);
33
+ }
20
34
  yield fs.mkdirp(changelogFolderBase);
21
35
  }
22
36
  for (const file of fs.readdirSync(changelogFolderBase)) {
@@ -24,11 +38,29 @@ class Changelog extends CommandBase {
24
38
  possibleComponents.push(file);
25
39
  }
26
40
  }
41
+ // Validate changelog component first, so nobody answers prompts for a command that fails anyway
42
+ let changelogComponent = flags.component;
43
+ let changelogFolder = path.resolve(changelogFolderBase, changelogComponent);
44
+ if (changelogComponent) {
45
+ const relativeFolder = path.relative(changelogFolderBase, changelogFolder);
46
+ if (/[\\/]/.test(changelogComponent) || relativeFolder === '' || relativeFolder.startsWith('..') || path.isAbsolute(relativeFolder)) {
47
+ this.error(`Component '${changelogComponent}' is not a valid folder name.`);
48
+ }
49
+ if (yield fs.pathExists(changelogFolder)) {
50
+ if (!(yield fs.stat(changelogFolder)).isDirectory()) {
51
+ this.error(`Component '${changelogComponent}' in '${changelogFolderBase}' is not a folder.`);
52
+ }
53
+ }
54
+ else if (!flags.force) {
55
+ const available = possibleComponents.length > 0 ? ` Available components: ${possibleComponents.join(', ')}.` : '';
56
+ this.error(`Component '${changelogComponent}' does not exist in '${changelogFolderBase}'.${available} Use -f to create it.`);
57
+ }
58
+ }
27
59
  // Validate JIRA ticket
28
60
  const issueRegex = /\w+-\d+/;
29
61
  let changelogIssue = args.issue;
30
62
  if (!issueRegex.test(changelogIssue)) {
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ this.ensureInteractive(`'${changelogIssue}' is not a valid JIRA issue.`);
32
64
  const responses = yield inquirer.prompt([{
33
65
  name: 'issue',
34
66
  message: 'select a JIRA issue',
@@ -45,24 +77,21 @@ class Changelog extends CommandBase {
45
77
  // Validate changelog type
46
78
  let changelogType = flags.type;
47
79
  if (!changelogType) {
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
+ this.ensureInteractive('Use -t to set the changelog type.');
49
81
  const responses = yield inquirer.prompt([{
50
82
  name: 'type',
51
83
  message: 'select a changelog type',
52
- type: 'list',
84
+ type: 'select',
53
85
  choices: [{ name: 'feature' }, { name: 'fixed' }, { name: 'improve' }, { name: 'breaking' }],
54
86
  }]);
55
87
  changelogType = responses.type;
56
88
  }
57
- // Validate changelog component
58
- let changelogComponent = flags.component;
59
- let changelogFolder = path.resolve(changelogFolderBase, changelogComponent);
60
- if ((possibleComponents.length > 0 && !changelogComponent) || !fs.pathExistsSync(path.resolve(changelogFolderBase, changelogComponent))) {
61
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ if (possibleComponents.length > 0 && !changelogComponent) {
90
+ this.ensureInteractive(`Use -c to set the component. Available components: ${possibleComponents.join(', ')}.`);
62
91
  const responses = yield inquirer.prompt([{
63
92
  name: 'component',
64
93
  message: 'Multiple components found. Select a changelog component',
65
- type: 'list',
94
+ type: 'select',
66
95
  choices: possibleComponents,
67
96
  }]);
68
97
  changelogComponent = responses.component;
@@ -123,7 +152,7 @@ Changelog.flags = {
123
152
  }),
124
153
  force: Flags.boolean({
125
154
  char: 'f',
126
- description: 'Create logs directory if it does not exist',
155
+ description: 'Create the changelogs folder and the component folder if they do not exist',
127
156
  default: false,
128
157
  }),
129
158
  };
@@ -6,12 +6,12 @@ export default class Generate extends CommandBase<typeof Generate> {
6
6
  static usage: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- components: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- file: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
- force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
12
- preview: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
13
- version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
14
- 'ignore-no-changelogs': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
9
+ components: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ preview: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'ignore-no-changelogs': import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  };
16
16
  private readonly _entryTypes;
17
17
  private readonly _mdFileTypeRegex;
@@ -1,10 +1,11 @@
1
1
  import { __awaiter } from "tslib";
2
+ import inquirer from 'inquirer';
3
+ import matter from '@11ty/gray-matter';
2
4
  import { Flags, ux } from '@oclif/core';
3
5
  import fs from 'fs-extra';
4
- import matter from 'gray-matter';
5
- import _ from 'lodash-es';
6
+ import { capitalize, groupBy, indexOf } from 'lodash-es';
6
7
  import moment from 'moment';
7
- import path from 'path';
8
+ import path from 'node:path';
8
9
  import { rimraf } from 'rimraf';
9
10
  import CommandBase from '../../command.base.js';
10
11
  class Generate extends CommandBase {
@@ -44,11 +45,11 @@ class Generate extends CommandBase {
44
45
  var _a;
45
46
  let content = '';
46
47
  // First group by component, then re-sort the components to get the desired output ordering
47
- const componentGroups = _.groupBy(entries, 'component');
48
+ const componentGroups = groupBy(entries, 'component');
48
49
  for (const group of components) {
49
50
  const groupEntries = (_a = componentGroups[group]) !== null && _a !== void 0 ? _a : [];
50
51
  if (group !== '') {
51
- content += `${'#'.repeat(headingLevel)} ${_.capitalize(group)}\r\n\r\n`;
52
+ content += `${'#'.repeat(headingLevel)} ${capitalize(group)}\r\n\r\n`;
52
53
  }
53
54
  if (groupEntries.length === 0) {
54
55
  content += `No changes were introduced in this version.\r\n\r\n`;
@@ -56,11 +57,11 @@ class Generate extends CommandBase {
56
57
  }
57
58
  const typeHeadingLevel = group === '' ? headingLevel : headingLevel + 1;
58
59
  for (const type of this._entryTypes) {
59
- const batch = groupEntries.filter(e => _.indexOf(type.types, e.type) > -1);
60
+ const batch = groupEntries.filter(e => indexOf(type.types, e.type) > -1);
60
61
  if (batch.length === 0) {
61
62
  continue;
62
63
  }
63
- content += `${'#'.repeat(typeHeadingLevel)} ${type.text} (${batch.length} changes)\r\n\r\n`;
64
+ content += `${'#'.repeat(typeHeadingLevel)} ${type.text} (${batch.length} ${batch.length === 1 ? 'change' : 'changes'})\r\n\r\n`;
64
65
  for (const log of batch) {
65
66
  content += `${this.formatEntry(log)}\r\n\r\n`;
66
67
  }
@@ -142,7 +143,14 @@ class Generate extends CommandBase {
142
143
  return;
143
144
  }
144
145
  this.warn(`The following action will update ${flags.file} and remove all unreleased changelogs in '${changelogFolder}'`);
145
- const confirm = flags.force || (yield ux.confirm(`Do you want to continue? [y/n/yes/no]`));
146
+ const confirm = flags.force || (yield ux.action.pauseAsync(() => __awaiter(this, void 0, void 0, function* () {
147
+ return (yield inquirer.createPromptModule({ output: process.stderr })([{
148
+ name: 'proceed',
149
+ type: 'confirm',
150
+ message: 'Do you want to continue?',
151
+ default: false,
152
+ }])).proceed;
153
+ })));
146
154
  if (confirm) {
147
155
  const changelogFile = path.resolve(root, flags.file);
148
156
  const currentContents = fs.readFileSync(changelogFile, { encoding: 'utf8', flag: 'a+' });
@@ -1,7 +1,7 @@
1
1
  import { __awaiter } from "tslib";
2
+ import matter from '@11ty/gray-matter';
2
3
  import { ux } from '@oclif/core';
3
- import matter from 'gray-matter';
4
- import path from 'path';
4
+ import path from 'node:path';
5
5
  import CommandBase from '../../command.base.js';
6
6
  class Validate extends CommandBase {
7
7
  constructor() {
@@ -4,13 +4,14 @@ export default class Login extends CommandBase<typeof Login> {
4
4
  static usage: string;
5
5
  static examples: string[];
6
6
  static flags: {
7
- deviceFlow: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
8
- npm: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
9
- skipCI: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
- docker: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
7
+ deviceFlow: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ npm: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ skipCI: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ docker: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
12
  };
13
13
  static responsePageContent: string;
14
+ static failurePageContent: string;
14
15
  private readonly npmRegistries;
15
16
  /**
16
17
  * Get NPM token for adinsure npm repositories
@@ -26,5 +27,24 @@ export default class Login extends CommandBase<typeof Login> {
26
27
  * 4. Running 'docker login' with the generated token.
27
28
  */
28
29
  private handleDockerLogin;
30
+ /**
31
+ * Opens the system browser with the given URL. Separate method so tests can stub it.
32
+ */
33
+ protected openBrowser(loginUrl: string): Promise<void>;
34
+ private printLoginUrl;
35
+ /**
36
+ * Starts the local redirect server on port 3044.
37
+ * Resolves once the server is listening (rejects if it cannot bind, e.g. EADDRINUSE) with
38
+ * `authenticated`, which settles with the signed-in user's name or the code exchange error.
39
+ * The server is closed once the redirect has been handled or the server fails.
40
+ */
41
+ protected startAuthServer(): Promise<{
42
+ authenticated: Promise<string>;
43
+ }>;
44
+ /**
45
+ * Interactive browser login: opens the AAD sign-in page and redeems the redirected authorization code.
46
+ * Any failure is reported and exits with code 1.
47
+ */
48
+ private loginWithBrowser;
29
49
  run(): Promise<void>;
30
50
  }