@zohodesk/codestandard-validator 0.0.6-exp-16 → 0.0.6-exp-18
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.
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = validateRemotePackages;
|
|
7
|
+
var _executeSyncCommands = require("../../utils/General/executeSyncCommands");
|
|
8
|
+
var _getNodeModulesPath = require("../../utils/General/getNodeModulesPath");
|
|
7
9
|
const {
|
|
8
10
|
cloneViaCdt
|
|
9
11
|
} = require("../../utils/CloneCommonLinterRepo/cloneViaCdt");
|
|
@@ -15,14 +17,11 @@ const {
|
|
|
15
17
|
getStoredCommitHash
|
|
16
18
|
} = require("../../utils/General/getGeneralInfo");
|
|
17
19
|
const {
|
|
18
|
-
|
|
19
|
-
} = require("
|
|
20
|
+
execSync
|
|
21
|
+
} = require("child_process");
|
|
20
22
|
const {
|
|
21
23
|
Logger
|
|
22
24
|
} = require("../../utils/Logger/Logger");
|
|
23
|
-
const {
|
|
24
|
-
arePluginsInstalled
|
|
25
|
-
} = require("../../utils/PluginsInstallation/arePluginsInstalled");
|
|
26
25
|
async function validateRemotePackages() {
|
|
27
26
|
try {
|
|
28
27
|
if (!(getStoredCommitHash() == getLastCommitHash())) {
|
|
@@ -30,7 +29,9 @@ async function validateRemotePackages() {
|
|
|
30
29
|
await executeMethodsThatReturnBooleanValue("Some issue occurred in creating eslint config file.", createEslintConfigFile, null);
|
|
31
30
|
Logger.log(Logger.SUCCESS_TYPE, "Pre commit setup successfull");
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
execSync("npx ZDPrecommit setupPlugins", {
|
|
33
|
+
cwd: (0, _getNodeModulesPath.getNodeModulesPath)()
|
|
34
|
+
});
|
|
34
35
|
} catch (error) {
|
|
35
36
|
Logger.log(Logger.FAILURE_TYPE, `Kindly retry npm install. & ${error.message}`);
|
|
36
37
|
}
|
package/build/lib/cli.js
CHANGED
|
@@ -12,12 +12,12 @@ const {
|
|
|
12
12
|
const {
|
|
13
13
|
installEslintExtension
|
|
14
14
|
} = require("../utils/ExtensionInstallation/installEslintExtension");
|
|
15
|
-
const {
|
|
16
|
-
default: validateRemotePackages
|
|
17
|
-
} = require("../hooks/Precommit/pre-commit");
|
|
18
15
|
const {
|
|
19
16
|
Logger
|
|
20
17
|
} = require("../utils/Logger/Logger");
|
|
18
|
+
const {
|
|
19
|
+
arePluginsInstalled
|
|
20
|
+
} = require("../utils/PluginsInstallation/arePluginsInstalled");
|
|
21
21
|
const [,, action, ...options] = process.argv;
|
|
22
22
|
async function run() {
|
|
23
23
|
switch (action) {
|
|
@@ -33,7 +33,7 @@ async function run() {
|
|
|
33
33
|
}
|
|
34
34
|
case "setupPlugins":
|
|
35
35
|
{
|
|
36
|
-
|
|
36
|
+
arePluginsInstalled();
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
39
|
case "setupExtension":
|
|
@@ -28,9 +28,8 @@ function installPlugins(pluginsToBeInstalled) {
|
|
|
28
28
|
Logger.log(Logger.INFO_TYPE, 'Plugins are already installed');
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const installCommand = `npm install --no-save ${pluginsToBeInstalled.join(' ')}`;
|
|
31
|
+
const packageJsonBackup = getPackageJsonContentBeforeInstallingPlugins();
|
|
32
|
+
const installCommand = `npm install --save-dev ${pluginsToBeInstalled.join(' ')}`;
|
|
34
33
|
Logger.log(Logger.INFO_TYPE, 'Installing plugins...');
|
|
35
34
|
Logger.log(Logger.INFO_TYPE, `Install command being executed: ${installCommand}`);
|
|
36
35
|
const installed = executeSynchronizedCommands(execSync, [installCommand, {
|
|
@@ -42,13 +41,11 @@ function installPlugins(pluginsToBeInstalled) {
|
|
|
42
41
|
return false;
|
|
43
42
|
}
|
|
44
43
|
Logger.log(Logger.SUCCESS_TYPE, 'Plugins installation successful');
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// }
|
|
51
|
-
|
|
44
|
+
const restored = restorePackageJsonContent(packageJsonBackup);
|
|
45
|
+
if (!restored) {
|
|
46
|
+
Logger.log(Logger.FAILURE_TYPE, 'Unable to restore package.json content');
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
52
49
|
createVersionControlFile(pluginsToBeInstalled);
|
|
53
50
|
return true;
|
|
54
51
|
}
|