@storm-software/workspace-tools 1.66.7 → 1.66.9

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,27 @@
1
+ ## 1.66.9 (2024-03-28)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **workspace-tools:** Resolve result handling in `cargo-publish` executor ([09a25a73](https://github.com/storm-software/storm-ops/commit/09a25a73))
7
+
8
+
9
+ ### ❤️ Thank You
10
+
11
+ - Patrick Sullivan
12
+
13
+ ## 1.66.8 (2024-03-28)
14
+
15
+
16
+ ### 🩹 Fixes
17
+
18
+ - **workspace-tools:** Correctly handle all value types in error logging ([4b072154](https://github.com/storm-software/storm-ops/commit/4b072154))
19
+
20
+
21
+ ### ❤️ Thank You
22
+
23
+ - Patrick Sullivan
24
+
1
25
  ## 1.66.7 (2024-03-28)
2
26
 
3
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.66.7",
3
+ "version": "1.66.9",
4
4
  "private": false,
5
5
  "description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
6
6
  "keywords": [
@@ -49,37 +49,30 @@ export default async function runExecutor(
49
49
  const command = cargoPublishCommandSegments.join(" ");
50
50
  output.logSingleLine(`Running "${command}"...`);
51
51
 
52
- execSync(command, {
52
+ const result = execSync(command, {
53
53
  maxBuffer: LARGE_BUFFER,
54
54
  env: {
55
- ...process.env
55
+ ...process.env,
56
+ FORCE_COLOR: "true"
56
57
  },
57
58
  cwd: packageRoot,
58
- stdio: "inherit"
59
+ stdio: ["ignore", "pipe", "pipe"]
59
60
  });
60
61
  console.log("");
62
+ console.log(result ? result.toString() : "No Result");
61
63
 
62
- if (isDryRun) {
63
- console.log("Would publish to https://crates.io, but [dry-run] was set");
64
- } else {
65
- console.log("Published to https://crates.io");
66
- }
67
-
68
- return {
69
- success: true
70
- };
71
- } catch (error: any) {
64
+ const resultJson = JSON.parse(result.toString());
72
65
  if (
73
- (error?.message &&
74
- typeof error.message === "string" &&
75
- error.message.toLowerCase().includes("crate version") &&
76
- error.message.toLowerCase().includes("is already uploaded")) ||
77
- (error?.cause?.message &&
78
- typeof error.cause.message === "string" &&
79
- error.cause.message.toLowerCase().includes("crate version") &&
80
- error.cause.message.toLowerCase().includes("is already uploaded"))
66
+ (resultJson?.message &&
67
+ typeof resultJson.message === "string" &&
68
+ resultJson.message.toLowerCase().includes("crate version") &&
69
+ resultJson.message.toLowerCase().includes("is already uploaded")) ||
70
+ (resultJson?.cause?.message &&
71
+ typeof resultJson.cause.message === "string" &&
72
+ resultJson.cause.message.toLowerCase().includes("crate version") &&
73
+ resultJson.cause.message.toLowerCase().includes("is already uploaded"))
81
74
  ) {
82
- console.log(
75
+ console.warn(
83
76
  `Skipped package "${cargoToml.package.name}" from project "${cargoToml.package.name}" because v${cargoToml.package.version} already exists in https://crates.io with tag "latest"`
84
77
  );
85
78
 
@@ -88,10 +81,19 @@ export default async function runExecutor(
88
81
  };
89
82
  }
90
83
 
84
+ if (isDryRun) {
85
+ console.log("Would publish to https://crates.io, but [dry-run] was set");
86
+ } else {
87
+ console.log("Published to https://crates.io");
88
+ }
89
+
90
+ return {
91
+ success: true
92
+ };
93
+ } catch (error: any) {
91
94
  console.error("Failed to publish to https://crates.io");
92
95
  console.error(error);
93
96
  console.log("");
94
- console.error(formatLog(error));
95
97
 
96
98
  return {
97
99
  success: false
@@ -99,9 +101,18 @@ export default async function runExecutor(
99
101
  }
100
102
  }
101
103
 
102
- const formatLog = (message: any): string =>
103
- typeof message === "object"
104
- ? Object.keys(message)
105
- .map((key) => ` - ${key}=${formatLog(message[key])}`)
106
- .join("\n")
107
- : JSON.stringify(message);
104
+ const formatLog = (message?: any, name?: string): string =>
105
+ typeof message === "boolean"
106
+ ? String(message)
107
+ : !message
108
+ ? "<None>"
109
+ : typeof message === "string"
110
+ ? `"${message}"`
111
+ : typeof message === "number"
112
+ ? message.toString()
113
+ : typeof message === "object"
114
+ ? (name ? ` --- ${name} ---\n` : "") +
115
+ Object.keys(message)
116
+ .map((key) => ` - ${key}=${formatLog(message[key], key)}`)
117
+ .join("\n")
118
+ : JSON.stringify(message);