felangel / felangel/mason

Hooks are too complicated for simple tasks

未关闭
#311 16 条评论 0 个 reaction 已指派 1 人 已被 @felangel 认领 在 GitHub 查看
enhancement candidate feedback wanted
主要语言
Dart
星标
1.1k
派生
113
PR 合并指标
30 天内没有已合并 PR

描述

Hooks are too complicated for simple tasks. Let's say you want to run `task get gen -f` in a directory created by Mason post-gen, and display the output, the most straightforward solution is:

```dart
import 'dart:io';

import 'package:mason/mason.dart';

void run(HookContext context) async {
final workingDirectory = "${Directory.current.path}/packages/{{package}}";

final process = await Process.start(
'task',
['get', 'gen', '-f'],
workingDirectory: workingDirectory,
);

await process.stdout.transform(utf8.decoder).forEach(print);
}
```

Ideally there would be a `hooks` field in brick.yaml, which might look like this

```yaml
name: package
description: Create a package in the /packages directory
version: 0.1.0+1
vars:
package:
type: string
description: Package name
default: my_package
prompt: What do you want to call your package?

hooks:
post-gen: cd packages/{{package}} && task get gen -f
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。