@adinsure-ops/ops-cli 4.8.3 → 5.0.0-rc4

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 (89) hide show
  1. package/CHANGELOGS.md +52 -36
  2. package/LICENSE +1 -1
  3. package/README.md +32 -242
  4. package/bin/dev.cmd +3 -0
  5. package/bin/dev.js +6 -0
  6. package/bin/run.cmd +1 -1
  7. package/bin/run.js +8 -0
  8. package/lib/command.base.d.ts +9 -5
  9. package/lib/command.base.jira.d.ts +7 -8
  10. package/lib/command.base.jira.js +26 -24
  11. package/lib/command.base.js +69 -57
  12. package/lib/commands/docker/update-image-version.d.ts +6 -9
  13. package/lib/commands/docker/update-image-version.js +35 -34
  14. package/lib/commands/doctor.d.ts +15 -5
  15. package/lib/commands/doctor.js +219 -186
  16. package/lib/commands/download/client.d.ts +10 -7
  17. package/lib/commands/download/client.js +60 -52
  18. package/lib/commands/download/identity-server.d.ts +9 -7
  19. package/lib/commands/download/identity-server.js +59 -53
  20. package/lib/commands/download/jmeter.d.ts +5 -5
  21. package/lib/commands/download/jmeter.js +54 -49
  22. package/lib/commands/download/keycloak-scim.d.ts +6 -6
  23. package/lib/commands/download/keycloak-scim.js +56 -51
  24. package/lib/commands/download/platform.d.ts +9 -7
  25. package/lib/commands/download/platform.js +59 -53
  26. package/lib/commands/download/scheduler.d.ts +9 -7
  27. package/lib/commands/download/scheduler.js +59 -53
  28. package/lib/commands/download/server.d.ts +9 -7
  29. package/lib/commands/download/server.js +59 -53
  30. package/lib/commands/download/signalr.d.ts +9 -7
  31. package/lib/commands/download/signalr.js +59 -53
  32. package/lib/commands/download/studio.d.ts +12 -9
  33. package/lib/commands/download/studio.js +107 -82
  34. package/lib/commands/gitlab/get-tag-pipeline.d.ts +11 -14
  35. package/lib/commands/gitlab/get-tag-pipeline.js +95 -92
  36. package/lib/commands/gitlab/next-nightly-tag.d.ts +10 -12
  37. package/lib/commands/gitlab/next-nightly-tag.js +96 -98
  38. package/lib/commands/jira/issue.d.ts +6 -8
  39. package/lib/commands/jira/issue.js +25 -23
  40. package/lib/commands/jira/labels.d.ts +9 -12
  41. package/lib/commands/jira/labels.js +52 -51
  42. package/lib/commands/log/add.d.ts +6 -8
  43. package/lib/commands/log/add.js +92 -87
  44. package/lib/commands/log/generate.d.ts +9 -10
  45. package/lib/commands/log/generate.js +112 -107
  46. package/lib/commands/log/validate.d.ts +2 -2
  47. package/lib/commands/log/validate.js +47 -43
  48. package/lib/commands/login.d.ts +9 -10
  49. package/lib/commands/login.js +101 -97
  50. package/lib/commands/npm/check-publish.d.ts +7 -8
  51. package/lib/commands/npm/check-publish.js +59 -54
  52. package/lib/commands/npm/dependency-update.d.ts +14 -12
  53. package/lib/commands/npm/dependency-update.js +94 -86
  54. package/lib/commands/npm/publish.d.ts +8 -9
  55. package/lib/commands/npm/publish.js +154 -140
  56. package/lib/commands/nuget/dependency-update.d.ts +15 -10
  57. package/lib/commands/nuget/dependency-update.js +60 -49
  58. package/lib/commands/sql.d.ts +24 -20
  59. package/lib/commands/sql.js +245 -226
  60. package/lib/commands/translate.d.ts +15 -16
  61. package/lib/commands/translate.js +109 -104
  62. package/lib/commands/version.d.ts +29 -19
  63. package/lib/commands/version.js +215 -190
  64. package/lib/config.js +3 -6
  65. package/lib/hooks/init/version-override.d.ts +2 -2
  66. package/lib/hooks/init/version-override.js +15 -13
  67. package/lib/index.d.ts +1 -1
  68. package/lib/index.js +1 -4
  69. package/lib/lib/command.d.ts +2 -0
  70. package/lib/lib/command.js +65 -58
  71. package/lib/lib/gitlab.d.ts +8 -2
  72. package/lib/lib/gitlab.js +94 -82
  73. package/lib/lib/npm.d.ts +7 -3
  74. package/lib/lib/npm.js +72 -60
  75. package/lib/lib/npmrc.d.ts +5 -0
  76. package/lib/lib/npmrc.js +20 -13
  77. package/lib/lib/nuget.d.ts +2 -0
  78. package/lib/lib/nuget.js +20 -17
  79. package/lib/security/cache.js +31 -27
  80. package/lib/security/context.d.ts +2 -1
  81. package/lib/security/context.js +106 -103
  82. package/lib/types/changelog.types.js +1 -2
  83. package/lib/types/npm.types.d.ts +5 -5
  84. package/lib/types/npm.types.js +1 -2
  85. package/oclif.manifest.json +1223 -1
  86. package/package.json +50 -46
  87. package/bin/run +0 -5
  88. package/lib/commands/prepare-content.d.ts +0 -29
  89. package/lib/commands/prepare-content.js +0 -386
@@ -1,73 +1,85 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
4
- const fs = require("fs-extra");
5
- const path = require("path");
6
- const context_1 = require("./security/context");
7
- class CommandBase extends command_1.Command {
1
+ import { __awaiter } from "tslib";
2
+ import { Command } from '@oclif/core';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import SecurityContext from './security/context.js';
6
+ /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
7
+ export default class CommandBase extends Command {
8
8
  constructor(argv, config) {
9
9
  super(argv, config);
10
- this.security = new context_1.default(this.config.configDir);
10
+ this.security = new SecurityContext(this.config.configDir);
11
11
  }
12
- async getGitRoot(startDir) {
13
- let currentPath = path.resolve(startDir || process.cwd());
14
- // tslint:disable-next-line: no-constant-condition
15
- while (true) {
16
- // We've reached the root and didn't find .git
17
- if (currentPath === path.parse(currentPath).root) {
18
- throw new Error('Not a git repository (or any of the parent directories)');
12
+ getGitRoot(startDir) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ let currentPath = path.resolve(startDir !== null && startDir !== void 0 ? startDir : process.cwd());
15
+ /* eslint-disable-next-line no-constant-condition */
16
+ while (true) {
17
+ // We've reached the root and didn't find .git
18
+ if (currentPath === path.parse(currentPath).root) {
19
+ throw new Error('Not a git repository (or any of the parent directories)');
20
+ }
21
+ if (yield fs.pathExists(path.resolve(currentPath, '.git'))) {
22
+ // toLowerCase because of different behaviour when executing tests with yarn or with Test Explorer in VS Code
23
+ return currentPath.toLowerCase();
24
+ }
25
+ currentPath = path.dirname(currentPath);
19
26
  }
20
- if (await fs.pathExists(path.resolve(currentPath, '.git'))) {
21
- // toLowerCase because of different behaviour when executing tests with yarn or with Test Explorer in VS Code
22
- return currentPath.toLowerCase();
23
- }
24
- currentPath = path.dirname(currentPath);
25
- }
27
+ });
26
28
  }
27
- async getVersion(versionFile = 'VERSION', ...filesToCheck) {
28
- filesToCheck.unshift(versionFile);
29
- const gitRoot = await this.getGitRoot();
30
- for (const file of filesToCheck) {
31
- const versionPath = path.resolve(gitRoot, file);
32
- if (await fs.pathExists(versionPath)) {
33
- return fs.readFileSync(versionPath, 'utf-8').trim();
29
+ getVersion(versionFile = 'VERSION', ...filesToCheck) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ filesToCheck.unshift(versionFile);
32
+ const gitRoot = yield this.getGitRoot();
33
+ for (const file of filesToCheck) {
34
+ const versionPath = path.resolve(gitRoot, file);
35
+ if (yield fs.pathExists(versionPath)) {
36
+ return fs.readFileSync(versionPath, 'utf8').trim();
37
+ }
34
38
  }
35
- }
36
- return this.error(`${filesToCheck} file was not found`, { exit: 2 });
39
+ return this.error(`${filesToCheck} file was not found`, { exit: 2 });
40
+ });
37
41
  }
38
42
  /**
39
43
  * Resolve path to Changelog folder from current execution directory
44
+ * @returns {string} the resolved path to changelogs
40
45
  */
41
- async getChangelogsRoot() {
42
- let currentPath = path.resolve(process.cwd());
43
- if (!await fs.pathExists(currentPath)) {
44
- this.log(`Directory '${currentPath}' doesn't exist ... nothing to do here.`);
45
- this.exit(0);
46
- }
47
- return path.resolve(currentPath, 'changelogs', 'unreleased');
46
+ getChangelogsRoot() {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const currentPath = path.resolve(process.cwd());
49
+ if (!(yield fs.pathExists(currentPath))) {
50
+ this.log(`Directory '${currentPath}' doesn't exist ... nothing to do here.`);
51
+ this.exit(0);
52
+ }
53
+ return path.resolve(currentPath, 'changelogs', 'unreleased');
54
+ });
48
55
  }
49
56
  /**
50
57
  * Get all files inside directory and normalize it against {baseRelativePath}.
58
+ * @param {string} dir The name or path of the current directory
59
+ * @param {string} baseRelativePath The relatice path format from the `dir`
60
+ * @param {RegExp} filter Regular expressions filter for the file path
61
+ * @returns {string[]} An array of files inside the directory with the specified filter
51
62
  */
52
- async getFilesRecursive(dir, baseRelativePath, filter) {
53
- if (!await fs.pathExists(dir)) {
54
- this.warn(`Directory '${dir}' doesn't exist ... nothing to do here.`);
55
- return [];
56
- }
57
- let relativePath = path.relative(baseRelativePath, dir);
58
- relativePath = relativePath === '' ? '.' : relativePath;
59
- const entries = await fs.readdir(dir);
60
- // Get files within the current directory and add a relative path to the file objects
61
- const files = entries
62
- .filter(file => !fs.statSync(path.resolve(dir, file)).isDirectory())
63
- .filter(file => filter.test(path.resolve(dir, file)))
64
- .map(file => `${relativePath}/${file}`);
65
- // Get folders within the current directory
66
- const folders = entries.filter(filetype => fs.statSync(path.resolve(dir, filetype)).isDirectory());
67
- for (const folder of folders)
68
- // Recursivly call this function and get relative paths of files inside directory
69
- files.push(...await this.getFilesRecursive(path.join(dir, folder), baseRelativePath, filter));
70
- return files;
63
+ getFilesRecursive(dir, baseRelativePath, filter) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ if (!(yield fs.pathExists(dir))) {
66
+ this.warn(`Directory '${dir}' doesn't exist ... nothing to do here.`);
67
+ return [];
68
+ }
69
+ let relativePath = path.relative(baseRelativePath, dir);
70
+ relativePath = relativePath === '' ? '.' : relativePath;
71
+ const entries = yield fs.readdir(dir);
72
+ // Get files within the current directory and add a relative path to the file objects
73
+ const files = entries
74
+ .filter(file => !fs.statSync(path.resolve(dir, file)).isDirectory())
75
+ .filter(file => filter.test(path.resolve(dir, file)))
76
+ .map(file => `${relativePath}/${file}`);
77
+ // Get folders within the current directory
78
+ const folders = entries.filter(filetype => fs.statSync(path.resolve(dir, filetype)).isDirectory());
79
+ for (const folder of folders)
80
+ // Recursivly call this function and get relative paths of files inside directory
81
+ files.push(...yield this.getFilesRecursive(path.join(dir, folder), baseRelativePath, filter));
82
+ return files;
83
+ });
71
84
  }
72
85
  }
73
- exports.default = CommandBase;
@@ -1,17 +1,14 @@
1
- import { flags } from '@oclif/command';
2
- import CommandBase from '../../command.base';
3
- export default class DockerUpdateImageVersion extends CommandBase {
1
+ import CommandBase from '../../command.base.js';
2
+ export default class DockerUpdateImageVersion extends CommandBase<typeof DockerUpdateImageVersion> {
4
3
  static description: string;
5
4
  static usage: string;
6
5
  static examples: string[];
7
6
  static args: {
8
- name: string;
9
- description: string;
10
- required: boolean;
11
- }[];
7
+ version: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
8
+ };
12
9
  static flags: {
13
- services: flags.IOptionFlag<string[]>;
14
- 'file-path': flags.IOptionFlag<string>;
10
+ services: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
+ 'file-path': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
15
12
  };
16
13
  run(): Promise<void>;
17
14
  }
@@ -1,47 +1,48 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
4
- const fs = require("fs-extra");
5
- const yaml_1 = require("yaml");
6
- const command_base_1 = require("../../command.base");
7
- class DockerUpdateImageVersion extends command_base_1.default {
8
- async run() {
9
- const { args, flags } = this.parse(DockerUpdateImageVersion);
10
- try {
11
- let parsedYaml = yaml_1.parse(fs.readFileSync(flags['file-path'], 'utf8'));
12
- for (let service of flags.services) {
13
- let image = parsedYaml.services[service].image.split(':');
14
- image[1] = args.version;
15
- parsedYaml.services[service].image = image.join(':');
1
+ import { __awaiter } from "tslib";
2
+ import { Args, Flags } from '@oclif/core';
3
+ import fs from 'fs-extra';
4
+ import { parse as yamlParse, stringify as yamlStringify } from 'yaml';
5
+ import CommandBase from '../../command.base.js';
6
+ class DockerUpdateImageVersion extends CommandBase {
7
+ run() {
8
+ return __awaiter(this, void 0, void 0, function* () {
9
+ const { args, flags } = yield this.parse(DockerUpdateImageVersion);
10
+ try {
11
+ const parsedYaml = yamlParse(fs.readFileSync(flags['file-path'], 'utf8'));
12
+ for (const service of flags.services) {
13
+ const image = parsedYaml.services[service].image.split(':');
14
+ image[1] = args.version;
15
+ parsedYaml.services[service].image = image.join(':');
16
+ }
17
+ fs.writeFileSync(flags['file-path'], yamlStringify(parsedYaml));
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
19
  }
17
- fs.writeFileSync(flags['file-path'], yaml_1.stringify(parsedYaml));
18
- }
19
- catch (err) {
20
- this.error(err.message);
21
- }
20
+ catch (error) {
21
+ this.error(error.message);
22
+ }
23
+ });
22
24
  }
23
25
  }
24
- exports.default = DockerUpdateImageVersion;
25
26
  DockerUpdateImageVersion.description = 'update docker image version docker compose file';
26
27
  DockerUpdateImageVersion.usage = 'docker:update-image-version <tag>';
27
28
  DockerUpdateImageVersion.examples = [
28
- `$ ops docker:update-image-version 17.0.0 --service server client`
29
- ];
30
- DockerUpdateImageVersion.args = [
31
- {
32
- name: 'version',
33
- description: 'version',
34
- required: true
35
- }
29
+ `$ ops docker:update-image-version 17.0.0 --service server client`,
36
30
  ];
31
+ DockerUpdateImageVersion.args = {
32
+ version: Args.string({
33
+ required: true,
34
+ description: 'Version',
35
+ }),
36
+ };
37
37
  DockerUpdateImageVersion.flags = {
38
- services: command_1.flags.string({
38
+ services: Flags.string({
39
39
  required: true,
40
40
  description: 'list of services to update',
41
- multiple: true
41
+ multiple: true,
42
42
  }),
43
- 'file-path': command_1.flags.string({
43
+ 'file-path': Flags.string({
44
44
  default: './docker-compose.yml',
45
- description: 'list of services to update'
46
- })
45
+ description: 'list of services to update',
46
+ }),
47
47
  };
48
+ export default DockerUpdateImageVersion;
@@ -1,18 +1,20 @@
1
- import CommandBase from '../command.base';
2
- export default class Doctor extends CommandBase {
1
+ import CommandBase from '../command.base.js';
2
+ export default class Doctor extends CommandBase<typeof Doctor> {
3
3
  static description: string;
4
4
  static usage: string;
5
5
  static examples: string[];
6
6
  static flags: {
7
- fix: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
7
+ fix: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
8
8
  };
9
9
  private readonly cp;
10
10
  private nvm;
11
11
  private yarn;
12
12
  private node;
13
- private missing_packages;
13
+ private missingPackages;
14
14
  /**
15
- * Check if nvm is installed
15
+ * Check if Git is installed
16
+ * @param {boolean} fix Try to install Git if found missing
17
+ * @returns {void}
16
18
  */
17
19
  gitCheck(fix: boolean): Promise<void>;
18
20
  gitInstall(): Promise<void>;
@@ -20,26 +22,34 @@ export default class Doctor extends CommandBase {
20
22
  gitWindowsInstall(): Promise<void>;
21
23
  /**
22
24
  * Check if nvm is installed
25
+ * @returns {void}
23
26
  */
24
27
  nvmCheck(): Promise<void>;
25
28
  /**
26
29
  * Check which node is installed
30
+ * @param {boolean} fix Try to install Node if found missing
31
+ * @returns {void}
27
32
  */
28
33
  nodeCheck(fix: boolean): Promise<void>;
29
34
  /**
30
35
  * Check which node is installed
36
+ * @returns {void}
31
37
  */
32
38
  nodeInstall(): Promise<void>;
33
39
  /**
34
40
  * Check which yarn is installed
41
+ * @param {boolean} fix Try to install yarn if found missing
42
+ * @returns {void}
35
43
  */
36
44
  yarnCheck(fix: boolean): Promise<void>;
37
45
  /**
38
46
  * Check which yarn is installed
47
+ * @returns {void}
39
48
  */
40
49
  yarnInstall(): Promise<void>;
41
50
  /**
42
51
  * Check which VSCode is installed
52
+ * @returns {void}
43
53
  */
44
54
  vscodeCheck(): Promise<void>;
45
55
  run(): Promise<void>;