@storm-software/workspace-tools 1.66.10 → 1.66.12

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.12 (2024-03-28)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **workspace-tools:** Resolved `axios` module import issue ([a2bf92c2](https://github.com/storm-software/storm-ops/commit/a2bf92c2))
7
+
8
+
9
+ ### ❤️ Thank You
10
+
11
+ - Patrick Sullivan
12
+
13
+ ## 1.66.11 (2024-03-28)
14
+
15
+
16
+ ### 🩹 Fixes
17
+
18
+ - **workspace-tools:** Enhance code to check crates.io version through API ([1cec1ccd](https://github.com/storm-software/storm-ops/commit/1cec1ccd))
19
+
20
+
21
+ ### ❤️ Thank You
22
+
23
+ - Patrick Sullivan
24
+
1
25
  ## 1.66.10 (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.10",
3
+ "version": "1.66.12",
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": [
@@ -52,8 +52,8 @@
52
52
  "@nx/devkit": "18.0.4",
53
53
  "@nx/esbuild": "18.0.4",
54
54
  "@rollup/plugin-json": "6.1.0",
55
+ "axios": "1.6.7",
55
56
  "bundle-require": "^4.0.2",
56
- "crates.io": "^2.2.7",
57
57
  "decky": "1.1.1",
58
58
  "esbuild-plugin-environment": "0.3.0",
59
59
  "esbuild-plugin-handlebars": "1.0.2",
@@ -3,7 +3,7 @@ import { execSync } from "node:child_process";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { parseCargoToml } from "../../utils/toml";
5
5
  import type { CargoPublishExecutorSchema } from "./schema.d";
6
- import { CratesIO } from "crates.io";
6
+ import { encode } from "node:querystring";
7
7
 
8
8
  const LARGE_BUFFER = 1024 * 1000000;
9
9
 
@@ -11,6 +11,16 @@ export default async function runExecutor(
11
11
  options: CargoPublishExecutorSchema,
12
12
  context: ExecutorContext
13
13
  ) {
14
+ const axios = await import("axios");
15
+ const registryApi = axios.default.create({
16
+ baseURL: "https://crates.io/api/v1/crates",
17
+ headers: {
18
+ "Content-Type": "application/json",
19
+ Authorization: process.env.CARGO_REGISTRY_TOKEN
20
+ },
21
+ timeout: 8000
22
+ });
23
+
14
24
  /**
15
25
  * We need to check both the env var and the option because the executor may have been triggered
16
26
  * indirectly via dependsOn, in which case the env var will be set, but the option will not.
@@ -41,23 +51,19 @@ export default async function runExecutor(
41
51
  );
42
52
 
43
53
  try {
44
- const currentVersion = cargoToml.package.version;
45
- const packageName = cargoToml.package.name;
46
-
47
- const result = await new CratesIO().api.crates.getVersion(packageName, currentVersion);
48
- if (result) {
54
+ const result = await registryApi.get(
55
+ `/${encode(cargoToml.package.name)}/${encode(cargoToml.package.version)}`
56
+ );
57
+ if (result?.data) {
49
58
  console.warn(
50
- `Skipped package "${packageName}" from project "${context.projectName}" because v${currentVersion} already exists in https://crates.io with tag "latest"`
59
+ `Skipped package "${cargoToml.package.name}" from project "${context.projectName}" because v${cargoToml.package.version} already exists in https://crates.io with tag "latest"`
51
60
  );
52
61
 
53
62
  return {
54
63
  success: true
55
64
  };
56
65
  }
57
- } catch (error: any) {
58
- console.log("No results returned while checking the crate version in https://crates.io");
59
- console.warn(error);
60
- }
66
+ } catch (_: any) {}
61
67
 
62
68
  const cargoPublishCommandSegments = [`cargo publish --allow-dirty -p ${cargoToml.package.name}`];
63
69
  if (isDryRun) {