Skip to content

Conversation

@AlexD10S
Copy link
Collaborator

@AlexD10S AlexD10S commented Oct 16, 2025

Closes #663

New flag --with-frontend in pop new that supports frontend for contracts and chains. Currently it supports a curated set of community templates:
Contracts: inkathon, typink
Chain: create-dot-app

How to test

# Install with 
cargo install --git https://github.com/r0gue-io/pop-cli.git --branch  feat/scaffold-ui-templates --locked

# Interactive will prompt you for frontend template
pop new chain / pop new contract
# Or just CLI
pop new chain my-chain --with-frontend
pop new contract flipper --with-frontend
# To specify the template with the CLI
pop new chain my-chain --with-frontend=create-dot-app 
pop new contract flipper --with-frontend=typink

It prompts the user to install the needed dependencies if not installed: A version >= 20 of node & bun for inkathon.
It also also includes --frontend in pop install to cover the installation of these dependencies:

pop install -y --frontend

And it provides with a command to easily start the frontend dev server:

pop up frontend

Ideally, pop up would also spin up the local chain (or deploy the contract) and start the frontend dev server in one go. But that's trickier than it looks, because both spinning up the chain/contract and running the frontend are long-running processes that block indefinitely.

Future improvements:

@AlexD10S AlexD10S changed the title POC - feat: scaffold UI templates feat: scaffold UI templates Oct 20, 2025
@AlexD10S AlexD10S force-pushed the feat/scaffold-ui-templates branch from 5aeeb0c to 83d3eef Compare October 20, 2025 10:07
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 47.46193% with 207 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.59%. Comparing base (4c38fc3) to head (e54e9a6).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/install/frontend.rs 20.21% 71 Missing and 4 partials ⚠️
crates/pop-cli/src/commands/new/frontend.rs 46.91% 40 Missing and 3 partials ⚠️
crates/pop-cli/src/commands/up/frontend.rs 53.08% 30 Missing and 8 partials ⚠️
crates/pop-cli/src/commands/new/chain.rs 0.00% 22 Missing ⚠️
crates/pop-cli/src/commands/new/contract.rs 51.72% 9 Missing and 5 partials ⚠️
crates/pop-cli/src/commands/install/mod.rs 61.11% 7 Missing ⚠️
crates/pop-common/src/templates/frontend.rs 92.30% 5 Missing ⚠️
crates/pop-cli/src/commands/mod.rs 0.00% 1 Missing ⚠️
crates/pop-cli/src/commands/new/mod.rs 50.00% 1 Missing ⚠️
crates/pop-cli/src/commands/up/mod.rs 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main     #676      +/-   ##
==========================================
- Coverage   77.06%   76.59%   -0.47%     
==========================================
  Files         109      113       +4     
  Lines       24667    25050     +383     
  Branches    24667    25050     +383     
==========================================
+ Hits        19010    19188     +178     
- Misses       3654     3841     +187     
- Partials     2003     2021      +18     
Files with missing lines Coverage Δ
crates/pop-cli/src/common/binary.rs 72.65% <ø> (ø)
crates/pop-common/src/lib.rs 83.82% <ø> (ø)
crates/pop-common/src/templates/mod.rs 78.57% <ø> (ø)
crates/pop-cli/src/commands/mod.rs 67.50% <0.00%> (-0.34%) ⬇️
crates/pop-cli/src/commands/new/mod.rs 76.81% <50.00%> (-0.81%) ⬇️
crates/pop-cli/src/commands/up/mod.rs 71.42% <0.00%> (-0.74%) ⬇️
crates/pop-common/src/templates/frontend.rs 92.30% <92.30%> (ø)
crates/pop-cli/src/commands/install/mod.rs 41.47% <61.11%> (-0.26%) ⬇️
crates/pop-cli/src/commands/new/contract.rs 79.11% <51.72%> (-3.39%) ⬇️
crates/pop-cli/src/commands/new/chain.rs 47.97% <0.00%> (-2.51%) ⬇️
... and 3 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlexD10S AlexD10S requested a review from Copilot October 23, 2025 08:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds frontend scaffolding capabilities to Pop CLI through a new --with-frontend flag for the pop new chain and pop new contract commands. The feature supports curated community templates for both contracts (inkathon, typink) and chains (create-polkadot-dapp, create-dot-app), and integrates frontend development server startup into the pop up command.

Key changes:

  • Introduces FrontendType and FrontendTemplate enums to represent and configure frontend templates
  • Adds --with-frontend flag to contract and chain creation commands with interactive template selection
  • Extends pop up command to automatically start frontend dev servers when a frontend directory is detected

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/pop-common/src/templates/mod.rs Exports new frontend module
crates/pop-common/src/templates/frontend.rs Defines frontend template types and configuration
crates/pop-common/src/lib.rs Exports frontend types for public API
crates/pop-cli/src/common/binary.rs Extends feature flags to include contract features
crates/pop-cli/src/commands/up/network.rs Adds frontend server support to network command
crates/pop-cli/src/commands/up/mod.rs Adds frontend module and updates test defaults
crates/pop-cli/src/commands/up/frontend.rs Implements frontend directory resolution and server startup
crates/pop-cli/src/commands/up/contract.rs Adds frontend server support to contract deployment
crates/pop-cli/src/commands/new/mod.rs Updates command defaults with frontend flag
crates/pop-cli/src/commands/new/frontend.rs Implements frontend template selection and creation
crates/pop-cli/src/commands/new/contract.rs Integrates frontend scaffolding into contract creation
crates/pop-cli/src/commands/new/chain.rs Integrates frontend scaffolding into chain creation
crates/pop-cli/src/commands/install/mod.rs Exports new frontend installation module
crates/pop-cli/src/commands/install/frontend.rs Implements installation checks for Node, npx, and Bun

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@AlexD10S AlexD10S force-pushed the feat/scaffold-ui-templates branch from fc8643f to 37eff52 Compare October 29, 2025 13:23
));
}
}
install_nvm(cli).await?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
// Install Bun (macOS/Linux official script)
cmd("bash", vec!["-lc", r#"curl -fsSL https://bun.sh/install | bash"#]).run()?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexD10S AlexD10S marked this pull request as ready for review October 31, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(pop new): scaffold UI templates

2 participants