@zohodesk/codestandard-validator 0.0.4-exp-8 → 0.0.4-exp-13
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/lib/cli.js
CHANGED
|
@@ -15,6 +15,9 @@ const {
|
|
|
15
15
|
const {
|
|
16
16
|
installPlugins
|
|
17
17
|
} = require("../utils/PluginsInstallation/installPlugins");
|
|
18
|
+
const {
|
|
19
|
+
checkIfPluginsAreInstalled
|
|
20
|
+
} = require("../utils/PluginsInstallation/checkIfPluginsAreInstalled");
|
|
18
21
|
const [,, action, ...options] = process.argv;
|
|
19
22
|
async function run() {
|
|
20
23
|
switch (action) {
|
|
@@ -30,7 +33,10 @@ async function run() {
|
|
|
30
33
|
}
|
|
31
34
|
case "setupPlugins":
|
|
32
35
|
{
|
|
33
|
-
|
|
36
|
+
const {
|
|
37
|
+
uninstalledPlugins
|
|
38
|
+
} = checkIfPluginsAreInstalled();
|
|
39
|
+
await executeMethodsThatReturnBooleanValue("Some issue occurred in installing plugins", installPlugins, uninstalledPlugins);
|
|
34
40
|
break;
|
|
35
41
|
}
|
|
36
42
|
case "setupExtension":
|
|
@@ -11,10 +11,11 @@ const {
|
|
|
11
11
|
} = require('./printUninstalledPlugins');
|
|
12
12
|
function arePluginsInstalled() {
|
|
13
13
|
let {
|
|
14
|
-
uninstalledPlugins
|
|
14
|
+
uninstalledPlugins,
|
|
15
|
+
noPluginMessage
|
|
15
16
|
} = checkIfPluginsAreInstalled();
|
|
16
|
-
printUninstalledPlugins(uninstalledPlugins);
|
|
17
|
-
installPlugins();
|
|
17
|
+
printUninstalledPlugins(uninstalledPlugins, noPluginMessage);
|
|
18
|
+
installPlugins(uninstalledPlugins);
|
|
18
19
|
}
|
|
19
20
|
module.exports = {
|
|
20
21
|
arePluginsInstalled
|
|
@@ -23,10 +23,8 @@ const {
|
|
|
23
23
|
* @function installPlugins - installs uninstalled plugins for the project
|
|
24
24
|
* @returns {boolean} - indicating if plugins to be installed are installed successfully or not
|
|
25
25
|
*/
|
|
26
|
-
function installPlugins() {
|
|
27
|
-
let {
|
|
28
|
-
uninstalledPlugins: pluginsToBeInstalled
|
|
29
|
-
} = checkIfPluginsAreInstalled();
|
|
26
|
+
function installPlugins(pluginsToBeInstalled) {
|
|
27
|
+
// let {uninstalledPlugins : pluginsToBeInstalled} = checkIfPluginsAreInstalled()
|
|
30
28
|
if (pluginsToBeInstalled.length > 0) {
|
|
31
29
|
let installCommand = `npm install --no-save ${pluginsToBeInstalled.join(' ')}`;
|
|
32
30
|
Logger.log(Logger.INFO_TYPE, 'Installing plugins ....');
|
|
@@ -8,17 +8,17 @@ const {
|
|
|
8
8
|
* @function printUninstalledPlugins - to notify the user regarding plugins for the repository has been installed or not
|
|
9
9
|
* @param {Array} uninstalledPlugins - contains list of uninstalled plugins for the project
|
|
10
10
|
*/
|
|
11
|
-
function printUninstalledPlugins(uninstalledPlugins) {
|
|
11
|
+
function printUninstalledPlugins(uninstalledPlugins, noPluginMessage) {
|
|
12
12
|
let commandToInstallPlugins = 'npx ZDPrecommit setupPlugins';
|
|
13
|
-
if (uninstalledPlugins.
|
|
13
|
+
if (uninstalledPlugins.length !== 0) {
|
|
14
14
|
Logger.log(Logger.INFO_TYPE, 'The following plugins are not installed:');
|
|
15
|
-
uninstalledPlugins.
|
|
15
|
+
uninstalledPlugins.map(plugin => {
|
|
16
16
|
Logger.log(Logger.INFO_TYPE, `"${plugin}"`);
|
|
17
17
|
});
|
|
18
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
|
-
} else if (uninstalledPlugins.
|
|
19
|
+
} else if (uninstalledPlugins.length === 0 && noPluginMessage.trim() === '') {
|
|
20
20
|
Logger.log(Logger.INFO_TYPE, 'Plugins are installed already');
|
|
21
|
-
} else if (uninstalledPlugins.
|
|
21
|
+
} else if (uninstalledPlugins.length === 0 && noPluginMessage.trim() !== '') {
|
|
22
22
|
Logger.log(Logger.INFO_TYPE, 'No plugins present for the repository');
|
|
23
23
|
}
|
|
24
24
|
}
|