@zohodesk/codestandard-validator 0.0.5 → 0.0.6-exp-1

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/bin/push.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+
4
+ console.log("pre push called ... ")
@@ -8,13 +8,14 @@ const path = require("path");
8
8
  * @property {boolean} impactBased - Indicates if the linting is impact-based.
9
9
  * @property {string} lintReportPath - The path to the lint report JSON file.
10
10
  * @property {string} metricServerHost - The URL of the SonarQube server.
11
- * @property {string} meticHandler_api_token - The token for authentication with the SonarQube server.
12
- * @property {string} metric_token - The token for authentication with the SonarQube server.
11
+ * @property {string} meticHandler_api_token - The token to authenticate sonarQube apis.
12
+ * @property {string} metric_token - The token to authenticate sonarQube.
13
13
  * @property {string} gitEndPoint - API EndPoint for Git Actions
14
14
  * @property {string} tsConfigurationPath - The path of the ts configuration Path
15
15
  * @property {number} projectId - project id of repository
16
16
  * @property {boolean} impactBasedPrecommit - Indicates if the linting is impact-based in pre commit
17
17
  * @property {boolean} shouldWarningsAbortCommit - Indicates if eslint warnings should abort the commit
18
+ * @property {string} pushMetricsOnPreCommit - Indicates to push metrics to sonarQube or not
18
19
  * @property {string} token - Encrypted Authentication Token
19
20
  * @property {string} compareBranch - Branch to compare diff
20
21
  */
@@ -23,15 +24,17 @@ module.exports = {
23
24
  ruleConfigurationPath: path.resolve(process.cwd(), ".eslintrc.js"),
24
25
  impactBased: true,
25
26
  lintReportPath: path.resolve(process.cwd(), "lint-report", "lintReport.json"),
26
- metricServerHost: "https://client-linters.zohodesk.csez.zohocorpin.com",
27
- meticHandler_api_token: "oyRcKJZxm2RkXytfAzVtmyRlLIftou5anC==",
28
- metric_token: "zxh_9737850jh2l53ml17223929ihii73072j54j2260",
27
+ metricServerHost: "https://client-linters.zdesk.csez.zohocorpin.com",
28
+ meticHandler_api_token: "KIDfmI46KIDfmI4kYPU1",
29
+ metric_token: "zxh_371336m636584i54m662j6495h46228mkj6hihh8",
29
30
  branchDiffPath: path.resolve(process.cwd(), "diffBranch.json"),
30
31
  gitEndPoint: "https://zgit.csez.zohocorpin.com",
31
32
  tsConfigurationPath: path.resolve(process.cwd(), 'tsconfig.json'),
32
33
  projectId: `project-id`,
33
34
  impactBasedPrecommit: true,
34
35
  shouldWarningsAbortCommit: false,
36
+ pushMetricsOnPreCommit: true,
35
37
  token: "w-OkG3f5OOM1Rkly8phZ",
36
- compareBranch: 'release'
38
+ compareBranch: 'release',
39
+ supportedExtensions: ['.js', '.jsx', '.ts', '.tsx', '.properties']
37
40
  };
@@ -54,11 +54,10 @@ function getConfigurationPrecommit() {
54
54
  * @returns {Array<string>}
55
55
  */
56
56
  function getSupportedLanguage() {
57
- const _language = [];
58
- _language.push('.js');
59
- _language.push('.jsx');
60
- _language.push('.ts');
61
- _language.push('.tsx');
57
+ const {
58
+ supportedExtensions
59
+ } = getConfigurationPrecommit();
60
+ const _language = supportedExtensions;
62
61
  return _language;
63
62
  }
64
63
  function getRunningEnv() {
@@ -22,16 +22,27 @@ const {
22
22
  function configurePrecommitHook() {
23
23
  let rootDirectory = getRootDirectory();
24
24
  let customPrecomitHookPath = path.join(getLibraryInstalledLocation(), "bin", "execute.js");
25
+ let customPrePushHookPath = path.join(getLibraryInstalledLocation(), "bin", "push.js");
25
26
  let huskyPrecommitPath = path.join(rootDirectory, ".husky", "pre-commit");
27
+ let huskyPrePushPath = path.join(rootDirectory, ".husky", "pre-push");
26
28
  let huskyPrecommitHookContent = `#!/bin/sh
27
29
  . "$(dirname "$0")/_/husky.sh"
28
30
 
29
31
  "${customPrecomitHookPath}"
32
+ `;
33
+ let huskyPrePushHookContent = `#!/bin/sh
34
+ . "$(dirname "$0")/_/husky.sh"
35
+
36
+ "${customPrePushHookPath}"
30
37
  `;
31
38
  let isCustomPrecommitConfigurationSuccessful = executeSynchronizedCommands(writeFileSync, [huskyPrecommitPath, huskyPrecommitHookContent, 'utf-8'], '', 'Could not create and write pre-commit.sh inisde husky directory', false, true);
39
+ let isCustomPrePushConfigurationSuccessful = executeSynchronizedCommands(writeFileSync, [huskyPrePushPath, huskyPrePushHookContent, 'utf-8'], '', 'Could not create and write pre-commit.sh inisde husky directory', false, true);
32
40
  if (isCustomPrecommitConfigurationSuccessful) {
33
41
  let isExecutionPermissionGivenSuccessfully = grantExecutionPermission([huskyPrecommitPath, customPrecomitHookPath]);
34
42
  return isExecutionPermissionGivenSuccessfully;
43
+ } else if (isCustomPrePushConfigurationSuccessful) {
44
+ let isExecutionPermissionGivenSuccessfully = grantExecutionPermission([huskyPrePushPath, customPrePushHookPath]);
45
+ return isExecutionPermissionGivenSuccessfully;
35
46
  } else {
36
47
  return false;
37
48
  }
package/changeLog.md CHANGED
@@ -23,7 +23,10 @@
23
23
  3. Added configuration to abort commits if there are warnings or issues.
24
24
  4. Environment-specific clone configuration added.
25
25
 
26
- # 0.0.5 - auto plugin installtion and dependencies validation
26
+ # 0.0.5 - Automatic eslint plugins installation
27
+ 1. The required eslint plugins configured for a repository will be automatically installed during the installation of the library
27
28
 
28
- 1. check plugin version in local with remote and auto install rules plugins.
29
- 2. plugin version log file.
29
+ # 0.0.6 - Support extended for .properties file
30
+
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/codestandard-validator",
3
- "version": "0.0.5",
3
+ "version": "0.0.6-exp-1",
4
4
  "description": "library to enforce code standard using eslint",
5
5
  "main": "index.js",
6
6
  "scripts": {