addNewFeatureInPubspec method

void addNewFeatureInPubspec(
  1. String pathFeature,
  2. String featureName,
  3. String appsName
)

Implementation

void addNewFeatureInPubspec(
    String pathFeature, String featureName, String appsName) {
  String pathPubspec = join(current, 'pubspec.yaml');
  if (appsName.isNotEmpty) {
    pathPubspec = join(current, 'apps', appsName, 'pubspec.yaml');
  }
  if (!exists(pathPubspec)) {
    return;
  }
  String pubspec = File(pathPubspec).readAsStringSync();
  pubspec = pubspec.replaceAll(
    RegExp(r'(^\n?dev_dependencies)', multiLine: true),
    '''  $featureName:
  path: ./features/$featureName

dev_dependencies''',
  );
  pathPubspec.write(pubspec);

  StatusHelper.generated(pathPubspec);
}