@storm-software/workspace-tools 1.66.10 → 1.66.11

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.11 (2024-03-28)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **workspace-tools:** Enhance code to check crates.io version through API ([1cec1ccd](https://github.com/storm-software/storm-ops/commit/1cec1ccd))
7
+
8
+
9
+ ### ❤️ Thank You
10
+
11
+ - Patrick Sullivan
12
+
1
13
  ## 1.66.10 (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.10",
3
+ "version": "1.66.11",
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,10 +3,17 @@ 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 axios from "axios";
7
+ import { encode } from "node:querystring";
7
8
 
8
9
  const LARGE_BUFFER = 1024 * 1000000;
9
10
 
11
+ const REGISTRY = axios.create({
12
+ baseURL: "https://crates.io/api/v1/crates",
13
+ headers: { "Content-Type": "application/json", Authorization: process.env.CARGO_REGISTRY_TOKEN },
14
+ timeout: 8000
15
+ });
16
+
10
17
  export default async function runExecutor(
11
18
  options: CargoPublishExecutorSchema,
12
19
  context: ExecutorContext
@@ -41,23 +48,19 @@ export default async function runExecutor(
41
48
  );
42
49
 
43
50
  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) {
51
+ const result = await REGISTRY.get(
52
+ `/${encode(cargoToml.package.name)}/${encode(cargoToml.package.version)}`
53
+ );
54
+ if (result?.data) {
49
55
  console.warn(
50
- `Skipped package "${packageName}" from project "${context.projectName}" because v${currentVersion} already exists in https://crates.io with tag "latest"`
56
+ `Skipped package "${cargoToml.package.name}" from project "${context.projectName}" because v${cargoToml.package.version} already exists in https://crates.io with tag "latest"`
51
57
  );
52
58
 
53
59
  return {
54
60
  success: true
55
61
  };
56
62
  }
57
- } catch (error: any) {
58
- console.log("No results returned while checking the crate version in https://crates.io");
59
- console.warn(error);
60
- }
63
+ } catch (_: any) {}
61
64
 
62
65
  const cargoPublishCommandSegments = [`cargo publish --allow-dirty -p ${cargoToml.package.name}`];
63
66
  if (isDryRun) {