-
-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requestedwaiting for responseWaiting for additional informationWaiting for additional information
Description
Description
We have the following scenario:
- Our brick contains a pre-hook that prints out some metadata (e.g. project directory) and injects it into the template files of the brick.
- When installing the brick locally via a file-path, running the brick works fine (console output is visible and files are generated).
- When installing the brick from a git repository, running the brick leads to a stuck console. Not even the log output of the hook is visible.
If we install any other brick without any hook via git, these bricks work just fine.
Steps To Reproduce
- Create a brick with a pre hook and push it to a git repository
- Install the brick via the git-url in another project
- Run the brick
Expected Behavior
The pre hook should be executed, even if the corresponding brick was installed via git.
Screenshots
none
Additional Context
Contents of our pre-hook. Purpose: retrieving the package name from the pubspec.yaml.
import 'dart:io';
import 'package:mason/mason.dart';
import 'package:yaml/yaml.dart';
const pubspecYamlName = 'pubspec.yaml';
Future<File?> _getPackageYaml(HookContext context) async {
var directory = Directory.current;
var depth = 5;
do {
try {
context.logger.info(directory.path);
final yaml = (await directory
.list()
.firstWhere((file) => file.path.endsWith(pubspecYamlName)));
return File(yaml.absolute.path);
} catch (_) {
directory = directory.parent;
depth--;
}
} while (depth > 0);
return null;
}
void run(HookContext context) async {
final yamlFile = await _getPackageYaml(context);
if (yamlFile != null) {
context.logger.info('Füge $pubspecYamlName-Inhalt unter "package" ein.');
final data = loadYaml(await yamlFile.readAsString());
context.vars.putIfAbsent('package', () => data);
}
}
I am quite sure, that the combination of hook + git integration is the reason for the problem as all our bricks work just fine if just one of those are used.
Environment: Windows 10, Flutter 3.32.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requestedwaiting for responseWaiting for additional informationWaiting for additional information