@storm-software/workspace-tools 1.66.8 → 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,15 @@
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
+
1
13
  ## 1.66.8 (2024-03-28)
2
14
 
3
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.66.8",
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
@@ -111,6 +113,6 @@ const formatLog = (message?: any, name?: string): string =>
111
113
  : typeof message === "object"
112
114
  ? (name ? ` --- ${name} ---\n` : "") +
113
115
  Object.keys(message)
114
- .map((key) => ` - ${key}=${formatLog(message[key])}`)
116
+ .map((key) => ` - ${key}=${formatLog(message[key], key)}`)
115
117
  .join("\n")
116
118
  : JSON.stringify(message);