Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

How to add your template to Stagehand

Sanford Redlich edited this page May 31, 2015 · 12 revisions

Get Stagehand

cd my_dir
git clone https://github.com/google/stagehand.git
cd stagehand

Set this copy of Stagehand to be the default

  • Deactivate your usual stagehand, if any, to avoid confusion pub global deactivate stagehand
  • Activate your clone of stagehand pub global activate --source path ...my_dir/stagehand

Create your generator and _data files

  • Copy and rename the files most like your app in lib/generators, (e.g. web_polymer for a web app)
    • both the main generator file and its *_data counterpart
    • a name like "my-new-app", see the console_full.dart for an example of where the name goes
  • Update the info in the main generator file to match your app

Create a directory for your app in /templates, add your files there

  • Remove all /packages entries
  • Add this copyright notice as a comment near the top of every dart or html file Copyright (c) {{year}}, {{author}}. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
  • Replace all instances of your project’s name with {{projectName}}
  • Update pubspec.yaml with entries like name: {{projectName}} version: 0.0.1 description: A sample command-line application. #author: {{author}} email@example.com #homepage: https://www.example.com

Run the Grind.build() to compress your template into the generator

  • From within your stagehand directory dart tool/grind.dart build

Create an app from your new template

mkdir ../my_new_app
cd ../my_new_app
stagehand my-new-app

Run it, test it

  • the console should have shown instructions to set it up and run it; try them out

Fork the code and make a pull request

  • See instructions here in the "As a contributor to open-source" section

When it works and your pull request is accepted, reset stagehand

pub global deactivate --source path my_dir/stagehand
pub global activate stagehand
Clone this wiki locally