Update to 2.1.7
This commit is contained in:
parent
cf1b813578
commit
427f81ee49
13 changed files with 60 additions and 51 deletions
|
@ -1,3 +1,11 @@
|
|||
# 2.1.7
|
||||
* Fix a bug where `ArgResults.arguments` was used in `init` instead of the
|
||||
intended `ArgResults.rest`.
|
||||
* Stop including `package:angel_model` imports in `make model`.
|
||||
* Update dependencies in `make` commands.
|
||||
* Fix `make model` to generate ORM + migration by default.
|
||||
* Fix `MakerDependency` logic to print missing dependencies.
|
||||
|
||||
# 2.1.6
|
||||
* Fix a bug where models always defaulted to ORM.
|
||||
* Add GraphQL boilerplate.
|
||||
|
|
|
@ -31,7 +31,7 @@ class InitCommand extends Command {
|
|||
@override
|
||||
run() async {
|
||||
Directory projectDir = new Directory(
|
||||
argResults.arguments.isEmpty ? "." : argResults.arguments[0]);
|
||||
argResults.rest.isEmpty ? "." : argResults.rest[0]);
|
||||
print("Creating new Angel project in ${projectDir.absolute.path}...");
|
||||
await _cloneRepo(projectDir);
|
||||
// await preBuild(projectDir);
|
||||
|
|
|
@ -40,7 +40,7 @@ class ControllerCommand extends Command {
|
|||
}
|
||||
|
||||
List<MakerDependency> deps = [
|
||||
const MakerDependency('angel_framework', '^1.0.0')
|
||||
const MakerDependency('angel_framework', '^2.0.0')
|
||||
];
|
||||
|
||||
// ${pubspec.name}.src.models.${rc.snakeCase}
|
||||
|
@ -48,7 +48,7 @@ class ControllerCommand extends Command {
|
|||
var rc = new ReCase(name);
|
||||
var controllerLib = new Library((controllerLib) {
|
||||
if (argResults['websocket'] as bool) {
|
||||
deps.add(const MakerDependency('angel_websocket', '^1.0.0'));
|
||||
deps.add(const MakerDependency('angel_websocket', '^2.0.0'));
|
||||
controllerLib.directives
|
||||
.add(new Directive.import('package:angel_websocket/server.dart'));
|
||||
} else {
|
||||
|
|
|
@ -2,11 +2,14 @@ import 'dart:async';
|
|||
import 'package:io/ansi.dart';
|
||||
import '../../util.dart';
|
||||
|
||||
class MakerDependency {
|
||||
class MakerDependency implements Comparable<MakerDependency> {
|
||||
final String name, version;
|
||||
final bool dev;
|
||||
|
||||
const MakerDependency(this.name, this.version, {this.dev: false});
|
||||
|
||||
@override
|
||||
int compareTo(MakerDependency other) => name.compareTo(other.name);
|
||||
}
|
||||
|
||||
Future depend(Iterable<MakerDependency> deps) async {
|
||||
|
@ -21,6 +24,7 @@ Future depend(Iterable<MakerDependency> deps) async {
|
|||
isPresent = pubspec.dependencies.containsKey(dep.name);
|
||||
|
||||
if (!isPresent) {
|
||||
missing.add(dep);
|
||||
// TODO: https://github.com/dart-lang/pubspec_parse/issues/17:
|
||||
// print('Installing ${dep.name}@${dep.version}...');
|
||||
//
|
||||
|
@ -36,33 +40,28 @@ Future depend(Iterable<MakerDependency> deps) async {
|
|||
}
|
||||
}
|
||||
|
||||
missing.sort((a, b) {
|
||||
if (!a.dev) {
|
||||
if (b.dev) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (b.dev) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
var missingDeps = deps.where((d) => !d.dev).toList()..sort();
|
||||
var missingDevDeps = deps.where((d) => d.dev).toList()..sort();
|
||||
|
||||
if (missingDeps.isNotEmpty || missingDevDeps.isNotEmpty) {
|
||||
var totalCount = missingDeps.length + missingDevDeps.length;
|
||||
print(yellow.wrap(totalCount == 1
|
||||
? 'You are missing one dependency.'
|
||||
: 'You are missing ${missing.length} dependencies.'));
|
||||
print(yellow.wrap(
|
||||
'Update your `pubspec.yaml` to add the following dependencies:\n'));
|
||||
|
||||
void printMissing(String type, Iterable<MakerDependency> deps) {
|
||||
if (deps.isNotEmpty) {
|
||||
print(yellow.wrap(' $type:'));
|
||||
for (var dep in deps) {
|
||||
print(yellow.wrap(' ${dep.name}: ${dep.version}'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (missing.isNotEmpty) {
|
||||
print(yellow.wrap(missing.length == 1
|
||||
? 'You are missing one dependency:'
|
||||
: 'You are missing ${missing.length} dependencies:'));
|
||||
print('\n');
|
||||
|
||||
for (var dep in missing) {
|
||||
var m = ' * ${dep.name}@${dep.version}';
|
||||
if (dep.dev) m += ' (dev dependency)';
|
||||
print(yellow.wrap(m));
|
||||
}
|
||||
printMissing('dependencies', missingDeps);
|
||||
printMissing('dev_dependencies', missingDevDeps);
|
||||
}
|
||||
|
||||
// if (isPresent) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class MigrationCommand extends Command {
|
|||
name = prompts.get('Name of model class');
|
||||
}
|
||||
|
||||
var deps = [const MakerDependency('angel_migration', '^1.0.0-alpha')];
|
||||
var deps = [const MakerDependency('angel_migration', '^2.0.0')];
|
||||
var rc = new ReCase(name);
|
||||
|
||||
var migrationLib = new Library((migrationLib) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class ModelCommand extends Command {
|
|||
..addFlag('migration',
|
||||
abbr: 'm',
|
||||
help: 'Generate migrations when running `build_runner`.',
|
||||
negatable: false)
|
||||
defaultsTo: true)
|
||||
..addFlag('orm', help: 'Generate angel_orm code.', negatable: false)
|
||||
..addFlag('serializable',
|
||||
help: 'Generate angel_serialize annotations.', defaultsTo: true)
|
||||
|
@ -47,33 +47,35 @@ class ModelCommand extends Command {
|
|||
var rc = new ReCase(name);
|
||||
|
||||
var modelLib = new Library((modelLib) {
|
||||
if (argResults['migration'] as bool) {
|
||||
if (argResults['orm'] as bool && argResults['migration'] as bool) {
|
||||
modelLib.directives.addAll([
|
||||
new Directive.import('package:angel_migration/angel_migration.dart'),
|
||||
]);
|
||||
}
|
||||
|
||||
var needsSerialize = argResults['serializable'] as bool ||
|
||||
argResults['orm'] as bool ||
|
||||
argResults['migration'] as bool;
|
||||
var needsSerialize =
|
||||
argResults['serializable'] as bool || argResults['orm'] as bool;
|
||||
// argResults['migration'] as bool;
|
||||
|
||||
if (needsSerialize) {
|
||||
modelLib.directives.add(new Directive.import(
|
||||
'package:angel_serialize/angel_serialize.dart'));
|
||||
deps.add(const MakerDependency('angel_serialize', '^2.0.0'));
|
||||
deps.add(const MakerDependency('angel_serialize_generator', '^2.0.0'));
|
||||
deps.add(const MakerDependency('build_runner', '">=0.7.0 <0.10.0"'));
|
||||
} else {
|
||||
modelLib.directives
|
||||
.add(new Directive.import('package:angel_model/angel_model.dart'));
|
||||
deps.add(const MakerDependency('angel_model', '^1.0.0'));
|
||||
deps.add(const MakerDependency('build_runner', '^1.0.0'));
|
||||
}
|
||||
|
||||
if (argResults['orm'] as bool || argResults['migration'] as bool) {
|
||||
// else {
|
||||
// modelLib.directives
|
||||
// .add(new Directive.import('package:angel_model/angel_model.dart'));
|
||||
// deps.add(const MakerDependency('angel_model', '^1.0.0'));
|
||||
// }
|
||||
|
||||
if (argResults['orm'] as bool) {
|
||||
modelLib.directives.addAll([
|
||||
new Directive.import('package:angel_orm/angel_orm.dart'),
|
||||
]);
|
||||
deps.add(const MakerDependency('angel_orm', '^1.0.0-alpha'));
|
||||
deps.add(const MakerDependency('angel_orm', '^2.0.0'));
|
||||
}
|
||||
|
||||
modelLib.body.addAll([
|
||||
|
@ -91,7 +93,7 @@ class ModelCommand extends Command {
|
|||
modelClazz.annotations.add(refer('serializable'));
|
||||
}
|
||||
|
||||
if (argResults['orm'] as bool || argResults['migration'] as bool) {
|
||||
if (argResults['orm'] as bool) {
|
||||
if (argResults['migration'] as bool) {
|
||||
modelClazz.annotations.add(refer('orm'));
|
||||
} else {
|
||||
|
|
|
@ -35,7 +35,7 @@ class PluginCommand extends Command {
|
|||
}
|
||||
|
||||
List<MakerDependency> deps = [
|
||||
const MakerDependency('angel_framework', '^1.0.0')
|
||||
const MakerDependency('angel_framework', '^2.0.0')
|
||||
];
|
||||
|
||||
var rc = new ReCase(name);
|
||||
|
|
|
@ -42,7 +42,7 @@ class ServiceCommand extends Command {
|
|||
}
|
||||
|
||||
List<MakerDependency> deps = [
|
||||
const MakerDependency('angel_framework', '^1.0.0')
|
||||
const MakerDependency('angel_framework', '^2.0.0')
|
||||
];
|
||||
|
||||
// '${pubspec.name}.src.services.${rc.snakeCase}'
|
||||
|
|
|
@ -38,9 +38,9 @@ class TestCommand extends Command {
|
|||
}
|
||||
|
||||
List<MakerDependency> deps = [
|
||||
const MakerDependency('angel_framework', '^1.0.0'),
|
||||
const MakerDependency('angel_test', '^1.0.0', dev: true),
|
||||
const MakerDependency('test', '^0.12.0', dev: true),
|
||||
const MakerDependency('angel_framework', '^2.0.0'),
|
||||
const MakerDependency('angel_test', '^2.0.0', dev: true),
|
||||
const MakerDependency('test', '^1.0.0', dev: true),
|
||||
];
|
||||
|
||||
var rc = new ReCase(name);
|
||||
|
|
|
@ -8,7 +8,7 @@ class FileServiceGenerator extends ServiceGenerator {
|
|||
|
||||
@override
|
||||
List<MakerDependency> get dependencies =>
|
||||
const [const MakerDependency('angel_file_service', '^1.0.0')];
|
||||
const [const MakerDependency('angel_file_service', '^2.0.0')];
|
||||
|
||||
@override
|
||||
bool get goesFirst => true;
|
||||
|
|
|
@ -8,7 +8,7 @@ class MongoServiceGenerator extends ServiceGenerator {
|
|||
|
||||
@override
|
||||
List<MakerDependency> get dependencies =>
|
||||
const [const MakerDependency('angel_mongo', '^1.0.0')];
|
||||
const [const MakerDependency('angel_mongo', '^2.0.0')];
|
||||
|
||||
@override
|
||||
bool get createsModel => false;
|
||||
|
|
|
@ -8,7 +8,7 @@ class RethinkServiceGenerator extends ServiceGenerator {
|
|||
|
||||
@override
|
||||
List<MakerDependency> get dependencies =>
|
||||
const [const MakerDependency('angel_rethink', '^1.0.0')];
|
||||
const [const MakerDependency('angel_rethink', '^2.0.0')];
|
||||
|
||||
@override
|
||||
bool get createsModel => false;
|
||||
|
|
|
@ -2,7 +2,7 @@ author: Tobe O <thosakwe@gmail.com>
|
|||
description: Command-line tools for the Angel framework, including scaffolding.
|
||||
homepage: https://github.com/angel-dart/angel_cli
|
||||
name: angel_cli
|
||||
version: 2.1.6
|
||||
version: 2.1.7
|
||||
dependencies:
|
||||
analyzer: ">=0.32.0 <2.0.0"
|
||||
args: ^1.0.0
|
||||
|
|
Loading…
Reference in a new issue