add patch version tool

add version to 1.6.0
hmxc
张萌 3 years ago
parent 956cfb5692
commit 0473acee25

@ -2,7 +2,7 @@ name: aku_community
description: A new Flutter project. description: A new Flutter project.
publish_to: "none" publish_to: "none"
version: 1.5.0-dev+41 version: 1.6.0-dev+42
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"

@ -13,7 +13,7 @@ part '_project_manage.dart';
main(args) => grind(args); main(args) => grind(args);
@Task('add version number') @Task('add minor version number')
void addVersion() async { void addVersion() async {
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml'); String yamlPath = join(projectPath, 'pubspec.yaml');
@ -28,6 +28,21 @@ void addVersion() async {
await File(yamlPath).writeAsString(result); await File(yamlPath).writeAsString(result);
} }
@Task('add path version number')
void addVersionPatch() async {
String projectPath = Directory('.').absolute.path;
String yamlPath = join(projectPath, 'pubspec.yaml');
String yamlContent = await File(yamlPath).readAsString();
dynamic content = loadYaml(yamlContent);
String version = content['version'];
//rename version
Version resultVersion = VersionTool.fromText(version).nextPatchTag('dev');
String result = yamlContent.replaceFirst(version, resultVersion.toString());
await File(yamlPath).writeAsString(result);
}
@Task() @Task()
Future<String> getVersion() async { Future<String> getVersion() async {
String projectPath = Directory('.').absolute.path; String projectPath = Directory('.').absolute.path;

Loading…
Cancel
Save