Merge branch 'master' into sdk-2.12.x_nnbd

This commit is contained in:
thomashii 2021-03-14 13:44:58 +08:00
commit 4cf7409c1d
13 changed files with 178 additions and 89 deletions

View file

@ -1,4 +1,10 @@
# 3.0.0 # 3.0.1 (NNBD)
* Changed Dart SDK requirements for all packages to ">=2.12.0 <3.0.0" to support NNBD.
* Updated pretty_logging to 2.0.0
* Updated angel_http_exception to 2.0.0
* Updated angel_cli to 3.0.0. (Rename not working)
# 3.0.0 (Non NNBD)
* Changed Dart SDK requirements for all packages to ">=2.10.0 <3.0.0" * Changed Dart SDK requirements for all packages to ">=2.10.0 <3.0.0"
* Updated pretty_logging to 2.0.0 * Updated pretty_logging to 2.0.0
* Updated angel_http_exception to 2.0.0 * Updated angel_http_exception to 2.0.0
@ -31,7 +37,13 @@
* Updated angel_orm_test to 1.0.0 * Updated angel_orm_test to 1.0.0
* Updated angel_orm_postgres to 2.0.0 * Updated angel_orm_postgres to 2.0.0
* Update orm-sdk-2.12.x boilerplate * Update orm-sdk-2.12.x boilerplate
* Updated angel_auth_oauth2 to 3.0.0
* Updated angel_auth_cache to 3.0.0
* Updated angel_auth_cors to 3.0.0
* Updated angel_container_generator to 2.0.0
* Updated angel_file_service to 3.0.0
* Updated angel_eventsource to 2.0.0 (use a fork of eventsource)
* Updated angel_auth_twitter to 3.0.0 (use a fork of twitter and oauth)
# 2.2.0 # 2.2.0
* Changed Dart SDK requirements for all packages to ">=2.10.0 <2.12.0" * Changed Dart SDK requirements for all packages to ">=2.10.0 <2.12.0"
@ -39,6 +51,6 @@
* Fixed broken code due to 3rd party libraries update * Fixed broken code due to 3rd party libraries update
* Revert packages/validate from version 3.0 to version 2.2 * Revert packages/validate from version 3.0 to version 2.2
# 2.1.1 and before # 2.1.x and below
* Refer to packages/framework/CHANGELOG.md * Refer to the orginal repo before the fork

View file

@ -22,14 +22,46 @@ With features like the following, Angel is the all-in-one framework you should c
See all the packages in the `packages/` directory. See all the packages in the `packages/` directory.
## IMPORTANT NOTES
This is a port of Angel Framework to work with Dart 2.10.x and above. Dart version below 2.10.x is not supported.
Branch: master
- Stable version of sdk-2.12.x branch
Branch: sdk-2.10.x
- Support dart 2.10.x only. Use sdk: ">=2.10.0 <2.12.0"
- Status: Working
- Notes: Migration completed. Not all plugin packages are tested.
Branch: sdk-2.12.x
- Support dart 2.12.x. Use sdk: ">=2.10.0 <3.0.0"
- Do not support NNBD
- Status: Working
- Notes: Basic and ORM templates are working with the core plugins migration completed. The remaining add on plugin packages are work in progress.
Branch: sdk-2.12.x-nnbd
- Support dart 2.12.x. Use sdk: ">=2.12.0 <3.0.0"
- Support NNBD
- Status: Not working
- Notes: To be available once all the dependency libraries that support NNBD are released
Changes:
- Upgraded dependency libraries and fixed the deprecated API
Deprecated Features:
- None
New features:
- None
## Installation & Setup ## Installation & Setup
Once you have [Dart](https://www.dartlang.org/) installed, bootstrapping a project is as simple as running a few shell commands: Once you have [Dart](https://www.dartlang.org/) installed, bootstrapping a project is as simple as running a few shell commands:
Install the [Angel CLI](https://github.com/angel-dart/cli): Install the [Angel CLI](https://github.com/dukefirehawk/cli):
```bash ```bash
pub global activate angel_cli pub global activate --source git https://github.com/dukefirehawk/cli.git
``` ```
Bootstrap a project: Bootstrap a project:
@ -44,14 +76,14 @@ You can even have your server run and be *hot-reloaded* on file changes:
dart --observe bin/dev.dart dart --observe bin/dev.dart
``` ```
(For CLI development only)Install Angel CLI
```bash
pub global activate --source path ./packages/cli
```
Next, check out the [detailed documentation](https://docs.angel-dart.dev/v/2.x) to learn to flesh out your project. Next, check out the [detailed documentation](https://docs.angel-dart.dev/v/2.x) to learn to flesh out your project.
## Development
* Install development version of Angel CLI
`dart pub global activate --source path ./packages/cli`
`dart pub global activate --source git https://github.com/dukefirehawk/angel/packages/cli`
## Examples and Documentation ## Examples and Documentation
Visit the [documentation](https://docs.angel-dart.dev/v/2.x) Visit the [documentation](https://docs.angel-dart.dev/v/2.x)
for dozens of guides and resources, including video tutorials, for dozens of guides and resources, including video tutorials,

View file

@ -20,17 +20,18 @@ var options = ExternalAuthOptions(
/// Github doesn't properly follow the OAuth2 spec, so here's logic to parse their response. /// Github doesn't properly follow the OAuth2 spec, so here's logic to parse their response.
Map<String, dynamic> parseParamsFromGithub(MediaType contentType, String body) { Map<String, dynamic> parseParamsFromGithub(MediaType contentType, String body) {
if (contentType.type == 'application') { if (contentType.type == 'application') {
if (contentType.subtype == 'x-www-form-urlencoded') if (contentType.subtype == 'x-www-form-urlencoded') {
return Uri.splitQueryString(body); return Uri.splitQueryString(body);
else if (contentType.subtype == 'json') } else if (contentType.subtype == 'json') {
return (json.decode(body) as Map).cast<String, String>(); return (json.decode(body) as Map).cast<String, String>();
}
} }
throw FormatException( throw FormatException(
'Invalid content-type $contentType; expected application/x-www-form-urlencoded or application/json.'); 'Invalid content-type $contentType; expected application/x-www-form-urlencoded or application/json.');
} }
main() async { void main() async {
// Create the server instance. // Create the server instance.
var app = Angel(); var app = Angel();
var http = AngelHttp(app); var http = AngelHttp(app);
@ -60,7 +61,7 @@ main() async {
// This function is called when the user ACCEPTS the request to sign in with Github. // This function is called when the user ACCEPTS the request to sign in with Github.
(client, req, res) async { (client, req, res) async {
var response = await client.get('https://api.github.com/user'); var response = await client.get(Uri.parse('https://api.github.com/user'));
var ghUser = json.decode(response.body); var ghUser = json.decode(response.body);
var id = ghUser['id'] as int; var id = ghUser['id'] as int;

View file

@ -1,17 +1,24 @@
name: angel_auth_oauth2 name: angel_auth_oauth2
description: angel_auth strategy for OAuth2 login, i.e. Facebook, Github, etc. description: angel_auth strategy for OAuth2 login, i.e. Facebook, Github, etc.
version: 2.1.0 version: 3.0.0
author: Tobe O <thosakwe@gmail.com> #author: Tobe O <thosakwe@gmail.com>
publish_to: none
environment: environment:
sdk: ">=2.10.0 <2.12.0" sdk: ">=2.10.0 <3.0.0"
homepage: https://github.com/angel-dart/auth_oauth2.git homepage: https://github.com/angel-dart/auth_oauth2.git
dependencies: dependencies:
angel_auth: # ^2.0.0 angel_auth:
path: ../auth git:
angel_framework: # ^2.0.0-alpha url: https://github.com/dukefirehawk/angel.git
path: ../framework ref: sdk-2.12.x
http_parser: ^3.0.0 path: packages/auth
oauth2: ^1.0.0 angel_framework:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/framework
http_parser: ^4.0.0
oauth2: ^2.0.0
dev_dependencies: dev_dependencies:
logging: ^0.11.0 logging: ^1.0.0
pedantic: ^1.0.0 pedantic: ^1.0.0

View file

@ -1,22 +1,28 @@
author: "Tobe O <thosakwe@gmail.com>" name: "angel_auth_twitter"
#author: "Tobe O <thosakwe@gmail.com>"
description: "package:angel_auth strategy for Twitter login. Auto-signs requests." description: "package:angel_auth strategy for Twitter login. Auto-signs requests."
environment: environment:
sdk: ">=2.10.0 <2.12.0" sdk: ">=2.10.0 <3.0.0"
homepage: "https://github.com/angel-dart/auth_twitter.git" homepage: "https://github.com/angel-dart/auth_twitter.git"
name: "angel_auth_twitter" version: 3.0.0
version: 2.0.0 publish_to: none
dependencies: dependencies:
angel_auth: # ^2.0.0 angel_auth:
path: ../auth git:
angel_framework: # ^2.0.0-alpha url: https://github.com/dukefirehawk/angel.git
path: ../framework ref: sdk-2.12.x
http: ">=0.11.0 <0.13.0" path: packages/auth
angel_framework:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/framework
http: ^0.13.0
path: ^1.0.0 path: ^1.0.0
# oauth: twitter:
# git: git:
# url: git://github.com/sh4869/oauth.dart.git url: https://github.com/dukefirehawk/twitter.dart.git
# ref: develop ref: sdk-2.12.x
twitter: ^1.0.0
dev_dependencies: dev_dependencies:
logging: ^0.11.0 logging: ^1.0.0
pedantic: ^1.0.0 pedantic: ^1.11.0

View file

@ -1,19 +1,26 @@
name: angel_cache name: angel_cache
version: 2.0.1 version: 3.0.0
homepage: https://github.com/angel-dart/cache homepage: https://github.com/angel-dart/cache
description: Support for server-side caching in Angel. description: Support for server-side caching in Angel.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
publish_to: none
environment: environment:
sdk: ">=2.10.0 <2.12.0" sdk: ">=2.10.0 <3.0.0"
dependencies: dependencies:
angel_framework: #^2.0.0-alpha angel_framework:
path: ../framework git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/framework
collection: ^1.0.0 collection: ^1.0.0
meta: ^1.0.0 meta: ^1.0.0
pool: ^1.0.0 pool: ^1.0.0
dev_dependencies: dev_dependencies:
angel_test: # ^2.0.0-alpha angel_test:
path: ../test git:
glob: ^1.0.0 url: https://github.com/dukefirehawk/angel.git
http: any ref: sdk-2.12.x
test: ^1.15.7 path: packages/test
glob: ^2.0.0
http: ^0.13.0
test: ^1.16.5

View file

@ -42,8 +42,8 @@ main() async {
}; };
client = await connectTo(app); client = await connectTo(app);
response1 = await client.get('/date.txt'); response1 = await client.get(Uri.parse('/date.txt'));
response2 = await client.get('/date.txt'); response2 = await client.get(Uri.parse('/date.txt'));
print(response2.headers); print(response2.headers);
lastModified = HttpDate.parse(response2.headers['last-modified']); lastModified = HttpDate.parse(response2.headers['last-modified']);
print('Response 1 status: ${response1.statusCode}'); print('Response 1 status: ${response1.statusCode}');
@ -76,7 +76,7 @@ main() async {
test('invalidate', () async { test('invalidate', () async {
await client.sendUnstreamed('PURGE', '/date.txt', {}); await client.sendUnstreamed('PURGE', '/date.txt', {});
var response = await client.get('/date.txt'); var response = await client.get(Uri.parse('/date.txt'));
print('Response after invalidation: ${response.body}'); print('Response after invalidation: ${response.body}');
expect(response.body, isNot(response1.body)); expect(response.body, isNot(response1.body));
}); });
@ -86,14 +86,14 @@ main() async {
'if-modified-since': 'if-modified-since':
HttpDate.format(lastModified.add(const Duration(days: 1))) HttpDate.format(lastModified.add(const Duration(days: 1)))
}; };
var response = await client.get('/date.txt', headers: headers); var response = await client.get(Uri.parse('/date.txt'), headers: headers);
print('Sending headers: $headers'); print('Sending headers: $headers');
print('Response (${response.statusCode}): ${response.headers}'); print('Response (${response.statusCode}): ${response.headers}');
expect(response.statusCode, 304); expect(response.statusCode, 304);
}); });
test('last-modified in the past', () async { test('last-modified in the past', () async {
var response = await client.get('/date.txt', headers: { var response = await client.get(Uri.parse('/date.txt'), headers: {
'if-modified-since': 'if-modified-since':
HttpDate.format(lastModified.subtract(const Duration(days: 10))) HttpDate.format(lastModified.subtract(const Duration(days: 10)))
}); });

View file

@ -43,7 +43,7 @@ class ControllerCommand extends Command {
const MakerDependency('angel_framework', '^2.0.0') const MakerDependency('angel_framework', '^2.0.0')
]; ];
// ${pubspec.name}.src.models.${rc.snakeCase} //${pubspec.name}.src.models.${rc.snakeCase}
var rc = new ReCase(name); var rc = new ReCase(name);
var controllerLib = new Library((controllerLib) { var controllerLib = new Library((controllerLib) {

View file

@ -37,5 +37,5 @@ dev_dependencies:
build_runner: ^1.0.0 build_runner: ^1.0.0
build_web_compilers: ^2.12.2 build_web_compilers: ^2.12.2
mock_request: ^1.0.0 mock_request: ^1.0.0
pedantic: ^1.0.0 pedantic: ^1.11.0
test: ^1.15.7 test: ^1.16.5

View file

@ -1,15 +1,19 @@
name: angel_container_generator name: angel_container_generator
version: 1.0.1 version: 2.0.0
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
description: Codegen support for using pkg:reflectable with pkg:angel_container. description: Codegen support for using pkg:reflectable with pkg:angel_container.
homepage: https://github.com/angel-dart/container.git homepage: https://github.com/angel-dart/container.git
publish_to: none
environment: environment:
sdk: ">=2.10.0 <2.12.0" sdk: ">=2.10.0 <3.0.0"
dependencies: dependencies:
angel_container: # ^1.0.0-alpha angel_container:
path: ../angel_container git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/container/angel_container
reflectable: ^2.2.9 reflectable: ^2.2.9
dev_dependencies: dev_dependencies:
build_runner: ^1.11.1 build_runner: ^1.11.1
build_test: ^1.3.6 build_test: ^1.3.6
test: ^1.15.7 test: ^1.16.5

View file

@ -1,16 +1,23 @@
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
description: Angel CORS middleware. Port of expressjs/cors to the Angel framework. description: Angel CORS middleware. Port of expressjs/cors to the Angel framework.
environment: environment:
sdk: ">=2.10.0 <2.12.0" sdk: ">=2.10.0 <3.0.0"
homepage: https://github.com/angel-dart/cors.git homepage: https://github.com/angel-dart/cors.git
name: angel_cors name: angel_cors
version: 2.0.0 version: 3.0.0
publish_to: none
dependencies: dependencies:
angel_framework: #^2.0.0-alpha angel_framework:
path: ../framework git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/framework
dev_dependencies: dev_dependencies:
angel_test: #^2.0.0 angel_test:
path: ../test git:
http: ^0.12.0 url: https://github.com/dukefirehawk/angel.git
pedantic: ^1.0.0 ref: sdk-2.12.x
test: ^1.15.7 path: packages/test
http: ^0.13.0
pedantic: ^1.11.0
test: ^1.16.5

View file

@ -1,18 +1,27 @@
name: angel_eventsource name: angel_eventsource
version: 1.0.0 version: 2.0.0
description: Server-sent Events (SSE) plugin for Angel. description: Server-sent Events (SSE) plugin for Angel.
homepage: https://github.com/angel-dart/eventsource homepage: https://github.com/angel-dart/eventsource
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
publish_to: none
environment: environment:
sdk: ">=2.10.0 <2.12.0" sdk: ">=2.10.0 <3.0.0"
dependencies: dependencies:
angel_framework: #^2.0.0-alpha angel_framework:
path: ../framework git:
angel_websocket: #^2.0.0-alpha url: https://github.com/dukefirehawk/angel.git
path: ../websocket ref: sdk-2.12.x
eventsource: ^0.2.0 path: packages/framework
angel_websocket:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/websocket
eventsource:
git:
url: https://github.com/dukefirehawk/dart-eventsource.git
stream_channel: ^2.0.0 stream_channel: ^2.0.0
dev_dependencies: dev_dependencies:
console: ^3.0.0 console: ^4.0.0
logging: logging: ^1.0.0
test: ^1.15.7 test: ^1.16.5

View file

@ -1,14 +1,18 @@
name: angel_file_service name: angel_file_service
version: 2.0.1 version: 3.0.0
description: Angel service that persists data to a file on disk. description: Angel service that persists data to a file on disk.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/file_service homepage: https://github.com/angel-dart/file_service
publish_to: none
environment: environment:
sdk: ">=2.10.0 <2.12.0" sdk: ">=2.10.0 <3.0.0"
dependencies: dependencies:
angel_framework: #^2.0.0-alpha angel_framework:
path: ../framework git:
file: ^5.0.0 url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/framework
file: ^6.1.0
pool: ^1.0.0 pool: ^1.0.0
dev_dependencies: dev_dependencies:
test: ^1.15.7 test: ^1.16.5