搜尋套件、儲存庫與 APP 分類

套件詳情v0.10.2

grinder

Grinder 是 Dart 的任務執行器,可協助定義和自動化常見的專案工作流程。

macOSWindowsLinux
近 30 天下載
12.2萬
喜歡數
116
Pub 分數
160

安裝套件

flutter pub add grinder

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Grinder 是 Dart 的任務執行工具,能簡化常見專案工作流程的自動化,例如測試、建構與程式碼產生。它允許開發者在 Dart 程式碼中定義可重複使用的任務,讓團隊之間的開發流程更容易標準化與順暢化。支援在 macOS、Windows 與 Linux 上跨平台執行,可無縫整合至 Dart 與 Flutter 專案。其清晰的語法與可擴充設計,使其非常適合以最少的開銷管理複雜的建構流程。

適用情境

  • 自動化建構流程
  • 執行測試和程式碼檢查
  • 管理發佈工作流程
  • 產生樣板程式碼
  • 簡化 CI/CD 流水線

主要特色

  • 基於 Dart 的任務定義
  • 跨平台相容性
  • 可擴展的任務系統
  • 與 Flutter 和 Dart 項目整合
  • 支援命令列執行

適合對象

  • Dart 和 Flutter 開發者
  • 需要一致工作流程的團隊
  • CI/CD流水線設定
  • 專案維護者

使用建議

  • 需要理解 Dart 腳本
  • 有限的圖形使用者介面
  • 最適合命令列環境
  • 可能需要為複雜工作流程進行額外設定

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Dart pub package

Dart workflows, automated.

Grinder consists of a library to define project tasks (e.g. test, build, doc) and a command-line tool to run them.

Getting Started

To start using grinder, add it to your dev_dependencies.

Defining Tasks

Tasks are defined entirely by Dart code allowing you to take advantage of the whole Dart ecosystem to write and debug them. Task definitions reside in a tool/grind.dart script. To create a simple grinder script, run:

dart run grinder:init

In general, grinder scripts look something like this:

import 'package:grinder/grinder.dart';

main(args) => grind(args);

@DefaultTask('Build the project.')
build() {
  log("Building...");
}

@Task('Test stuff.')
@Depends(build)
test() {
  new PubApp.local('test').run([]);
}

@Task('Generate docs.')
doc() {
  log("Generating docs...");
}

@Task('Deploy built app.')
@Depends(build, test, doc)
deploy() {
  ...
}

Any task dependencies (see @Depends above), are run before the dependent task.

Grinder contains a variety of convenience APIs for common task definitions, such as PubApp referenced above. See the API Documentation for full details.

Running Tasks

First install the grind executable:

pub global activate grinder

then use it to run desired tasks:

grind test
grind build doc

or to run a default task (see @DefaultTask above):

grind

or to display a list of available tasks and their dependencies:

grind -h

You can also bypass installing grind and instead use pub run grinder.

Passing parameters to tasks

In order to pass parameters to tasks from the command-line, you query the TaskArgs instance for your task invocation. For example:

grind build --release --mode=topaz

and:

@Task()
build() {
  TaskArgs args = context.invocation.arguments;
  bool isRelease = args.getFlag('release'); // will be set to true
  String mode = args.getOption('mode'); // will be set to topaz
  
  ...
}

would pass the flag release and the option mode to the build task.

You can pass flags and options to multiple tasks. The following command-line would pass separate flags and options to two different tasks:

grind build --release generate-docs --header=small

Disclaimer

This is not an official Google product.

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案