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
## 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

View file

@ -26,11 +26,11 @@ void main(List<String> 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 @@ ____________ ________________________
___ |__ | / /_ ____/__ ____/__ /
__ /| |_ |/ /_ / __ __ __/ __ /
_ ___ | /| / / /_/ / _ /___ _ /___
/_/ |_/_/ |_/ \____/ /_____/ /_____/
/_/ |_/_/ |_/ \\____/ /_____/ /_____/
''';

View file

@ -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',
);

View file

@ -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 =

View file

@ -40,8 +40,8 @@ class TestCommand extends Command {
}
var deps = <MakerDependency>[
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),
];

View file

@ -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;

View file

@ -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) + ';';
}
}

View file

@ -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

View file

@ -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;