@adinsure-ops/ops-cli 5.3.1 → 5.4.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/README.md +1 -1
- package/lib/command.base.d.ts +3 -0
- package/lib/command.base.js +24 -1
- package/lib/commands/doctor.d.ts +8 -1
- package/lib/commands/doctor.js +42 -2
- package/lib/commands/download/studio.d.ts +1 -0
- package/lib/commands/download/studio.js +15 -2
- package/lib/commands/gitlab/get-tag-pipeline.d.ts +3 -0
- package/lib/commands/gitlab/get-tag-pipeline.js +25 -2
- package/lib/commands/gitlab/next-nightly-tag.d.ts +3 -0
- package/lib/commands/gitlab/next-nightly-tag.js +25 -2
- package/lib/commands/log/generate.d.ts +8 -1
- package/lib/commands/log/generate.js +61 -20
- package/lib/commands/npm/dependency-update.js +11 -2
- package/lib/commands/sql.d.ts +1 -0
- package/lib/commands/sql.js +11 -2
- package/oclif.manifest.json +12 -6
- package/package.json +39 -28
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ To quick start development:
|
|
|
21
21
|
- Run `yarn install`
|
|
22
22
|
- For easier debugging, run `yarn link`
|
|
23
23
|
|
|
24
|
-
You can run and debug commands directly from terminal by running `ops [command]` (if you `yarn link`-ed the package) or execute `.\bin\run [command]` (if you didn't). For debugging, you can follow oclif's documentation on how to turn on debug mode for a single command **[here](https://oclif.io/docs/debugging/)**.
|
|
24
|
+
You can run and debug commands directly from terminal by running `ops [command]` (if you `yarn link`-ed the package) or execute `.\bin\run [command]` (if you didn't link, e.g. `.\bin\run.cmd sql schema` for non-Windows environments and `.\bin\dev.cmd sql schema` for Windows environments). For debugging, you can follow oclif's documentation on how to turn on debug mode for a single command **[here](https://oclif.io/docs/debugging/)**.
|
|
25
25
|
|
|
26
26
|
## Upgrade guilde
|
|
27
27
|
|
package/lib/command.base.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ import { Command, Config } from '@oclif/core';
|
|
|
2
2
|
import SecurityContext from './security/context.js';
|
|
3
3
|
export default abstract class CommandBase<T extends typeof Command> extends Command {
|
|
4
4
|
protected readonly security: SecurityContext;
|
|
5
|
+
private readonly childProcess;
|
|
5
6
|
constructor(argv: string[], config: Config);
|
|
6
7
|
getGitRoot(startDir?: string): Promise<string>;
|
|
8
|
+
getYarnVersion(): Promise<string>;
|
|
9
|
+
yarnIsBerryVersion(version: string): boolean;
|
|
7
10
|
getVersion(versionFile?: string, ...filesToCheck: string[]): Promise<string>;
|
|
8
11
|
/**
|
|
9
12
|
* Resolve path to Changelog folder from current execution directory
|
package/lib/command.base.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { Command } from '@oclif/core';
|
|
2
|
+
import { Command, ux } from '@oclif/core';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import SecurityContext from './security/context.js';
|
|
8
|
+
import ChildProcessCommand from './lib/command.js';
|
|
8
9
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
9
10
|
export default class CommandBase extends Command {
|
|
10
11
|
constructor(argv, config) {
|
|
11
12
|
super(argv, config);
|
|
13
|
+
this.childProcess = new ChildProcessCommand();
|
|
12
14
|
this.security = new SecurityContext(this.config.configDir);
|
|
13
15
|
}
|
|
14
16
|
getGitRoot(startDir) {
|
|
@@ -28,6 +30,27 @@ export default class CommandBase extends Command {
|
|
|
28
30
|
}
|
|
29
31
|
});
|
|
30
32
|
}
|
|
33
|
+
getYarnVersion() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const output = yield this.childProcess.runCommand(['yarn', '--version']);
|
|
36
|
+
if (output.error) {
|
|
37
|
+
ux.action.stop(`${chalk.red(output.error)}`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const version = output.data.split('\n')[0];
|
|
41
|
+
if (version) {
|
|
42
|
+
return version;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
ux.action.stop(`${chalk.red('failed getting yarn version')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`Could not resolve yarn version.`);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
yarnIsBerryVersion(version) {
|
|
52
|
+
return version.startsWith('v4');
|
|
53
|
+
}
|
|
31
54
|
getVersion() {
|
|
32
55
|
return __awaiter(this, arguments, void 0, function* (versionFile = 'VERSION', ...filesToCheck) {
|
|
33
56
|
filesToCheck.unshift(versionFile);
|
package/lib/commands/doctor.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export default class Doctor extends CommandBase<typeof Doctor> {
|
|
|
10
10
|
private nvm;
|
|
11
11
|
private yarn;
|
|
12
12
|
private node;
|
|
13
|
+
private corepack;
|
|
13
14
|
private missingPackages;
|
|
14
15
|
/**
|
|
15
16
|
* Check if Git is installed
|
|
@@ -43,7 +44,13 @@ export default class Doctor extends CommandBase<typeof Doctor> {
|
|
|
43
44
|
*/
|
|
44
45
|
yarnCheck(fix: boolean): Promise<void>;
|
|
45
46
|
/**
|
|
46
|
-
* Check
|
|
47
|
+
* Check corepack is installed
|
|
48
|
+
* @param {boolean} fix Try to install yarn if found missing
|
|
49
|
+
* @returns {void}
|
|
50
|
+
*/
|
|
51
|
+
corepackCheck(fix: boolean): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Install yarn via corepack.
|
|
47
54
|
* @returns {void}
|
|
48
55
|
*/
|
|
49
56
|
yarnInstall(): Promise<void>;
|
package/lib/commands/doctor.js
CHANGED
|
@@ -11,6 +11,7 @@ class Doctor extends CommandBase {
|
|
|
11
11
|
this.nvm = false;
|
|
12
12
|
this.yarn = false;
|
|
13
13
|
this.node = false;
|
|
14
|
+
this.corepack = false;
|
|
14
15
|
this.missingPackages = 0;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
@@ -137,6 +138,7 @@ class Doctor extends CommandBase {
|
|
|
137
138
|
ux.action.stop(`${chalk.green(version)}`);
|
|
138
139
|
this.node = true;
|
|
139
140
|
// only check yarn if node is installed
|
|
141
|
+
yield this.corepackCheck(fix);
|
|
140
142
|
yield this.yarnCheck(fix);
|
|
141
143
|
}
|
|
142
144
|
else {
|
|
@@ -217,14 +219,52 @@ class Doctor extends CommandBase {
|
|
|
217
219
|
});
|
|
218
220
|
}
|
|
219
221
|
/**
|
|
220
|
-
* Check
|
|
222
|
+
* Check corepack is installed
|
|
223
|
+
* @param {boolean} fix Try to install yarn if found missing
|
|
224
|
+
* @returns {void}
|
|
225
|
+
*/
|
|
226
|
+
corepackCheck(fix) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
ux.action.start('Checking corepack', undefined, { stdout: true });
|
|
229
|
+
try {
|
|
230
|
+
const output = yield this.cp.runCommand(['corepack', '--version']);
|
|
231
|
+
if (output.error) {
|
|
232
|
+
ux.action.stop(`${chalk.red(output.error)}`);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
const version = output.data.split('\n')[0];
|
|
236
|
+
if (version) {
|
|
237
|
+
this.corepack = true;
|
|
238
|
+
ux.action.stop(`${chalk.green(version)}`);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
ux.action.stop(`${chalk.red('corepack is missing')}`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (_a) {
|
|
246
|
+
this.missingPackages++;
|
|
247
|
+
ux.action.stop(`${chalk.red('corepack is missing')}`);
|
|
248
|
+
if (fix) {
|
|
249
|
+
yield this.yarnInstall();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Install yarn via corepack.
|
|
221
256
|
* @returns {void}
|
|
222
257
|
*/
|
|
223
258
|
yarnInstall() {
|
|
224
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
225
260
|
ux.action.start('Install yarn', undefined, { stdout: true });
|
|
226
261
|
try {
|
|
227
|
-
const output = yield this.cp.runCommand([
|
|
262
|
+
const output = yield this.cp.runCommand([
|
|
263
|
+
'npm',
|
|
264
|
+
'-g',
|
|
265
|
+
'install',
|
|
266
|
+
'corepack',
|
|
267
|
+
]);
|
|
228
268
|
if (output.error) {
|
|
229
269
|
ux.action.stop(`${chalk.red(output.error)}`);
|
|
230
270
|
}
|
|
@@ -15,6 +15,7 @@ export default class DownloadStudio extends CommandBase<typeof DownloadStudio> {
|
|
|
15
15
|
};
|
|
16
16
|
private readonly url_azure;
|
|
17
17
|
private readonly url_gitlabru;
|
|
18
|
+
private get vscodeExecutable();
|
|
18
19
|
/**
|
|
19
20
|
* Get unique AdInsure Studio vsix zip by specified version
|
|
20
21
|
* @param {string} version The version of AdInsure Studio vsix
|
|
@@ -14,6 +14,19 @@ class DownloadStudio extends CommandBase {
|
|
|
14
14
|
this.url_azure = 'https://ops.adinsure.com/api/storage/extensions/';
|
|
15
15
|
this.url_gitlabru = 'https://gitlabru.adacta-fintech.ru/api/v4/projects/2/packages/generic';
|
|
16
16
|
}
|
|
17
|
+
get vscodeExecutable() {
|
|
18
|
+
if (process.platform === 'win32') {
|
|
19
|
+
const pathEnv = process.env.PATH || process.env.Path;
|
|
20
|
+
if (pathEnv) {
|
|
21
|
+
for (const dir of pathEnv.split(path.delimiter)) {
|
|
22
|
+
if (fs.existsSync(path.join(dir, 'code.cmd'))) {
|
|
23
|
+
return 'code.cmd';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return 'code';
|
|
29
|
+
}
|
|
17
30
|
/**
|
|
18
31
|
* Get unique AdInsure Studio vsix zip by specified version
|
|
19
32
|
* @param {string} version The version of AdInsure Studio vsix
|
|
@@ -52,7 +65,7 @@ class DownloadStudio extends CommandBase {
|
|
|
52
65
|
installExtension(extensionPath) {
|
|
53
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
67
|
const cp = new ChildProcessCommand();
|
|
55
|
-
const commandResult = yield cp.runCommand([
|
|
68
|
+
const commandResult = yield cp.runCommand([this.vscodeExecutable, '--install-extension', extensionPath, '--force']);
|
|
56
69
|
if (commandResult.error) {
|
|
57
70
|
this.error(`${chalk.redBright('Installing into VSCode failed!')}\n${commandResult.error}`);
|
|
58
71
|
}
|
|
@@ -65,7 +78,7 @@ class DownloadStudio extends CommandBase {
|
|
|
65
78
|
return false;
|
|
66
79
|
}
|
|
67
80
|
const cp = new ChildProcessCommand();
|
|
68
|
-
const result = yield cp.runCommand([
|
|
81
|
+
const result = yield cp.runCommand([this.vscodeExecutable, '--list-extensions', '--show-versions']);
|
|
69
82
|
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.includes(studioVersion);
|
|
70
83
|
});
|
|
71
84
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import CommandBase from '../../command.base.js';
|
|
2
2
|
import GitLab from '../../lib/gitlab.js';
|
|
3
|
+
import OpsConfig from '../../lib/config.js';
|
|
3
4
|
export default class GitlabGetTagPipeline extends CommandBase<typeof GitlabGetTagPipeline> {
|
|
4
5
|
static description: string;
|
|
5
6
|
static usage: string;
|
|
@@ -16,5 +17,7 @@ export default class GitlabGetTagPipeline extends CommandBase<typeof GitlabGetTa
|
|
|
16
17
|
delay: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
17
18
|
};
|
|
18
19
|
waitPipelineStatus(gitlab: GitLab, tag: string, timeout: number, delay: number): Promise<string>;
|
|
20
|
+
hostConfigValidation(config: OpsConfig): Promise<void>;
|
|
21
|
+
projectConfigValidation(config: OpsConfig): Promise<void>;
|
|
19
22
|
run(): Promise<void>;
|
|
20
23
|
}
|
|
@@ -3,6 +3,7 @@ import { Args, Flags } from '@oclif/core';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import CommandBase from '../../command.base.js';
|
|
5
5
|
import GitLab from '../../lib/gitlab.js';
|
|
6
|
+
import OpsConfig from '../../lib/config.js';
|
|
6
7
|
class GitlabGetTagPipeline extends CommandBase {
|
|
7
8
|
waitPipelineStatus(gitlab, tag, timeout, delay) {
|
|
8
9
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -82,12 +83,36 @@ class GitlabGetTagPipeline extends CommandBase {
|
|
|
82
83
|
}));
|
|
83
84
|
});
|
|
84
85
|
}
|
|
86
|
+
hostConfigValidation(config) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const host = config.get("gitlab_host");
|
|
89
|
+
if (host !== undefined) {
|
|
90
|
+
GitlabGetTagPipeline.flags.host.default = host;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
GitlabGetTagPipeline.flags.host.default =
|
|
94
|
+
"https://git.adacta-fintech.com";
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
projectConfigValidation(config) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const project = config.get("gitlab_project_id");
|
|
100
|
+
if (project !== undefined) {
|
|
101
|
+
GitlabGetTagPipeline.flags.project.default = project;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
GitlabGetTagPipeline.flags.project.default = "413";
|
|
105
|
+
});
|
|
106
|
+
}
|
|
85
107
|
run() {
|
|
86
108
|
const _super = Object.create(null, {
|
|
87
109
|
run: { get: () => super.run }
|
|
88
110
|
});
|
|
89
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
112
|
_super.run.call(this);
|
|
113
|
+
const config = new OpsConfig(this.security.getConfigPath());
|
|
114
|
+
this.hostConfigValidation(config);
|
|
115
|
+
this.projectConfigValidation(config);
|
|
91
116
|
const { args, flags } = yield this.parse(GitlabGetTagPipeline);
|
|
92
117
|
const gitlab = new GitLab(flags.host, flags.project, flags.pat);
|
|
93
118
|
if (!flags.wait) {
|
|
@@ -123,13 +148,11 @@ GitlabGetTagPipeline.flags = {
|
|
|
123
148
|
description: 'Token from user that has permissions to list and create tags',
|
|
124
149
|
}),
|
|
125
150
|
host: Flags.string({
|
|
126
|
-
required: true,
|
|
127
151
|
default: 'https://git.adacta-fintech.com',
|
|
128
152
|
env: 'CI_SERVER_URL',
|
|
129
153
|
description: 'Server hostname',
|
|
130
154
|
}),
|
|
131
155
|
project: Flags.string({
|
|
132
|
-
required: true,
|
|
133
156
|
default: '413',
|
|
134
157
|
env: 'CI_PROJECT_ID',
|
|
135
158
|
description: 'Project ID',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import CommandBase from '../../command.base.js';
|
|
2
|
+
import OpsConfig from '../../lib/config.js';
|
|
2
3
|
export default class GitlabNextNightlyTag extends CommandBase<typeof GitlabNextNightlyTag> {
|
|
3
4
|
static description: string;
|
|
4
5
|
static usage: string;
|
|
@@ -14,5 +15,7 @@ export default class GitlabNextNightlyTag extends CommandBase<typeof GitlabNextN
|
|
|
14
15
|
outputVersionOnly: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
15
16
|
dryRun: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
16
17
|
};
|
|
18
|
+
hostConfigValidation(config: OpsConfig): Promise<void>;
|
|
19
|
+
projectConfigValidation(config: OpsConfig): Promise<void>;
|
|
17
20
|
run(): Promise<undefined>;
|
|
18
21
|
}
|
|
@@ -4,13 +4,38 @@ import chalk from 'chalk';
|
|
|
4
4
|
import semver from 'semver';
|
|
5
5
|
import CommandBase from '../../command.base.js';
|
|
6
6
|
import GitLab from '../../lib/gitlab.js';
|
|
7
|
+
import OpsConfig from '../../lib/config.js';
|
|
7
8
|
class GitlabNextNightlyTag extends CommandBase {
|
|
9
|
+
hostConfigValidation(config) {
|
|
10
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
const host = config.get("gitlab_host");
|
|
12
|
+
if (host !== undefined) {
|
|
13
|
+
GitlabNextNightlyTag.flags.host.default = host;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
GitlabNextNightlyTag.flags.host.default =
|
|
17
|
+
"https://git.adacta-fintech.com";
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
projectConfigValidation(config) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const project = config.get("gitlab_project_id");
|
|
23
|
+
if (project !== undefined) {
|
|
24
|
+
GitlabNextNightlyTag.flags.project.default = project;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
GitlabNextNightlyTag.flags.project.default = "413";
|
|
28
|
+
});
|
|
29
|
+
}
|
|
8
30
|
run() {
|
|
9
31
|
const _super = Object.create(null, {
|
|
10
32
|
run: { get: () => super.run }
|
|
11
33
|
});
|
|
12
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
35
|
_super.run.call(this);
|
|
36
|
+
const config = new OpsConfig(this.security.getConfigPath());
|
|
37
|
+
this.hostConfigValidation(config);
|
|
38
|
+
this.projectConfigValidation(config);
|
|
14
39
|
const { args, flags } = yield this.parse(GitlabNextNightlyTag);
|
|
15
40
|
const gitlab = new GitLab(flags.host, flags.project, flags.pat);
|
|
16
41
|
const re = /^release\/(\w+-)?((\d+)(\.\d+)?)$/;
|
|
@@ -103,13 +128,11 @@ GitlabNextNightlyTag.flags = {
|
|
|
103
128
|
description: 'Token from user that has permissions to list and create tags',
|
|
104
129
|
}),
|
|
105
130
|
host: Flags.string({
|
|
106
|
-
required: true,
|
|
107
131
|
default: 'https://git.adacta-fintech.com',
|
|
108
132
|
env: 'CI_SERVER_URL',
|
|
109
133
|
description: 'Server hostname',
|
|
110
134
|
}),
|
|
111
135
|
project: Flags.string({
|
|
112
|
-
required: true,
|
|
113
136
|
default: '413',
|
|
114
137
|
env: 'CI_PROJECT_ID',
|
|
115
138
|
description: 'Project ID',
|
|
@@ -15,7 +15,14 @@ export default class Generate extends CommandBase<typeof Generate> {
|
|
|
15
15
|
};
|
|
16
16
|
private readonly _entryTypes;
|
|
17
17
|
private readonly _mdFileTypeRegex;
|
|
18
|
+
private readonly _changelogTitle;
|
|
18
19
|
readChangelogs(dir: string): Promise<ChangelogEntry[]>;
|
|
19
|
-
generateLog(entries: ChangelogEntry[], components: string[]): Promise<string>;
|
|
20
|
+
generateLog(entries: ChangelogEntry[], components: string[], headingLevel?: number): Promise<string>;
|
|
21
|
+
generateChangelog(version: string, entries: ChangelogEntry[], components: string[], currentContents?: string, date?: string): Promise<string>;
|
|
22
|
+
private formatEntry;
|
|
23
|
+
private indentMarkdownLines;
|
|
24
|
+
private stripChangelogTitle;
|
|
25
|
+
private normalizeLineEndings;
|
|
26
|
+
private startsWithBlockContent;
|
|
20
27
|
run(): Promise<void>;
|
|
21
28
|
}
|
|
@@ -18,6 +18,7 @@ class Generate extends CommandBase {
|
|
|
18
18
|
{ types: ['Fixed', 'fixed'], text: 'Fixed' },
|
|
19
19
|
];
|
|
20
20
|
this._mdFileTypeRegex = /\.md$/i;
|
|
21
|
+
this._changelogTitle = '# Changelog';
|
|
21
22
|
}
|
|
22
23
|
readChangelogs(dir) {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -38,43 +39,84 @@ class Generate extends CommandBase {
|
|
|
38
39
|
return result;
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
generateLog(
|
|
42
|
-
return __awaiter(this,
|
|
42
|
+
generateLog(entries_1, components_1) {
|
|
43
|
+
return __awaiter(this, arguments, void 0, function* (entries, components, headingLevel = 3) {
|
|
44
|
+
var _a;
|
|
43
45
|
let content = '';
|
|
44
46
|
// First group by component, then re-sort the components to get the desired output ordering
|
|
45
47
|
const componentGroups = _.groupBy(entries, 'component');
|
|
46
48
|
for (const group of components) {
|
|
49
|
+
const groupEntries = (_a = componentGroups[group]) !== null && _a !== void 0 ? _a : [];
|
|
47
50
|
if (group !== '') {
|
|
48
|
-
content +=
|
|
51
|
+
content += `${'#'.repeat(headingLevel)} ${_.capitalize(group)}\r\n\r\n`;
|
|
49
52
|
}
|
|
50
|
-
if (
|
|
53
|
+
if (groupEntries.length === 0) {
|
|
51
54
|
content += `No changes were introduced in this version.\r\n\r\n`;
|
|
52
55
|
continue;
|
|
53
56
|
}
|
|
57
|
+
const typeHeadingLevel = group === '' ? headingLevel : headingLevel + 1;
|
|
54
58
|
for (const type of this._entryTypes) {
|
|
55
|
-
const batch =
|
|
59
|
+
const batch = groupEntries.filter(e => _.indexOf(type.types, e.type) > -1);
|
|
56
60
|
if (batch.length === 0) {
|
|
57
61
|
continue;
|
|
58
62
|
}
|
|
59
|
-
content +=
|
|
63
|
+
content += `${'#'.repeat(typeHeadingLevel)} ${type.text} (${batch.length} changes)\r\n\r\n`;
|
|
60
64
|
for (const log of batch) {
|
|
61
|
-
|
|
62
|
-
content += `- [${log.issue}](https://jira.adacta-fintech.com/browse/${log.issue}):\r\n`;
|
|
63
|
-
content += ' ' + log.content.replaceAll('\n', '\n ');
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
content += `- [${log.issue}](https://jira.adacta-fintech.com/browse/${log.issue}): `;
|
|
67
|
-
content += log.content.replaceAll('\n', '\n ') + '\r\n';
|
|
68
|
-
}
|
|
69
|
-
content += '\r\n';
|
|
65
|
+
content += `${this.formatEntry(log)}\r\n\r\n`;
|
|
70
66
|
}
|
|
71
|
-
content += '\r\n';
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
// We only want 1 new line at the end of this changelog
|
|
75
|
-
return content.trimEnd() + '\r\n
|
|
70
|
+
return content.trimEnd() + '\r\n';
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
generateChangelog(version_1, entries_1, components_1) {
|
|
74
|
+
return __awaiter(this, arguments, void 0, function* (version, entries, components, currentContents = '', date = moment().format('YYYY-MM-DD')) {
|
|
75
|
+
const currentChangelog = this.stripChangelogTitle(currentContents);
|
|
76
|
+
const generatedChangelog = `${this._changelogTitle}\r\n\r\n## ${version} (${date})\r\n\r\n${yield this.generateLog(entries, components)}`;
|
|
77
|
+
return currentChangelog ? `${generatedChangelog}\r\n${currentChangelog}\r\n` : generatedChangelog;
|
|
76
78
|
});
|
|
77
79
|
}
|
|
80
|
+
formatEntry(log) {
|
|
81
|
+
const normalizedContent = this.normalizeLineEndings(log.content).trim();
|
|
82
|
+
const lines = normalizedContent.length === 0 ? [] : normalizedContent.split('\n').map(line => line.trimEnd());
|
|
83
|
+
const issueLine = `- [${log.issue}](https://jira.adacta-fintech.com/browse/${log.issue}):`;
|
|
84
|
+
if (lines.length === 0) {
|
|
85
|
+
return issueLine;
|
|
86
|
+
}
|
|
87
|
+
if (this.startsWithBlockContent(lines[0])) {
|
|
88
|
+
return `${issueLine}\r\n${this.indentMarkdownLines(lines)}`;
|
|
89
|
+
}
|
|
90
|
+
const [firstLine, ...remainingLines] = lines;
|
|
91
|
+
if (remainingLines.length === 0) {
|
|
92
|
+
return `${issueLine} ${firstLine}`;
|
|
93
|
+
}
|
|
94
|
+
return `${issueLine} ${firstLine}\r\n${this.indentMarkdownLines(remainingLines)}`;
|
|
95
|
+
}
|
|
96
|
+
indentMarkdownLines(lines) {
|
|
97
|
+
return lines.map(line => line.length === 0 ? '' : ` ${line}`).join('\r\n');
|
|
98
|
+
}
|
|
99
|
+
stripChangelogTitle(currentContents) {
|
|
100
|
+
const trimmedContents = currentContents.trimEnd();
|
|
101
|
+
if (trimmedContents.length === 0) {
|
|
102
|
+
return '';
|
|
103
|
+
}
|
|
104
|
+
const lines = this.normalizeLineEndings(trimmedContents.trimStart()).split('\n');
|
|
105
|
+
if (lines[0].trim().toLowerCase() !== this._changelogTitle.toLowerCase()) {
|
|
106
|
+
return trimmedContents;
|
|
107
|
+
}
|
|
108
|
+
lines.shift();
|
|
109
|
+
while (lines.length > 0 && lines[0].trim().length === 0) {
|
|
110
|
+
lines.shift();
|
|
111
|
+
}
|
|
112
|
+
return lines.join('\r\n').trimEnd();
|
|
113
|
+
}
|
|
114
|
+
normalizeLineEndings(content) {
|
|
115
|
+
return content.replace(/\r\n?/g, '\n');
|
|
116
|
+
}
|
|
117
|
+
startsWithBlockContent(line) {
|
|
118
|
+
return /^([-*+]\s|\d+\.\s|```|~~~|\||#{1,6}\s)/.test(line.trimStart());
|
|
119
|
+
}
|
|
78
120
|
run() {
|
|
79
121
|
const _super = Object.create(null, {
|
|
80
122
|
run: { get: () => super.run }
|
|
@@ -94,9 +136,8 @@ class Generate extends CommandBase {
|
|
|
94
136
|
ux.action.stop('done, no changelogs found.');
|
|
95
137
|
return;
|
|
96
138
|
}
|
|
97
|
-
const content = `# ${version} (${moment().format('YYYY-MM-DD')})\r\n\r\n${yield this.generateLog(changelogs, components)}`;
|
|
98
139
|
if (flags.preview) {
|
|
99
|
-
fs.writeFileSync(path.resolve(root, 'preview.md'),
|
|
140
|
+
fs.writeFileSync(path.resolve(root, 'preview.md'), yield this.generateChangelog(version, changelogs, components), 'utf8');
|
|
100
141
|
ux.action.stop('generated preview.md');
|
|
101
142
|
return;
|
|
102
143
|
}
|
|
@@ -105,7 +146,7 @@ class Generate extends CommandBase {
|
|
|
105
146
|
if (confirm) {
|
|
106
147
|
const changelogFile = path.resolve(root, flags.file);
|
|
107
148
|
const currentContents = fs.readFileSync(changelogFile, { encoding: 'utf8', flag: 'a+' });
|
|
108
|
-
fs.writeFileSync(changelogFile,
|
|
149
|
+
fs.writeFileSync(changelogFile, yield this.generateChangelog(version, changelogs, components, currentContents), { encoding: 'utf8', flag: 'w' });
|
|
109
150
|
// delete unreleased changelogs
|
|
110
151
|
for (const group of components) {
|
|
111
152
|
const componentChangelogFolder = path.join(changelogFolder, group);
|
|
@@ -85,8 +85,17 @@ class NpmDependencyUpdate extends CommandBase {
|
|
|
85
85
|
const packages = yield npmContext.packageList(this);
|
|
86
86
|
try {
|
|
87
87
|
yield this.updateDependencies(newVersion, packages, flags.force, flags.filter);
|
|
88
|
-
ux.action.start(`running 'yarn install'`, undefined, {
|
|
89
|
-
|
|
88
|
+
ux.action.start(`running 'yarn install'`, undefined, {
|
|
89
|
+
stdout: true,
|
|
90
|
+
});
|
|
91
|
+
const yarnVersion = yield this.getYarnVersion();
|
|
92
|
+
if (this.yarnIsBerryVersion(yarnVersion)) {
|
|
93
|
+
yield command.runCommand(['yarn', 'install', '--mode=update-lockfile']);
|
|
94
|
+
yield command.runCommand(['yarn', 'install', '--immutable']);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
yield command.runCommand(['yarn', 'install']);
|
|
98
|
+
}
|
|
90
99
|
ux.action.stop(`${chalk.green('done')}`);
|
|
91
100
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
101
|
}
|
package/lib/commands/sql.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export default class Sql extends CommandBase<typeof Sql> {
|
|
|
18
18
|
'table-name': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
19
19
|
'column-name': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
20
20
|
'column-type': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
21
|
+
dwh: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
21
22
|
};
|
|
22
23
|
private readonly _moduleTypes;
|
|
23
24
|
private _dbmsTypes;
|
package/lib/commands/sql.js
CHANGED
|
@@ -237,7 +237,8 @@ ADD COLUMN IF NOT EXISTS ${columnName} ${columnType};
|
|
|
237
237
|
}
|
|
238
238
|
const scriptLayer = flags.layer;
|
|
239
239
|
this.log(`Generating on SQL script layer:'${scriptLayer}'`);
|
|
240
|
-
const
|
|
240
|
+
const databaseFolder = flags.dwh ? 'database-dwh' : 'database';
|
|
241
|
+
const scriptsRootFolder = path.resolve(yield this.getGitRoot(), databaseFolder);
|
|
241
242
|
if (!(yield fs.pathExists(scriptsRootFolder))) {
|
|
242
243
|
this.error(`Could not resolve database scripts folder: ${scriptsRootFolder}`);
|
|
243
244
|
}
|
|
@@ -282,8 +283,12 @@ ADD COLUMN IF NOT EXISTS ${columnName} ${columnType};
|
|
|
282
283
|
Sql.description = 'creates a new database script';
|
|
283
284
|
Sql.usage = 'sql <type> <module> [flags]';
|
|
284
285
|
Sql.examples = [
|
|
285
|
-
`$ ops sql schema
|
|
286
|
+
`$ ops sql schema`,
|
|
287
|
+
`$ ops sql schema --dwh`,
|
|
288
|
+
`$ ops sql data acc`,
|
|
289
|
+
`$ ops sql data acc --dwh`,
|
|
286
290
|
`$ ops sql data shared --layer basic`,
|
|
291
|
+
`$ ops sql data shared --dwh --layer basic`,
|
|
287
292
|
`$ ops sql data shared --major`,
|
|
288
293
|
`$ ops sql data shared --offline --description "this is script description"`,
|
|
289
294
|
];
|
|
@@ -335,5 +340,9 @@ Sql.flags = {
|
|
|
335
340
|
'column-type': Flags.string({
|
|
336
341
|
description: 'type of the new column to be added',
|
|
337
342
|
}),
|
|
343
|
+
'dwh': Flags.boolean({
|
|
344
|
+
description: 'create database scripts for DWH',
|
|
345
|
+
default: false
|
|
346
|
+
}),
|
|
338
347
|
};
|
|
339
348
|
export default Sql;
|
package/oclif.manifest.json
CHANGED
|
@@ -210,8 +210,12 @@
|
|
|
210
210
|
},
|
|
211
211
|
"description": "creates a new database script",
|
|
212
212
|
"examples": [
|
|
213
|
-
"$ ops sql schema
|
|
213
|
+
"$ ops sql schema",
|
|
214
|
+
"$ ops sql schema --dwh",
|
|
215
|
+
"$ ops sql data acc",
|
|
216
|
+
"$ ops sql data acc --dwh",
|
|
214
217
|
"$ ops sql data shared --layer basic",
|
|
218
|
+
"$ ops sql data shared --dwh --layer basic",
|
|
215
219
|
"$ ops sql data shared --major",
|
|
216
220
|
"$ ops sql data shared --offline --description \"this is script description\""
|
|
217
221
|
],
|
|
@@ -284,6 +288,12 @@
|
|
|
284
288
|
"hasDynamicHelp": false,
|
|
285
289
|
"multiple": false,
|
|
286
290
|
"type": "option"
|
|
291
|
+
},
|
|
292
|
+
"dwh": {
|
|
293
|
+
"description": "create database scripts for DWH",
|
|
294
|
+
"name": "dwh",
|
|
295
|
+
"allowNo": false,
|
|
296
|
+
"type": "boolean"
|
|
287
297
|
}
|
|
288
298
|
},
|
|
289
299
|
"hasDynamicHelp": false,
|
|
@@ -1181,7 +1191,6 @@
|
|
|
1181
1191
|
"description": "Server hostname",
|
|
1182
1192
|
"env": "CI_SERVER_URL",
|
|
1183
1193
|
"name": "host",
|
|
1184
|
-
"required": true,
|
|
1185
1194
|
"default": "https://git.adacta-fintech.com",
|
|
1186
1195
|
"hasDynamicHelp": false,
|
|
1187
1196
|
"multiple": false,
|
|
@@ -1191,7 +1200,6 @@
|
|
|
1191
1200
|
"description": "Project ID",
|
|
1192
1201
|
"env": "CI_PROJECT_ID",
|
|
1193
1202
|
"name": "project",
|
|
1194
|
-
"required": true,
|
|
1195
1203
|
"default": "413",
|
|
1196
1204
|
"hasDynamicHelp": false,
|
|
1197
1205
|
"multiple": false,
|
|
@@ -1263,7 +1271,6 @@
|
|
|
1263
1271
|
"description": "Server hostname",
|
|
1264
1272
|
"env": "CI_SERVER_URL",
|
|
1265
1273
|
"name": "host",
|
|
1266
|
-
"required": true,
|
|
1267
1274
|
"default": "https://git.adacta-fintech.com",
|
|
1268
1275
|
"hasDynamicHelp": false,
|
|
1269
1276
|
"multiple": false,
|
|
@@ -1273,7 +1280,6 @@
|
|
|
1273
1280
|
"description": "Project ID",
|
|
1274
1281
|
"env": "CI_PROJECT_ID",
|
|
1275
1282
|
"name": "project",
|
|
1276
|
-
"required": true,
|
|
1277
1283
|
"default": "413",
|
|
1278
1284
|
"hasDynamicHelp": false,
|
|
1279
1285
|
"multiple": false,
|
|
@@ -1853,5 +1859,5 @@
|
|
|
1853
1859
|
]
|
|
1854
1860
|
}
|
|
1855
1861
|
},
|
|
1856
|
-
"version": "5.
|
|
1862
|
+
"version": "5.4.0-rc4"
|
|
1857
1863
|
}
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adinsure-ops/ops-cli",
|
|
3
3
|
"description": "Operations CLI for working with AdInsure",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.4.0-rc4",
|
|
5
5
|
"author": "Adacta Digital Service Department",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ops": "./bin/run.js"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@azure/msal-node": "
|
|
12
|
-
"@oclif/core": "
|
|
13
|
-
"@oclif/plugin-help": "
|
|
14
|
-
"@oclif/plugin-not-found": "
|
|
15
|
-
"@oclif/plugin-warn-if-update-available": "
|
|
16
|
-
"axios": "
|
|
17
|
-
"chalk": "
|
|
18
|
-
"fs-extra": "
|
|
19
|
-
"globby": "
|
|
20
|
-
"gray-matter": "
|
|
21
|
-
"ini": "
|
|
22
|
-
"inquirer": "
|
|
11
|
+
"@azure/msal-node": "2.8.1",
|
|
12
|
+
"@oclif/core": "3.26.6",
|
|
13
|
+
"@oclif/plugin-help": "6.0.22",
|
|
14
|
+
"@oclif/plugin-not-found": "3.1.9",
|
|
15
|
+
"@oclif/plugin-warn-if-update-available": "3.0.19",
|
|
16
|
+
"axios": "1.14.0",
|
|
17
|
+
"chalk": "5.3.0",
|
|
18
|
+
"fs-extra": "11.2.0",
|
|
19
|
+
"globby": "14.0.1",
|
|
20
|
+
"gray-matter": "4.0.3",
|
|
21
|
+
"ini": "4.1.2",
|
|
22
|
+
"inquirer": "9.2.21",
|
|
23
23
|
"jira-client": "8.2.2",
|
|
24
|
-
"jszip": "
|
|
25
|
-
"lodash-es": "
|
|
26
|
-
"minimatch": "
|
|
27
|
-
"moment": "
|
|
28
|
-
"oauth": "
|
|
29
|
-
"open": "
|
|
30
|
-
"replace-in-file": "
|
|
31
|
-
"rimraf": "
|
|
32
|
-
"semver": "
|
|
33
|
-
"tough-cookie": "
|
|
34
|
-
"tslib": "
|
|
35
|
-
"yaml": "
|
|
24
|
+
"jszip": "3.10.1",
|
|
25
|
+
"lodash-es": "4.17.21",
|
|
26
|
+
"minimatch": "9.0.4",
|
|
27
|
+
"moment": "2.30.1",
|
|
28
|
+
"oauth": "0.10.0",
|
|
29
|
+
"open": "10.1.0",
|
|
30
|
+
"replace-in-file": "7.1.0",
|
|
31
|
+
"rimraf": "5.0.7",
|
|
32
|
+
"semver": "7.6.2",
|
|
33
|
+
"tough-cookie": "4.1.4",
|
|
34
|
+
"tslib": "2.6.2",
|
|
35
|
+
"yaml": "2.4.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@eslint/js": "^9.2.0",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"typescript-eslint": "^7.9.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@types/node": "^
|
|
73
|
+
"@types/node": "^24.0.0"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
|
-
"node": ">=
|
|
76
|
+
"node": ">=20"
|
|
77
77
|
},
|
|
78
78
|
"files": [
|
|
79
79
|
"/bin",
|
|
@@ -100,6 +100,14 @@
|
|
|
100
100
|
"@oclif/plugin-not-found",
|
|
101
101
|
"@oclif/plugin-warn-if-update-available"
|
|
102
102
|
],
|
|
103
|
+
"update": {
|
|
104
|
+
"node": {
|
|
105
|
+
"targets": [
|
|
106
|
+
"linux-x64",
|
|
107
|
+
"linux-arm64"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
103
111
|
"topics": {
|
|
104
112
|
"download": {
|
|
105
113
|
"description": "download AdInsure platform bundle zip from Azure storage. Use download:[client, identity-server, scheduler, server, signalr, studio] for individual components"
|
|
@@ -122,5 +130,8 @@
|
|
|
122
130
|
"test-single-with-coverage": "nyc --require ts-node/register --extension .ts mocha --reporter=doc --timeout 20000 --forbid-only",
|
|
123
131
|
"eslint": "eslint --quiet --config .eslint.config.js --fix"
|
|
124
132
|
},
|
|
125
|
-
"types": "lib/index.d.ts"
|
|
133
|
+
"types": "lib/index.d.ts",
|
|
134
|
+
"resolutions": {
|
|
135
|
+
"axios": "1.14.0"
|
|
136
|
+
}
|
|
126
137
|
}
|