iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐙
Setting Up Common Flutter Command Shortcuts with Derry
I found a package that allows you to register shortcuts for frequently used commands in pubspec.yaml, so I'd like to introduce it.
https://pub.dev/packages/derry
How to Install
Run the following command:
dart pub global activate derry
```text
If you get an error saying the path is not set, add the following to your .zshrc or .bashrc.
```text:.zshrc
export PATH="$PATH":"$HOME/.pub-cache/bin"
```text
# How to Use
Add `scripts: derry.yaml` to `pubspec.yaml`.
(You can also write commands directly in `pubspec.yaml`.)
```yaml:pubspec.yaml
scripts: derry.yaml
```text
Create `derry.yaml` directly under the project root and write appropriate commands.
Below is a sample:
```yaml:derry.yaml
generate: flutter pub run build_runner build --delete-conflicting-outputs
pod_update:
(execution): once
(scripts):
- cd ios
- rm -rf Pods/
- rm -rf Podfile.lock
- cd ..
- flutter clean
- flutter pub get
- cd ios
- pod install --repo-update
- cd ..
```text
You will be able to use shortcuts as follows:
```text
derry generate
```text
Registered shortcuts can be checked as follows:
```text
derry ls
Summary
Using Derry is convenient because it allows you to share useful commands when developing as a team. I think it's especially good because you can start easily just by copying and pasting the commands you usually type in the terminal.
There is also a similar package called Grinder, so I'm planning to write an article about that as well in the future.
Discussion