{"id":21261524,"url":"https://github.com/chenasraf/dart_script_runner","last_synced_at":"2025-07-11T03:32:27.810Z","repository":{"id":54350492,"uuid":"522065250","full_name":"chenasraf/dart_script_runner","owner":"chenasraf","description":"Run all your project-related scripts in a portable, simple config.","archived":false,"fork":false,"pushed_at":"2024-07-21T22:55:16.000Z","size":113,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T20:11:09.380Z","etag":null,"topics":["dart","runner","script","script-runner","tools"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/script_runner","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenasraf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"chenasraf","patreon":null,"open_collective":null,"ko_fi":"casraf","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-08-06T22:18:53.000Z","updated_at":"2024-07-21T22:54:48.000Z","dependencies_parsed_at":"2024-01-21T00:31:10.897Z","dependency_job_id":"fed3ba91-c5bb-489f-951f-a8409715f326","html_url":"https://github.com/chenasraf/dart_script_runner","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"8e0c89f6d06aef4faeaf79fd357705c40864668d"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/chenasraf/dart_script_runner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenasraf%2Fdart_script_runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenasraf%2Fdart_script_runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenasraf%2Fdart_script_runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenasraf%2Fdart_script_runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenasraf","download_url":"https://codeload.github.com/chenasraf/dart_script_runner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenasraf%2Fdart_script_runner/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264721387,"owners_count":23653928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","runner","script","script-runner","tools"],"created_at":"2024-11-21T04:43:39.346Z","updated_at":"2025-07-11T03:32:26.375Z","avatar_url":"https://github.com/chenasraf.png","language":"Dart","funding_links":["https://github.com/sponsors/chenasraf","https://ko-fi.com/casraf","https://ko-fi.com/casraf'"],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003eDart Script Runner\u003c/h1\u003e\n\nA general script runner for any type of project - run all your project-related scripts and commands\nin a portable, simple config.\n\n![script_runner help output](https://github.com/chenasraf/dart_script_runner/assets/167217/d172cd98-c041-48ff-80cc-a24c80e635c7)\n\n---\n\n## What for?\n\nYou might use it to chain multiple commands into a unified build process, format and lint your\ndocuments, or more.\n\nThe advantage over make is that this is auto documented, and will automatically load your scripts\nfrom the directory that contains `pubspec.yaml`, instead of having to find the root project dirctory\nmanually.\n\nThis project was developed with inspiration from NPM's `scripts` inside `package.json` and is meant\nto work similarly, though it can be customized to fit your needs more specifically.\n\n## Features\n\n- **Easy:** Provides an easy to use config for project-related scripts, similar to what NPM allows\n  in its `scripts` section of `package.json`.\n- **Portable:** The scripts are meant to be portable and can reference each-other, to maximize the\n  flexibility of creating configurable script execution orders \u0026amp; dependencies. Also you don't\n  have to be on a dart project, just add a `script_runner.yaml` file to any folder and you're good\n  to go!\n- **Self-documenting:** Removes the need to document where and how to load different types of\n  scripts on your project, or create custom script loaders and more time-wasting pipeline. Unify all\n  your runners into 1 config that lets you freely call everything on-demand from any type of\n  project, and also supply an auto-generated documentation using `scr -h`.\n\n## Getting started\n\nYou can install this package globally for the most easy usage.\n\n```sh\npub global activate script_runner\n```\n\nOnce activated, you can use the supplied `scr` executable to directly call scripts from any project\nyou are currently in.\n\n```sh\nscr my-script ...args\n```\n\nYou can also install this package as a dependency and build/run your own script lists. (but why\nwould you?)\n\n### Built-in Commands\n\nTo get help, including the list of all scripts available in the current directory, run:\n\n```sh\nscr -h\n```\n\nTo list all the scripts, with the ability to search, use:\n\n```sh\nscr -ls # see all\nscr -ls terms # search for \"terms\"\n```\n\n## Usage\n\n### Normal usage (config file)\n\nAdd the `script_runner` config to your `pubspec.yaml` under `script_runner`, or alternatively you\ncan use a separate config file named `script_runner.yaml` at the root of your project.\n\nIf you are using a separate file, you may also use JSON instead of YAML, if you prefer.\n\nA bare-bones example looks like this:\n\n```yaml\nscript_runner:\n  scripts:\n    - doc: dart doc\n    - publish: dart pub publish\n    - deploy: doc \u0026\u0026 publish\n    - auto-fix: dart fix --apply\n```\n\nThis is the full structure of a config:\n\n```yaml\n# only use this key if you are inside pubspec.yaml. Otherwise, it's not needed\nscript_runner:\n  # The shell to run all of the scripts with. (optional - defaults to OS shell)\n  shell: /bin/sh\n  # Use a map to define shell per OS, when not specified falls back to \"default\":\n  # (optional)\n  shell:\n    default: /bin/sh\n    windows: cmd.exe\n    macos: /bin/sh\n    linux: /bin/sh\n  # The current working directory to run the scripts in. (optional)\n  cwd: .\n  # Environment variables to add to the running shells in the scripts. (optional)\n  env:\n    MY_ENV: my-value\n    # ...\n  # The amount of characters to allow before considering the line over when\n  # printing help usage (scr -h)\n  line_length: 80\n  # Scripts support either a short-format config, or a more verbose one with\n  # more possible argument to pass to each script.\n  # Scripts are aliased for the current, e.g. `script1` can reference\n  # `script2` by calling it directly in the command:\n  # - script1: echo '1'\n  # - name: script2\n  #   cmd: script1 \u0026\u0026 echo '2'\n  # Running `script1` will echo 1 and then 2.\n  scripts:\n    # short format - only name + cmd \u0026 args:\n    - my-short-script: my_scr arg1 arg2 arg3 \u0026\u0026 echo 'Done!'\n\n    # more verbose config, for extra configuration\n    - name: my-script\n      # Optional - will be used in docs when using `scr -h`.\n      description: Run my script\n      # Optional - overrides the root-level config\n      cwd: .\n      # Optional - overrides the root-level config\n      env:\n        MY_ENV: my-value\n        # ...\n      # Use `false` to hide the command itself before running it.\n      # This is useful for using the output in other scripts (scr or external)\n      # Defaults to true\n      display_cmd: true\n      # The script to run. You can supply the args directly here, or split into\n      # `cmd` and `args` as a list.\n      cmd: my_scr 'arg1'\n      # Optional - if supplied, will be appended as arguments to `cmd`, before the args passed\n      # by calling the script from the CLI\n      args:\n        - arg2\n        - arg3\n```\n\nFor this config, running `scr my-script` will run the appropriate script, filling the env and\nchanging the working directory as needed.\n\nMore arguments can be passed during the call to the script, which will then be piped to the original\n`cmd`.\n\n### Advanced usage (Dart import)\n\nIf you want to build your own configs dynamically in Dart, you can import the package and create\nyour own runners and scripts:\n\n```dart\nimport 'package:script_runner/script_runner.dart';\n\nvoid main() {\n  // Directly run a script from config, same as running `scr`\n  runScript('my-script', ['arg1', 'arg2'])\n\n  // Build your own configurations and scripts and run them as you please:\n  final runner = ScriptRunnerConfig(\n    shell: '/bin/zsh',\n    scripts: [\n      RunnableScript(\n        name: 'my-script',\n        cmd: 'echo',\n        args: ['Hello world'],\n      ),\n    ],\n  );\n\n  runner.scriptsMap['my-script'].run();\n}\n```\n\n## Contributing\n\nI am developing this package on my free time, so any support, whether code, issues, or just stars is\nvery helpful to sustaining its life. If you are feeling incredibly generous and would like to donate\njust a small amount to help sustain this project, I would be very very thankful!\n\n\u003ca href='https://ko-fi.com/casraf' target='_blank'\u003e\n  \u003cimg height='36' style='border:0px;height:36px;'\n    src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3'\n    alt='Buy Me a Coffee at ko-fi.com' /\u003e\n\u003c/a\u003e\n\nI welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature,\ndon't hesitate to open an appropriate issue and I will do my best to reply promptly.\n\nIf you are a developer and want to contribute code, here are some starting tips:\n\n1. Fork this repository\n2. Run `dart pub get`\n3. Make any changes you would like\n4. Create tests for your changes, run all tests to make sure no regressions are introduced\n5. Update the relevant documentation (readme, code comments, changelog)\n6. Create a PR on upstream\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenasraf%2Fdart_script_runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenasraf%2Fdart_script_runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenasraf%2Fdart_script_runner/lists"}