@zohodesk/codestandard-validator 1.0.0-exp-4 → 1.0.0-exp-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.
|
@@ -108,15 +108,11 @@ async function runLintWorkflow(files, branch) {
|
|
|
108
108
|
await execute.executeLintHandler().finally(async () => {
|
|
109
109
|
await execute.executeMetricHandler();
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* global.analytics.totalIssues = global.analytics.totalIssues + 1;
|
|
112
112
|
global.analytics.status = "FAILURE";
|
|
113
113
|
global.analytics.message = 'Issues are detected, please review and resolve the errors'
|
|
114
114
|
*/
|
|
115
|
-
const {
|
|
116
|
-
issues,
|
|
117
|
-
hasIssue,
|
|
118
|
-
totalIssues
|
|
119
|
-
} = fetchProjectIssuesViaCurl("projectName");
|
|
115
|
+
// const { issues, hasIssue, totalIssues } = fetchProjectIssuesViaCurl("projectName");
|
|
120
116
|
});
|
|
121
117
|
Logger.log(Logger.INFO_TYPE, global.analytics);
|
|
122
118
|
return global.analytics.status == 'FAILURE' ? true : false;
|
|
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _Logger = require("../Logger/Logger");
|
|
8
8
|
var _getGeneralInfo = require("./getGeneralInfo");
|
|
9
|
-
|
|
9
|
+
const {
|
|
10
|
+
exec
|
|
11
|
+
} = require('child_process');
|
|
12
|
+
const {
|
|
13
|
+
promisify
|
|
14
|
+
} = require('util');
|
|
15
|
+
const execAsync = promisify(exec);
|
|
10
16
|
/**
|
|
11
17
|
* Constructs a URL for searching issues in SonarQube.
|
|
12
18
|
*
|
|
@@ -72,14 +78,14 @@ function extractIssues(json) {
|
|
|
72
78
|
* - {Array} issues: An array of extracted issues, or an empty array if an error occurred.
|
|
73
79
|
*/
|
|
74
80
|
|
|
75
|
-
function fetchProjectIssuesViaCurl(componentKey) {
|
|
81
|
+
async function fetchProjectIssuesViaCurl(componentKey) {
|
|
76
82
|
_Logger.Logger.log(_Logger.Logger.INFO_TYPE, `\n Fetching issues (curl) for component: ${componentKey}`);
|
|
77
83
|
const url = buildIssuesSearchUrl(componentKey);
|
|
78
84
|
try {
|
|
79
85
|
const token = 'sqa_1f6675c05f63c4784dc741ce751efa0066d2693c' || decrypt(getAPIToken(), process.env.DECRYPT_TOKEN);
|
|
80
86
|
const command = `curl --tlsv1.2 -s -u "${token}:" "${url}"`;
|
|
81
87
|
console.log("command", command);
|
|
82
|
-
const output =
|
|
88
|
+
const output = await execAsync(command).toString();
|
|
83
89
|
const json = JSON.parse(output);
|
|
84
90
|
const {
|
|
85
91
|
issues,
|
|
@@ -104,5 +110,4 @@ function fetchProjectIssuesViaCurl(componentKey) {
|
|
|
104
110
|
};
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
|
-
console.log(fetchProjectIssuesViaCurl('zohogc_client_master_rajasekar.hm_Dev-report'));
|
|
108
113
|
var _default = exports.default = fetchProjectIssuesViaCurl;
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable no-console */
|
|
4
4
|
|
|
5
|
-
const {
|
|
6
|
-
execSync
|
|
7
|
-
} = require('child_process');
|
|
8
5
|
const {
|
|
9
6
|
navigateToRootDirectory
|
|
10
7
|
} = require('../General/RootDirectoryUtils/navigateToRootDirectory');
|
|
@@ -14,16 +11,23 @@ const {
|
|
|
14
11
|
const {
|
|
15
12
|
Logger
|
|
16
13
|
} = require('../Logger/Logger');
|
|
14
|
+
const {
|
|
15
|
+
exec
|
|
16
|
+
} = require('child_process');
|
|
17
|
+
const {
|
|
18
|
+
promisify
|
|
19
|
+
} = require('util');
|
|
20
|
+
const execAsync = promisify(exec);
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* @function initializeHusky - creates a .husky folder at the root of the project with the husky execution script file
|
|
20
24
|
* @returns {boolean} - indicating the success or failure of initializing husky process
|
|
21
25
|
*/
|
|
22
|
-
function initializeHusky() {
|
|
26
|
+
async function initializeHusky() {
|
|
23
27
|
let isNavigationToRootDirectorySuccessful = navigateToRootDirectory(getRootDirectory());
|
|
24
28
|
if (isNavigationToRootDirectorySuccessful) {
|
|
25
29
|
try {
|
|
26
|
-
|
|
30
|
+
await execAsync('npx husky@7 install');
|
|
27
31
|
return true;
|
|
28
32
|
} catch (error) {
|
|
29
33
|
Logger.log(Logger.FAILURE_TYPE, error.toString());
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
execSync
|
|
5
|
-
} = require('child_process');
|
|
6
3
|
const {
|
|
7
4
|
writeFileSync
|
|
8
5
|
} = require('fs');
|
|
@@ -16,18 +13,25 @@ const {
|
|
|
16
13
|
getNodeModulesPath
|
|
17
14
|
} = require('../General/getNodeModulesPath');
|
|
18
15
|
const path = require('path');
|
|
16
|
+
const {
|
|
17
|
+
exec
|
|
18
|
+
} = require('child_process');
|
|
19
|
+
const {
|
|
20
|
+
promisify
|
|
21
|
+
} = require('util');
|
|
22
|
+
const execAsync = promisify(exec);
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* @function installPlugins - installs uninstalled plugins for the project
|
|
22
26
|
* @returns {boolean} - indicating if plugins to be installed are installed successfully or not
|
|
23
27
|
*/
|
|
24
|
-
function installPlugins(pluginsToBeInstalled) {
|
|
28
|
+
async function installPlugins(pluginsToBeInstalled) {
|
|
25
29
|
if (pluginsToBeInstalled.length > 0) {
|
|
26
30
|
let packageJsonBeforePluginsInstallation = getPackageJsonContentBeforeInstallingPlugins();
|
|
27
31
|
Logger.log(Logger.INFO_TYPE, 'Installing plugins ....');
|
|
28
32
|
const installCommand = `npm install --save-dev ${pluginsToBeInstalled.join(' ')} --legacy-peer-deps`;
|
|
29
33
|
Logger.log(Logger.INFO_TYPE, `Install command being executed: ${installCommand}`);
|
|
30
|
-
let arePluginsInstalledSuccessfully = executeSynchronizedCommands(
|
|
34
|
+
let arePluginsInstalledSuccessfully = await executeSynchronizedCommands(execAsync, [installCommand, {
|
|
31
35
|
stdio: 'inherit',
|
|
32
36
|
cwd: getNodeModulesPath()
|
|
33
37
|
}], '', 'Some issue occured while installing plugins', false, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/codestandard-validator",
|
|
3
|
-
"version": "1.0.0-exp-
|
|
3
|
+
"version": "1.0.0-exp-5",
|
|
4
4
|
"description": "library to enforce code standard using eslint",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "commonjs",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@zohodesk/codestandard-analytics": "1.0.2-exp-
|
|
18
|
+
"@zohodesk/codestandard-analytics": "1.0.2-exp-5",
|
|
19
19
|
"@zohodesk-private/client_deployment_tool": "0.0.5",
|
|
20
20
|
"eslint": "8.26.0",
|
|
21
21
|
"stylelint": "16.23.0"
|