@storm-software/git-tools 1.2.17 → 1.2.19
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/CHANGELOG.md +17 -0
- package/bin/post-checkout.cjs +12 -8
- package/bin/post-commit.cjs +7 -7
- package/bin/post-merge.cjs +12 -8
- package/bin/pre-push.cjs +44 -8
- package/package.json +1 -1
- package/scripts/check-lock-file.cjs +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [1.2.18](https://github.com/storm-software/storm-ops/compare/git-tools-v1.2.17...git-tools-v1.2.18) (2023-11-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **git-tools:** Updated code that checks for git-lfs in hooks ([ec4e632](https://github.com/storm-software/storm-ops/commit/ec4e632fe5db27eba12e7dffbbab7ef96c2ef40e))
|
|
7
|
+
|
|
8
|
+
## [1.2.17](https://github.com/storm-software/storm-ops/compare/git-tools-v1.2.16...git-tools-v1.2.17) (2023-11-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **git-tools:** Added logging to husky hooks ([5b4a159](https://github.com/storm-software/storm-ops/commit/5b4a1597fee820bf1aa009473b313d43d06ae1c9))
|
|
14
|
+
* **git-tools:** Moved hook executable scripts to bin folder ([36f8896](https://github.com/storm-software/storm-ops/commit/36f889633a971ac091491dd82fbd40d6cc6236dc))
|
|
15
|
+
* **git-tools:** Updated executable scripts to check for git-lfs failures ([ad738cf](https://github.com/storm-software/storm-ops/commit/ad738cfaadc30306c9ff9e2e7fde19c9b328ccaf))
|
|
16
|
+
* **git-tools:** Wrapped all hook executable scripts with try-catches ([f36b181](https://github.com/storm-software/storm-ops/commit/f36b1813a88970eb7fd24c67ef71e93bca7edcf9))
|
|
17
|
+
|
|
1
18
|
## [1.2.16](https://github.com/storm-software/storm-ops/compare/git-tools-v1.2.15...git-tools-v1.2.16) (2023-11-10)
|
|
2
19
|
|
|
3
20
|
|
package/bin/post-checkout.cjs
CHANGED
|
@@ -5,19 +5,23 @@ const { execSync } = require("node:child_process");
|
|
|
5
5
|
try {
|
|
6
6
|
console.log("Running Storm post-checkout hook...");
|
|
7
7
|
|
|
8
|
+
const changed = execSync(
|
|
9
|
+
"git diff-tree -r --name-only --no-commit-id $1 $2",
|
|
10
|
+
"utf8"
|
|
11
|
+
);
|
|
8
12
|
execSync(
|
|
9
|
-
|
|
13
|
+
`node @storm-software/git-tools/scripts/package-version-warning.cjs ${changed}`
|
|
10
14
|
);
|
|
11
15
|
|
|
12
|
-
const result = execSync(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
console.error(`Git LFS error: ${result}`);
|
|
16
|
+
const result = execSync("git-lfs -v", "utf8");
|
|
17
|
+
if (result && Number.isInteger(Number.parseInt(result)) && Number(result)) {
|
|
18
|
+
console.error(
|
|
19
|
+
`This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.\nError: ${result}`
|
|
20
|
+
);
|
|
18
21
|
process.exit(1);
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
|
|
24
|
+
execSync("git lfs post-checkout origin main");
|
|
21
25
|
} catch (e) {
|
|
22
26
|
console.error(e);
|
|
23
27
|
process.exit(1);
|
package/bin/post-commit.cjs
CHANGED
|
@@ -5,15 +5,15 @@ const { execSync } = require("node:child_process");
|
|
|
5
5
|
try {
|
|
6
6
|
console.log("Running Storm post-commit hook...");
|
|
7
7
|
|
|
8
|
-
const result = execSync(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
console.error(`Git LFS error: ${result}`);
|
|
8
|
+
const result = execSync("git-lfs -v", "utf8");
|
|
9
|
+
if (result && Number.isInteger(Number.parseInt(result)) && Number(result)) {
|
|
10
|
+
console.error(
|
|
11
|
+
`This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-commit.\nError: ${result}`
|
|
12
|
+
);
|
|
14
13
|
process.exit(1);
|
|
15
14
|
}
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
execSync("git lfs post-commit origin main");
|
|
17
17
|
} catch (e) {
|
|
18
18
|
console.error(e);
|
|
19
19
|
process.exit(1);
|
package/bin/post-merge.cjs
CHANGED
|
@@ -5,19 +5,23 @@ const { execSync } = require("node:child_process");
|
|
|
5
5
|
try {
|
|
6
6
|
console.log("Running Storm post-merge hook...");
|
|
7
7
|
|
|
8
|
+
const changed = execSync(
|
|
9
|
+
"git diff-tree -r --name-only --no-commit-id $1 $2",
|
|
10
|
+
"utf8"
|
|
11
|
+
);
|
|
8
12
|
execSync(
|
|
9
|
-
|
|
13
|
+
`node @storm-software/git-tools/scripts/package-version-warning.cjs ${changed}`
|
|
10
14
|
);
|
|
11
15
|
|
|
12
|
-
const result = execSync(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
console.error(`Git LFS error: ${result}`);
|
|
16
|
+
const result = execSync("git-lfs -v", "utf8");
|
|
17
|
+
if (result && Number.isInteger(Number.parseInt(result)) && Number(result)) {
|
|
18
|
+
console.error(
|
|
19
|
+
`This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\nError: ${result}`
|
|
20
|
+
);
|
|
18
21
|
process.exit(1);
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
|
|
24
|
+
execSync("git lfs post-merge origin main");
|
|
21
25
|
} catch (e) {
|
|
22
26
|
console.error(e);
|
|
23
27
|
process.exit(1);
|
package/bin/pre-push.cjs
CHANGED
|
@@ -1,21 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { execSync } = require("node:child_process");
|
|
4
|
+
const fs = require("fs");
|
|
4
5
|
|
|
5
6
|
try {
|
|
6
7
|
console.log("Running Storm pre-push hook...");
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
console.log("🔒🔒🔒 Validating lock files 🔒🔒🔒\n");
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const errors = [];
|
|
12
|
+
if (fs.existsSync("package-lock.json")) {
|
|
13
|
+
errors.push(
|
|
14
|
+
'Invalid occurrence of "package-lock.json" file. Please remove it and use only "pnpm-lock.yaml"'
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
if (fs.existsSync("yarn.lock")) {
|
|
18
|
+
errors.push(
|
|
19
|
+
'Invalid occurrence of "yarn.lock" file. Please remove it and use only "pnpm-lock.yaml"'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const content = fs.readFileSync("pnpm-lock.yaml", "utf-8");
|
|
25
|
+
if (content.match(/localhost:487/)) {
|
|
26
|
+
errors.push(
|
|
27
|
+
'The "pnpm-lock.yaml" has reference to local repository ("localhost:4873"). Please use ensure you disable local registry before running "pnpm i"'
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
if (content.match(/resolution: \{tarball/)) {
|
|
31
|
+
errors.push(
|
|
32
|
+
'The "pnpm-lock.yaml" has reference to tarball package. Please use npm registry only'
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
errors.push('The "pnpm-lock.yaml" does not exist or cannot be read');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (errors.length > 0) {
|
|
40
|
+
errors.forEach(e => console.error(e));
|
|
16
41
|
process.exit(1);
|
|
17
42
|
}
|
|
18
|
-
|
|
43
|
+
|
|
44
|
+
console.log("Lock file is valid 👍");
|
|
45
|
+
|
|
46
|
+
const result = execSync("git-lfs -v", "utf8");
|
|
47
|
+
if (result && Number.isInteger(Number.parseInt(result)) && Number(result)) {
|
|
48
|
+
console.error(
|
|
49
|
+
`This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\nError: ${result}`
|
|
50
|
+
);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
execSync("git lfs pre-push origin main");
|
|
19
55
|
} catch (e) {
|
|
20
56
|
console.error(e);
|
|
21
57
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
|
|
3
|
-
console.log("🔒🔒🔒 Validating lock files 🔒🔒🔒\n");
|
|
4
|
-
|
|
5
|
-
const errors = [];
|
|
6
|
-
if (fs.existsSync("package-lock.json")) {
|
|
7
|
-
errors.push(
|
|
8
|
-
'Invalid occurrence of "package-lock.json" file. Please remove it and use only "pnpm-lock.yaml"'
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
if (fs.existsSync("yarn.lock")) {
|
|
12
|
-
errors.push(
|
|
13
|
-
'Invalid occurrence of "yarn.lock" file. Please remove it and use only "pnpm-lock.yaml"'
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
const content = fs.readFileSync("pnpm-lock.yaml", "utf-8");
|
|
19
|
-
if (content.match(/localhost:487/)) {
|
|
20
|
-
errors.push(
|
|
21
|
-
'The "pnpm-lock.yaml" has reference to local repository ("localhost:4873"). Please use ensure you disable local registry before running "pnpm i"'
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
if (content.match(/resolution: \{tarball/)) {
|
|
25
|
-
errors.push(
|
|
26
|
-
'The "pnpm-lock.yaml" has reference to tarball package. Please use npm registry only'
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
} catch {
|
|
30
|
-
errors.push('The "pnpm-lock.yaml" does not exist or cannot be read');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (errors.length > 0) {
|
|
34
|
-
errors.forEach(e => console.log(e));
|
|
35
|
-
process.exit(1);
|
|
36
|
-
} else {
|
|
37
|
-
console.log("Lock file is valid 👍");
|
|
38
|
-
process.exit(0);
|
|
39
|
-
}
|