@@ -43,32 +43,37 @@ export async function createStylusProject() {
43
43
choices : [
44
44
{ title : "Default" , value : "default" } ,
45
45
{ title : "ERC20" , value : "erc20" } ,
46
+ { title : "ERC721" , value : "erc721" } ,
46
47
] ,
47
48
message : "Select a template:" ,
48
49
name : "projectType" ,
49
50
type : "select" ,
50
51
} ) ;
51
52
52
53
// Step 5: Create the project
54
+ let newProject ;
53
55
if ( projectType === "default" ) {
54
56
spinner . start ( `Creating new Stylus project: ${ projectName } ...` ) ;
55
- const newProject = spawnSync ( "cargo" , [ "stylus" , "new" , projectName ] , {
57
+ newProject = spawnSync ( "cargo" , [ "stylus" , "new" , projectName ] , {
56
58
stdio : "inherit" ,
57
59
} ) ;
58
- if ( newProject . status !== 0 ) {
59
- spinner . fail ( "Failed to create Stylus project." ) ;
60
- process . exit ( 1 ) ;
61
- }
62
60
} else if ( projectType === "erc20" ) {
63
61
const repoUrl = "git@github.com:thirdweb-example/stylus-erc20-template.git" ;
64
62
spinner . start ( `Creating new ERC20 Stylus project: ${ projectName } ...` ) ;
65
- const clone = spawnSync ( "git" , [ "clone" , repoUrl , projectName ] , {
63
+ newProject = spawnSync ( "git" , [ "clone" , repoUrl , projectName ] , {
66
64
stdio : "inherit" ,
67
65
} ) ;
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 ) ;
72
77
}
73
78
74
79
spinner . succeed ( "Project created successfully." ) ;
0 commit comments