@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,71 +1,78 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const child_process_1 = require("child_process");
5
- class ChildProcessCommand {
1
+ import { __asyncValues, __awaiter } from "tslib";
2
+ import { spawn } from 'child_process';
3
+ export default class ChildProcessCommand {
6
4
  /**
7
5
  * Only Windows supported at this point
6
+ * @param cmd Command to run
7
+ * @return {void}
8
8
  */
9
- async runCommand(cmd) {
10
- var e_1, _a, e_2, _b;
11
- let sh;
12
- let args;
13
- let cp;
14
- // cross platform compatibility
15
- if (process.platform === 'win32') {
16
- sh = 'cmd';
17
- args = ['/c'].concat(cmd);
18
- }
19
- else {
20
- [sh, ...args] = cmd;
21
- }
22
- try {
23
- cp = child_process_1.spawn(sh, args, {
24
- // cwd:
25
- // pkg.path,
26
- env: Object.assign(Object.assign({}, process.env), process.stdout.isTTY ? { FORCE_COLOR: process.env.FORCE_COLOR || '1' } : {}),
27
- stdio: 'pipe',
28
- shell: true
29
- });
30
- let data = '';
31
- try {
32
- for (var _c = tslib_1.__asyncValues(cp.stdout), _d; _d = await _c.next(), !_d.done;) {
33
- const chunk = _d.value;
34
- data += chunk;
35
- }
9
+ runCommand(cmd) {
10
+ var _a, e_1, _b, _c, _d, e_2, _e, _f;
11
+ var _g;
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ let sh;
14
+ let args;
15
+ let cp;
16
+ // cross platform compatibility
17
+ if (process.platform === 'win32') {
18
+ sh = 'cmd';
19
+ args = ['/c', ...cmd];
36
20
  }
37
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
38
- finally {
39
- try {
40
- if (_d && !_d.done && (_a = _c.return)) await _a.call(_c);
41
- }
42
- finally { if (e_1) throw e_1.error; }
21
+ else {
22
+ [sh, ...args] = cmd;
43
23
  }
44
- let error = '';
45
24
  try {
46
- for (var _e = tslib_1.__asyncValues(cp.stderr), _f; _f = await _e.next(), !_f.done;) {
47
- const chunk = _f.value;
48
- error += chunk;
25
+ cp = spawn(sh, args, {
26
+ // cwd:
27
+ // pkg.path,
28
+ env: Object.assign(Object.assign({}, process.env), process.stdout.isTTY ? { FORCE_COLOR: (_g = process.env.FORCE_COLOR) !== null && _g !== void 0 ? _g : '1' } : {}),
29
+ stdio: 'pipe',
30
+ shell: true,
31
+ });
32
+ let data = '';
33
+ try {
34
+ for (var _h = true, _j = __asyncValues(cp.stdout), _k; _k = yield _j.next(), _a = _k.done, !_a; _h = true) {
35
+ _c = _k.value;
36
+ _h = false;
37
+ const chunk = _c;
38
+ data += chunk;
39
+ }
49
40
  }
50
- }
51
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
52
- finally {
41
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
42
+ finally {
43
+ try {
44
+ if (!_h && !_a && (_b = _j.return)) yield _b.call(_j);
45
+ }
46
+ finally { if (e_1) throw e_1.error; }
47
+ }
48
+ let error = '';
53
49
  try {
54
- if (_f && !_f.done && (_b = _e.return)) await _b.call(_e);
50
+ for (var _l = true, _m = __asyncValues(cp.stderr), _o; _o = yield _m.next(), _d = _o.done, !_d; _l = true) {
51
+ _f = _o.value;
52
+ _l = false;
53
+ const chunk = _f;
54
+ error += chunk;
55
+ }
56
+ }
57
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
58
+ finally {
59
+ try {
60
+ if (!_l && !_d && (_e = _m.return)) yield _e.call(_m);
61
+ }
62
+ finally { if (e_2) throw e_2.error; }
63
+ }
64
+ const exitCode = yield new Promise((resolve, _reject) => {
65
+ cp.on('close', resolve);
66
+ });
67
+ if (exitCode) {
68
+ throw new Error(`subprocess error exit ${exitCode}, ${error}`);
55
69
  }
56
- finally { if (e_2) throw e_2.error; }
70
+ return { data, error };
71
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
72
  }
58
- const exitCode = await new Promise((resolve, _reject) => {
59
- cp.on('close', resolve);
60
- });
61
- if (exitCode) {
62
- throw new Error(`subprocess error exit ${exitCode}, ${error}`);
73
+ catch (error) {
74
+ throw new Error(error.message);
63
75
  }
64
- return { data, error };
65
- }
66
- catch (err) {
67
- throw new Error(err.message);
68
- }
76
+ });
69
77
  }
70
78
  }
71
- exports.default = ChildProcessCommand;
@@ -1,4 +1,4 @@
1
- import * as semver from 'semver';
1
+ import semver from 'semver';
2
2
  export default class GitLab {
3
3
  private readonly pat;
4
4
  private readonly host;
@@ -7,11 +7,17 @@ export default class GitLab {
7
7
  constructor(host: string, project: string, pat: string);
8
8
  /**
9
9
  * Try to figure out latest available version already created
10
+ * @param searchVersion Version to search for
11
+ * @param prefix Prefix
12
+ * @returns {semver.SemVer} Version object
10
13
  */
11
14
  getLatestVersion(searchVersion: string, prefix?: string): Promise<semver.SemVer>;
12
15
  /**
13
16
  * Try to figure out latest available version already created
17
+ * @param tagName Tag name
18
+ * @param ref Reference
19
+ * @returns {void}
14
20
  */
15
- createNewTag(tag_name: string, ref: string): Promise<void>;
21
+ createNewTag(tagName: string, ref: string): Promise<void>;
16
22
  getTagPipelineStatus(tag: string): Promise<string>;
17
23
  }
package/lib/lib/gitlab.js CHANGED
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const axios_1 = require("axios");
4
- const semver = require("semver");
5
- class GitLab {
1
+ import { __awaiter } from "tslib";
2
+ import axios from 'axios';
3
+ import semver from 'semver';
4
+ export default class GitLab {
6
5
  constructor(host, project, pat) {
7
6
  this.apiBase = '/api/v4/projects';
8
7
  this.pat = pat;
@@ -11,89 +10,102 @@ class GitLab {
11
10
  }
12
11
  /**
13
12
  * Try to figure out latest available version already created
13
+ * @param searchVersion Version to search for
14
+ * @param prefix Prefix
15
+ * @returns {semver.SemVer} Version object
14
16
  */
15
- async getLatestVersion(searchVersion, prefix = '') {
16
- let versions = [];
17
- try {
18
- let page = 1;
19
- let totalPages = 1;
20
- do {
21
- let response = await axios_1.default.get(`${this.host}${this.apiBase}/${this.project}/repository/tags`, {
22
- headers: {
23
- Authorization: `Bearer ${this.pat}`,
24
- },
25
- params: {
26
- search: `^${prefix}v${searchVersion}`,
27
- per_page: 100,
28
- page
29
- }
30
- });
31
- response.data.forEach((tag) => {
32
- const regex = new RegExp(`${prefix}(.*)`);
33
- let searchTag = tag;
34
- let match = tag.name.match(regex);
35
- if (match[1]) {
36
- searchTag = match[1];
37
- }
38
- const customOptions = {
39
- includePrerelease: true,
40
- };
41
- let semanticVersion = semver.parse(searchTag, customOptions);
42
- if (semanticVersion && semanticVersion.prerelease.length === 0) {
43
- versions.push(semanticVersion);
44
- // ignore versions that that doesn't have number for prerelease identifier (skip qa and test prereleases)
45
- }
46
- else if (semanticVersion && semanticVersion.prerelease.length === 2 && /^[0-9]+$/.test(semanticVersion.prerelease[1].toString())) {
47
- versions.push(semanticVersion);
48
- }
49
- });
50
- totalPages = parseInt(response.headers['x-total-pages'], 10);
51
- page++;
52
- } while (page <= totalPages);
53
- }
54
- catch (err) {
55
- throw new Error(err);
56
- }
57
- return semver.rsort(versions)[0];
17
+ getLatestVersion(searchVersion, prefix = '') {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const versions = [];
20
+ try {
21
+ let page = 1;
22
+ let totalPages = 1;
23
+ do {
24
+ const response = yield axios.get(`${this.host}${this.apiBase}/${this.project}/repository/tags`, {
25
+ headers: {
26
+ Authorization: `Bearer ${this.pat}`,
27
+ },
28
+ params: {
29
+ search: `^${prefix}v${searchVersion}`,
30
+ // eslint-disable-next-line camelcase
31
+ per_page: 100,
32
+ page,
33
+ },
34
+ });
35
+ // eslint-disable-next-line unicorn/no-array-for-each, @typescript-eslint/no-explicit-any
36
+ response.data.forEach((tag) => {
37
+ const regex = new RegExp(`${prefix}(.*)`);
38
+ let searchTag = tag;
39
+ const match = tag.name.match(regex);
40
+ if (match[1]) {
41
+ searchTag = match[1];
42
+ }
43
+ const customOptions = {
44
+ includePrerelease: true,
45
+ };
46
+ const semanticVersion = semver.parse(searchTag, customOptions);
47
+ if (semanticVersion && semanticVersion.prerelease.length === 0) {
48
+ versions.push(semanticVersion);
49
+ // ignore versions that that doesn't have number for prerelease identifier (skip qa and test prereleases)
50
+ }
51
+ else if (semanticVersion && semanticVersion.prerelease.length === 2 && /^\d+$/.test(semanticVersion.prerelease[1].toString())) {
52
+ versions.push(semanticVersion);
53
+ }
54
+ });
55
+ totalPages = Number.parseInt(response.headers['x-total-pages'], 10);
56
+ page++;
57
+ } while (page <= totalPages);
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ }
60
+ catch (error) {
61
+ throw new Error(error);
62
+ }
63
+ return semver.rsort(versions)[0];
64
+ });
58
65
  }
59
66
  /**
60
67
  * Try to figure out latest available version already created
68
+ * @param tagName Tag name
69
+ * @param ref Reference
70
+ * @returns {void}
61
71
  */
62
- async createNewTag(tag_name, ref) {
63
- try {
64
- await axios_1.default.post(`${this.host}${this.apiBase}/${this.project}/repository/tags`, {
65
- tag_name,
66
- ref
67
- }, {
68
- headers: {
69
- Authorization: `Bearer ${this.pat}`,
70
- }
71
- });
72
- }
73
- catch (err) {
74
- throw new Error(err);
75
- }
76
- return;
72
+ createNewTag(tagName, ref) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ try {
75
+ yield axios.post(`${this.host}${this.apiBase}/${this.project}/repository/tags`, {
76
+ tagName,
77
+ ref,
78
+ }, {
79
+ headers: {
80
+ Authorization: `Bearer ${this.pat}`,
81
+ },
82
+ });
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ }
85
+ catch (error) {
86
+ throw new Error(error);
87
+ }
88
+ });
77
89
  }
78
- async getTagPipelineStatus(tag) {
79
- let pipelines = null;
80
- tag = tag.replace(/^v/g, ''); // trim if tag starts with v because already include it in search
81
- try {
82
- pipelines = await axios_1.default.get(`${this.host}${this.apiBase}/${this.project}/pipelines?ref=v${tag}`, {
83
- headers: {
84
- Authorization: `Bearer ${this.pat}`,
85
- }
86
- });
87
- }
88
- catch (err) {
89
- throw new Error(err);
90
- }
91
- if (pipelines.data.length > 0) {
92
- return pipelines.data[0].status;
93
- }
94
- else {
90
+ getTagPipelineStatus(tag) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ let pipelines = null;
93
+ tag = tag.replaceAll(/^v/g, ''); // trim if tag starts with v because already include it in search
94
+ try {
95
+ pipelines = yield axios.get(`${this.host}${this.apiBase}/${this.project}/pipelines?ref=v${tag}`, {
96
+ headers: {
97
+ Authorization: `Bearer ${this.pat}`,
98
+ },
99
+ });
100
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
+ }
102
+ catch (error) {
103
+ throw new Error(error);
104
+ }
105
+ if (pipelines.data.length > 0) {
106
+ return pipelines.data[0].status;
107
+ }
95
108
  return 'unknown';
96
- }
109
+ });
97
110
  }
98
111
  }
99
- exports.default = GitLab;
package/lib/lib/npm.d.ts CHANGED
@@ -1,15 +1,19 @@
1
- import { NpmPackage } from '../types/npm.types';
1
+ import { AxiosResponse } from 'axios';
2
+ import { NpmPackage } from '../types/npm.types.js';
2
3
  export default class NpmContext {
3
4
  /**
4
5
  * Get all workspaces
6
+ * @returns {Promise<string[]>} String array of all workspaces
5
7
  */
6
8
  getWorkspaces(): Promise<string[]>;
7
9
  /**
8
10
  * Get package names
9
11
  */
10
- packageList(packages: string[] | undefined, excludes: string[] | undefined, context: any): Promise<NpmPackage[]>;
12
+ packageList(context: any, packages?: string[], excludes?: string[]): Promise<NpmPackage[]>;
11
13
  /**
12
14
  * Get package all packages
15
+ * @param patToken Auth token
16
+ * @returns {Promise<string>} Returns all the NPM packages
13
17
  */
14
- getAllNpmPackages(patToken?: string): Promise<string>;
18
+ getAllNpmPackages(patToken?: string): Promise<AxiosResponse<any, any>>;
15
19
  }
package/lib/lib/npm.js CHANGED
@@ -1,79 +1,91 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chalk_1 = require("chalk");
4
- const fs = require("fs-extra");
5
- const globby = require("globby");
6
- const minimatch = require("minimatch");
7
- const path = require("path");
8
- const request = require("request-promise");
9
- class NpmContext {
1
+ import { __awaiter } from "tslib";
2
+ import axios from 'axios';
3
+ import chalk from 'chalk';
4
+ import fs from 'fs-extra';
5
+ import { globby } from 'globby';
6
+ import { minimatch } from 'minimatch';
7
+ import path from 'path';
8
+ export default class NpmContext {
10
9
  /**
11
10
  * Get all workspaces
11
+ * @returns {Promise<string[]>} String array of all workspaces
12
12
  */
13
- async getWorkspaces() {
14
- let workspaces = [];
15
- try {
16
- let data = await fs.readJSON('./package.json');
17
- if (!data.workspaces) {
18
- return [];
13
+ getWorkspaces() {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const workspaces = [];
16
+ try {
17
+ const data = yield fs.readJSON('./package.json');
18
+ if (!data.workspaces) {
19
+ return [];
20
+ }
21
+ for (const workspace of data.workspaces.packages) {
22
+ workspaces.push(`${workspace}/+(package.json|yarn.json)`);
23
+ }
24
+ return workspaces;
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
26
  }
20
- for (const workspace of data.workspaces.packages) {
21
- workspaces.push(`${workspace}/+(package.json|yarn.json)`);
27
+ catch (error) {
28
+ throw new Error(error.message);
22
29
  }
23
- return workspaces;
24
- }
25
- catch (err) {
26
- throw new Error(err.message);
27
- }
30
+ });
28
31
  }
29
32
  /**
30
33
  * Get package names
31
34
  */
32
- async packageList(packages = ['**/*'], excludes = [''], context) {
33
- try {
34
- let workspaces = await this.getWorkspaces();
35
- let searchPattern = ['package.json', '**/package.json', '!**/node_modules'];
36
- let pkgs = [];
37
- if (workspaces.length > 0) {
38
- searchPattern = workspaces.concat(['package.json', '!**/node_modules']);
39
- }
40
- const pkgPaths = await globby(searchPattern);
41
- for (const pkgPath of pkgPaths) {
42
- try {
43
- let data = await fs.readJSON(pkgPath);
44
- if (!data.version || !data.name || excludes.indexOf(data.name) >= 0 || !packages.some(pkg => minimatch(data.name, pkg))) {
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ packageList(context, packages = ['**/*'], excludes = ['']) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ try {
39
+ const workspaces = yield this.getWorkspaces();
40
+ let searchPattern = ['package.json', '**/package.json', '!**/node_modules'];
41
+ const pkgs = [];
42
+ if (workspaces.length > 0) {
43
+ searchPattern = [...workspaces, 'package.json', '!**/node_modules'];
44
+ }
45
+ const pkgPaths = yield globby(searchPattern);
46
+ for (const pkgPath of pkgPaths) {
47
+ try {
48
+ const data = yield fs.readJSON(pkgPath);
49
+ if (!data.version || !data.name || excludes.includes(data.name) || !packages.some(pkg => minimatch(data.name, pkg))) {
50
+ continue;
51
+ }
52
+ // create object to simply remove duplicates
53
+ pkgs[data.name] = {
54
+ name: data.name,
55
+ path: path.dirname(pkgPath),
56
+ jsonPath: pkgPath,
57
+ version: data.version,
58
+ };
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
+ }
61
+ catch (error) {
62
+ context.warn(`Error reading package.json: ${chalk.yellow(error.message)}.`);
45
63
  continue;
46
64
  }
47
- // create object to simply remove duplicates
48
- pkgs[data.name] = {
49
- name: data.name,
50
- path: path.dirname(pkgPath),
51
- jsonPath: pkgPath,
52
- version: data.version
53
- };
54
- }
55
- catch (err) {
56
- context.warn(`Error reading package.json: ${chalk_1.default.yellow(err.message)}.`);
57
- continue;
58
65
  }
66
+ return Object.values(pkgs); // return array of values
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
68
  }
60
- return Object.values(pkgs); // return array of values
61
- }
62
- catch (err) {
63
- throw new Error(`Unknown error: ${chalk_1.default.red(err)}`);
64
- }
69
+ catch (error) {
70
+ throw new Error(`Unknown error: ${chalk.red(error)}`);
71
+ }
72
+ });
65
73
  }
66
74
  /**
67
75
  * Get package all packages
76
+ * @param patToken Auth token
77
+ * @returns {Promise<string>} Returns all the NPM packages
68
78
  */
69
- async getAllNpmPackages(patToken = '') {
70
- let options = {
71
- uri: `https://feeds.dev.azure.com/adacta-fintech/adinsure/_apis/packaging/Feeds/feed/packages?api-version=6.0-preview.1&includeAllVersions=true&protocolType=Npm`,
72
- headers: {
73
- Authorization: 'Basic ' + Buffer.from(`:${patToken}`).toString('base64')
74
- }
75
- };
76
- return request.get(options);
79
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
+ getAllNpmPackages(patToken = '') {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const uri = `https://feeds.dev.azure.com/adacta-fintech/adinsure/_apis/packaging/Feeds/feed/packages?api-version=6.0-preview.1&includeAllVersions=true&protocolType=Npm`;
83
+ return axios.get(uri, {
84
+ headers: {
85
+ Authorization: 'Basic ' + Buffer.from(`:${patToken}`).toString('base64'),
86
+ 'Content-Type': 'application/octet-strem',
87
+ },
88
+ });
89
+ });
77
90
  }
78
91
  }
79
- exports.default = NpmContext;
@@ -4,14 +4,19 @@ export default class NpmRc {
4
4
  constructor(createIfNotExists?: boolean);
5
5
  /**
6
6
  * Load config file
7
+ * @returns {void}
7
8
  */
8
9
  load(): void;
9
10
  /**
10
11
  * Add registry to config file
12
+ * @param key Config key
13
+ * @param value Config value
14
+ * @returns {void}
11
15
  */
12
16
  set(key: string, value: string): Promise<void>;
13
17
  /**
14
18
  * Set token for Registry
19
+ * @returns {void}
15
20
  */
16
21
  save(): Promise<void>;
17
22
  }
package/lib/lib/npmrc.js CHANGED
@@ -1,14 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const child_process_1 = require("child_process");
4
- const fs = require("fs");
5
- const ini = require("ini");
6
- const os = require("os");
7
- class NpmRc {
1
+ import { __awaiter } from "tslib";
2
+ import { execSync } from 'child_process';
3
+ import fs from 'fs';
4
+ import ini from 'ini';
5
+ import os from 'os';
6
+ export default class NpmRc {
8
7
  constructor(createIfNotExists = true) {
9
8
  this.config = {};
10
9
  try {
11
- this.filePath = child_process_1.execSync('npm config get userconfig', { stdio: ['pipe', 'pipe', 'ignore'] })
10
+ this.filePath = execSync('npm config get userconfig', { stdio: ['pipe', 'pipe', 'ignore'] })
12
11
  .toString()
13
12
  .trim();
14
13
  }
@@ -24,21 +23,29 @@ class NpmRc {
24
23
  }
25
24
  /**
26
25
  * Load config file
26
+ * @returns {void}
27
27
  */
28
28
  load() {
29
29
  this.config = ini.parse(fs.readFileSync(this.filePath, 'utf8'));
30
30
  }
31
31
  /**
32
32
  * Add registry to config file
33
+ * @param key Config key
34
+ * @param value Config value
35
+ * @returns {void}
33
36
  */
34
- async set(key, value) {
35
- this.config[key] = value;
37
+ set(key, value) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ this.config[key] = value;
40
+ });
36
41
  }
37
42
  /**
38
43
  * Set token for Registry
44
+ * @returns {void}
39
45
  */
40
- async save() {
41
- fs.writeFileSync(this.filePath, ini.encode(this.config));
46
+ save() {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ fs.writeFileSync(this.filePath, ini.encode(this.config));
49
+ });
42
50
  }
43
51
  }
44
- exports.default = NpmRc;
@@ -1,6 +1,8 @@
1
1
  export default class NugetContext {
2
2
  /**
3
3
  * Get package names
4
+ * @param exclude List of excluded packages
5
+ * @returns {Promise<string>} Array of package names
4
6
  */
5
7
  projectList(exclude?: string[]): Promise<string[]>;
6
8
  }