@@ -122,7 +122,6 @@ pub async fn entry(opts: Opts) -> Result<()> {
122122 anchor_cli:: Command :: Init {
123123 name,
124124 javascript,
125- solidity,
126125 no_install,
127126 no_git,
128127 template,
@@ -133,7 +132,6 @@ pub async fn entry(opts: Opts) -> Result<()> {
133132 & opts. cfg_override ,
134133 name,
135134 javascript,
136- solidity,
137135 no_install,
138136 no_git,
139137 template,
@@ -214,7 +212,6 @@ fn init(
214212 cfg_override : & ConfigOverride ,
215213 name : String ,
216214 javascript : bool ,
217- solidity : bool ,
218215 no_install : bool ,
219216 no_git : bool ,
220217 template : anchor_cli:: rust_template:: ProgramTemplate ,
@@ -289,33 +286,31 @@ fn init(
289286 idl : None ,
290287 } ,
291288 ) ;
292- if !solidity {
293- let component_id = anchor_cli:: rust_template:: get_or_create_program_id ( component_name) ;
294- let system_id = anchor_cli:: rust_template:: get_or_create_program_id ( system_name) ;
295- localnet. insert (
296- component_name. to_owned ( ) ,
297- ProgramDeployment {
298- address : component_id,
299- path : None ,
300- idl : None ,
301- } ,
302- ) ;
303- localnet. insert (
304- system_name. to_owned ( ) ,
305- ProgramDeployment {
306- address : system_id,
307- path : None ,
308- idl : None ,
309- } ,
310- ) ;
311- cfg. workspace . members . push ( "programs/*" . to_owned ( ) ) ;
312- cfg. workspace
313- . members
314- . push ( "programs-ecs/components/*" . to_owned ( ) ) ;
315- cfg. workspace
316- . members
317- . push ( "programs-ecs/systems/*" . to_owned ( ) ) ;
318- }
289+ let component_id = anchor_cli:: rust_template:: get_or_create_program_id ( component_name) ;
290+ let system_id = anchor_cli:: rust_template:: get_or_create_program_id ( system_name) ;
291+ localnet. insert (
292+ component_name. to_owned ( ) ,
293+ ProgramDeployment {
294+ address : component_id,
295+ path : None ,
296+ idl : None ,
297+ } ,
298+ ) ;
299+ localnet. insert (
300+ system_name. to_owned ( ) ,
301+ ProgramDeployment {
302+ address : system_id,
303+ path : None ,
304+ idl : None ,
305+ } ,
306+ ) ;
307+ cfg. workspace . members . push ( "programs/*" . to_owned ( ) ) ;
308+ cfg. workspace
309+ . members
310+ . push ( "programs-ecs/components/*" . to_owned ( ) ) ;
311+ cfg. workspace
312+ . members
313+ . push ( "programs-ecs/systems/*" . to_owned ( ) ) ;
319314
320315 // Setup the test validator to clone Bolt programs from devnet
321316 let validator = Validator {
@@ -359,7 +354,7 @@ fn init(
359354 // Remove the default programs if `--force` is passed
360355 if force {
361356 let programs_path = std:: env:: current_dir ( ) ?
362- . join ( if solidity { "solidity" } else { " programs" } )
357+ . join ( " programs")
363358 . join ( & project_name) ;
364359 fs:: create_dir_all ( & programs_path) ?;
365360 fs:: remove_dir_all ( & programs_path) ?;
@@ -371,32 +366,28 @@ fn init(
371366 }
372367
373368 // Build the program.
374- if solidity {
375- anchor_cli:: solidity_template:: create_program ( & project_name) ?;
376- } else {
377- create_system ( system_name) ?;
378- create_component ( component_name) ?;
379- rust_template:: create_program ( & project_name, template) ?;
380-
381- // Add the component as a dependency to the system
382- std:: process:: Command :: new ( "cargo" )
383- . arg ( "add" )
384- . arg ( "--package" )
385- . arg ( system_name)
386- . arg ( "--path" )
387- . arg ( format ! ( "programs-ecs/components/{}" , component_name) )
388- . arg ( "--features" )
389- . arg ( "cpi" )
390- . stdout ( std:: process:: Stdio :: null ( ) )
391- . stderr ( std:: process:: Stdio :: null ( ) )
392- . spawn ( )
393- . map_err ( |e| {
394- anyhow:: format_err!(
395- "error adding component as dependency to the system: {}" ,
396- e. to_string( )
397- )
398- } ) ?;
399- }
369+ create_system ( system_name) ?;
370+ create_component ( component_name) ?;
371+ rust_template:: create_program ( & project_name, template) ?;
372+
373+ // Add the component as a dependency to the system
374+ std:: process:: Command :: new ( "cargo" )
375+ . arg ( "add" )
376+ . arg ( "--package" )
377+ . arg ( system_name)
378+ . arg ( "--path" )
379+ . arg ( format ! ( "programs-ecs/components/{}" , component_name) )
380+ . arg ( "--features" )
381+ . arg ( "cpi" )
382+ . stdout ( std:: process:: Stdio :: null ( ) )
383+ . stderr ( std:: process:: Stdio :: null ( ) )
384+ . spawn ( )
385+ . map_err ( |e| {
386+ anyhow:: format_err!(
387+ "error adding component as dependency to the system: {}" ,
388+ e. to_string( )
389+ )
390+ } ) ?;
400391
401392 // Build the test suite.
402393 fs:: create_dir_all ( "tests/fixtures" ) ?;
@@ -429,18 +420,10 @@ fn init(
429420
430421 if jest {
431422 let mut test = File :: create ( format ! ( "tests/{}.test.js" , & project_name) ) ?;
432- if solidity {
433- test. write_all ( anchor_cli:: solidity_template:: jest ( & project_name) . as_bytes ( ) ) ?;
434- } else {
435- test. write_all ( templates:: workspace:: jest ( & project_name) . as_bytes ( ) ) ?;
436- }
423+ test. write_all ( templates:: workspace:: jest ( & project_name) . as_bytes ( ) ) ?;
437424 } else {
438425 let mut test = File :: create ( format ! ( "tests/{}.js" , & project_name) ) ?;
439- if solidity {
440- test. write_all ( anchor_cli:: solidity_template:: mocha ( & project_name) . as_bytes ( ) ) ?;
441- } else {
442- test. write_all ( templates:: workspace:: mocha ( & project_name) . as_bytes ( ) ) ?;
443- }
426+ test. write_all ( templates:: workspace:: mocha ( & project_name) . as_bytes ( ) ) ?;
444427 }
445428
446429 let mut deploy = File :: create ( "migrations/deploy.js" ) ?;
@@ -458,11 +441,7 @@ fn init(
458441 deploy. write_all ( anchor_cli:: rust_template:: ts_deploy_script ( ) . as_bytes ( ) ) ?;
459442
460443 let mut mocha = File :: create ( format ! ( "tests/{}.ts" , & project_name) ) ?;
461- if solidity {
462- mocha. write_all ( anchor_cli:: solidity_template:: ts_mocha ( & project_name) . as_bytes ( ) ) ?;
463- } else {
464- mocha. write_all ( templates:: workspace:: ts_mocha ( & project_name) . as_bytes ( ) ) ?;
465- }
444+ mocha. write_all ( templates:: workspace:: ts_mocha ( & project_name) . as_bytes ( ) ) ?;
466445 }
467446
468447 if !no_install {
0 commit comments