runCreate method

Future<int> runCreate(
  1. MasonGenerator generator,
  2. Template template
)

Implementation

Future<int> runCreate(MasonGenerator generator, Template template) async {
  var vars = getTemplateVars();

  final target = DirectoryGeneratorTarget(outputDirectory);

  await generator.hooks.preGen(
    vars: vars,
    onVarsChanged: (v) => vars = v,
    workingDirectory: target.dir.path,
    logger: logger,
  );

  final _ = await generator.generate(target, vars: vars, logger: logger);

  await generator.hooks.postGen(
    vars: vars,
    onVarsChanged: (v) => vars = v,
    workingDirectory: target.dir.path,
    logger: logger,
  );

  await template.onGenerateComplete(
    logger,
    Directory(path.join(target.dir.path, featureName)),
  );

  return ExitCode.success.code;
}