@adinsure-ops/ops-cli 5.0.4 → 5.0.5

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 (34) hide show
  1. package/CHANGELOGS.md +6 -7
  2. package/README.md +11 -1
  3. package/lib/command.base.d.ts +1 -0
  4. package/lib/command.base.js +11 -0
  5. package/lib/commands/docker/update-image-version.js +4 -0
  6. package/lib/commands/doctor.js +4 -0
  7. package/lib/commands/download/client.js +4 -0
  8. package/lib/commands/download/identity-server.js +4 -0
  9. package/lib/commands/download/jmeter.js +4 -0
  10. package/lib/commands/download/keycloak-scim.js +4 -0
  11. package/lib/commands/download/platform.js +4 -0
  12. package/lib/commands/download/scheduler.js +4 -0
  13. package/lib/commands/download/server.js +4 -0
  14. package/lib/commands/download/signalr.js +4 -0
  15. package/lib/commands/download/studio.js +4 -0
  16. package/lib/commands/gitlab/get-tag-pipeline.js +4 -0
  17. package/lib/commands/gitlab/next-nightly-tag.js +4 -0
  18. package/lib/commands/jira/issue.js +4 -0
  19. package/lib/commands/jira/labels.js +4 -0
  20. package/lib/commands/log/add.js +4 -0
  21. package/lib/commands/log/generate.js +4 -0
  22. package/lib/commands/log/validate.js +4 -0
  23. package/lib/commands/login.js +4 -0
  24. package/lib/commands/npm/check-publish.js +4 -0
  25. package/lib/commands/npm/dependency-update.js +4 -0
  26. package/lib/commands/npm/publish.js +4 -0
  27. package/lib/commands/nuget/dependency-update.d.ts +2 -2
  28. package/lib/commands/nuget/dependency-update.js +7 -2
  29. package/lib/commands/prepare-content.js +4 -0
  30. package/lib/commands/sql.js +4 -0
  31. package/lib/commands/translate.js +4 -0
  32. package/lib/commands/version.js +4 -0
  33. package/oclif.manifest.json +1 -1
  34. package/package.json +1 -1
package/CHANGELOGS.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelogs
2
2
 
3
+ ## 5.0.5: 2023-11-20
4
+
5
+ - Fixed the ops-cli releasing cycle as a few minor releases were not uploaded to npm.js
6
+
3
7
  ## 5.0.4: 2023-09-27
4
8
 
5
9
  - Fixed version command's post request, where the headers were actually stored in the body
@@ -19,21 +23,16 @@
19
23
  - Prepare-content command is back! But with a differenct syntax than before, so check the README
20
24
  - Faster performance and updated dependencies
21
25
 
22
- ## 5.0.0-rc5: 2023-09-08
26
+ ## 5.0.0: 2023-09-08
23
27
 
24
28
  - Added --description flag to the log command. It accepts the description of the changelog which will be used
25
29
  - Added --force flag to the log command. It creates folder structure if missing
26
-
27
- ## 5.0.0-rc4: 2023-09-05
28
-
29
30
  - Added --keep flag to the download:studio command
30
-
31
- ## 5.0.0-rc3: 2023-09-01
32
-
33
31
  - Bugfixes
34
32
  - Security patching: the project was migrated to a new oclif framework from the old one
35
33
  - Performace tuning
36
34
  - [DEPRECATED] Deprecation and removal of the prepare-content command
35
+ - [REMOVED] `--servicePrincipal` login is no longer available or required. 'AZURE_CLIENT_ID' and 'AZURE_CLIENT_SECRET' environment variables are required with every command in order to use service principal.
37
36
 
38
37
  ## 4.8.3: 2023-08-22
39
38
 
package/README.md CHANGED
@@ -21,7 +21,17 @@ 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).
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/)**.
25
+
26
+ ## Upgrade guilde
27
+
28
+ ### Upgrade to version 5
29
+
30
+ Node 18 or 20 are required.
31
+
32
+ ### Upgrade to version 4
33
+
34
+ We changed the way service principal login works. It is no longer needed to call login command for service principal login (for example in CI). Commands `ops login --servicePrincipal -c ${AZURE_CLIENT_ID} -s ${AZURE_CLIENT_SECRET}` should be removed, but `AZURE_CLIENT_ID` and `AZURE_CLIENT_SECRET` environment variables should exists, because OPS Cli uses it in background.
25
35
 
26
36
  ## Commands
27
37
 
@@ -18,4 +18,5 @@ export default abstract class CommandBase<T extends typeof Command> extends Comm
18
18
  * @returns {string[]} An array of files inside the directory with the specified filter
19
19
  */
20
20
  getFilesRecursive(dir: string, baseRelativePath: string, filter: RegExp): Promise<string[]>;
21
+ run(): Promise<any>;
21
22
  }
@@ -2,6 +2,8 @@ import { __awaiter } from "tslib";
2
2
  import { Command } from '@oclif/core';
3
3
  import fs from 'fs-extra';
4
4
  import path from 'path';
5
+ import chalk from 'chalk';
6
+ import axios from 'axios';
5
7
  import SecurityContext from './security/context.js';
6
8
  /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
7
9
  export default class CommandBase extends Command {
@@ -82,4 +84,13 @@ export default class CommandBase extends Command {
82
84
  return files;
83
85
  });
84
86
  }
87
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
+ run() {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ axios.interceptors.request.use(req => {
91
+ this.debug(`${chalk.bgCyan('DEBUG: ')} Request that was sent with your command:\n${JSON.stringify(req, null, 2)}`);
92
+ return req;
93
+ });
94
+ });
95
+ }
85
96
  }
@@ -5,7 +5,11 @@ import { parse as yamlParse, stringify as yamlStringify } from 'yaml';
5
5
  import CommandBase from '../../command.base.js';
6
6
  class DockerUpdateImageVersion extends CommandBase {
7
7
  run() {
8
+ const _super = Object.create(null, {
9
+ run: { get: () => super.run }
10
+ });
8
11
  return __awaiter(this, void 0, void 0, function* () {
12
+ _super.run.call(this);
9
13
  const { args, flags } = yield this.parse(DockerUpdateImageVersion);
10
14
  try {
11
15
  const parsedYaml = yamlParse(fs.readFileSync(flags['file-path'], 'utf8'));
@@ -263,7 +263,11 @@ class Doctor extends CommandBase {
263
263
  });
264
264
  }
265
265
  run() {
266
+ const _super = Object.create(null, {
267
+ run: { get: () => super.run }
268
+ });
266
269
  return __awaiter(this, void 0, void 0, function* () {
270
+ _super.run.call(this);
267
271
  const { flags } = yield this.parse(Doctor);
268
272
  yield this.gitCheck(flags.fix);
269
273
  yield this.nvmCheck();
@@ -29,7 +29,11 @@ class DownloadClient extends CommandBase {
29
29
  });
30
30
  }
31
31
  run() {
32
+ const _super = Object.create(null, {
33
+ run: { get: () => super.run }
34
+ });
32
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ _super.run.call(this);
33
37
  const { flags } = yield this.parse(DownloadClient);
34
38
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
35
39
  const filename = `AdInsure-client-${flags.version}.zip`;
@@ -29,7 +29,11 @@ class DownloadIdentityServer extends CommandBase {
29
29
  });
30
30
  }
31
31
  run() {
32
+ const _super = Object.create(null, {
33
+ run: { get: () => super.run }
34
+ });
32
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ _super.run.call(this);
33
37
  const { flags } = yield this.parse(DownloadIdentityServer);
34
38
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
35
39
  const filename = `AdInsure-identityServer-${flags.version}.zip`;
@@ -24,7 +24,11 @@ class DownloadJmeter extends CommandBase {
24
24
  });
25
25
  }
26
26
  run() {
27
+ const _super = Object.create(null, {
28
+ run: { get: () => super.run }
29
+ });
27
30
  return __awaiter(this, void 0, void 0, function* () {
31
+ _super.run.call(this);
28
32
  const { flags } = yield this.parse(DownloadJmeter);
29
33
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
30
34
  const filename = `jmeter-artifacts.zip`;
@@ -24,7 +24,11 @@ class DownloadKeycloak extends CommandBase {
24
24
  });
25
25
  }
26
26
  run() {
27
+ const _super = Object.create(null, {
28
+ run: { get: () => super.run }
29
+ });
27
30
  return __awaiter(this, void 0, void 0, function* () {
31
+ _super.run.call(this);
28
32
  const { flags } = yield this.parse(DownloadKeycloak);
29
33
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
30
34
  const filename = `Keycloak-scim-${flags.version}.zip`;
@@ -29,7 +29,11 @@ class DownloadPlatform extends CommandBase {
29
29
  });
30
30
  }
31
31
  run() {
32
+ const _super = Object.create(null, {
33
+ run: { get: () => super.run }
34
+ });
32
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ _super.run.call(this);
33
37
  const { flags } = yield this.parse(DownloadPlatform);
34
38
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
35
39
  const filename = `AdInsure-${flags.version}.zip`;
@@ -29,7 +29,11 @@ class DownloadScheduler extends CommandBase {
29
29
  });
30
30
  }
31
31
  run() {
32
+ const _super = Object.create(null, {
33
+ run: { get: () => super.run }
34
+ });
32
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ _super.run.call(this);
33
37
  const { flags } = yield this.parse(DownloadScheduler);
34
38
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
35
39
  const filename = `AdInsureScheduler-${flags.version}.zip`;
@@ -29,7 +29,11 @@ class DownloadServer extends CommandBase {
29
29
  });
30
30
  }
31
31
  run() {
32
+ const _super = Object.create(null, {
33
+ run: { get: () => super.run }
34
+ });
32
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ _super.run.call(this);
33
37
  const { flags } = yield this.parse(DownloadServer);
34
38
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
35
39
  const filename = `AdInsure-server-${flags.version}.zip`;
@@ -29,7 +29,11 @@ class DownloadSignalrServer extends CommandBase {
29
29
  });
30
30
  }
31
31
  run() {
32
+ const _super = Object.create(null, {
33
+ run: { get: () => super.run }
34
+ });
32
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ _super.run.call(this);
33
37
  const { flags } = yield this.parse(DownloadSignalrServer);
34
38
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
35
39
  const filename = `AdInsure-signalr-${flags.version}.zip`;
@@ -47,7 +47,11 @@ class DownloadStudio extends CommandBase {
47
47
  });
48
48
  }
49
49
  run() {
50
+ const _super = Object.create(null, {
51
+ run: { get: () => super.run }
52
+ });
50
53
  return __awaiter(this, void 0, void 0, function* () {
54
+ _super.run.call(this);
51
55
  const { flags } = yield this.parse(DownloadStudio);
52
56
  // The os.homedir expands the ~ char, as the node path.resolve method does not expand it
53
57
  const basePath = flags.output.charAt(0) === '~' ? os.homedir() + flags.output.split('~')[1] : flags.output;
@@ -83,7 +83,11 @@ class GitlabGetTagPipeline extends CommandBase {
83
83
  });
84
84
  }
85
85
  run() {
86
+ const _super = Object.create(null, {
87
+ run: { get: () => super.run }
88
+ });
86
89
  return __awaiter(this, void 0, void 0, function* () {
90
+ _super.run.call(this);
87
91
  const { args, flags } = yield this.parse(GitlabGetTagPipeline);
88
92
  const gitlab = new GitLab(flags.host, flags.project, flags.pat);
89
93
  if (!flags.wait) {
@@ -6,7 +6,11 @@ import CommandBase from '../../command.base.js';
6
6
  import GitLab from '../../lib/gitlab.js';
7
7
  class GitlabNextNightlyTag extends CommandBase {
8
8
  run() {
9
+ const _super = Object.create(null, {
10
+ run: { get: () => super.run }
11
+ });
9
12
  return __awaiter(this, void 0, void 0, function* () {
13
+ _super.run.call(this);
10
14
  const { args, flags } = yield this.parse(GitlabNextNightlyTag);
11
15
  const gitlab = new GitLab(flags.host, flags.project, flags.pat);
12
16
  const re = /^release\/(\w+-)?((\d+)(\.\d+)?)$/;
@@ -3,7 +3,11 @@ import { Args } from '@oclif/core';
3
3
  import CommandBaseJira from '../../command.base.jira.js';
4
4
  class JiraLabels extends CommandBaseJira {
5
5
  run() {
6
+ const _super = Object.create(null, {
7
+ run: { get: () => super.run }
8
+ });
6
9
  return __awaiter(this, void 0, void 0, function* () {
10
+ _super.run.call(this);
7
11
  const { args, flags } = yield this.parse(JiraLabels);
8
12
  const jira = yield this.jiraInit(flags.hostname, flags.username, flags.password);
9
13
  try {
@@ -27,7 +27,11 @@ class JiraLabels extends CommandBaseJira {
27
27
  });
28
28
  }
29
29
  run() {
30
+ const _super = Object.create(null, {
31
+ run: { get: () => super.run }
32
+ });
30
33
  return __awaiter(this, void 0, void 0, function* () {
34
+ _super.run.call(this);
31
35
  const { args, flags } = yield this.parse(JiraLabels);
32
36
  const jira = yield this.jiraInit(flags.hostname, flags.username, flags.password);
33
37
  if (flags.remove || flags.add) {
@@ -7,7 +7,11 @@ import path from 'path';
7
7
  import CommandBase from '../../command.base.js';
8
8
  class Changelog extends CommandBase {
9
9
  run() {
10
+ const _super = Object.create(null, {
11
+ run: { get: () => super.run }
12
+ });
10
13
  return __awaiter(this, void 0, void 0, function* () {
14
+ _super.run.call(this);
11
15
  const { args, flags } = yield this.parse(Changelog);
12
16
  // Validation of input parameters
13
17
  const changelogFolderBase = yield this.getChangelogsRoot();
@@ -76,8 +76,12 @@ class Generate extends CommandBase {
76
76
  });
77
77
  }
78
78
  run() {
79
+ const _super = Object.create(null, {
80
+ run: { get: () => super.run }
81
+ });
79
82
  var _a;
80
83
  return __awaiter(this, void 0, void 0, function* () {
84
+ _super.run.call(this);
81
85
  const { flags } = yield this.parse(Generate);
82
86
  const root = path.resolve(process.cwd());
83
87
  const changelogFolder = yield this.getChangelogsRoot();
@@ -30,7 +30,11 @@ class Validate extends CommandBase {
30
30
  });
31
31
  }
32
32
  run() {
33
+ const _super = Object.create(null, {
34
+ run: { get: () => super.run }
35
+ });
33
36
  return __awaiter(this, void 0, void 0, function* () {
37
+ _super.run.call(this);
34
38
  const directory = yield this.getChangelogsRoot();
35
39
  const files = yield this.getFilesRecursive(directory, directory, /\.md$/i);
36
40
  ux.action.start('validating changelogs', undefined, { stdout: true });
@@ -43,7 +43,11 @@ class Login extends CommandBase {
43
43
  });
44
44
  }
45
45
  run() {
46
+ const _super = Object.create(null, {
47
+ run: { get: () => super.run }
48
+ });
46
49
  return __awaiter(this, void 0, void 0, function* () {
50
+ _super.run.call(this);
47
51
  const { flags } = yield this.parse(Login);
48
52
  if (flags.force) {
49
53
  fs.unlink(path.resolve(this.security.getTokenPath()), () => {
@@ -29,7 +29,11 @@ class NpmCheckPublish extends CommandBase {
29
29
  });
30
30
  }
31
31
  run() {
32
+ const _super = Object.create(null, {
33
+ run: { get: () => super.run }
34
+ });
32
35
  return __awaiter(this, void 0, void 0, function* () {
36
+ _super.run.call(this);
33
37
  try {
34
38
  // eslint-disable-next-line unicorn/no-await-expression-member
35
39
  const { flags } = (yield this.parse(NpmCheckPublish)).flags;
@@ -69,7 +69,11 @@ class NpmDependencyUpdate extends CommandBase {
69
69
  });
70
70
  }
71
71
  run() {
72
+ const _super = Object.create(null, {
73
+ run: { get: () => super.run }
74
+ });
72
75
  return __awaiter(this, void 0, void 0, function* () {
76
+ _super.run.call(this);
73
77
  const { args, flags } = yield this.parse(NpmDependencyUpdate);
74
78
  const newVersion = semver.valid(args.version);
75
79
  const npmContext = new NpmContext();
@@ -138,7 +138,11 @@ class NpmPublish extends CommandBase {
138
138
  });
139
139
  }
140
140
  run() {
141
+ const _super = Object.create(null, {
142
+ run: { get: () => super.run }
143
+ });
141
144
  return __awaiter(this, void 0, void 0, function* () {
145
+ _super.run.call(this);
142
146
  try {
143
147
  const { flags } = yield this.parse(NpmPublish);
144
148
  const npmContext = new NpmContext();
@@ -1,5 +1,5 @@
1
- import { Command } from '@oclif/core';
2
- export default class NuGetDependencyUpdate extends Command {
1
+ import CommandBase from '../../command.base.js';
2
+ export default class NuGetDependencyUpdate extends CommandBase<typeof NuGetDependencyUpdate> {
3
3
  static description: string;
4
4
  static usage: string;
5
5
  static examples: string[];
@@ -1,10 +1,11 @@
1
1
  import { __awaiter } from "tslib";
2
- import { Args, Command, Flags } from '@oclif/core';
2
+ import { Args, Flags } from '@oclif/core';
3
3
  import chalk from 'chalk';
4
4
  import fs from 'fs-extra';
5
5
  import semver from 'semver';
6
6
  import NugetContext from '../../lib/nuget.js';
7
- class NuGetDependencyUpdate extends Command {
7
+ import CommandBase from '../../command.base.js';
8
+ class NuGetDependencyUpdate extends CommandBase {
8
9
  /**
9
10
  * Update dependencies in csproj files for @adinsure packages
10
11
  * @param
@@ -35,7 +36,11 @@ class NuGetDependencyUpdate extends Command {
35
36
  });
36
37
  }
37
38
  run() {
39
+ const _super = Object.create(null, {
40
+ run: { get: () => super.run }
41
+ });
38
42
  return __awaiter(this, void 0, void 0, function* () {
43
+ _super.run.call(this);
39
44
  const { args, flags } = yield this.parse(NuGetDependencyUpdate);
40
45
  const newVersion = semver.valid(args.version);
41
46
  const nugetContext = new NugetContext();
@@ -357,7 +357,11 @@ class PrepareContent extends CommandBase {
357
357
  }
358
358
  */
359
359
  run() {
360
+ const _super = Object.create(null, {
361
+ run: { get: () => super.run }
362
+ });
360
363
  return __awaiter(this, void 0, void 0, function* () {
364
+ _super.run.call(this);
361
365
  const { flags } = yield this.parse(PrepareContent);
362
366
  // read the flags and set paths relative to execution directory
363
367
  let source = path.relative(process.cwd(), flags.source);
@@ -145,8 +145,12 @@ end;`;
145
145
  }
146
146
  // eslint-disable-next-line complexity
147
147
  run() {
148
+ const _super = Object.create(null, {
149
+ run: { get: () => super.run }
150
+ });
148
151
  var _a, _b, _c;
149
152
  return __awaiter(this, void 0, void 0, function* () {
153
+ _super.run.call(this);
150
154
  const { args, flags } = yield this.parse(Sql);
151
155
  const fullVersion = (_a = flags.version) !== null && _a !== void 0 ? _a : yield this.getVersion('SQL_SCRIPTS_VERSION', 'PLATFORM_VERSION', 'VERSION');
152
156
  let version = semver.parse(fullVersion);
@@ -83,7 +83,11 @@ class Translate extends CommandBase {
83
83
  });
84
84
  }
85
85
  run() {
86
+ const _super = Object.create(null, {
87
+ run: { get: () => super.run }
88
+ });
86
89
  return __awaiter(this, void 0, void 0, function* () {
90
+ _super.run.call(this);
87
91
  const { args, flags } = yield this.parse(Translate);
88
92
  const destination = flags.output;
89
93
  if (flags.format === 'json' && flags.module === undefined) {
@@ -178,7 +178,11 @@ class Version extends CommandBase {
178
178
  });
179
179
  }
180
180
  run() {
181
+ const _super = Object.create(null, {
182
+ run: { get: () => super.run }
183
+ });
181
184
  return __awaiter(this, void 0, void 0, function* () {
185
+ _super.run.call(this);
182
186
  const { args, flags } = yield this.parse(Version);
183
187
  const currentPrereleaseDate = moment().format('YYYYMM');
184
188
  // Check if token is correct and save it for later use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.4",
2
+ "version": "5.0.5",
3
3
  "commands": {
4
4
  "doctor": {
5
5
  "id": "doctor",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adinsure-ops/ops-cli",
3
3
  "description": "Operations CLI for working with AdInsure",
4
- "version": "5.0.4",
4
+ "version": "5.0.5",
5
5
  "author": "Adacta Digital Service Department",
6
6
  "bin": {
7
7
  "ops": "./bin/run.js"