@zohodesk/codestandard-validator 1.0.0-exp-13 → 1.0.0-exp-15
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/postinstall.js +22 -21
- package/package.json +1 -1
package/build/lib/postinstall.js
CHANGED
|
@@ -2,47 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
4
|
cloneViaCdt
|
|
5
|
-
} = require(
|
|
5
|
+
} = require('../utils/CloneCommonLinterRepo/cloneViaCdt');
|
|
6
6
|
const {
|
|
7
7
|
setupHusky
|
|
8
|
-
} = require(
|
|
8
|
+
} = require('../utils/HuskySetup/setupHusky');
|
|
9
9
|
const {
|
|
10
10
|
createConfigFile
|
|
11
|
-
} = require(
|
|
11
|
+
} = require('../utils/ConfigFileUtils/createConfigFile');
|
|
12
12
|
const {
|
|
13
13
|
Logger
|
|
14
|
-
} = require(
|
|
14
|
+
} = require('../utils/Logger/Logger');
|
|
15
15
|
const {
|
|
16
16
|
executeMethodsThatReturnBooleanValue
|
|
17
|
-
} = require(
|
|
17
|
+
} = require('../utils/General/wrapperFunctionToExecuteAFunction');
|
|
18
18
|
const {
|
|
19
19
|
arePluginsInstalled
|
|
20
|
-
} = require(
|
|
20
|
+
} = require('../utils/PluginsInstallation/arePluginsInstalled');
|
|
21
21
|
const {
|
|
22
22
|
isGitInitialized
|
|
23
|
-
} = require(
|
|
23
|
+
} = require('../utils/GitActions/gitActions');
|
|
24
24
|
const {
|
|
25
25
|
writeFsPaths
|
|
26
|
-
} = require(
|
|
27
|
-
const
|
|
28
|
-
getNodeModulesPath
|
|
29
|
-
} = require("../utils/General/getNodeModulesPath");
|
|
30
|
-
const config = require(path.join(getNodeModulesPath(), 'lint.config.js'));
|
|
31
|
-
process.env.SONARQUBE_EXTERNAL = config.metric_token;
|
|
32
|
-
process.env.SONARQUBE = config.meticHandler_api_token;
|
|
33
|
-
process.env.ZGIT_TOKEN = config.token;
|
|
34
|
-
|
|
26
|
+
} = require('../utils/General/writeProjectDetailsToJson');
|
|
27
|
+
const path = require('path');
|
|
35
28
|
/**
|
|
36
29
|
* @function {postInstall} - This methods setup husky and configuration for executing project
|
|
37
30
|
* @returns {void}
|
|
38
31
|
*/
|
|
39
32
|
async function postInstall() {
|
|
40
33
|
try {
|
|
41
|
-
await executeMethodsThatReturnBooleanValue(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
await executeMethodsThatReturnBooleanValue('Some issue in writing node_modules path to json', writeFsPaths, null).then(() => {
|
|
35
|
+
const {
|
|
36
|
+
getNodeModulesPath
|
|
37
|
+
} = require('../utils/General/getNodeModulesPath');
|
|
38
|
+
const config = require(path.join(getNodeModulesPath(), 'lint.config.js'));
|
|
39
|
+
process.env.SONARQUBE_EXTERNAL = config.metric_token;
|
|
40
|
+
process.env.SONARQUBE = config.meticHandler_api_token;
|
|
41
|
+
process.env.ZGIT_TOKEN = config.token;
|
|
42
|
+
});
|
|
43
|
+
isGitInitialized() ? await executeMethodsThatReturnBooleanValue('Some issue occurred in setting up husky.', setupHusky, null) : null;
|
|
44
|
+
await executeMethodsThatReturnBooleanValue('Make sure zgit.csez.zohocorpin.com is accessible', cloneViaCdt, null);
|
|
45
|
+
await executeMethodsThatReturnBooleanValue('Some issue occurred in creating eslint config file.', createConfigFile, null);
|
|
46
|
+
Logger.log(Logger.SUCCESS_TYPE, 'Pre commit setup successfull');
|
|
46
47
|
// arePluginsInstalled();
|
|
47
48
|
} catch (error) {
|
|
48
49
|
Logger.log(Logger.FAILURE_TYPE, `Kindly retry npm install. & ${error.message}`);
|