@storm-software/git-tools 1.2.18 → 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 +7 -0
- package/bin/post-checkout.cjs +6 -2
- package/bin/post-commit.cjs +1 -1
- package/bin/post-merge.cjs +6 -2
- package/bin/pre-push.cjs +38 -2
- package/package.json +1 -1
- package/scripts/check-lock-file.cjs +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
9
|
|
|
3
10
|
|
package/bin/post-checkout.cjs
CHANGED
|
@@ -5,8 +5,12 @@ 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
16
|
const result = execSync("git-lfs -v", "utf8");
|
|
@@ -17,7 +21,7 @@ try {
|
|
|
17
21
|
process.exit(1);
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
execSync(
|
|
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
package/bin/post-merge.cjs
CHANGED
|
@@ -5,8 +5,12 @@ 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
16
|
const result = execSync("git-lfs -v", "utf8");
|
|
@@ -17,7 +21,7 @@ try {
|
|
|
17
21
|
process.exit(1);
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
execSync(
|
|
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,11 +1,47 @@
|
|
|
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");
|
|
10
|
+
|
|
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));
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.log("Lock file is valid 👍");
|
|
9
45
|
|
|
10
46
|
const result = execSync("git-lfs -v", "utf8");
|
|
11
47
|
if (result && Number.isInteger(Number.parseInt(result)) && Number(result)) {
|
|
@@ -15,7 +51,7 @@ try {
|
|
|
15
51
|
process.exit(1);
|
|
16
52
|
}
|
|
17
53
|
|
|
18
|
-
execSync(
|
|
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
|
-
}
|