Skip to content

Commit fc8643f

Browse files
committed
refactor: use typeink as default
1 parent 13c8f58 commit fc8643f

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

crates/pop-cli/src/commands/new/frontend.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,22 @@ pub fn create_frontend(
4646
ensure_node_v20()?;
4747
ensure_npx()?;
4848
let project_dir = target.canonicalize()?;
49+
let command = template
50+
.command()
51+
.ok_or_else(|| anyhow::anyhow!("no command configured for {:?}", template))?;
4952
match template {
5053
// Inkathon requires Bun installed.
5154
FrontendTemplate::Inkathon => {
5255
let bun = ensure_bun(cli)?;
53-
cmd(&bun, &["x", "create-inkathon-app@latest", "frontend", "-y"])
56+
cmd(&bun, &["add", "polkadot-api"]).dir(&project_dir).unchecked().run()?;
57+
cmd(&bun, &[command, "frontend", "--yes"])
5458
.dir(&project_dir)
5559
.env("SKIP_INSTALL_SIMPLE_GIT_HOOKS", "1")
5660
.unchecked()
5761
.run()?;
5862
},
5963
// Typeink we can specify the parameters directly
6064
FrontendTemplate::Typink => {
61-
let command = template
62-
.command()
63-
.ok_or_else(|| anyhow::anyhow!("no command configured for {:?}", template))?;
6465
cmd(
6566
"npx",
6667
vec![
@@ -78,9 +79,6 @@ pub fn create_frontend(
7879
.run()?;
7980
},
8081
_ => {
81-
let command = template
82-
.command()
83-
.ok_or_else(|| anyhow::anyhow!("no command configured for {:?}", template))?;
8482
cmd("npx", vec![command, "frontend"]).dir(&project_dir).run()?;
8583
},
8684
}
@@ -131,7 +129,7 @@ mod tests {
131129
);
132130

133131
let user_input = prompt_frontend_template(&FrontendType::Contract, &mut cli)?;
134-
assert_eq!(user_input, FrontendTemplate::Inkathon);
132+
assert_eq!(user_input, FrontendTemplate::Typink);
135133

136134
cli.verify()
137135
}

crates/pop-common/src/templates/frontend.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,24 @@ impl Type<FrontendTemplate> for FrontendType {
4343
VariantArray,
4444
)]
4545
pub enum FrontendTemplate {
46+
/// Typeink template: The ultimate toolkit for dApps development on Polkadot, powered by <https://dedot.dev>!.
47+
#[default]
48+
#[strum(
49+
serialize = "typink",
50+
message = "Typink",
51+
detailed_message = "The ultimate toolkit for dApps development on Polkadot, powered by https://dedot.dev",
52+
props(Command = "create-typink@latest", Type = "Contract",)
53+
)]
54+
Typink,
4655
/// Inkathon template: Next generation full-stack boilerplate for ink! smart contracts running
4756
/// on PolkaVM.
48-
#[default]
4957
#[strum(
5058
serialize = "inkathon",
5159
message = "Inkathon",
5260
detailed_message = "Next generation full-stack boilerplate for ink! smart contracts running on PolkaVM.",
5361
props(Command = "create-inkathon-app@latest", Type = "Contract",)
5462
)]
5563
Inkathon,
56-
/// Typeink template: The ultimate toolkit for dApps development on Polkadot, powered by <https://dedot.dev>!.
57-
#[strum(
58-
serialize = "typink",
59-
message = "Typink",
60-
detailed_message = "The ultimate toolkit for dApps development on Polkadot, powered by https://dedot.dev",
61-
props(Command = "create-typink@latest", Type = "Contract",)
62-
)]
63-
Typink,
6464
/// Parity template: Create Polkadot DApp in one command.
6565
#[strum(
6666
serialize = "create-polkadot-dapp",
@@ -136,7 +136,7 @@ mod tests {
136136
fn test_convert_string_to_template() {
137137
let template_names = templates_names();
138138
// Test the default
139-
assert_eq!(FrontendTemplate::from_str("").unwrap_or_default(), Inkathon);
139+
assert_eq!(FrontendTemplate::from_str("").unwrap_or_default(), Typink);
140140
// Test the rest
141141
for template in FrontendTemplate::VARIANTS {
142142
assert_eq!(
@@ -168,7 +168,7 @@ mod tests {
168168
#[test]
169169
fn test_templates_of_type() {
170170
let mut frontend_type = FrontendType::Contract;
171-
assert_eq!(frontend_type.templates(), [&Inkathon, &Typink]);
171+
assert_eq!(frontend_type.templates(), [&Typink, &Inkathon]);
172172
frontend_type = FrontendType::Chain;
173173
assert_eq!(frontend_type.templates(), [&CreatePolkadotDapp, &CreateDotApp]);
174174
}

0 commit comments

Comments
 (0)