dmake 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 37

dmake #

Simple, flexible build system in Dart. Supports incremental builds, file watching, and snapshotting for faster startup.

Usage #

dmake is a DSL that creates a simple graph of inputs and outputs.

Try compiling a Dart app! In tool/all.dart:

import 'package:dmake/dmake.dart';
import 'package:dmake/dart.dart';

main(List<String> args) {
  make(args, () {
    if (isRelease) {
      // Build to JS in release mode.
      dart2js('web/main.dart');
    } else {
      // Run all web/ files through dartdevc.
      all(glob('web/*.dart', recursive: false), dartdevc);
    }
  });
}

Then, run dart tool/all.dart. All of your .dart files in web/ will be built to JavaScript via the Dart dev compiler.

Release mode #

It's pretty common to have different build rules in debug and release mode. To switch over to dart2js, run dart tool/all.dart --release.

Snapshotting Builds #

Build systems are called very often, and therefore should start up quickly. Using the dmake executable, you can easily snapshot your build script.

To create a snapshot of tool/all.dart, just run pub run dmake.

If you had another file, say, tool/foo.dart, the command would become pub run dmake -t foo.

The single caveat is that to distinguish between arguments passed to the dmake toplevel and to your actual script, you need to separate them with a --.

For example, to run in release mode:

pub run dmake -- --release

Run pub run dmake --help for help.

You can also pub global activate dmake. In this case, you can simply run dmake, dmake -t foo, etc.

Infrastructure #

dmake includes utilities for quickly building files in different languages:

  • package:dmake/dart.dart
  • package:dmake/sass.dart

0.0.3 #

  • Fixed an error that prevented argument passing.

0.0.2 #

  • Fixed an error that prevented proper mode detection.

0.0.1 #

  • Added watch support.
  • Added SASS.

0.0.0 #

First version.

example/example.dart

import 'package:dmake/dmake.dart';
import 'package:dmake/dart.dart';

main(List<String> args) {
  make(args, () {
    if (isRelease) {
      // Build to JS in release mode.
      dart2js('web/main.dart');
    } else {
      // Run all web/ files through dartdevc.
      all(glob('web/*.dart', recursive: false), dartdevc);
    }
  });
}

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate dmake

2. Use it

The package has the following executables:


$ dmake

Use this package as a library

1. Depend on it

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


dependencies:
  dmake: ^0.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:dmake/dmake.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
85
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
59
Overall:
Weighted score of the above. [more]
37
Learn more about scoring.

We analyzed this package on Dec 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Health issues and suggestions

Document public APIs. (-1 points)

25 out of 25 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/top_level.dart. (-3.93 points)

Analysis of lib/src/top_level.dart reported 8 hints, including:

line 16 col 26: Unnecessary new keyword.

line 19 col 12: Unnecessary new keyword.

line 22 col 19: Unnecessary new keyword.

line 38 col 14: Unnecessary new keyword.

line 83 col 25: Unnecessary new keyword.

Fix bin/dmake.dart. (-3.45 points)

Analysis of bin/dmake.dart reported 7 hints, including:

line 8 col 17: Unnecessary new keyword.

line 31 col 16: Unnecessary new keyword.

line 32 col 13: Unnecessary new keyword.

line 41 col 30: Unnecessary new keyword.

line 44 col 26: Unnecessary new keyword.

Fix lib/src/build_graph.dart. (-2.48 points)

Analysis of lib/src/build_graph.dart reported 5 hints:

line 5 col 31: Unnecessary new keyword.

line 9 col 14: Unnecessary new keyword.

line 10 col 14: Unnecessary new keyword.

line 16 col 28: Unnecessary new keyword.

line 21 col 7: Unnecessary new keyword.

Fix additional 4 files with analysis or formatting issues. (-4.97 points)

Additional issues in the following files:

  • lib/sass.dart (3 hints)
  • lib/src/glob.dart (3 hints)
  • lib/src/process.dart (3 hints)
  • lib/dart.dart (1 hint)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (graphs, rxdart).

Package is getting outdated. (-10.96 points)

The package was last published 57 weeks ago.

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

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
args ^1.0.0 1.5.2
glob ^1.0.0 1.2.0
graphs ^0.1.2 0.1.3+1 0.2.0
io ^0.3.2 0.3.3
logging ^0.11.0 0.11.3+2
mime ^0.9.6 0.9.6+3
path ^1.0.0 1.6.4
rxdart ^0.19.0 0.19.0 0.22.6
watcher ^0.9.7 0.9.7+13
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
js 0.6.1+1
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
pedantic 1.9.0
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0