cake_wallet/tool/generate_pubspec.dart

26 lines
868 B
Dart
Raw Normal View History

2022-01-10 13:27:36 +00:00
import 'dart:io';
const pubspecBasePath = 'pubspec_base.yaml';
const pubspecDescriptionPath = 'pubspec_description.yaml';
const outputPubspecPath = 'pubspec.yaml';
Future<void> main(List<String> args) async {
final pubspecBase = File(pubspecBasePath);
final pubspecDescription = File(pubspecDescriptionPath);
if (!pubspecBase.existsSync() || !pubspecDescription.existsSync()) {
throw("$pubspecBasePath or $pubspecDescriptionPath doesn't exists");
2022-01-10 13:27:36 +00:00
}
final pubspecBaseContent = await pubspecBase.readAsString();
final pubspecDescriptionContent = await pubspecDescription.readAsString();
final pubSpecContent = pubspecDescriptionContent + '\n\n' + pubspecBaseContent;
final outputPubspec = File(outputPubspecPath);
if (outputPubspec.existsSync()) {
await outputPubspec.delete();
}
await outputPubspec.writeAsString(pubSpecContent);
}