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"
* Updated pretty_logging 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_postgres to 2.0.0
* 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
* 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
* Revert packages/validate from version 3.0 to version 2.2
# 2.1.1 and before
* Refer to packages/framework/CHANGELOG.md
# 2.1.x and below
* 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.
## 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
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
pub global activate angel_cli
pub global activate --source git https://github.com/dukefirehawk/cli.git
```
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
```
(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.
## 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
Visit the [documentation](https://docs.angel-dart.dev/v/2.x)
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.
Map<String, dynamic> parseParamsFromGithub(MediaType contentType, String body) {
if (contentType.type == 'application') {
if (contentType.subtype == 'x-www-form-urlencoded')
if (contentType.subtype == 'x-www-form-urlencoded') {
return Uri.splitQueryString(body);
else if (contentType.subtype == 'json')
} else if (contentType.subtype == 'json') {
return (json.decode(body) as Map).cast<String, String>();
}
}
throw FormatException(
'Invalid content-type $contentType; expected application/x-www-form-urlencoded or application/json.');
}
main() async {
void main() async {
// Create the server instance.
var app = Angel();
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.
(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 id = ghUser['id'] as int;

View file

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

View file

@ -1,19 +1,26 @@
name: angel_cache
version: 2.0.1
version: 3.0.0
homepage: https://github.com/angel-dart/cache
description: Support for server-side caching in Angel.
author: Tobe O <thosakwe@gmail.com>
publish_to: none
environment:
sdk: ">=2.10.0 <2.12.0"
sdk: ">=2.10.0 <3.0.0"
dependencies:
angel_framework: #^2.0.0-alpha
path: ../framework
angel_framework:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/framework
collection: ^1.0.0
meta: ^1.0.0
pool: ^1.0.0
dev_dependencies:
angel_test: # ^2.0.0-alpha
path: ../test
glob: ^1.0.0
http: any
test: ^1.15.7
angel_test:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
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);
response1 = await client.get('/date.txt');
response2 = await client.get('/date.txt');
response1 = await client.get(Uri.parse('/date.txt'));
response2 = await client.get(Uri.parse('/date.txt'));
print(response2.headers);
lastModified = HttpDate.parse(response2.headers['last-modified']);
print('Response 1 status: ${response1.statusCode}');
@ -76,7 +76,7 @@ main() async {
test('invalidate', () async {
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}');
expect(response.body, isNot(response1.body));
});
@ -86,14 +86,14 @@ main() async {
'if-modified-since':
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('Response (${response.statusCode}): ${response.headers}');
expect(response.statusCode, 304);
});
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':
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')
];
// ${pubspec.name}.src.models.${rc.snakeCase}
//${pubspec.name}.src.models.${rc.snakeCase}
var rc = new ReCase(name);
var controllerLib = new Library((controllerLib) {

View file

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

View file

@ -1,15 +1,19 @@
name: angel_container_generator
version: 1.0.1
version: 2.0.0
author: Tobe O <thosakwe@gmail.com>
description: Codegen support for using pkg:reflectable with pkg:angel_container.
homepage: https://github.com/angel-dart/container.git
publish_to: none
environment:
sdk: ">=2.10.0 <2.12.0"
sdk: ">=2.10.0 <3.0.0"
dependencies:
angel_container: # ^1.0.0-alpha
path: ../angel_container
angel_container:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/container/angel_container
reflectable: ^2.2.9
dev_dependencies:
build_runner: ^1.11.1
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>
description: Angel CORS middleware. Port of expressjs/cors to the Angel framework.
environment:
sdk: ">=2.10.0 <2.12.0"
sdk: ">=2.10.0 <3.0.0"
homepage: https://github.com/angel-dart/cors.git
name: angel_cors
version: 2.0.0
version: 3.0.0
publish_to: none
dependencies:
angel_framework: #^2.0.0-alpha
path: ../framework
angel_framework:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/framework
dev_dependencies:
angel_test: #^2.0.0
path: ../test
http: ^0.12.0
pedantic: ^1.0.0
test: ^1.15.7
angel_test:
git:
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x
path: packages/test
http: ^0.13.0
pedantic: ^1.11.0
test: ^1.16.5

View file

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

View file

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