@zohodesk/codestandard-validator 0.0.7-exp-10 → 0.0.7-exp-11
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/build/hooks/hook.js
CHANGED
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
cloneViaCdt
|
|
12
12
|
} = require("../utils/CloneCommonLinterRepo/cloneViaCdt");
|
|
13
13
|
const {
|
|
14
|
-
|
|
14
|
+
getPluginsToInstall
|
|
15
15
|
} = require("../utils/PluginsInstallation/checkIfPluginsAreInstalled");
|
|
16
16
|
const {
|
|
17
17
|
installPlugins
|
|
@@ -21,7 +21,7 @@ async function hooks() {
|
|
|
21
21
|
await executeMethodsThatReturnBooleanValue("Make sure zgit.csez.zohocorpin.com is accessible", cloneViaCdt, null);
|
|
22
22
|
const {
|
|
23
23
|
uninstalledPlugins
|
|
24
|
-
} =
|
|
24
|
+
} = getPluginsToInstall();
|
|
25
25
|
await executeMethodsThatReturnBooleanValue("Some issue occurred in installing plugins", installPlugins, uninstalledPlugins);
|
|
26
26
|
}
|
|
27
27
|
require('./Precommit/pre-commit');
|
package/build/lib/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
installPlugins
|
|
17
17
|
} = require("../utils/PluginsInstallation/installPlugins");
|
|
18
18
|
const {
|
|
19
|
-
|
|
19
|
+
getPluginsToInstall
|
|
20
20
|
} = require("../utils/PluginsInstallation/checkIfPluginsAreInstalled");
|
|
21
21
|
const [,, action, ...options] = process.argv;
|
|
22
22
|
async function run() {
|
|
@@ -35,7 +35,7 @@ async function run() {
|
|
|
35
35
|
{
|
|
36
36
|
const {
|
|
37
37
|
uninstalledPlugins
|
|
38
|
-
} =
|
|
38
|
+
} = getPluginsToInstall();
|
|
39
39
|
await executeMethodsThatReturnBooleanValue("Some issue occurred in installing plugins", installPlugins, uninstalledPlugins);
|
|
40
40
|
break;
|
|
41
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
|
-
|
|
4
|
+
getPluginsToInstall
|
|
5
5
|
} = require('./checkIfPluginsAreInstalled');
|
|
6
6
|
const {
|
|
7
7
|
installPlugins
|
|
@@ -10,7 +10,7 @@ function arePluginsInstalled() {
|
|
|
10
10
|
let {
|
|
11
11
|
uninstalledPlugins,
|
|
12
12
|
noPluginMessage
|
|
13
|
-
} =
|
|
13
|
+
} = getPluginsToInstall();
|
|
14
14
|
let areAllPluginsInstalled = uninstalledPlugins.length === 0 ? true : false;
|
|
15
15
|
if (!areAllPluginsInstalled) {
|
|
16
16
|
installPlugins(uninstalledPlugins);
|
|
@@ -51,10 +51,42 @@ function checkIfPluginsAreInstalled() {
|
|
|
51
51
|
packageName,
|
|
52
52
|
version
|
|
53
53
|
} = plugin;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
//
|
|
54
|
+
const {
|
|
55
|
+
isPluginPresent,
|
|
56
|
+
pluginPath
|
|
57
|
+
} = checkPluginsPresentInNodemodules(packageName); // circular installation loop so comment out
|
|
58
|
+
if (isPluginPresent && checkPluginHasProperVersion(packageName, pluginPath, version)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return `${packageName}@${version}`;
|
|
62
|
+
}).filter(Boolean);
|
|
63
|
+
if (uninstalledPlugins.length > 0) {
|
|
64
|
+
plugin.noPluginMessage = '';
|
|
65
|
+
plugin.uninstalledPlugins = uninstalledPlugins;
|
|
66
|
+
return plugin;
|
|
67
|
+
} else {
|
|
68
|
+
plugin.noPluginMessage = 'No plugins present for the repository';
|
|
69
|
+
plugin.uninstalledPlugins = [];
|
|
70
|
+
return plugin;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @function getPluginsToInstall - plugins need for this repository
|
|
76
|
+
* @returns {Array<String>}
|
|
77
|
+
*/
|
|
78
|
+
function getPluginsToInstall() {
|
|
79
|
+
const pluginsForCurrentRepo = getAllPlugins();
|
|
80
|
+
var uninstalledPlugins = [];
|
|
81
|
+
var plugin = {
|
|
82
|
+
noPluginMessage: '',
|
|
83
|
+
uninstalledPlugins: []
|
|
84
|
+
};
|
|
85
|
+
uninstalledPlugins = pluginsForCurrentRepo.map(plugin => {
|
|
86
|
+
const {
|
|
87
|
+
packageName,
|
|
88
|
+
version
|
|
89
|
+
} = plugin;
|
|
58
90
|
return `${packageName}@${version}`;
|
|
59
91
|
}).filter(Boolean);
|
|
60
92
|
if (uninstalledPlugins.length > 0) {
|
|
@@ -113,5 +145,6 @@ function checkPluginHasProperVersion(rulePluginName, installationPath, remotePlu
|
|
|
113
145
|
return remotePluginExactVersion == packageJsonPluginExactVersion ? true : false;
|
|
114
146
|
}
|
|
115
147
|
module.exports = {
|
|
148
|
+
getPluginsToInstall,
|
|
116
149
|
checkIfPluginsAreInstalled
|
|
117
150
|
};
|