@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 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
 
@@ -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
- 'changedFiles="$(git diff-tree -r --name-only --no-commit-id $1 $2)" && node @storm-software/git-tools/scripts/package-version-warning.cjs $changedFiles'
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('git lfs post-checkout "$@"');
24
+ execSync("git lfs post-checkout origin main");
21
25
  } catch (e) {
22
26
  console.error(e);
23
27
  process.exit(1);
@@ -13,7 +13,7 @@ try {
13
13
  process.exit(1);
14
14
  }
15
15
 
16
- execSync('git lfs post-commit "$@"');
16
+ execSync("git lfs post-commit origin main");
17
17
  } catch (e) {
18
18
  console.error(e);
19
19
  process.exit(1);
@@ -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
- 'changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" && @storm-software/git-tools/scripts/package-version-warning.cjs $changedFiles'
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('git lfs post-merge "$@"');
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
- execSync("node @storm-software/git-tools/scripts/check-lock-file.cjs");
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('git lfs pre-push "$@"');
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/git-tools",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "private": false,
5
5
  "description": "⚡ A package containing various git tools used in Storm workspaces.",
6
6
  "keywords": [
@@ -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
- }