@storm-software/git-tools 2.5.1 → 2.5.2

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,15 @@
1
+ ## 2.5.2 (2024-03-28)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **git-tools:** Update to executable git hook scripts ([d1e0cb22](https://github.com/storm-software/storm-ops/commit/d1e0cb22))
7
+
8
+
9
+ ### ❤️ Thank You
10
+
11
+ - Patrick Sullivan
12
+
1
13
  ## 2.5.1 (2024-03-28)
2
14
 
3
15
 
package/bin/git.ts CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  import {
2
4
  loadStormConfig,
3
5
  exitWithSuccess,
@@ -37,7 +39,3 @@ void (async () => {
37
39
  process.exit(1);
38
40
  }
39
41
  })();
40
-
41
- // .then(() => {
42
- // loadStormConfig().then((config) => exitWithSuccess(config));
43
- // });
@@ -7,32 +7,37 @@ import {
7
7
  loadStormConfig,
8
8
  run,
9
9
  writeError,
10
+ writeFatal,
10
11
  writeInfo
11
12
  } from "@storm-software/config-tools";
12
13
  import { checkPackageVersion } from "../src/utilities";
13
14
 
14
- const handle = async () => {
15
+ void (async () => {
15
16
  const config = await loadStormConfig();
16
- handleProcess(config);
17
+ try {
18
+ handleProcess(config);
17
19
 
18
- writeInfo(config, "Running post-checkout hook...");
19
- checkPackageVersion(process.argv?.slice(1));
20
+ writeInfo(config, "Running post-checkout hook...");
21
+ checkPackageVersion(process.argv?.slice(1));
20
22
 
21
- try {
22
- run(config, "git-lfs version");
23
+ try {
24
+ run(config, "git-lfs version");
25
+ } catch (error) {
26
+ writeError(
27
+ config,
28
+ `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: ${
29
+ (error as Error)?.message
30
+ }`
31
+ );
32
+ exitWithError(config);
33
+ }
34
+
35
+ run(config, "git lfs post-checkout");
36
+
37
+ exitWithSuccess(config);
23
38
  } catch (error) {
24
- writeError(
25
- config,
26
- `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: ${
27
- (error as Error)?.message
28
- }`
29
- );
39
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
30
40
  exitWithError(config);
41
+ process.exit(1);
31
42
  }
32
-
33
- run(config, "git lfs post-checkout");
34
- };
35
-
36
- handle().then(() => {
37
- loadStormConfig().then((config) => exitWithSuccess(config));
38
- });
43
+ })();
@@ -7,32 +7,37 @@ import {
7
7
  loadStormConfig,
8
8
  run,
9
9
  writeError,
10
+ writeFatal,
10
11
  writeInfo
11
12
  } from "@storm-software/config-tools";
12
13
  import { checkPackageVersion } from "../src/utilities";
13
14
 
14
- const handle = async () => {
15
+ void (async () => {
15
16
  const config = await loadStormConfig();
16
- handleProcess(config);
17
+ try {
18
+ handleProcess(config);
17
19
 
18
- writeInfo(config, "Running post-commit hook...");
19
- checkPackageVersion(process.argv?.slice(1));
20
+ writeInfo(config, "Running post-commit hook...");
21
+ checkPackageVersion(process.argv?.slice(1));
20
22
 
21
- try {
22
- run(config, "git-lfs version");
23
+ try {
24
+ run(config, "git-lfs version");
25
+ } catch (error) {
26
+ writeError(
27
+ config,
28
+ `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: ${
29
+ (error as Error)?.message
30
+ }`
31
+ );
32
+ exitWithError(config);
33
+ }
34
+
35
+ run(config, "git lfs post-commit");
36
+
37
+ exitWithSuccess(config);
23
38
  } catch (error) {
24
- writeError(
25
- config,
26
- `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: ${
27
- (error as Error)?.message
28
- }`
29
- );
39
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
30
40
  exitWithError(config);
41
+ process.exit(1);
31
42
  }
32
-
33
- run(config, "git lfs post-commit");
34
- };
35
-
36
- handle().then(() => {
37
- loadStormConfig().then((config) => exitWithSuccess(config));
38
- });
43
+ })();
package/bin/post-merge.ts CHANGED
@@ -7,32 +7,37 @@ import {
7
7
  loadStormConfig,
8
8
  run,
9
9
  writeError,
10
+ writeFatal,
10
11
  writeInfo
11
12
  } from "@storm-software/config-tools";
12
13
  import { checkPackageVersion } from "../src/utilities";
13
14
 
14
- const handle = async () => {
15
+ void (async () => {
15
16
  const config = await loadStormConfig();
16
- handleProcess(config);
17
+ try {
18
+ handleProcess(config);
17
19
 
18
- writeInfo(config, "Running post-merge hook...");
19
- checkPackageVersion(process.argv?.slice(1));
20
+ writeInfo(config, "Running post-merge hook...");
21
+ checkPackageVersion(process.argv?.slice(1));
20
22
 
21
- try {
22
- run(config, "git-lfs version");
23
+ try {
24
+ run(config, "git-lfs version");
25
+ } catch (error) {
26
+ writeError(
27
+ config,
28
+ `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: ${
29
+ (error as Error)?.message
30
+ }`
31
+ );
32
+ exitWithError(config);
33
+ }
34
+
35
+ run(config, "git lfs post-merge");
36
+
37
+ exitWithSuccess(config);
23
38
  } catch (error) {
24
- writeError(
25
- config,
26
- `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: ${
27
- (error as Error)?.message
28
- }`
29
- );
39
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
30
40
  exitWithError(config);
41
+ process.exit(1);
31
42
  }
32
-
33
- run(config, "git lfs post-merge");
34
- };
35
-
36
- handle().then(() => {
37
- loadStormConfig().then((config) => exitWithSuccess(config));
38
- });
43
+ })();
package/bin/pre-commit.ts CHANGED
@@ -5,24 +5,32 @@ import {
5
5
  exitWithSuccess,
6
6
  handleProcess,
7
7
  loadStormConfig,
8
- writeError
8
+ writeError,
9
+ writeFatal,
10
+ writeInfo
9
11
  } from "@storm-software/config-tools";
10
12
  import {
11
13
  checkPackageVersion,
12
14
  isPackageVersionChanged
13
15
  } from "../src/utilities/check-package-version";
14
16
 
15
- const handle = async () => {
17
+ void (async () => {
16
18
  const config = await loadStormConfig();
17
- handleProcess(config);
19
+ try {
20
+ handleProcess(config);
18
21
 
19
- checkPackageVersion(process.argv.slice(1));
20
- if (isPackageVersionChanged(process.argv?.slice(1))) {
21
- writeError(config, "Please regenerate the package lock file before committing...");
22
+ writeInfo(config, "Running pre-commit hook...");
23
+
24
+ checkPackageVersion(process.argv.slice(1));
25
+ if (isPackageVersionChanged(process.argv?.slice(1))) {
26
+ writeError(config, "Please regenerate the package lock file before committing...");
27
+ exitWithError(config);
28
+ }
29
+
30
+ exitWithSuccess(config);
31
+ } catch (error) {
32
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
22
33
  exitWithError(config);
34
+ process.exit(1);
23
35
  }
24
- };
25
-
26
- handle().then(() => {
27
- loadStormConfig().then((config) => exitWithSuccess(config));
28
- });
36
+ })();
@@ -1,25 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import {
4
+ exitWithError,
4
5
  exitWithSuccess,
5
6
  handleProcess,
6
7
  loadStormConfig,
7
8
  run,
9
+ writeFatal,
8
10
  writeInfo
9
11
  } from "@storm-software/config-tools";
10
12
 
11
- const handle = async () => {
13
+ void (async () => {
12
14
  const config = await loadStormConfig();
13
- handleProcess(config);
15
+ try {
16
+ handleProcess(config);
14
17
 
15
- if (config.ci) {
16
- writeInfo(config, "Skipping pre-install for CI process...");
17
- exitWithSuccess(config);
18
- }
18
+ writeInfo(config, "Running pre-install hook...");
19
+
20
+ if (config.ci) {
21
+ writeInfo(config, "Skipping pre-install for CI process...");
22
+ exitWithSuccess(config);
23
+ }
19
24
 
20
- run(config, "npx -y only-allow pnpm");
21
- };
25
+ run(config, "npx -y only-allow pnpm");
22
26
 
23
- handle().then(() => {
24
- loadStormConfig().then((config) => exitWithSuccess(config));
25
- });
27
+ exitWithSuccess(config);
28
+ } catch (error) {
29
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
30
+ exitWithError(config);
31
+ process.exit(1);
32
+ }
33
+ })();
package/bin/pre-push.ts CHANGED
@@ -6,84 +6,87 @@ import path from "node:path";
6
6
  import {
7
7
  exitWithError,
8
8
  exitWithSuccess,
9
- findWorkspaceRootSafe,
10
9
  handleProcess,
11
10
  loadStormConfig,
12
11
  run,
13
12
  writeError,
13
+ writeFatal,
14
14
  writeInfo,
15
15
  writeSuccess
16
16
  } from "@storm-software/config-tools";
17
17
  import { checkPackageVersion } from "../src/utilities";
18
18
 
19
- const handle = async () => {
19
+ void (async () => {
20
20
  const config = await loadStormConfig();
21
- handleProcess(config);
21
+ try {
22
+ handleProcess(config);
22
23
 
23
- writeInfo(config, "Running pre-push hook...");
24
- checkPackageVersion(process.argv?.slice(1));
24
+ writeInfo(config, "Running pre-push hook...");
25
+ checkPackageVersion(process.argv?.slice(1));
25
26
 
26
- writeInfo(config, "🔒🔒🔒 Validating lock files 🔒🔒🔒\n");
27
+ writeInfo(config, "🔒🔒🔒 Validating lock files 🔒🔒🔒\n");
27
28
 
28
- const workspaceRoot = findWorkspaceRootSafe();
29
- const errors = [];
29
+ const errors = [] as string[];
30
30
 
31
- if (fs.existsSync(path.join(workspaceRoot, "package-lock.json"))) {
32
- errors.push(
33
- 'Invalid occurrence of "package-lock.json" file. Please remove it and use only "pnpm-lock.yaml"'
34
- );
35
- }
36
- if (fs.existsSync(path.join(workspaceRoot, "yarn.lock"))) {
37
- errors.push(
38
- 'Invalid occurrence of "yarn.lock" file. Please remove it and use only "pnpm-lock.yaml"'
39
- );
40
- }
41
-
42
- try {
43
- const content = await readFile(path.join(workspaceRoot, "pnpm-lock.yaml"), {
44
- encoding: "utf8"
45
- });
46
- if (content.match(/localhost:487/)) {
31
+ if (fs.existsSync(path.join(config.workspaceRoot ?? "./", "package-lock.json"))) {
47
32
  errors.push(
48
- 'The "pnpm-lock.yaml" has reference to local repository ("localhost:4873"). Please use ensure you disable local registry before running "pnpm i"'
33
+ 'Invalid occurrence of "package-lock.json" file. Please remove it and use only "pnpm-lock.yaml"'
49
34
  );
50
35
  }
51
- if (content.match(/resolution: \{tarball/)) {
36
+ if (fs.existsSync(path.join(config.workspaceRoot ?? "./", "yarn.lock"))) {
52
37
  errors.push(
53
- 'The "pnpm-lock.yaml" has reference to tarball package. Please use npm registry only'
38
+ 'Invalid occurrence of "yarn.lock" file. Please remove it and use only "pnpm-lock.yaml"'
54
39
  );
55
40
  }
56
- } catch {
57
- errors.push('The "pnpm-lock.yaml" does not exist or cannot be read');
58
- }
59
41
 
60
- if (errors.length > 0) {
61
- writeError(config, "❌ Lock file validation failed");
62
- for (const error of errors) {
63
- console.error(error);
42
+ try {
43
+ const content = await readFile(path.join(config.workspaceRoot ?? "./", "pnpm-lock.yaml"), {
44
+ encoding: "utf8"
45
+ });
46
+ if (content.match(/localhost:487/)) {
47
+ errors.push(
48
+ 'The "pnpm-lock.yaml" has reference to local repository ("localhost:4873"). Please use ensure you disable local registry before running "pnpm i"'
49
+ );
50
+ }
51
+ if (content.match(/resolution: \{tarball/)) {
52
+ errors.push(
53
+ 'The "pnpm-lock.yaml" has reference to tarball package. Please use npm registry only'
54
+ );
55
+ }
56
+ } catch {
57
+ errors.push('The "pnpm-lock.yaml" does not exist or cannot be read');
64
58
  }
65
59
 
66
- exitWithError(config);
67
- }
60
+ if (errors.length > 0) {
61
+ writeError(config, "❌ Lock file validation failed");
62
+ for (const error of errors) {
63
+ console.error(error);
64
+ }
68
65
 
69
- writeSuccess(config, "✅ Lock file is valid");
70
- run(config, "git lfs pre-push origin");
66
+ exitWithError(config);
67
+ }
71
68
 
72
- try {
73
- run(config, "git-lfs version");
69
+ writeSuccess(config, "✅ Lock file is valid");
70
+ run(config, "git lfs pre-push origin");
71
+
72
+ try {
73
+ run(config, "git-lfs version");
74
+ } catch (error) {
75
+ writeError(
76
+ config,
77
+ `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: ${
78
+ (error as Error)?.message
79
+ }`
80
+ );
81
+ exitWithError(config);
82
+ }
83
+
84
+ run(config, "git lfs pre-push origin");
85
+
86
+ exitWithSuccess(config);
74
87
  } catch (error) {
75
- writeError(
76
- config,
77
- `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: ${
78
- (error as Error)?.message
79
- }`
80
- );
88
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
81
89
  exitWithError(config);
90
+ process.exit(1);
82
91
  }
83
-
84
- run(config, "git lfs pre-push origin");
85
- };
86
-
87
- handle().then(() => {
88
- loadStormConfig().then((config) => exitWithSuccess(config));
89
- });
92
+ })();
package/bin/prepare.ts CHANGED
@@ -1,16 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { exitWithSuccess, handleProcess, loadStormConfig, run } from "@storm-software/config-tools";
3
+ import {
4
+ exitWithError,
5
+ exitWithSuccess,
6
+ handleProcess,
7
+ loadStormConfig,
8
+ run,
9
+ writeFatal,
10
+ writeInfo
11
+ } from "@storm-software/config-tools";
4
12
 
5
- const handle = async () => {
13
+ void (async () => {
6
14
  const config = await loadStormConfig();
7
- handleProcess(config);
15
+ try {
16
+ handleProcess(config);
8
17
 
9
- if (!config.ci) {
10
- run(config, "lefthook install");
11
- }
12
- };
18
+ writeInfo(config, "Running prepare hook...");
19
+
20
+ if (!config.ci) {
21
+ run(config, "lefthook install");
22
+ }
13
23
 
14
- handle().then(() => {
15
- loadStormConfig().then((config) => exitWithSuccess(config));
16
- });
24
+ exitWithSuccess(config);
25
+ } catch (error) {
26
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
27
+ exitWithError(config);
28
+ process.exit(1);
29
+ }
30
+ })();
@@ -1,15 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { exitWithSuccess, handleProcess, loadStormConfig } from "@storm-software/config-tools";
3
+ import {
4
+ exitWithError,
5
+ handleProcess,
6
+ loadStormConfig,
7
+ writeFatal
8
+ } from "@storm-software/config-tools";
4
9
  import { checkPackageVersion } from "../src/utilities/check-package-version";
5
10
 
6
- const handle = async () => {
11
+ void (async () => {
7
12
  const config = await loadStormConfig();
8
- handleProcess(config);
13
+ try {
14
+ handleProcess(config);
9
15
 
10
- checkPackageVersion(process.argv.slice(1));
11
- };
12
-
13
- handle().then(() => {
14
- loadStormConfig().then((config) => exitWithSuccess(config));
15
- });
16
+ checkPackageVersion(process.argv.slice(1));
17
+ } catch (error) {
18
+ writeFatal(config, `A fatal error occurred while running the program: ${error.message}`);
19
+ exitWithError(config);
20
+ process.exit(1);
21
+ }
22
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/git-tools",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "private": false,
5
5
  "description": "⚡ A package containing various git tools used in Storm workspaces.",
6
6
  "keywords": [
package/project.json CHANGED
@@ -7,8 +7,13 @@
7
7
  "build": {
8
8
  "cache": true,
9
9
  "executor": "@nx/esbuild:esbuild",
10
- "inputs": ["default", "^production"],
11
- "outputs": ["{options.outputPath}"],
10
+ "inputs": [
11
+ "default",
12
+ "^production"
13
+ ],
14
+ "outputs": [
15
+ "{options.outputPath}"
16
+ ],
12
17
  "options": {
13
18
  "outputPath": "dist/packages/git-tools",
14
19
  "tsConfig": "packages/git-tools/tsconfig.json",
@@ -40,8 +45,12 @@
40
45
  "skipTypeCheck": true,
41
46
  "thirdParty": true,
42
47
  "platform": "node",
43
- "format": ["cjs", "esm"],
44
- "external": ["nx"],
48
+ "format": [
49
+ "esm"
50
+ ],
51
+ "external": [
52
+ "nx"
53
+ ],
45
54
  "esbuildOptions": {
46
55
  "legalComments": "inline",
47
56
  "banner": {
@@ -98,5 +107,8 @@
98
107
  }
99
108
  }
100
109
  },
101
- "tags": ["type:util", "scope:tools"]
102
- }
110
+ "tags": [
111
+ "type:util",
112
+ "scope:tools"
113
+ ]
114
+ }
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "../../dist/out-tsc",
5
- "baseUrl": "../..",
6
- "strict": false,
7
- "module": "commonjs",
8
- "allowJs": true,
9
- "esModuleInterop": true,
10
- "allowSyntheticDefaultImports": true,
11
- "preserveSymlinks": true,
12
- "isolatedModules": true,
13
- "types": ["node"]
14
- },
15
- "include": ["**/*.ts"],
16
- "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"],
17
- "ts-node": {
18
- "require": ["tsconfig-paths/register"]
19
- }
20
- }