felangel / felangel/mason

feat: Read a default configuration file by convention instead of configuration

オープン
#508 コメント 2 件 リアクション 0 件 担当者 1 名 @felangel が担当を希望しています GitHub で見る
question waiting for response
主要言語
Dart
スター
1.1k
フォーク
113
PR マージ指標
30日以内にマージされた PR はありません

説明

**Description**

I have a brick that generates two files:

1. page
2. controller

To be able to share the brick across projects, I've added some variables:

1. project_name
2. page_id
3. page_name

This works great, but when you are working on a project, the ```project_name``` is for that project always the same. Asking the ```project_name``` is redundant and error-prone.

So I've added a configuration file ```mason-variables.json```.

The Flutter project source is also generated using Mason, which means that this file is in my case always available and the content is specific for the generated Flutter project.

```
{
"project_name": "flutter_demo_app"
}
```
So now I can run:
```
mason make rubigo_page -c mason-variables.json
```

and now the brick only asks for

1. page_id
2. page_name

Is there a way that I can eliminate the need for adding ```-c mason-variables.json``` to the mason command?

Of course, I could write a shell script, but that's not platform-independent. I also tried mason_hooks, but the pre_gen hook is executed after the variables are asked to the user.

A better idea might be to solve this by convention, for example, that a file with the name ```mason-variables.json``` in the working directory is read by default by Mason.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。