From 9123a770571910a6b4a2fdc15cf439a809e82149 Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Sun, 29 May 2022 08:13:58 +0800 Subject: [PATCH 1/3] Updated dependencies --- CHANGELOG.md | 5 +++++ bin/angel3.dart | 11 +++-------- lib/src/commands/key.dart | 2 +- lib/src/commands/pub.dart | 2 +- lib/src/commands/rename.dart | 8 ++++---- pubspec.yaml | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba43c42..66fa9f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 6.1.0 + +* Updated to `analyzer` 4.x.x +* Updated to `lints` 2.x.x + ## 6.0.1 * Added `angel3-orm-mysql` template for ORM support for MariaDB and MySQL diff --git a/bin/angel3.dart b/bin/angel3.dart index a07a507..db4f353 100644 --- a/bin/angel3.dart +++ b/bin/angel3.dart @@ -7,16 +7,11 @@ import 'package:args/command_runner.dart'; import 'package:angel3_cli/angel3_cli.dart'; import 'package:io/ansi.dart'; -final String DOCTOR = 'doctor'; +//const String doctor = 'doctor'; void main(List args) async { - var runner = CommandRunner( - 'angel3', - asciiArt + - '\n\n' + - 'Command-line tools for the Angel3 framework.' + - '\n\n' + - 'https://angel3-framework.web.app'); + var runner = CommandRunner('angel3', + '$asciiArt\n\nCommand-line tools for the Angel3 framework.\n\nhttps://angel3-framework.web.app'); runner.argParser .addFlag('verbose', help: 'Print verbose output.', negatable: false); diff --git a/lib/src/commands/key.dart b/lib/src/commands/key.dart index 2fc89d6..eade104 100644 --- a/lib/src/commands/key.dart +++ b/lib/src/commands/key.dart @@ -24,7 +24,7 @@ class KeyCommand extends Command { if (await file.exists()) { var contents = await file.readAsString(); contents = contents.replaceAll(RegExp(r'jwt_secret:[^\n]+\n?'), ''); - await file.writeAsString(contents.trim() + '\njwt_secret: "$secret"'); + await file.writeAsString('${contents.trim()}\njwt_secret: "$secret"'); } } } diff --git a/lib/src/commands/pub.dart b/lib/src/commands/pub.dart index d6d68d1..6900a32 100644 --- a/lib/src/commands/pub.dart +++ b/lib/src/commands/pub.dart @@ -7,7 +7,7 @@ String resolvePub() { var exec = File(Platform.resolvedExecutable); var pubPath = exec.parent.uri.resolve('pub').path; if (Platform.isWindows) { - pubPath = pubPath.replaceAll(_leadingSlashes, '') + '.bat'; + pubPath = '${pubPath.replaceAll(_leadingSlashes, '')}.bat'; } pubPath = Uri.decodeFull(pubPath); return pubPath; diff --git a/lib/src/commands/rename.dart b/lib/src/commands/rename.dart index bf229ee..84923c3 100644 --- a/lib/src/commands/rename.dart +++ b/lib/src/commands/rename.dart @@ -148,7 +148,7 @@ Future renameDartFiles(Directory dir, String oldName, String newName) async { var contents = lineList.fold('', (prev, cur) { var updatedCur = updateImport(cur, oldName, newName); updatedCur = updateMustacheBinding(updatedCur, oldName, newName); - return prev + '\n' + updatedCur; + return '$prev\n$updatedCur'; }); await file.writeAsString(fmt.format(contents)); @@ -198,7 +198,7 @@ class RenamingVisitor extends RecursiveAstVisitor { if (uri == 'package:$oldName/$oldName.dart') { return 'package:$newName/$newName.dart'; } else if (uri.startsWith('package:$oldName/')) { - return 'package:$newName/' + uri.replaceFirst('package:$oldName/', ''); + return 'package:$newName/${uri.replaceFirst('package:$oldName/', '')}'; } else { return uri; } @@ -229,7 +229,7 @@ class RenamingVisitor extends RecursiveAstVisitor { if (name.startsWith(oldName)) { replace[[node.offset, node.end]] = - 'library ' + name.replaceFirst(oldName, newName) + ';'; + 'library ${name.replaceFirst(oldName, newName)};'; } } @@ -240,7 +240,7 @@ class RenamingVisitor extends RecursiveAstVisitor { if (name.startsWith(oldName)) { replace[[node.offset, node.end]] = - 'part of ' + name.replaceFirst(oldName, newName) + ';'; + 'part of ${name.replaceFirst(oldName, newName)};'; } } } diff --git a/pubspec.yaml b/pubspec.yaml index c28b905..5be8e1b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_cli -version: 6.0.1 +version: 6.1.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.16.0 <3.0.0' dependencies: - analyzer: ^3.0.0 + analyzer: ^4.0.0 args: ^2.1.1 code_builder: ^4.0.0 dart_style: ^2.0.1 @@ -24,6 +24,6 @@ dependencies: watcher: ^1.0.0 yaml: ^3.1.0 dev_dependencies: - lints: ^1.0.0 + lints: ^2.0.0 executables: angel3: angel3 From 883f0341408d0c25226e4b3906012851d71e2d20 Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Wed, 31 Aug 2022 00:56:09 +0800 Subject: [PATCH 2/3] Updated to version 7.0.0 --- .gitignore | 4 ++-- .vscode/settings.json | 3 ++- CHANGELOG.md | 7 ++++++- lib/src/commands/init.dart | 12 ++++++------ lib/src/commands/make/controller.dart | 4 ++-- lib/src/commands/make/migration.dart | 2 +- lib/src/commands/make/model.dart | 8 ++++---- lib/src/commands/make/plugin.dart | 2 +- lib/src/commands/make/service.dart | 2 +- lib/src/commands/make/test.dart | 6 +++--- .../commands/service_generators/file_service.dart | 4 ++-- lib/src/commands/service_generators/mongo.dart | 2 +- pubspec.yaml | 4 ++-- 13 files changed, 33 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 5876e8c..060200d 100644 --- a/.gitignore +++ b/.gitignore @@ -58,5 +58,5 @@ sample-project .dart_tool .metals -.vscode -!.vscode/settings.json \ No newline at end of file +#.vscode +#!.vscode/settings.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 32cfc61..57d6762 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "files.watcherExclude": { "**/target": true - } + }, + "cmake.configureOnOpen": false } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 66fa9f1..071ad77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 7.0.0 + +* Required Dart >= 2.17.x +* Updated packages versions + ## 6.1.0 * Updated to `analyzer` 4.x.x @@ -11,7 +16,7 @@ ## 6.0.0 -* Updated SDK to 2.16.x +* Required Dart >= 2.16.x ## 5.0.0 diff --git a/lib/src/commands/init.dart b/lib/src/commands/init.dart index 8bca097..466cae0 100644 --- a/lib/src/commands/init.dart +++ b/lib/src/commands/init.dart @@ -286,28 +286,28 @@ const BoilerplateInfo graphQLBoilerplate = BoilerplateInfo( 'GraphQL', 'A starter application with GraphQL support.', '$repoLocation/boilerplates.git', - ref: 'angel3-graphql', + ref: 'v7/angel3-graphql', ); const BoilerplateInfo ormBoilerplate = BoilerplateInfo( 'ORM for PostgreSQL', 'A starter application with ORM support for PostgreSQL.', '$repoLocation/boilerplates.git', - ref: 'angel3-orm', + ref: 'v7/angel3-orm', ); const BoilerplateInfo ormMySqlBoilerplate = BoilerplateInfo( - 'ORM for MariaDB', - 'A starter application with ORM support for MariaDB.', + 'ORM for MySQL/MariaDB', + 'A starter application with ORM support for MySQL/MariaDB.', '$repoLocation/boilerplates.git', - ref: 'angel3-orm-mysql', + ref: 'v7/angel3-orm-mysql', ); const BoilerplateInfo basicBoilerplate = BoilerplateInfo( 'Basic', 'A basic starter application with minimal packages.', '$repoLocation/boilerplates.git', - ref: 'angel3-basic'); + ref: 'v7/angel3-basic'); const BoilerplateInfo sharedBoilerplate = BoilerplateInfo( 'Shared', diff --git a/lib/src/commands/make/controller.dart b/lib/src/commands/make/controller.dart index 536ca97..1783953 100644 --- a/lib/src/commands/make/controller.dart +++ b/lib/src/commands/make/controller.dart @@ -41,7 +41,7 @@ class ControllerCommand extends Command { } var deps = [ - const MakerDependency('angel3_framework', '^4.1.0') + const MakerDependency('angel3_framework', '^7.0.0') ]; //${pubspec.name}.src.models.${rc.snakeCase} @@ -49,7 +49,7 @@ class ControllerCommand extends Command { var rc = ReCase(name!); var controllerLib = Library((controllerLib) { if (argResults?['websocket'] as bool) { - deps.add(const MakerDependency('angel3_websocket', '^4.0.0')); + deps.add(const MakerDependency('angel3_websocket', '^7.0.0')); controllerLib.directives .add(Directive.import('package:angel3_websocket/server.dart')); } else { diff --git a/lib/src/commands/make/migration.dart b/lib/src/commands/make/migration.dart index 18520e2..f6a7790 100644 --- a/lib/src/commands/make/migration.dart +++ b/lib/src/commands/make/migration.dart @@ -37,7 +37,7 @@ class MigrationCommand extends Command { name = prompts.get('Name of model class'); } - var deps = [const MakerDependency('angel3_migration', '^4.0.0')]; + var deps = [const MakerDependency('angel3_migration', '^7.0.0')]; var rc = ReCase(name!); var migrationLib = Library((migrationLib) { diff --git a/lib/src/commands/make/model.dart b/lib/src/commands/make/model.dart index f2e6a17..0e400a0 100644 --- a/lib/src/commands/make/model.dart +++ b/lib/src/commands/make/model.dart @@ -62,9 +62,9 @@ class ModelCommand extends Command { if (needsSerialize) { modelLib.directives.add( Directive.import('package:angel3_serialize/angel3_serialize.dart')); - deps.add(const MakerDependency('angel3_serialize', '^4.0.0')); - deps.add(const MakerDependency('angel3_serialize_generator', '^4.0.0')); - deps.add(const MakerDependency('build_runner', '^2.0.0')); + deps.add(const MakerDependency('angel3_serialize', '^7.0.0')); + deps.add(const MakerDependency('angel3_serialize_generator', '^7.0.0')); + deps.add(const MakerDependency('build_runner', '^2.2.0')); } // else { @@ -77,7 +77,7 @@ class ModelCommand extends Command { modelLib.directives.addAll([ Directive.import('package:angel3_orm/angel3_orm.dart'), ]); - deps.add(const MakerDependency('angel3_orm', '^4.0.0')); + deps.add(const MakerDependency('angel3_orm', '^7.0.0')); } modelLib.body.addAll([ diff --git a/lib/src/commands/make/plugin.dart b/lib/src/commands/make/plugin.dart index 59766fa..10e718e 100644 --- a/lib/src/commands/make/plugin.dart +++ b/lib/src/commands/make/plugin.dart @@ -37,7 +37,7 @@ class PluginCommand extends Command { } var deps = [ - const MakerDependency('angel3_framework', '^4.1.0') + const MakerDependency('angel3_framework', '^7.0.0') ]; var rc = ReCase(name!); diff --git a/lib/src/commands/make/service.dart b/lib/src/commands/make/service.dart index 87d9bb8..fbd0f41 100644 --- a/lib/src/commands/make/service.dart +++ b/lib/src/commands/make/service.dart @@ -43,7 +43,7 @@ class ServiceCommand extends Command { } var deps = [ - const MakerDependency('angel3_framework', '^4.1.0') + const MakerDependency('angel3_framework', '^7.0.0') ]; // '${pubspec.name}.src.services.${rc.snakeCase}' diff --git a/lib/src/commands/make/test.dart b/lib/src/commands/make/test.dart index ca3e820..698d9e1 100644 --- a/lib/src/commands/make/test.dart +++ b/lib/src/commands/make/test.dart @@ -40,9 +40,9 @@ class TestCommand extends Command { } var deps = [ - const MakerDependency('angel3_framework', '^4.2.0'), - const MakerDependency('angel3_test', '^4.1.0', dev: true), - const MakerDependency('test', '^1.17.0', dev: true), + const MakerDependency('angel3_framework', '^7.0.0'), + const MakerDependency('angel3_test', '^7.0.0', dev: true), + const MakerDependency('test', '^1.21.0', dev: true), ]; var rc = ReCase(name!); diff --git a/lib/src/commands/service_generators/file_service.dart b/lib/src/commands/service_generators/file_service.dart index e4e2fa5..072b71d 100644 --- a/lib/src/commands/service_generators/file_service.dart +++ b/lib/src/commands/service_generators/file_service.dart @@ -8,7 +8,7 @@ class FileServiceGenerator extends ServiceGenerator { @override List get dependencies => - const [MakerDependency('angel3_file_service', '^4.0.0')]; + const [MakerDependency('angel3_file_service', '^7.0.0')]; @override bool get goesFirst => true; @@ -41,7 +41,7 @@ class FileServiceGenerator extends ServiceGenerator { return refer('JsonFileService').newInstance([ refer('dbDirectory') .property('childFile') - .call([literal(pluralize(lower) + '_db.json')]) + .call([literal('${pluralize(lower)}_db.json')]) ]); } } diff --git a/lib/src/commands/service_generators/mongo.dart b/lib/src/commands/service_generators/mongo.dart index be09079..0e84fce 100644 --- a/lib/src/commands/service_generators/mongo.dart +++ b/lib/src/commands/service_generators/mongo.dart @@ -8,7 +8,7 @@ class MongoServiceGenerator extends ServiceGenerator { @override List get dependencies => - const [MakerDependency('angel3_mongo', '^4.0.0')]; + const [MakerDependency('angel3_mongo', '^7.0.0')]; @override bool get createsModel => false; diff --git a/pubspec.yaml b/pubspec.yaml index 5be8e1b..28695bc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,10 @@ name: angel3_cli -version: 6.1.0 +version: 7.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.16.0 <3.0.0' + sdk: '>=2.17.0 <3.0.0' dependencies: analyzer: ^4.0.0 args: ^2.1.1 From f11746994947acd42a41f7a261de4170d4fe56f6 Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Sat, 3 Dec 2022 13:09:44 +0800 Subject: [PATCH 3/3] Upgaded libraries --- CHANGELOG.md | 5 +++++ lib/src/commands/rename.dart | 10 ++++++---- lib/src/commands/service_generators/custom.dart | 6 ------ lib/src/commands/service_generators/generator.dart | 2 ++ lib/src/commands/service_generators/map.dart | 3 --- lib/src/commands/service_generators/mongo.dart | 3 --- lib/src/commands/service_generators/rethink.dart | 3 --- pubspec.yaml | 6 +++--- test/replace_name.dart | 2 +- 9 files changed, 17 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 071ad77..1c180d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 7.1.0 + +* Required Dart >= 2.18.x +* Updated `analyzer` to 5.x.x + ## 7.0.0 * Required Dart >= 2.17.x diff --git a/lib/src/commands/rename.dart b/lib/src/commands/rename.dart index 84923c3..7fbbb3f 100644 --- a/lib/src/commands/rename.dart +++ b/lib/src/commands/rename.dart @@ -225,11 +225,13 @@ class RenamingVisitor extends RecursiveAstVisitor { @override void visitLibraryDirective(LibraryDirective node) { - var name = node.name.name; + var name = node.name2?.name; - if (name.startsWith(oldName)) { - replace[[node.offset, node.end]] = - 'library ${name.replaceFirst(oldName, newName)};'; + if (name != null) { + if (name.startsWith(oldName)) { + replace[[node.offset, node.end]] = + 'library ${name.replaceFirst(oldName, newName)};'; + } } } diff --git a/lib/src/commands/service_generators/custom.dart b/lib/src/commands/service_generators/custom.dart index 9008b69..7d70c43 100644 --- a/lib/src/commands/service_generators/custom.dart +++ b/lib/src/commands/service_generators/custom.dart @@ -2,12 +2,6 @@ import 'package:code_builder/code_builder.dart'; import 'generator.dart'; class CustomServiceGenerator extends ServiceGenerator { - @override - bool get createsModel => false; - - @override - bool get createsValidator => false; - const CustomServiceGenerator() : super('Custom'); @override diff --git a/lib/src/commands/service_generators/generator.dart b/lib/src/commands/service_generators/generator.dart index 6328958..6cd76ae 100644 --- a/lib/src/commands/service_generators/generator.dart +++ b/lib/src/commands/service_generators/generator.dart @@ -8,6 +8,7 @@ class ServiceGenerator { List get dependencies => []; + /* @deprecated bool get createsModel => true; @@ -22,6 +23,7 @@ class ServiceGenerator { @deprecated bool get shouldRunBuild => false; + */ bool get goesFirst => false; diff --git a/lib/src/commands/service_generators/map.dart b/lib/src/commands/service_generators/map.dart index 545961d..e6482a5 100644 --- a/lib/src/commands/service_generators/map.dart +++ b/lib/src/commands/service_generators/map.dart @@ -4,9 +4,6 @@ import 'package:code_builder/code_builder.dart'; class MapServiceGenerator extends ServiceGenerator { const MapServiceGenerator() : super('In-Memory'); - @override - bool get createsModel => false; - @override Expression createInstance(LibraryBuilder library, MethodBuilder methodBuilder, String name, String lower) { diff --git a/lib/src/commands/service_generators/mongo.dart b/lib/src/commands/service_generators/mongo.dart index 0e84fce..9ce01b2 100644 --- a/lib/src/commands/service_generators/mongo.dart +++ b/lib/src/commands/service_generators/mongo.dart @@ -10,9 +10,6 @@ class MongoServiceGenerator extends ServiceGenerator { List get dependencies => const [MakerDependency('angel3_mongo', '^7.0.0')]; - @override - bool get createsModel => false; - @override void applyToConfigureServer( LibraryBuilder library, diff --git a/lib/src/commands/service_generators/rethink.dart b/lib/src/commands/service_generators/rethink.dart index dcc18c8..097bea8 100644 --- a/lib/src/commands/service_generators/rethink.dart +++ b/lib/src/commands/service_generators/rethink.dart @@ -10,9 +10,6 @@ class RethinkServiceGenerator extends ServiceGenerator { List get dependencies => const [MakerDependency('angel3_rethink', '^4.0.0')]; - @override - bool get createsModel => false; - @override void applyToConfigureServer( LibraryBuilder library, diff --git a/pubspec.yaml b/pubspec.yaml index 28695bc..2189e06 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,12 @@ name: angel3_cli -version: 7.0.0 +version: 7.1.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.17.0 <3.0.0' + sdk: '>=2.18.0 <3.0.0' dependencies: - analyzer: ^4.0.0 + analyzer: ^5.2.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 a037115..67df9d6 100644 --- a/test/replace_name.dart +++ b/test/replace_name.dart @@ -42,7 +42,7 @@ void main() async { var contents = lineList.fold('', (prev, cur) { var updatedCur = updateImport(cur, oldName, newName); updatedCur = updateMustacheBinding(updatedCur, oldName, newName); - return prev + '\n' + updatedCur; + return '$prev\n$updatedCur'; }); await file.writeAsString(fmt.format(contents));