project_gen 0.0.1

  • Installing
  • Versions
  • 0


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.


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';
Version Uploaded Documentation Archive
0.0.1 Jan 5, 2017 Go to the documentation of project_gen 0.0.1 Download project_gen 0.0.1 archive
0.0.0 Jan 5, 2017 Go to the documentation of project_gen 0.0.0 Download project_gen 0.0.0 archive
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

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.1.0.
 Because project_gen depends on console >=1.1.0 <3.0.0 which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format lib/project_gen.dart.

Run dartfmt to format lib/project_gen.dart.

Format lib/src/actions/actions.dart.

Run dartfmt to format lib/src/actions/actions.dart.

Format lib/src/project.dart.

Run dartfmt to format lib/src/project.dart.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Maintain (-20 points)

Changelog entries help clients to follow the progress in your code.

Package is getting outdated. (-93.97 points)

The package was released 101 weeks ago.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use project_gen.dart. Packages with multiple examples should use example/


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0