Updated the SDK 2.14.0

This commit is contained in:
thomashii 2022-01-13 22:32:40 +08:00
parent 64104653a0
commit f4b38337e0
10 changed files with 46 additions and 42 deletions

View file

@ -1 +0,0 @@
language: dart

View file

@ -1,5 +1,11 @@
# Change Log # 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 ## 3.2.0
* Upgraded from `pedantic` to `lints` linter * Upgraded from `pedantic` to `lints` linter

View file

@ -26,11 +26,11 @@ void main(List<String> args) async {
..addCommand(DoctorCommand()) ..addCommand(DoctorCommand())
..addCommand(KeyCommand()) ..addCommand(KeyCommand())
..addCommand(InitCommand()) ..addCommand(InitCommand())
..addCommand(InstallCommand()) // ..addCommand(InstallCommand())
..addCommand(RenameCommand()) ..addCommand(RenameCommand())
..addCommand(MakeCommand()); ..addCommand(MakeCommand());
return await runner.run(args).catchError((exc, st) { await runner.run(args).catchError((exc, st) {
if (exc is String) { if (exc is String) {
stdout.writeln(exc); stdout.writeln(exc);
} else { } else {
@ -67,10 +67,10 @@ const String asciiArt = '''
const String asciiArt3 = ''' const String asciiArt3 = '''
\ \ | ___| ____| | ___ / \\ \\ | ___| ____| | ___ /
_ \ \ | | __| | _ \ _ \\ \\ | | __| | _ \\
___ \ |\ | | | | | ) | ___ \\ |\\ | | | | | ) |
_/ _\ _| \_| \____| _____| _____| ____/ _/ _\\ _| \\_| \\____| _____| _____| ____/
'''; ''';
const String asciiArtOld = ''' const String asciiArtOld = '''
@ -78,6 +78,6 @@ ____________ ________________________
___ |__ | / /_ ____/__ ____/__ / ___ |__ | / /_ ____/__ ____/__ /
__ /| |_ |/ /_ / __ __ __/ __ / __ /| |_ |/ /_ / __ __ __/ __ /
_ ___ | /| / / /_/ / _ /___ _ /___ _ ___ | /| / / /_/ / _ /___ _ /___
/_/ |_/_/ |_/ \____/ /_____/ /_____/ /_/ |_/_/ |_/ \\____/ /_____/ /_____/
'''; ''';

View file

@ -8,7 +8,6 @@ import 'package:recase/recase.dart';
import '../random_string.dart' as rs; import '../random_string.dart' as rs;
import '../util.dart'; import '../util.dart';
import 'key.dart'; import 'key.dart';
import 'pub.dart';
import 'rename.dart'; import 'rename.dart';
class InitCommand extends Command { class InitCommand extends Command {
@ -66,7 +65,7 @@ class InitCommand extends Command {
// Renaming executable files // Renaming executable files
if (argResults!['pub-get'] != false && argResults!['offline'] == false) { if (argResults!['pub-get'] != false && argResults!['offline'] == false) {
print('Now running pub get...'); print('Now running dart pub get...');
await _pubGet(projectDir); await _pubGet(projectDir);
} }
@ -222,7 +221,7 @@ class InitCommand extends Command {
// Otherwise, pull from git. // Otherwise, pull from git.
else if (!(argResults!['offline'] as bool)) { else if (!(argResults!['offline'] as bool)) {
print(darkGray.wrap('\$ git pull origin $branch')); 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, mode: ProcessStartMode.inheritStdio,
workingDirectory: boilerplateDir.absolute.path); workingDirectory: boilerplateDir.absolute.path);
if (await git.exitCode != 0) { if (await git.exitCode != 0) {
@ -256,8 +255,8 @@ class InitCommand extends Command {
} }
Future _pubGet(Directory projectDir) async { Future _pubGet(Directory projectDir) async {
var pubPath = resolvePub(); var pubPath = "dart pub";
print(darkGray.wrap('Running pub at "$pubPath"...')); //print(darkGray.wrap('Running "$pubPath"...'));
print(darkGray.wrap('\$ $pubPath get')); print(darkGray.wrap('\$ $pubPath get'));
var pub = await Process.start(pubPath, ['get'], var pub = await Process.start(pubPath, ['get'],
workingDirectory: projectDir.absolute.path, workingDirectory: projectDir.absolute.path,
@ -269,11 +268,10 @@ class InitCommand extends Command {
Future preBuild(Directory projectDir) async { Future preBuild(Directory projectDir) async {
// Run build // Run build
// print('Running `pub run build_runner build`...'); // print('Running `dart run build_runner build`...');
print(darkGray.wrap('\$ pub run build_runner build')); print(darkGray.wrap('\$ dart run build_runner build'));
var build = await Process.start( var build = await Process.start("dart", ['run', 'build_runner', 'build'],
resolvePub(), ['run', 'build_runner', 'build'],
workingDirectory: projectDir.absolute.path, workingDirectory: projectDir.absolute.path,
mode: ProcessStartMode.inheritStdio); mode: ProcessStartMode.inheritStdio);
@ -282,37 +280,37 @@ Future preBuild(Directory projectDir) async {
if (buildCode != 0) throw Exception('Failed to pre-build resources.'); 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( const BoilerplateInfo graphQLBoilerplate = BoilerplateInfo(
'GraphQL', 'GraphQL',
'A starter application with GraphQL support.', 'A starter application with GraphQL support.',
'$RepoLocation/boilerplates.git', '$repoLocation/boilerplates.git',
ref: 'angel3-graphql', ref: 'angel3-graphql',
); );
const BoilerplateInfo ormBoilerplate = BoilerplateInfo( const BoilerplateInfo ormBoilerplate = BoilerplateInfo(
'ORM', 'ORM',
'A starter application with ORM support.', 'A starter application with ORM support.',
'$RepoLocation/boilerplates.git', '$repoLocation/boilerplates.git',
ref: 'angel3-orm', ref: 'angel3-orm',
); );
const BoilerplateInfo basicBoilerplate = BoilerplateInfo( const BoilerplateInfo basicBoilerplate = BoilerplateInfo(
'Basic', 'Basic',
'A basic starter application with minimal packages.', 'A basic starter application with minimal packages.',
'$RepoLocation/boilerplates.git', '$repoLocation/boilerplates.git',
ref: 'angel3-basic'); ref: 'angel3-basic');
const BoilerplateInfo sharedBoilerplate = BoilerplateInfo( const BoilerplateInfo sharedBoilerplate = BoilerplateInfo(
'Shared', 'Shared',
'Holds common models and files shared across multiple Dart projects.', 'Holds common models and files shared across multiple Dart projects.',
'$RepoLocation/boilerplate_shared.git'); '$repoLocation/boilerplate_shared.git');
const BoilerplateInfo sharedOrmBoilerplate = BoilerplateInfo( const BoilerplateInfo sharedOrmBoilerplate = BoilerplateInfo(
'Shared (ORM)', 'Shared (ORM)',
'Holds common models and files shared across multiple Dart projects.', 'Holds common models and files shared across multiple Dart projects.',
'$RepoLocation/boilerplate_shared.git', '$repoLocation/boilerplate_shared.git',
ref: 'orm', ref: 'orm',
); );

View file

@ -12,7 +12,7 @@ import 'package:yaml/yaml.dart' as yaml;
import '../util.dart'; import '../util.dart';
import 'make/maker.dart'; import 'make/maker.dart';
@deprecated @Deprecated("No longer needed")
class InstallCommand extends Command { class InstallCommand extends Command {
static const String repo = 'https://github.com/angel-dart/install.git'; static const String repo = 'https://github.com/angel-dart/install.git';
static final Directory installRepo = static final Directory installRepo =

View file

@ -40,8 +40,8 @@ class TestCommand extends Command {
} }
var deps = <MakerDependency>[ var deps = <MakerDependency>[
const MakerDependency('angel3_framework', '^4.1.0'), const MakerDependency('angel3_framework', '^4.2.0'),
const MakerDependency('angel3_test', '^4.0.0', dev: true), const MakerDependency('angel3_test', '^4.1.0', dev: true),
const MakerDependency('test', '^1.17.0', dev: true), const MakerDependency('test', '^1.17.0', dev: true),
]; ];

View file

@ -2,6 +2,7 @@ import 'dart:io';
final RegExp _leadingSlashes = RegExp(r'^/+'); final RegExp _leadingSlashes = RegExp(r'^/+');
@Deprecated("Replaced by dart pub")
String resolvePub() { String resolvePub() {
var exec = File(Platform.resolvedExecutable); var exec = File(Platform.resolvedExecutable);
var pubPath = exec.parent.uri.resolve('pub').path; var pubPath = exec.parent.uri.resolve('pub').path;

View file

@ -133,7 +133,7 @@ Future renameDartFiles(Directory dir, String oldName, String newName) async {
// Replace mustache {{oldName}} with newName // Replace mustache {{oldName}} with newName
String updateMustacheBinding(String content, String oldName, String newName) { String updateMustacheBinding(String content, String oldName, String newName) {
if (content.contains('{{$oldName}}')) { if (content.contains('{{$oldName}}')) {
return content.replaceAll('{{$oldName}}', '$newName'); return content.replaceAll('{{$oldName}}', newName);
} }
return content; return content;
@ -205,8 +205,8 @@ class RenamingVisitor extends RecursiveAstVisitor {
} }
@override @override
void visitExportDirective(ExportDirective ctx) { void visitExportDirective(ExportDirective node) {
var uri = ctx.uri.stringValue; var uri = node.uri.stringValue;
if (uri != null) { if (uri != null) {
var updated = updateUri(uri); var updated = updateUri(uri);
if (uri != updated) replace[[uri]] = updated; if (uri != updated) replace[[uri]] = updated;
@ -214,8 +214,8 @@ class RenamingVisitor extends RecursiveAstVisitor {
} }
@override @override
void visitImportDirective(ImportDirective ctx) { void visitImportDirective(ImportDirective node) {
var uri = ctx.uri.stringValue; var uri = node.uri.stringValue;
if (uri != null) { if (uri != null) {
var updated = updateUri(uri); var updated = updateUri(uri);
@ -224,22 +224,22 @@ class RenamingVisitor extends RecursiveAstVisitor {
} }
@override @override
void visitLibraryDirective(LibraryDirective ctx) { void visitLibraryDirective(LibraryDirective node) {
var name = ctx.name.name; var name = node.name.name;
if (name.startsWith(oldName)) { if (name.startsWith(oldName)) {
replace[[ctx.offset, ctx.end]] = replace[[node.offset, node.end]] =
'library ' + name.replaceFirst(oldName, newName) + ';'; 'library ' + name.replaceFirst(oldName, newName) + ';';
} }
} }
@override @override
void visitPartOfDirective(PartOfDirective ctx) { void visitPartOfDirective(PartOfDirective node) {
if (ctx.libraryName != null) { if (node.libraryName != null) {
var name = ctx.libraryName!.name; var name = node.libraryName!.name;
if (name.startsWith(oldName)) { if (name.startsWith(oldName)) {
replace[[ctx.offset, ctx.end]] = replace[[node.offset, node.end]] =
'part of ' + name.replaceFirst(oldName, newName) + ';'; 'part of ' + name.replaceFirst(oldName, newName) + ';';
} }
} }

View file

@ -1,12 +1,12 @@
name: angel3_cli name: angel3_cli
version: 3.2.0 version: 4.0.0
description: Command line tools for the Angel3 framework, including scaffolding. description: Command line tools for the Angel3 framework, including scaffolding.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel3-cli repository: https://github.com/dukefirehawk/angel3-cli
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.14.0 <3.0.0'
dependencies: dependencies:
analyzer: ^2.0.0 analyzer: ^3.0.0
args: ^2.1.1 args: ^2.1.1
code_builder: ^4.0.0 code_builder: ^4.0.0
dart_style: ^2.0.1 dart_style: ^2.0.1

View file

@ -22,7 +22,7 @@ void main() async {
String updateMustacheBinding(String content, String oldName, String newName) { String updateMustacheBinding(String content, String oldName, String newName) {
if (content.contains('{{$oldName}}')) { if (content.contains('{{$oldName}}')) {
return content.replaceAll('{{$oldName}}', '$newName'); return content.replaceAll('{{$oldName}}', newName);
} }
return content; return content;