copyModelsTemplate method

Future<void> copyModelsTemplate()

Copy the models template

Implementation

Future<void> copyModelsTemplate() async {
  if (!config.createModels) return;

  final Directory templateDir = Directory(getTemplatePath('arcane_models'));
  final Directory targetDir = Directory(
    p.join(config.outputDir, config.modelsPackageName),
  );

  if (!templateDir.existsSync()) {
    throw Exception('Models template not found: ${templateDir.path}');
  }

  info('Copying models template...');

  // Copy template files
  await _copyDirectory(templateDir, targetDir);

  // Process placeholders
  await _replacer.processDirectory(targetDir);

  // Update pubspec
  final File pubspecFile = File(p.join(targetDir.path, 'pubspec.yaml'));
  await _replacer.updatePubspec(pubspecFile, config.modelsPackageName);

  success('Models package created at: ${targetDir.path}');
}