@zohodesk/codestandard-validator 0.0.6-exp-15 → 0.0.6-exp-16

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.
@@ -145,6 +145,7 @@ async function calculateGitDiffForFile(branch_name, file) {
145
145
 
146
146
  function areAllPluginsInstalled() {
147
147
  let unInstalledPlugins = checkIfPluginsAreInstalled().uninstalledPlugins;
148
+ console.log("unInstalledPlugins", unInstalledPlugins);
148
149
  return unInstalledPlugins.length === 0 ? true : false;
149
150
  }
150
151
 
@@ -28,11 +28,9 @@ function installPlugins(pluginsToBeInstalled) {
28
28
  Logger.log(Logger.INFO_TYPE, 'Plugins are already installed');
29
29
  return true;
30
30
  }
31
- const {
32
- packageJsonContentBeforePluginsInstallation,
33
- packageLockJsonContentBeforePluginsInstallation
34
- } = getPackageJsonContentBeforeInstallingPlugins();
35
- const installCommand = `npm install --save-dev ${pluginsToBeInstalled.join(' ')}`;
31
+
32
+ // const packageJsonBackup = getPackageJsonContentBeforeInstallingPlugins();
33
+ const installCommand = `npm install --no-save ${pluginsToBeInstalled.join(' ')}`;
36
34
  Logger.log(Logger.INFO_TYPE, 'Installing plugins...');
37
35
  Logger.log(Logger.INFO_TYPE, `Install command being executed: ${installCommand}`);
38
36
  const installed = executeSynchronizedCommands(execSync, [installCommand, {
@@ -44,14 +42,13 @@ function installPlugins(pluginsToBeInstalled) {
44
42
  return false;
45
43
  }
46
44
  Logger.log(Logger.SUCCESS_TYPE, 'Plugins installation successful');
47
- const restored = restorePackageJsonContent({
48
- packageJsonContentBeforePluginsInstallation,
49
- packageLockJsonContentBeforePluginsInstallation
50
- });
51
- if (!restored) {
52
- Logger.log(Logger.FAILURE_TYPE, 'Unable to restore package.json content');
53
- return false;
54
- }
45
+
46
+ // const restored = restorePackageJsonContent(packageJsonBackup);
47
+ // if (!restored) {
48
+ // Logger.log(Logger.FAILURE_TYPE, 'Unable to restore package.json content');
49
+ // return false;
50
+ // }
51
+
55
52
  createVersionControlFile(pluginsToBeInstalled);
56
53
  return true;
57
54
  }
@@ -62,29 +59,18 @@ function installPlugins(pluginsToBeInstalled) {
62
59
  */
63
60
  function getPackageJsonContentBeforeInstallingPlugins() {
64
61
  let packageJsonFilePath = `${getNodeModulesPath()}/package.json`;
65
- let packageLockJsonFilePath = `${getNodeModulesPath()}/package-lock.json`;
66
62
  let packageJsonContentBeforePluginsInstallation = require(packageJsonFilePath);
67
- let packageLockJsonContentBeforePluginsInstallation = require(packageLockJsonFilePath);
68
- return {
69
- packageJsonContentBeforePluginsInstallation,
70
- packageLockJsonContentBeforePluginsInstallation
71
- };
63
+ return packageJsonContentBeforePluginsInstallation;
72
64
  }
73
65
 
74
66
  /**
75
67
  * @function restorePackageJsonContent - restore the same content as it was before installing plugins
76
68
  * @returns {Boolean} - indicating the success or failure of restoring package.json content
77
69
  */
78
- function restorePackageJsonContent(obj) {
79
- const {
80
- packageJsonContentBeforePluginsInstallation,
81
- packageLockJsonContentBeforePluginsInstallation
82
- } = obj;
70
+ function restorePackageJsonContent(packageJsonContentBeforePluginsInstallation) {
83
71
  let packageJsonFilePath = `${getNodeModulesPath()}/package.json`;
84
- let packageLockJsonFilePath = `${getNodeModulesPath()}/package-lock.json`;
85
72
  let isPackageJsonRestored = executeSynchronizedCommands(writeFileSync, [packageJsonFilePath, JSON.stringify(packageJsonContentBeforePluginsInstallation, null, 2)], 'Package.json content restored successfully', 'Unable to restore package.json content', false, true);
86
- let isPackageLockJsonRestored = executeSynchronizedCommands(writeFileSync, [packageLockJsonFilePath, JSON.stringify(packageLockJsonContentBeforePluginsInstallation, null, 2)], 'Packagk Locj.json content restored successfully', 'Unable to restore package-lock.json content', false, true);
87
- return isPackageJsonRestored && isPackageLockJsonRestored;
73
+ return isPackageJsonRestored;
88
74
  }
89
75
  module.exports = {
90
76
  installPlugins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/codestandard-validator",
3
- "version": "0.0.6-exp-15",
3
+ "version": "0.0.6-exp-16",
4
4
  "description": "library to enforce code standard using eslint",
5
5
  "main": "index.js",
6
6
  "scripts": {