DEV Community

Cover image for Quick Tip: Automatically generate the scaffolding for your next project 🎯
Jermaine
Jermaine

Posted on • Edited on • Originally published at creativebracket.com

Quick Tip: Automatically generate the scaffolding for your next project 🎯

Producing the necessary files and configuration each time you start a new project setup could become tiresome. This is the case especially when you're setting nothing different from a previous project.

In this quick tip, I'd like to show you a quicker alternative to getting a Dart project up and running using a package named stagehand.


β†’ Watch on Youtube

Stagehand is a Dart project scaffolding generator inspired by mainstream tools like Web Starter Kit and Yeoman.

Now assuming you have Dart version 2 already installed(brew install dart --devel), you can grab stagehand 3.0 by running the below command:

$ pub global activate stagehand
Enter fullscreen mode Exit fullscreen mode

This will pull down the package from the pub package management repo. Then take a look at the generator template options by running:

$ stagehand
Enter fullscreen mode Exit fullscreen mode

At this present time you could generate these templates:

  1. console-full - A command-line application sample.
  2. package-simple - A starting point for Dart libraries or applications.
  3. server-shelf - A web server built using the shelf package.
  4. web-angular - A web app with material design components.
  5. web-simple - A web app that uses only core Dart libraries.
  6. web-stagexl - A starting point for 2D animation and games.

So let's say we wanted to generate the scaffolding for an AngularDart application. We can do this by running the commands below:

$ mkdir awesome_dart_project
$ cd awesome_dart_project
$ stagehand web-angular # or whichever template
Enter fullscreen mode Exit fullscreen mode

And this gives us the below with further instructions in the output:

Stagehand web-angular scaffolding output

That's it for today's quick tip. Now how about you give it a go? πŸ‘β˜ΊοΈ

Subscribe to my Youtube channel for the latest videos on Dart, thanks!

Like and follow me 😍 for more articles on Dart.

Quick links

  1. Stagehand package
  2. Dart install instructions
  3. Free Dart screencasts on Egghead.io

Top comments (3)

Collapse
 
montyr75 profile image
Monty Rasmussen

More awesome stuff, Jermaine! So glad to see you contributing all this fantastic content geared toward Dart beginners.

One small thing: I run dart.academy, and more than 60% of that site's visitors are using Windows, which means a substantial number of Dart devs (or at least people interested in Dart) are using that OS. It'd be great if you provided instructions that work universally wherever possible. Fortunately, most things are already like that once you get past installation, but for the installation step, if you don't want to detail every possible way to do it, you could just link to the Dart site's more comprehensive instructions, as one approach.

Keep up the great work. Can't wait to see what you put out next. :)

Collapse
 
creativ_bracket profile image
Jermaine

Hey Monty, great to see you here after our Medium conversation and thanks for detailing the numbers of your Windows users. Apologies for the neglect of Windows. Will definitely be tailoring my content to be as universal as possible.

Collapse
 
montyr75 profile image
Monty Rasmussen

Yes, thanks! And of course, you were right on Medium. Only optional positional parameters can map directly to private properties. Couldn't reply on there to say that. ;)