compile method

Future<void> compile({
  1. bool install = false,
  2. bool overwrite = false,
  3. bool packed = false,
})

Compiles all dart scripts in the project. If you set install to true then each compiled script is added to your PATH by copying it into ~/.dcli/bin. install defaults to false.

The overwrite flag allows the compile to install the compiled script even if one of the same name exists in `/.dcli/bin overwrite defaults to false.

Implementation

Future<void> compile({
  bool install = false,
  bool overwrite = false,
  bool packed = false,
}) async {
  await NamedLock(name: _lockName, timeout: _lockTimeout).withLockAsync(
    () async {
      find('*.dart', workingDirectory: pathToProjectRoot).forEach(
        (file) => DartScript.fromFile(
          file,
        ).compile(install: install, overwrite: overwrite, packed: packed),
      );
    },
    waiting: 'Waiting for compile to complete...',
  );
}