project_gen 0.0.1

project_gen #

A simple scaffolding framework for Dart CLI tools. This makes it easier to get projects off the ground. It also depends on args and console, so those packages are available for your usage.

Usage #

project_gen has a simple, callback-based structure, and ultimately just provides abstractions to create files within a project directory.

Placing your code in callbacks will ensure files are created in order. Directories are created first, and then files.

import 'dart:io';
import 'package:args/command_runner.dart';
import 'package:project_gen/project_gen.dart';

class InitCommand extends Command {
    String get name => 'init';

    String get description => 'Initializes a new project.';

    run() async {
        // New project in the current dir
        var project = new Project('<project-name>');'web', (web) async {
            // Clone a repo into a directory.
            // By default, the .git dir will be deleted.
            await web.clone('git://path/to/repo');
        });'views', (views) async {
            views.file('index.jade', (index) async {
                await index.copyResource('package:example/res/views/index.jade');
                await index.copyFile(new File('/path/to/file'));
  'admin', (admin) async {
                // Without a callback
                var foo = admin.file('foo.txt');

                // Access underlying `dart:io` File or Directory
                await someStream().pipe(;

        // Run all generators and actions, and also run `pub get`
        await project.generate();

        // Pre-build assets
        await, ['tool/build.dart']);

Maintaining Projects #

The API's in project_gen only create directories/files if they do not exist, so they can be used to modify existing projects.

You generally will not need to use callbacks for existing projects.

import 'package:project_gen/project_gen.dart';

main() async {
    // Load project out of current dir
    var project = await Project.load();

    // Create file if it doesn't exist, otherwise just open the existing one
    var readme = project.file('');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  project_gen: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:project_gen/project_gen.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0