@zohodesk/codestandard-validator 0.0.4-exp-6 → 0.0.4-exp-7
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.
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
const {
|
|
4
4
|
checkIfPluginsAreInstalled
|
|
5
5
|
} = require('./checkIfPluginsAreInstalled');
|
|
6
|
+
const {
|
|
7
|
+
installPlugins
|
|
8
|
+
} = require('./installPlugins');
|
|
6
9
|
const {
|
|
7
10
|
printUninstalledPlugins
|
|
8
11
|
} = require('./printUninstalledPlugins');
|
|
9
12
|
function arePluginsInstalled() {
|
|
10
13
|
let uninstalledPlugins = checkIfPluginsAreInstalled();
|
|
11
14
|
printUninstalledPlugins(uninstalledPlugins);
|
|
15
|
+
installPlugins();
|
|
12
16
|
}
|
|
13
17
|
module.exports = {
|
|
14
18
|
arePluginsInstalled
|
|
@@ -127,6 +127,12 @@ function checkIfPluginsAreInstalled() {
|
|
|
127
127
|
return plugin;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @function checkPluginsPresentInNodemodules - to check if the plugin is present in the node_modules of the project
|
|
133
|
+
* @param {string} rulePluginName
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
130
136
|
function checkPluginsPresentInNodemodules(rulePluginName) {
|
|
131
137
|
try {
|
|
132
138
|
const pluginPath = require.resolve(rulePluginName.toString());
|
|
@@ -141,6 +147,15 @@ function checkPluginsPresentInNodemodules(rulePluginName) {
|
|
|
141
147
|
};
|
|
142
148
|
}
|
|
143
149
|
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @function checkPluginHasProperVersion - to check if the plugin has the proper version`
|
|
153
|
+
* @param {string} rulePluginName
|
|
154
|
+
* @param {string} installationPath
|
|
155
|
+
* @param {string} remotePluginVersion
|
|
156
|
+
* @returns
|
|
157
|
+
*/
|
|
158
|
+
|
|
144
159
|
function checkPluginHasProperVersion(rulePluginName, installationPath, remotePluginVersion) {
|
|
145
160
|
const pluginPathArray = installationPath.toString().split(rulePluginName);
|
|
146
161
|
const rulePluginPackageJSONPath = path.join(pluginPathArray[0], rulePluginName, 'package.json');
|
|
@@ -15,7 +15,7 @@ function printUninstalledPlugins(uninstalledPlugins) {
|
|
|
15
15
|
uninstalledPlugins.uninstalledPlugins.map(plugin => {
|
|
16
16
|
Logger.log(Logger.INFO_TYPE, `"${plugin}"`);
|
|
17
17
|
});
|
|
18
|
-
Logger.log(Logger.FAILURE_TYPE, `Kindly execute the command \x1b[37m"${commandToInstallPlugins}\x1b[0m" \x1b[31mfrom the location where package.json of the repo is present to install the plugins`)
|
|
18
|
+
// Logger.log(Logger.FAILURE_TYPE, `Kindly execute the command \x1b[37m"${commandToInstallPlugins}\x1b[0m" \x1b[31mfrom the location where package.json of the repo is present to install the plugins`)
|
|
19
19
|
} else if (uninstalledPlugins.uninstalledPlugins.length === 0 && uninstalledPlugins.noPluginMessage.trim() === '') {
|
|
20
20
|
Logger.log(Logger.INFO_TYPE, 'Plugins are installed already');
|
|
21
21
|
} else if (uninstalledPlugins.uninstalledPlugins.length === 0 && uninstalledPlugins.noPluginMessage.trim() !== '') {
|