Skip to content

Commit c01e0a8

Browse files
committed
erc721 template
1 parent 85c4ef1 commit c01e0a8

File tree

1 file changed

+15
-10
lines changed
  • packages/thirdweb/src/cli/commands/stylus

1 file changed

+15
-10
lines changed

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,37 @@ export async function createStylusProject() {
4343
choices: [
4444
{ title: "Default", value: "default" },
4545
{ title: "ERC20", value: "erc20" },
46+
{ title: "ERC721", value: "erc721" },
4647
],
4748
message: "Select a template:",
4849
name: "projectType",
4950
type: "select",
5051
});
5152

5253
// Step 5: Create the project
54+
let newProject;
5355
if (projectType === "default") {
5456
spinner.start(`Creating new Stylus project: ${projectName}...`);
55-
const newProject = spawnSync("cargo", ["stylus", "new", projectName], {
57+
newProject = spawnSync("cargo", ["stylus", "new", projectName], {
5658
stdio: "inherit",
5759
});
58-
if (newProject.status !== 0) {
59-
spinner.fail("Failed to create Stylus project.");
60-
process.exit(1);
61-
}
6260
} else if (projectType === "erc20") {
6361
const repoUrl = "git@github.com:thirdweb-example/stylus-erc20-template.git";
6462
spinner.start(`Creating new ERC20 Stylus project: ${projectName}...`);
65-
const clone = spawnSync("git", ["clone", repoUrl, projectName], {
63+
newProject = spawnSync("git", ["clone", repoUrl, projectName], {
6664
stdio: "inherit",
6765
});
68-
if (clone.status !== 0) {
69-
spinner.fail("Failed to create Stylus project.");
70-
process.exit(1);
71-
}
66+
} else if (projectType === "erc721") {
67+
const repoUrl = "git@github.com:thirdweb-example/stylus-erc721-template.git";
68+
spinner.start(`Creating new ERC721 Stylus project: ${projectName}...`);
69+
newProject = spawnSync("git", ["clone", repoUrl, projectName], {
70+
stdio: "inherit",
71+
});
72+
}
73+
74+
if (!newProject?.status || newProject.status !== 0) {
75+
spinner.fail("Failed to create Stylus project.");
76+
process.exit(1);
7277
}
7378

7479
spinner.succeed("Project created successfully.");

0 commit comments

Comments
 (0)