Hooks are too complicated for simple tasks
- Lenguaje dominante
- Dart
- Estrellas
- 1.1k
- Forks
- 113
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.