@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,14 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
4
- const chalk_1 = require("chalk");
5
- const cli_ux_1 = require("cli-ux");
6
- const fs = require("fs-extra");
7
- const JSZip = require("jszip");
8
- const path = require("path");
9
- const request = require("request-promise");
10
- const command_base_1 = require("../command.base");
11
- class Translate extends command_base_1.default {
1
+ import { __awaiter } from "tslib";
2
+ import { Args, Flags, ux } from '@oclif/core';
3
+ import axios from 'axios';
4
+ import chalk from 'chalk';
5
+ import fs from 'fs-extra';
6
+ import JSZip from 'jszip';
7
+ import path from 'path';
8
+ import CommandBase from '../command.base.js';
9
+ class Translate extends CommandBase {
12
10
  getFormat(format) {
13
11
  if (format === 'json') {
14
12
  return 'text/json';
@@ -25,131 +23,138 @@ class Translate extends command_base_1.default {
25
23
  * @param modules list of modules to download
26
24
  * @returns arhive as an byte array response stream
27
25
  */
28
- async getTranslations(languages, format, modules) {
29
- let requestOptions = {
30
- uri: `https://dictionary.adinsure.com/api/Translations?languages=${languages}`,
31
- headers: {
32
- Authorization: 'Bearer ' + await this.security.getToken(),
33
- 'Content-Type': this.getFormat(format),
34
- },
35
- encoding: null
36
- };
37
- if (modules) {
38
- requestOptions.uri += `&modules=${modules}`;
39
- }
40
- try {
41
- let response = await request.get(requestOptions);
42
- return response;
43
- }
44
- catch (err) {
45
- let errorMessage;
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ getTranslations(languages, format, modules) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const requestOptions = {
30
+ headers: {
31
+ Authorization: 'Bearer ' + (yield this.security.getToken()),
32
+ 'Content-Type': this.getFormat(format),
33
+ },
34
+ };
35
+ if (modules) {
36
+ requestOptions.url += `&modules=${modules}`;
37
+ }
46
38
  try {
47
- const errorJson = JSON.parse(err.error);
48
- errorMessage = `An error has occurred: ${errorJson.ExceptionMessage}`;
39
+ return (yield axios.get(`https://dictionary.adinsure.com/api/Translations?languages=${languages}`, requestOptions));
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
41
  }
50
- catch (_a) {
51
- errorMessage = err.message;
42
+ catch (error) {
43
+ let errorMessage;
44
+ try {
45
+ const errorJson = JSON.parse(error.error);
46
+ errorMessage = `An error has occurred: ${errorJson.ExceptionMessage}`;
47
+ }
48
+ catch (_a) {
49
+ errorMessage = error.message;
50
+ }
51
+ this.log(chalk.red(errorMessage));
52
+ throw error;
52
53
  }
53
- this.log(chalk_1.default.red(errorMessage));
54
- throw err;
55
- }
54
+ });
56
55
  }
57
56
  /**
58
57
  * Read from response stream and extract files into output directory.
59
58
  * @param content zip file or a stream
60
- * @param dest final destination to extract files
61
- * @returns void
62
- * @throws error message
59
+ * @param destinationDir final destination to extract files
60
+ * @param {string} [xmlFilename=false] XML filename
61
+ * @returns {Promise<void>} Void
62
+ * @throws Error message
63
63
  */
64
- async extractFiles(content, destinationDir, xmlFilename = '') {
65
- const zip = await JSZip.loadAsync(content);
66
- for (const fileName of Object.keys(zip.files)) {
67
- const buffer = await zip.files[fileName].async('nodebuffer');
68
- // Rename from translations..Xml to Translations..xml to respect naming in mono
69
- if (fileName.includes('Xml')) {
70
- let finalFileName = fileName;
71
- if (xmlFilename !== '') {
72
- finalFileName = xmlFilename;
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
+ extractFiles(content, destinationDir, xmlFilename = '') {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const zip = yield JSZip.loadAsync(content);
68
+ for (const fileName of Object.keys(zip.files)) {
69
+ const buffer = yield zip.files[fileName].async('nodebuffer');
70
+ // Rename from translations..Xml to Translations..xml to respect naming in mono
71
+ if (fileName.includes('Xml')) {
72
+ let finalFileName = fileName;
73
+ if (xmlFilename !== '') {
74
+ finalFileName = xmlFilename;
75
+ }
76
+ const dest = destinationDir + '/' + finalFileName;
77
+ yield fs.writeFile(dest, buffer);
78
+ }
79
+ else {
80
+ const dest = destinationDir + '/' + zip.files[fileName].name;
81
+ yield fs.writeFile(dest, buffer);
73
82
  }
74
- const dest = destinationDir + '/' + finalFileName;
75
- await fs.writeFile(dest, buffer);
76
- }
77
- else {
78
- const dest = destinationDir + '/' + zip.files[fileName].name;
79
- await fs.writeFile(dest, buffer);
80
83
  }
81
- }
84
+ });
82
85
  }
83
- async run() {
84
- const { args, flags } = this.parse(Translate);
85
- let destination = flags.output;
86
- if (flags.format === 'json' && flags.module === undefined) {
87
- this.error('You need to specify `\'module\' when choosing client `\'json\' format.');
88
- }
89
- try {
90
- // Get translations
91
- cli_ux_1.default.action.start('Fetching translations from AdDictionary', undefined, { stdout: true });
92
- let response = await this.getTranslations(args.language, flags.format, flags.module);
93
- cli_ux_1.default.action.stop(`${chalk_1.default.green('done')}`);
94
- if (!await fs.pathExists(destination)) {
95
- await fs.mkdirp(destination);
86
+ run() {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const { args, flags } = yield this.parse(Translate);
89
+ const destination = flags.output;
90
+ if (flags.format === 'json' && flags.module === undefined) {
91
+ this.error('You need to specify `\'module\' when choosing client `\'json\' format.');
96
92
  }
97
- // Extract files
98
- cli_ux_1.default.action.start('Extracting translation zip files', undefined, { stdout: true });
99
- let finalFileName = 'Translations..xml';
100
- if (flags.filename) {
101
- finalFileName = flags.filename;
93
+ try {
94
+ // Get translations
95
+ ux.action.start('Fetching translations from AdDictionary', undefined, { stdout: true });
96
+ const response = yield this.getTranslations(args.language, flags.format, flags.module);
97
+ ux.action.stop(`${chalk.green('done')}`);
98
+ if (!(yield fs.pathExists(destination))) {
99
+ yield fs.mkdirp(destination);
100
+ }
101
+ // Extract files
102
+ ux.action.start('Extracting translation zip files', undefined, { stdout: true });
103
+ let finalFileName = 'Translations..xml';
104
+ if (flags.filename) {
105
+ finalFileName = flags.filename;
106
+ }
107
+ // set finalFileName to empty string to indicate filename needs to be taken from server response
108
+ if (flags.respectServerFilename) {
109
+ finalFileName = '';
110
+ }
111
+ yield this.extractFiles(response.data, destination, finalFileName);
112
+ ux.action.stop(`${chalk.green('done')}`);
113
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
114
  }
103
- // set finalFileName to empty string to indicate filename needs to be taken from server response
104
- if (flags.respectServerFilename) {
105
- finalFileName = '';
115
+ catch (error) {
116
+ ux.action.stop(`${chalk.red('error')}`);
117
+ this.error(error.message);
106
118
  }
107
- await this.extractFiles(response, destination, finalFileName);
108
- cli_ux_1.default.action.stop(`${chalk_1.default.green('done')}`);
109
- }
110
- catch (err) {
111
- cli_ux_1.default.action.stop(`${chalk_1.default.red('error')}`);
112
- this.error(err.message);
113
- }
114
- this.log(`Translations extracted into ${chalk_1.default.cyan(path.resolve(destination))}`);
115
- this.log(`${chalk_1.default.green('Done.')}`);
119
+ this.log(`Translations extracted into ${chalk.cyan(path.resolve(destination))}`);
120
+ this.log(`${chalk.green('Done.')}`);
121
+ });
116
122
  }
117
123
  }
118
- exports.default = Translate;
119
124
  Translate.description = 'downloads translate from AdDictionary service';
120
125
  Translate.usage = 'translate <language> [flags]';
121
126
  Translate.examples = [
122
127
  `$ ops translate "en-US=en-US;ru-Ru=ru-RU" -f json -m "Client business accounting;Client business base;"`,
123
- `$ ops translate "en-US=en-US;ru-Ru=ru-RU" -f xml -o translationDestination`
128
+ `$ ops translate "en-US=en-US;ru-Ru=ru-RU" -f xml -o translationDestination`,
124
129
  ];
125
- Translate.args = [
126
- {
127
- name: 'language',
130
+ Translate.args = {
131
+ language: Args.string({
128
132
  required: true,
129
- description: 'language id you want to download. Values must be semi-colon (;) separated.'
130
- }
131
- ];
133
+ description: 'Language id you want to download. Values must be semi-colon (;) separated.',
134
+ }),
135
+ };
132
136
  Translate.flags = {
133
- format: command_1.flags.string({
137
+ format: Flags.string({
134
138
  char: 'f',
135
139
  description: 'translations format [xml - server translations, json - client translations]',
136
140
  options: ['json', 'xml'],
137
- required: true
141
+ required: true,
138
142
  }),
139
- module: command_1.flags.string({
143
+ module: Flags.string({
140
144
  char: 'm',
141
- description: 'module name you want to download. Values must be semi-colon (;) separated.'
145
+ description: 'module name you want to download. Values must be semi-colon (;) separated.',
142
146
  }),
143
- output: command_1.flags.string({
147
+ output: Flags.string({
144
148
  char: 'o',
145
149
  default: '.',
146
- description: 'absolute or relative destination path to a folder where translations are extracted.'
150
+ description: 'absolute or relative destination path to a folder where translations are extracted.',
147
151
  }),
148
- filename: command_1.flags.string({
149
- description: 'specify filename of output (XML only).'
152
+ filename: Flags.string({
153
+ description: 'specify filename of output (XML only).',
150
154
  }),
151
- respectServerFilename: command_1.flags.boolean({
155
+ respectServerFilename: Flags.boolean({
152
156
  default: false,
153
- description: 'respect filename that is returned from AdDictionary server (XML only).'
154
- })
157
+ description: 'respect filename that is returned from AdDictionary server (XML only).',
158
+ }),
155
159
  };
160
+ export default Translate;
@@ -1,46 +1,56 @@
1
- import { flags } from '@oclif/command';
2
- import * as semver from 'semver';
3
- import CommandBase from '../command.base';
4
- declare type ReleaseType = semver.ReleaseType | 'new';
5
- export default class Version extends CommandBase {
1
+ import { AxiosResponse } from 'axios';
2
+ import semver from 'semver';
3
+ import CommandBase from '../command.base.js';
4
+ type ReleaseType = semver.ReleaseType | 'new';
5
+ export default class Version extends CommandBase<typeof Version> {
6
6
  static description: string;
7
7
  static usage: string;
8
8
  static examples: string[];
9
9
  static args: {
10
- name: string;
11
- required: boolean;
12
- description: string;
13
- options: string[];
14
- }[];
10
+ type: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
11
+ };
15
12
  static flags: {
16
- independent: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
17
- version: flags.IOptionFlag<string | undefined>;
18
- 'script-prefix': flags.IOptionFlag<string>;
19
- 'no-deps': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
20
- 'no-script': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
21
- 'only-npm-packages': flags.IOptionFlag<string>;
22
- 'exclude-dir': flags.IOptionFlag<string[]>;
13
+ independent: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
14
+ version: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
15
+ 'script-prefix': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
16
+ 'no-deps': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
17
+ 'no-script': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
18
+ 'only-npm-packages': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
19
+ 'exclude-dir': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
23
20
  };
24
21
  /**
25
22
  * Update NPM packages with wsrun
23
+ * @param type Release type of NPM package
24
+ * @param version Version
25
+ * @param filter Regular Expression filter for packages
26
+ * @param excludeDirs Excluded directories
27
+ * @returns {Promise<void>} Void
26
28
  */
27
- bumpNpm(type: ReleaseType, version: string, filter: string, excludeDirs: string[]): Promise<string[]>;
29
+ bumpNpm(type: ReleaseType, version: string, filter: string, excludeDirs: string[] | undefined): Promise<string[]>;
28
30
  /**
29
31
  * Validate args and flags
30
32
  */
31
33
  validateOptions(args: any, flags: any): boolean;
32
34
  /**
33
35
  * Update dependencies in package.json files for @adinsure packages
36
+ * @param version Version
37
+ * @param updatedPackages Array of updated packages
38
+ * @returns {void}
34
39
  */
35
40
  updateDependencies(version: string, updatedPackages: Array<string>): Promise<void>;
36
- insertScriptRequest(token: string, version: string, prefix: string): Promise<string>;
41
+ insertScriptRequest(token: string, version: string, prefix: string): Promise<AxiosResponse<any, any>>;
37
42
  insertScript(token: string, version: string, prefix: string, skip?: boolean): Promise<void>;
38
43
  /**
39
44
  * Check if version has valid prerelease as 'rc' or '201910' (year month)
45
+ * @param version Version
46
+ * @param month Month of release
47
+ * @returns {boolean} True or false
40
48
  */
41
49
  checkPrerelease(version: string, month: string): boolean;
42
50
  /**
43
51
  * Write new version in VERSION file
52
+ * @param version The new version
53
+ * @returns {void}
44
54
  */
45
55
  setVersion(version: string): Promise<void>;
46
56
  run(): Promise<undefined>;