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

How to add your template to Stagehand

Kathy Walrath edited this page Jun 12, 2017 · 12 revisions

Get Stagehand

cd my_dir
git clone https://github.com/google/stagehand.git
cd 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
    

Add your template to lib/stagehand.dart

Import its main generator file, and add an instance of its generator to the generators list.

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

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

Test your template

See How to test a template.

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, don't forget to reset stagehand

pub global deactivate stagehand
pub global activate stagehand
Clone this wiki locally