Skip to content

Commit 10c1261

Browse files
committed
parse cargo toml
1 parent 5505a65 commit 10c1261

File tree

3 files changed

+71
-58
lines changed

3 files changed

+71
-58
lines changed

packages/thirdweb/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
"ora": "8.2.0",
198198
"ox": "0.6.10",
199199
"prompts": "2.4.2",
200+
"toml": "3.0.0",
200201
"uqr": "0.1.2",
201202
"viem": "2.23.10"
202203
},

packages/thirdweb/src/cli/commands/stylus/builder.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { existsSync, readFileSync } from "node:fs";
33
import { join } from "node:path";
44
import open from "open";
55
import ora, { type Ora } from "ora";
6+
import { parse } from "toml";
67
import { createThirdwebClient } from "../../../client/client.js";
78
import { upload } from "../../../storage/upload.js";
89

@@ -47,9 +48,12 @@ async function buildStylus(spinner: Ora, secretKey?: string) {
4748
}
4849

4950
const cargoToml = readFileSync(cargoTomlPath, "utf8");
50-
if (!cargoToml.includes("[dependencies.stylus-sdk]")) {
51-
// spinner.fail("Error: Not a Stylus project. Missing stylus-sdk dependency.");
52-
// process.exit(1);
51+
const parsedCargoToml = parse(cargoToml);
52+
if (!parsedCargoToml.dependencies?.["stylus-sdk"]) {
53+
spinner.fail(
54+
"Error: Not a Stylus project. Missing stylus-sdk dependency.",
55+
);
56+
process.exit(1);
5357
}
5458

5559
spinner.succeed("Stylus project detected.");

0 commit comments

Comments
 (0)