addNewAppsInPubspec method

void addNewAppsInPubspec(
  1. String pathApps,
  2. String appsName
)

Implementation

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

dev_dependencies''',
  );
  join(current, 'pubspec.yaml').write(pubspec);

  StatusHelper.generated(join(current, 'pubspec.yaml'));
}