| 1 | import 'dart:io'; |
| 2 | |
| 3 | const pubspecBasePath = 'pubspec_base.yaml'; |
| 4 | const pubspecDescriptionPath = 'pubspec_description.yaml'; |
| 5 | const outputPubspecPath = 'pubspec.yaml'; |
| 6 | |
| 7 | Future<void> main(List<String> args) async { |
| 8 | final pubspecBase = File(pubspecBasePath); |
| 9 | final pubspecDescription = File(pubspecDescriptionPath); |
| 10 | |
| 11 | if (!pubspecBase.existsSync() || !pubspecDescription.existsSync()) { |
| 12 | throw ("$pubspecBasePath or $pubspecDescriptionPath doesn't exists"); |
| 13 | } |
| 14 | |
| 15 | final pubspecBaseContent = await pubspecBase.readAsString(); |
| 16 | final pubspecDescriptionContent = await pubspecDescription.readAsString(); |
| 17 | final pubSpecContent = pubspecDescriptionContent + '\n\n' + pubspecBaseContent; |
| 18 | final outputPubspec = File(outputPubspecPath); |
| 19 | |
| 20 | if (outputPubspec.existsSync()) { |
| 21 | await outputPubspec.delete(); |
| 22 | } |
| 23 | |
| 24 | await outputPubspec.writeAsString(pubSpecContent); |
| 25 | } |