workspace_scripts 0.0.2 copy "workspace_scripts: ^0.0.2" to clipboard
workspace_scripts: ^0.0.2 copied to clipboard

A helper for dart workspace projects

workspace_scripts #

This is a quick and dirty solution for running commands in all projects in a dart workspace project.

Caution: It runs stable but the code is a mess since I wrote it in 30 minutes to get a quick solution for my specific problem.
If the dart developers do not provide a native built-in solution for the problem I'll consider to clean it up.

Installation #

Setup your workspace project as described here in Pub workspaces.

Now add the workspace_scripts package using this command:

dart pub global activate workspace_scripts

In your workspace pubspec.yaml add the workspace_scripts key and add the commands:

# Workspace pubspec.yaml
name: _
publish_to: none

workspace:
  - packages/a
  - packages/b
  - packages/c

# ...

workspace_scripts:
  build_watch: # name of the script
    command: dart                               # command to execute 
    arguments: [ 'run', 'build_runner', 'watch' ] # arguments to pass to the command
    # concurrency: # Number of parallel tasks. Defaults to the number of CPUs. 0 = no limit
    # checks:
    #   # If you use long-running commands like above, concurrency is not working ootb because
    #   # The processes don't end. The on_work_complete_pattern checks the tasks for a given output.
    #   # If the pattern was found, the task is marked as "complete"
    #   on_work_complete_pattern: 'Succeeded after \d+ms'

Now you're able to run workspace_scripts run build_watch (build_watch is the name of your script).

In the example above this will start 3 processes (package/a, package/b, package/c) with the command dart run build_runner watch.

1
likes
140
points
269
downloads

Publisher

verified publishermintware.de

Weekly Downloads

A helper for dart workspace projects

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

json_annotation, path, yaml

More

Packages that depend on workspace_scripts