@zohodesk/codestandard-validator 0.0.7-exp-11 → 0.0.7-exp-12

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.
@@ -253,8 +253,10 @@ async function preCommitHook() {
253
253
  // Logger.log(Logger.SUCCESS_TYPE,`Commit Successful`)
254
254
  // process.exit(0)
255
255
  // }
256
+
257
+ // CssFiles not Enabled For while
256
258
  areFilesStaged = true;
257
- var stagedFiles = [...staged_filesJS, ...CssFiles];
259
+ var stagedFiles = [...staged_filesJS];
258
260
  for (let file in stagedFiles) {
259
261
  let currentFileName = stagedFiles[file];
260
262
  let changedLinesArray = [];
@@ -2,7 +2,8 @@
2
2
 
3
3
  const {
4
4
  getLastCommitHash,
5
- getStoredCommitHash
5
+ getStoredCommitHash,
6
+ updateJsonFile
6
7
  } = require("../utils/General/getGeneralInfo");
7
8
  const {
8
9
  executeMethodsThatReturnBooleanValue
@@ -17,7 +18,12 @@ const {
17
18
  installPlugins
18
19
  } = require("../utils/PluginsInstallation/installPlugins");
19
20
  async function hooks() {
21
+ var jsonFilePath = path.join(__dirname, '..', '..', 'jsonUtils', 'fsUtils.json');
20
22
  if (!(getLastCommitHash() == getStoredCommitHash())) {
23
+ updateJsonFile(jsonFilePath, data => {
24
+ data.commitHash = getLastCommitHash();
25
+ return data;
26
+ });
21
27
  await executeMethodsThatReturnBooleanValue("Make sure zgit.csez.zohocorpin.com is accessible", cloneViaCdt, null);
22
28
  const {
23
29
  uninstalledPlugins
@@ -10,6 +10,9 @@ const {
10
10
  readOnlyToken,
11
11
  commitHashEndPoint
12
12
  } = require('../../../jsonUtils/commonLinterRepoDetails');
13
+ const {
14
+ Logger
15
+ } = require('../Logger/Logger');
13
16
 
14
17
  /**
15
18
  * @function getTimeStampInfo - to fetch various timestamp details
@@ -103,9 +106,23 @@ function getLastCommitHash() {
103
106
  */
104
107
 
105
108
  function getStoredCommitHash() {
106
- const commitInfoPath = path.join(__dirname, '..', '..', '..', 'jsonUtils', 'fsUtils.json');
109
+ const commitInfoPath = getJsonUtilsPath();
107
110
  return fs.existsSync(commitInfoPath) && require(commitInfoPath).commitHash;
108
111
  }
112
+ function getJsonUtilsPath() {
113
+ return path.join(__dirname, '..', '..', '..', 'jsonUtils', 'fsUtils.json');
114
+ }
115
+ function updateJsonFile(filePath, modifier) {
116
+ try {
117
+ const absolutePath = path.resolve(filePath);
118
+ const rawData = fs.readFileSync(absolutePath, "utf-8");
119
+ const jsonData = JSON.parse(rawData);
120
+ const updatedData = modifier(jsonData);
121
+ fs.writeFileSync(absolutePath, JSON.stringify(updatedData, null, 2), "utf-8");
122
+ } catch (error) {
123
+ Logger.log(Logger.FAILURE_TYPE, "Error updating JSON file");
124
+ }
125
+ }
109
126
  module.exports = {
110
127
  getSupportedLanguage,
111
128
  getTimeStampInfo,
@@ -113,5 +130,7 @@ module.exports = {
113
130
  getConfigurationPrecommit,
114
131
  getRunningEnv,
115
132
  getLastCommitHash,
116
- getStoredCommitHash
133
+ getStoredCommitHash,
134
+ getJsonUtilsPath,
135
+ updateJsonFile
117
136
  };
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  const path = require('path');
4
+ const {
5
+ getJsonUtilsPath
6
+ } = require('./getGeneralInfo');
4
7
 
5
8
  /**
6
9
  * @function getNodeModulesPath - fetches the absolute path where node_modules of project is present
7
10
  * @returns {string} - path where node_modules of the project is present
8
11
  */
9
12
  function getNodeModulesPath() {
10
- return require(path.join(__dirname, '..', '..', '..', 'jsonUtils', 'fsUtils.json')).nodeModulesPath;
13
+ return require(getJsonUtilsPath()).nodeModulesPath;
11
14
  }
12
15
  module.exports = {
13
16
  getNodeModulesPath
package/changeLog.md CHANGED
@@ -29,4 +29,10 @@
29
29
  # 0.0.6 - Support extended for .properties file
30
30
 
31
31
  1. The file types that are supported by this library can now be configured using the configuration file "lint.config.js"
32
- 2. Support for .properties file is also extended in this version along with existing support for file types .js, .jsx, .ts, .tsx
32
+ 2. Support for .properties file is also extended in this version along with existing support for file types .js, .jsx, .ts, .tsx
33
+
34
+
35
+ # - Support For Stylelint
36
+
37
+ 1. Enhancement Parser support CSS files and linter
38
+ 2. Clonet Configuration Flow Enhancement Validation
@@ -10,7 +10,7 @@
10
10
 
11
11
  module.exports = {
12
12
  endPoint: "zgit.csez.zohocorpin.com/code_standard/client_linter/linter_configuration.git",
13
- branch: "master",
13
+ branch: process.env.CONFIGURATION_BRANCH || "master",
14
14
  cacheDirectory: "./",
15
15
  commonLinterRepoName: "configuration",
16
16
  type: "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/codestandard-validator",
3
- "version": "0.0.7-exp-11",
3
+ "version": "0.0.7-exp-12",
4
4
  "description": "library to enforce code standard using eslint",
5
5
  "main": "index.js",
6
6
  "scripts": {