@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.
- package/CHANGELOGS.md +52 -36
- package/LICENSE +1 -1
- package/README.md +32 -242
- 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 +12 -9
- package/lib/commands/download/studio.js +107 -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 +245 -226
- 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 -82
- 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 +1223 -1
- package/package.json +50 -46
- package/bin/run +0 -5
- package/lib/commands/prepare-content.d.ts +0 -29
- package/lib/commands/prepare-content.js +0 -386
package/lib/command.base.js
CHANGED
|
@@ -1,73 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class CommandBase extends
|
|
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
|
|
10
|
+
this.security = new SecurityContext(this.config.configDir);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
2
|
-
|
|
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
|
-
|
|
9
|
-
|
|
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:
|
|
14
|
-
'file-path':
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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:
|
|
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':
|
|
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;
|
package/lib/commands/doctor.d.ts
CHANGED
|
@@ -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/
|
|
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
|
|
13
|
+
private missingPackages;
|
|
14
14
|
/**
|
|
15
|
-
* Check if
|
|
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>;
|