diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3939d62..0000000 --- a/.travis.yml +++ /dev/null @@ -1 +0,0 @@ -language: dart diff --git a/CHANGELOG.md b/CHANGELOG.md index bc900e0..4e4ba89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 4.0.0 + +* Changed `pub` to `dart pub` +* Changed `pub build` to `dart build` +* Updated min SDK to 2.14.0 + ## 3.2.0 * Upgraded from `pedantic` to `lints` linter diff --git a/bin/angel3.dart b/bin/angel3.dart index 35f19f8..a07a507 100644 --- a/bin/angel3.dart +++ b/bin/angel3.dart @@ -26,11 +26,11 @@ void main(List args) async { ..addCommand(DoctorCommand()) ..addCommand(KeyCommand()) ..addCommand(InitCommand()) - ..addCommand(InstallCommand()) +// ..addCommand(InstallCommand()) ..addCommand(RenameCommand()) ..addCommand(MakeCommand()); - return await runner.run(args).catchError((exc, st) { + await runner.run(args).catchError((exc, st) { if (exc is String) { stdout.writeln(exc); } else { @@ -67,10 +67,10 @@ const String asciiArt = ''' const String asciiArt3 = ''' - \ \ | ___| ____| | ___ / - _ \ \ | | __| | _ \ - ___ \ |\ | | | | | ) | - _/ _\ _| \_| \____| _____| _____| ____/ + \\ \\ | ___| ____| | ___ / + _ \\ \\ | | __| | _ \\ + ___ \\ |\\ | | | | | ) | + _/ _\\ _| \\_| \\____| _____| _____| ____/ '''; const String asciiArtOld = ''' @@ -78,6 +78,6 @@ ____________ ________________________ ___ |__ | / /_ ____/__ ____/__ / __ /| |_ |/ /_ / __ __ __/ __ / _ ___ | /| / / /_/ / _ /___ _ /___ -/_/ |_/_/ |_/ \____/ /_____/ /_____/ +/_/ |_/_/ |_/ \\____/ /_____/ /_____/ '''; diff --git a/lib/src/commands/init.dart b/lib/src/commands/init.dart index 11c33cc..d515186 100644 --- a/lib/src/commands/init.dart +++ b/lib/src/commands/init.dart @@ -8,7 +8,6 @@ import 'package:recase/recase.dart'; import '../random_string.dart' as rs; import '../util.dart'; import 'key.dart'; -import 'pub.dart'; import 'rename.dart'; class InitCommand extends Command { @@ -66,7 +65,7 @@ class InitCommand extends Command { // Renaming executable files if (argResults!['pub-get'] != false && argResults!['offline'] == false) { - print('Now running pub get...'); + print('Now running dart pub get...'); await _pubGet(projectDir); } @@ -222,7 +221,7 @@ class InitCommand extends Command { // Otherwise, pull from git. else if (!(argResults!['offline'] as bool)) { print(darkGray.wrap('\$ git pull origin $branch')); - var git = await Process.start('git', ['pull', 'origin', '$branch'], + var git = await Process.start('git', ['pull', 'origin', branch], mode: ProcessStartMode.inheritStdio, workingDirectory: boilerplateDir.absolute.path); if (await git.exitCode != 0) { @@ -256,8 +255,8 @@ class InitCommand extends Command { } Future _pubGet(Directory projectDir) async { - var pubPath = resolvePub(); - print(darkGray.wrap('Running pub at "$pubPath"...')); + var pubPath = "dart pub"; + //print(darkGray.wrap('Running "$pubPath"...')); print(darkGray.wrap('\$ $pubPath get')); var pub = await Process.start(pubPath, ['get'], workingDirectory: projectDir.absolute.path, @@ -269,11 +268,10 @@ class InitCommand extends Command { Future preBuild(Directory projectDir) async { // Run build - // print('Running `pub run build_runner build`...'); - print(darkGray.wrap('\$ pub run build_runner build')); + // print('Running `dart run build_runner build`...'); + print(darkGray.wrap('\$ dart run build_runner build')); - var build = await Process.start( - resolvePub(), ['run', 'build_runner', 'build'], + var build = await Process.start("dart", ['run', 'build_runner', 'build'], workingDirectory: projectDir.absolute.path, mode: ProcessStartMode.inheritStdio); @@ -282,37 +280,37 @@ Future preBuild(Directory projectDir) async { if (buildCode != 0) throw Exception('Failed to pre-build resources.'); } -const RepoLocation = 'https://github.com/dukefirehawk'; +const repoLocation = 'https://github.com/dukefirehawk'; const BoilerplateInfo graphQLBoilerplate = BoilerplateInfo( 'GraphQL', 'A starter application with GraphQL support.', - '$RepoLocation/boilerplates.git', + '$repoLocation/boilerplates.git', ref: 'angel3-graphql', ); const BoilerplateInfo ormBoilerplate = BoilerplateInfo( 'ORM', 'A starter application with ORM support.', - '$RepoLocation/boilerplates.git', + '$repoLocation/boilerplates.git', ref: 'angel3-orm', ); const BoilerplateInfo basicBoilerplate = BoilerplateInfo( 'Basic', 'A basic starter application with minimal packages.', - '$RepoLocation/boilerplates.git', + '$repoLocation/boilerplates.git', ref: 'angel3-basic'); const BoilerplateInfo sharedBoilerplate = BoilerplateInfo( 'Shared', 'Holds common models and files shared across multiple Dart projects.', - '$RepoLocation/boilerplate_shared.git'); + '$repoLocation/boilerplate_shared.git'); const BoilerplateInfo sharedOrmBoilerplate = BoilerplateInfo( 'Shared (ORM)', 'Holds common models and files shared across multiple Dart projects.', - '$RepoLocation/boilerplate_shared.git', + '$repoLocation/boilerplate_shared.git', ref: 'orm', ); diff --git a/lib/src/commands/install.dart b/lib/src/commands/install.dart index ea73f7d..0b73216 100644 --- a/lib/src/commands/install.dart +++ b/lib/src/commands/install.dart @@ -12,7 +12,7 @@ import 'package:yaml/yaml.dart' as yaml; import '../util.dart'; import 'make/maker.dart'; -@deprecated +@Deprecated("No longer needed") class InstallCommand extends Command { static const String repo = 'https://github.com/angel-dart/install.git'; static final Directory installRepo = diff --git a/lib/src/commands/make/test.dart b/lib/src/commands/make/test.dart index 70bb44b..ca3e820 100644 --- a/lib/src/commands/make/test.dart +++ b/lib/src/commands/make/test.dart @@ -40,8 +40,8 @@ class TestCommand extends Command { } var deps = [ - const MakerDependency('angel3_framework', '^4.1.0'), - const MakerDependency('angel3_test', '^4.0.0', dev: true), + const MakerDependency('angel3_framework', '^4.2.0'), + const MakerDependency('angel3_test', '^4.1.0', dev: true), const MakerDependency('test', '^1.17.0', dev: true), ]; diff --git a/lib/src/commands/pub.dart b/lib/src/commands/pub.dart index 90e7774..d6d68d1 100644 --- a/lib/src/commands/pub.dart +++ b/lib/src/commands/pub.dart @@ -2,6 +2,7 @@ import 'dart:io'; final RegExp _leadingSlashes = RegExp(r'^/+'); +@Deprecated("Replaced by dart pub") String resolvePub() { var exec = File(Platform.resolvedExecutable); var pubPath = exec.parent.uri.resolve('pub').path; diff --git a/lib/src/commands/rename.dart b/lib/src/commands/rename.dart index 1a1d8c1..bf229ee 100644 --- a/lib/src/commands/rename.dart +++ b/lib/src/commands/rename.dart @@ -133,7 +133,7 @@ Future renameDartFiles(Directory dir, String oldName, String newName) async { // Replace mustache {{oldName}} with newName String updateMustacheBinding(String content, String oldName, String newName) { if (content.contains('{{$oldName}}')) { - return content.replaceAll('{{$oldName}}', '$newName'); + return content.replaceAll('{{$oldName}}', newName); } return content; @@ -205,8 +205,8 @@ class RenamingVisitor extends RecursiveAstVisitor { } @override - void visitExportDirective(ExportDirective ctx) { - var uri = ctx.uri.stringValue; + void visitExportDirective(ExportDirective node) { + var uri = node.uri.stringValue; if (uri != null) { var updated = updateUri(uri); if (uri != updated) replace[[uri]] = updated; @@ -214,8 +214,8 @@ class RenamingVisitor extends RecursiveAstVisitor { } @override - void visitImportDirective(ImportDirective ctx) { - var uri = ctx.uri.stringValue; + void visitImportDirective(ImportDirective node) { + var uri = node.uri.stringValue; if (uri != null) { var updated = updateUri(uri); @@ -224,22 +224,22 @@ class RenamingVisitor extends RecursiveAstVisitor { } @override - void visitLibraryDirective(LibraryDirective ctx) { - var name = ctx.name.name; + void visitLibraryDirective(LibraryDirective node) { + var name = node.name.name; if (name.startsWith(oldName)) { - replace[[ctx.offset, ctx.end]] = + replace[[node.offset, node.end]] = 'library ' + name.replaceFirst(oldName, newName) + ';'; } } @override - void visitPartOfDirective(PartOfDirective ctx) { - if (ctx.libraryName != null) { - var name = ctx.libraryName!.name; + void visitPartOfDirective(PartOfDirective node) { + if (node.libraryName != null) { + var name = node.libraryName!.name; if (name.startsWith(oldName)) { - replace[[ctx.offset, ctx.end]] = + replace[[node.offset, node.end]] = 'part of ' + name.replaceFirst(oldName, newName) + ';'; } } diff --git a/pubspec.yaml b/pubspec.yaml index 97a979f..477fa41 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_cli -version: 3.2.0 +version: 4.0.0 description: Command line tools for the Angel3 framework, including scaffolding. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel3-cli environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: - analyzer: ^2.0.0 + analyzer: ^3.0.0 args: ^2.1.1 code_builder: ^4.0.0 dart_style: ^2.0.1 diff --git a/test/replace_name.dart b/test/replace_name.dart index bb88bef..a037115 100644 --- a/test/replace_name.dart +++ b/test/replace_name.dart @@ -22,7 +22,7 @@ void main() async { String updateMustacheBinding(String content, String oldName, String newName) { if (content.contains('{{$oldName}}')) { - return content.replaceAll('{{$oldName}}', '$newName'); + return content.replaceAll('{{$oldName}}', newName); } return content;