@zohodesk/codestandard-validator 0.0.6-exp-5 → 0.0.6-exp-6
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
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
3
7
|
const {
|
|
4
8
|
exec
|
|
5
9
|
} = require('child_process');
|
|
@@ -240,4 +244,4 @@ async function prePushCheck() {
|
|
|
240
244
|
process.exit(1);
|
|
241
245
|
}
|
|
242
246
|
}
|
|
243
|
-
prePushCheck
|
|
247
|
+
var _default = exports.default = prePushCheck;
|
|
@@ -19,6 +19,9 @@ const {
|
|
|
19
19
|
const {
|
|
20
20
|
arePluginsInstalled
|
|
21
21
|
} = require("../../utils/PluginsInstallation/arePluginsInstalled");
|
|
22
|
+
const {
|
|
23
|
+
default: prePushCheck
|
|
24
|
+
} = require("../PrePush/pre-push");
|
|
22
25
|
async function validateRemotePackages() {
|
|
23
26
|
try {
|
|
24
27
|
if (!(getStoredCommitHash() == getLastCommitHash())) {
|
|
@@ -31,4 +34,7 @@ async function validateRemotePackages() {
|
|
|
31
34
|
Logger.log(Logger.FAILURE_TYPE, `Kindly retry npm install. & ${error.message}`);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
|
|
37
|
+
(async function () {
|
|
38
|
+
await validateRemotePackages();
|
|
39
|
+
await prePushCheck();
|
|
40
|
+
})();
|
|
@@ -22,25 +22,32 @@ const {
|
|
|
22
22
|
function configurePrecommitHook() {
|
|
23
23
|
let rootDirectory = getRootDirectory();
|
|
24
24
|
let customPrecomitHookPath = path.join(getLibraryInstalledLocation(), "bin", "precommit.js");
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
// let customPrePushHookPath = path.join(
|
|
27
|
+
// getLibraryInstalledLocation(),
|
|
28
|
+
// "bin",
|
|
29
|
+
// "push.js"
|
|
30
|
+
// );
|
|
31
|
+
|
|
26
32
|
let huskyPrecommitPath = path.join(rootDirectory, ".husky", "pre-commit");
|
|
27
|
-
let huskyPrePushPath
|
|
33
|
+
// let huskyPrePushPath = path.join(rootDirectory,".husky","pre-push")
|
|
28
34
|
let huskyPrecommitHookContent = `#!/bin/sh
|
|
29
35
|
. "$(dirname "$0")/_/husky.sh"
|
|
30
36
|
|
|
31
37
|
"${customPrecomitHookPath}"
|
|
32
38
|
`;
|
|
33
|
-
let huskyPrePushHookContent = `#!/bin/sh
|
|
34
|
-
. "$(dirname "$0")/_/husky.sh"
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
// let huskyPrePushHookContent = `#!/bin/sh
|
|
41
|
+
// . "$(dirname "$0")/_/husky.sh"
|
|
42
|
+
|
|
43
|
+
// "${customPrePushHookPath}"
|
|
44
|
+
// `
|
|
38
45
|
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-push.sh inisde husky directory', false, true);
|
|
40
|
-
if (isCustomPrecommitConfigurationSuccessful
|
|
46
|
+
// let isCustomPrePushConfigurationSuccessful = executeSynchronizedCommands(writeFileSync, [huskyPrePushPath, huskyPrePushHookContent, 'utf-8'], '', 'Could not create and write pre-push.sh inisde husky directory', false, true);
|
|
47
|
+
if (isCustomPrecommitConfigurationSuccessful) {
|
|
41
48
|
let isExecutionPermissionGivenSuccessfully_precommit = grantExecutionPermission([huskyPrecommitPath, customPrecomitHookPath]);
|
|
42
|
-
let isExecutionPermissionGivenSuccessfully_prepush = grantExecutionPermission([huskyPrePushPath, customPrePushHookPath]);
|
|
43
|
-
return isExecutionPermissionGivenSuccessfully_precommit
|
|
49
|
+
// let isExecutionPermissionGivenSuccessfully_prepush = grantExecutionPermission([huskyPrePushPath, customPrePushHookPath]);
|
|
50
|
+
return isExecutionPermissionGivenSuccessfully_precommit;
|
|
44
51
|
} else {
|
|
45
52
|
return false;
|
|
46
53
|
}
|