Skip to content

Conversation

todortodorovic
Copy link
Contributor

Summary

Replaced two separate bash scripts with a single unified CLI tool that automates tutorial creation from start to finish.

Changes

Unified Tutorial Creator

  • Replaced: scaffold-tutorial.sh + bootstrap-tests.shcreate-tutorial.js
  • Command: npm run create-tutorial my-tutorial
  • Does everything:
    • Creates git branch
    • Scaffolds folder structure
    • Sets up test environment
    • Installs dependencies
    • Validates input and shows next steps

Documentation

  • Added: .github/TUTORIAL_WORKFLOW.md with visual Mermaid diagram
  • Updated: CONTRIBUTING.md with quick start guide

Benefits

  • 6 commands → 1 command for contributors
  • Better validation and error handling
  • Single source of truth (no confusion)
  • Clearer progress feedback

Testing

npm run create-tutorial test-tutorial
cd tutorials/test-tutorial
npm test

@todortodorovic todortodorovic self-assigned this Oct 9, 2025
@todortodorovic todortodorovic added the enhancement New feature or request label Oct 9, 2025
@todortodorovic todortodorovic added the enhancement New feature or request label Oct 9, 2025
Copy link
Collaborator

@brunopgalvao brunopgalvao left a comment

Choose a reason for hiding this comment

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

Overall looks good. One feedback that I have is why not create the CLI in Rust? As a systems programming language, Rust would be an excellent choice for a CLI tool. The code would compile down into a CLI binary that users can download and execute e.g. create-tutorial test-tutorial. Additionally, since I consider Parity/Polkadot mostly as a "Rust shop", I think it is good for us to invest regular practice using Rust as the ROI will pay off in terms of becoming more fluent and knowledgeable with the Polkadot SDK.

@todortodorovic
Copy link
Contributor Author

I agree with you, everything has now been fully migrated to Rust. A refactor has also been done, so the code is split into multiple files for easier future improvements. Tests have been added for all functions, along with end-to-end tests.

Copy link
Collaborator

@brunopgalvao brunopgalvao left a comment

Choose a reason for hiding this comment

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

A good start.

Comment on lines +18 to +20
```bash
cd tools/create-tutorial
cargo build --release
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally we will have a CI job that builds this and users can download the binary according to their OS.
This can come in a later PR.

Copy link
Collaborator

@brunopgalvao brunopgalvao Oct 13, 2025

Choose a reason for hiding this comment

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

Please update the CONTRIBUTING.md to reflect these steps e.g. cargo build, npm run...

println!("{}", "Step 1/4: Creating git branch...".cyan());

let branch_name = format!("feat/tutorial-{}", slug);
let output = Command::new("git")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I recommend using a git crate instead of relying on using whatever git binary they have on their machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants