@adinsure-ops/ops-cli 4.8.2 → 5.0.0-rc3
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.
- package/CHANGELOGS.md +12 -0
- package/README.md +0 -211
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +6 -0
- package/bin/run.cmd +1 -1
- package/bin/run.js +8 -0
- package/lib/command.base.d.ts +9 -5
- package/lib/command.base.jira.d.ts +7 -8
- package/lib/command.base.jira.js +26 -24
- package/lib/command.base.js +69 -57
- package/lib/commands/docker/update-image-version.d.ts +6 -9
- package/lib/commands/docker/update-image-version.js +35 -34
- package/lib/commands/doctor.d.ts +15 -5
- package/lib/commands/doctor.js +219 -186
- package/lib/commands/download/client.d.ts +10 -7
- package/lib/commands/download/client.js +60 -52
- package/lib/commands/download/identity-server.d.ts +9 -7
- package/lib/commands/download/identity-server.js +59 -53
- package/lib/commands/download/jmeter.d.ts +5 -5
- package/lib/commands/download/jmeter.js +54 -49
- package/lib/commands/download/keycloak-scim.d.ts +6 -6
- package/lib/commands/download/keycloak-scim.js +56 -51
- package/lib/commands/download/platform.d.ts +9 -7
- package/lib/commands/download/platform.js +59 -53
- package/lib/commands/download/scheduler.d.ts +9 -7
- package/lib/commands/download/scheduler.js +59 -53
- package/lib/commands/download/server.d.ts +9 -7
- package/lib/commands/download/server.js +59 -53
- package/lib/commands/download/signalr.d.ts +9 -7
- package/lib/commands/download/signalr.js +59 -53
- package/lib/commands/download/studio.d.ts +11 -9
- package/lib/commands/download/studio.js +92 -82
- package/lib/commands/gitlab/get-tag-pipeline.d.ts +11 -14
- package/lib/commands/gitlab/get-tag-pipeline.js +95 -92
- package/lib/commands/gitlab/next-nightly-tag.d.ts +10 -12
- package/lib/commands/gitlab/next-nightly-tag.js +96 -98
- package/lib/commands/jira/issue.d.ts +6 -8
- package/lib/commands/jira/issue.js +25 -23
- package/lib/commands/jira/labels.d.ts +9 -12
- package/lib/commands/jira/labels.js +52 -51
- package/lib/commands/log/add.d.ts +6 -8
- package/lib/commands/log/add.js +92 -87
- package/lib/commands/log/generate.d.ts +9 -10
- package/lib/commands/log/generate.js +112 -107
- package/lib/commands/log/validate.d.ts +2 -2
- package/lib/commands/log/validate.js +47 -43
- package/lib/commands/login.d.ts +9 -10
- package/lib/commands/login.js +101 -97
- package/lib/commands/npm/check-publish.d.ts +7 -8
- package/lib/commands/npm/check-publish.js +59 -54
- package/lib/commands/npm/dependency-update.d.ts +14 -12
- package/lib/commands/npm/dependency-update.js +94 -86
- package/lib/commands/npm/publish.d.ts +8 -9
- package/lib/commands/npm/publish.js +154 -140
- package/lib/commands/nuget/dependency-update.d.ts +15 -10
- package/lib/commands/nuget/dependency-update.js +60 -49
- package/lib/commands/sql.d.ts +24 -20
- package/lib/commands/sql.js +246 -225
- package/lib/commands/translate.d.ts +15 -16
- package/lib/commands/translate.js +109 -104
- package/lib/commands/version.d.ts +29 -19
- package/lib/commands/version.js +215 -190
- package/lib/config.js +3 -6
- package/lib/hooks/init/version-override.d.ts +2 -2
- package/lib/hooks/init/version-override.js +15 -13
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -4
- package/lib/lib/command.d.ts +2 -0
- package/lib/lib/command.js +65 -58
- package/lib/lib/gitlab.d.ts +8 -2
- package/lib/lib/gitlab.js +94 -79
- package/lib/lib/npm.d.ts +7 -3
- package/lib/lib/npm.js +72 -60
- package/lib/lib/npmrc.d.ts +5 -0
- package/lib/lib/npmrc.js +20 -13
- package/lib/lib/nuget.d.ts +2 -0
- package/lib/lib/nuget.js +20 -17
- package/lib/security/cache.js +31 -27
- package/lib/security/context.d.ts +2 -1
- package/lib/security/context.js +106 -103
- package/lib/types/changelog.types.js +1 -2
- package/lib/types/npm.types.d.ts +5 -5
- package/lib/types/npm.types.js +1 -2
- package/oclif.manifest.json +1212 -1
- package/package.json +52 -47
- package/bin/run +0 -5
- package/lib/commands/prepare-content.d.ts +0 -29
- package/lib/commands/prepare-content.js +0 -386
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
48
|
-
|
|
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 (
|
|
51
|
-
errorMessage
|
|
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
|
-
|
|
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
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
finalFileName =
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
catch (error) {
|
|
116
|
+
ux.action.stop(`${chalk.red('error')}`);
|
|
117
|
+
this.error(error.message);
|
|
106
118
|
}
|
|
107
|
-
|
|
108
|
-
|
|
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: '
|
|
130
|
-
}
|
|
131
|
-
|
|
133
|
+
description: 'Language id you want to download. Values must be semi-colon (;) separated.',
|
|
134
|
+
}),
|
|
135
|
+
};
|
|
132
136
|
Translate.flags = {
|
|
133
|
-
format:
|
|
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:
|
|
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:
|
|
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:
|
|
149
|
-
description: 'specify filename of output (XML only).'
|
|
152
|
+
filename: Flags.string({
|
|
153
|
+
description: 'specify filename of output (XML only).',
|
|
150
154
|
}),
|
|
151
|
-
respectServerFilename:
|
|
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 {
|
|
2
|
-
import
|
|
3
|
-
import CommandBase from '../command.base';
|
|
4
|
-
|
|
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
|
-
|
|
11
|
-
|
|
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/
|
|
17
|
-
version:
|
|
18
|
-
'script-prefix':
|
|
19
|
-
'no-deps': import("@oclif/
|
|
20
|
-
'no-script': import("@oclif/
|
|
21
|
-
'only-npm-packages':
|
|
22
|
-
'exclude-dir':
|
|
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<
|
|
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>;
|