Skip to content

Repository files navigation

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.yamlname: _publish_to: noneworkspace:
- packages/a
- packages/b
- packages/c# ...workspace_scripts:
build_watch: # name of the scriptcommand: 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.

About

A helper for dart workspace projects

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages