Replace some outdated links

This commit is contained in:
Simon Binder 2021-03-13 23:39:54 +01:00
parent 7c911713de
commit 21bfb84b31
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
7 changed files with 70 additions and 16 deletions

View File

@ -15,9 +15,7 @@ jobs:
- name: Run build - name: Run build
env: env:
IS_RELEASE: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} IS_RELEASE: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }}
run: | run: dart run tool/ci_build.dart
dart run tool/ci_build.dart
rm -rf deploy/packages deploy/build.manifest deploy/.dart_tool deploy/.packages
working-directory: docs working-directory: docs
- name: Deploy to netlify - name: Deploy to netlify
uses: nwtgck/actions-netlify@v1.1 uses: nwtgck/actions-netlify@v1.1

View File

@ -5,7 +5,7 @@ data:
weight: 200 weight: 200
# used to be in the "getting started" section # used to be in the "getting started" section
path: docs/Getting started/expressions/ path: docs/getting-started/expressions/
template: layouts/docs/single template: layouts/docs/single
--- ---

View File

@ -13,8 +13,8 @@ how to get started. You can watch it [here](https://youtu.be/zpWsedYMczM).
## Adding the dependency ## Adding the dependency
First, lets add moor to your project's `pubspec.yaml`. First, lets add moor to your project's `pubspec.yaml`.
At the moment, the current version of `moor` is [![Moor version](https://img.shields.io/pub/v/moor.svg)](https://pub.dartlang.org/packages/moor) At the moment, the current version of `moor` is [![Moor version](https://img.shields.io/pub/v/moor.svg)](https://pub.dev/packages/moor)
and the latest version of `moor_generator` is [![Generator version](https://img.shields.io/pub/v/moor_generator.svg)](https://pub.dartlang.org/packages/moor_generator) and the latest version of `moor_generator` is [![Generator version](https://img.shields.io/pub/v/moor_generator.svg)](https://pub.dev/packages/moor_generator)
```yaml ```yaml
dependencies: dependencies:

View File

@ -11,8 +11,8 @@ declaring both tables and queries in Dart. This version will focus on how to use
## Adding the dependency ## Adding the dependency
First, lets add moor to your project's `pubspec.yaml`. First, lets add moor to your project's `pubspec.yaml`.
At the moment, the current version of `moor` is [![Moor version](https://img.shields.io/pub/v/moor.svg)](https://pub.dartlang.org/packages/moor) At the moment, the current version of `moor` is [![Moor version](https://img.shields.io/pub/v/moor.svg)](https://pub.dev/packages/moor)
and the latest version of `moor_generator` is [![Generator version](https://img.shields.io/pub/v/moor_generator.svg)](https://pub.dartlang.org/packages/moor_generator) and the latest version of `moor_generator` is [![Generator version](https://img.shields.io/pub/v/moor_generator.svg)](https://pub.dev/packages/moor_generator)
```yaml ```yaml
dependencies: dependencies:

View File

@ -76,7 +76,7 @@ SharedDatabase constructDb() {
You can see all queries sent from moor to the underlying database engine by enabling the `logStatements` You can see all queries sent from moor to the underlying database engine by enabling the `logStatements`
parameter on the `WebDatabase` - they will appear in the console. parameter on the `WebDatabase` - they will appear in the console.
When you have assertions enabled (e.g. in debug mode), moor will expose the underlying When you have assertions enabled (e.g. in debug mode), moor will expose the underlying
[database](http://sql-js.github.io/sql.js/documentation/#http://sql-js.github.io/sql.js/documentation/class/Database.html) [database](https://sql.js.org/documentation/Database.html)
object via `window.db`. If you need to quickly run a query to check the state of the database, you can use object via `window.db`. If you need to quickly run a query to check the state of the database, you can use
`db.exec(sql)`. `db.exec(sql)`.
If you need to delete your databases, there stored using local storage. You can clear all your data with `localStorage.clear()`. If you need to delete your databases, there stored using local storage. You can clear all your data with `localStorage.clear()`.

View File

@ -1,10 +1,17 @@
//@dart=2.9
import 'dart:io'; import 'dart:io';
import 'package:build_runner_core/build_runner_core.dart';
import 'package:build_runner_core/src/asset/build_cache.dart';
import 'package:build_runner_core/src/asset_graph/graph.dart';
import 'package:build_runner_core/src/asset_graph/node.dart';
import 'package:path/path.dart' as p;
Future<void> main() async { Future<void> main() async {
final isReleaseEnv = Platform.environment['IS_RELEASE']; final isReleaseEnv = Platform.environment['IS_RELEASE'];
print('Is release build: $isReleaseEnv'); print('Is release build: $isReleaseEnv');
final isRelease = isReleaseEnv == '1'; final isRelease = isReleaseEnv == 'true';
final buildArgs = [ final buildArgs = [
'run', 'run',
'build_runner', 'build_runner',
@ -12,12 +19,61 @@ Future<void> main() async {
'--release', '--release',
if (isRelease) '--config=deploy', if (isRelease) '--config=deploy',
]; ];
final build = await Process.start('dart', buildArgs, final build = await Process.start(
'/home/simon/bin/dart-sdk/stable/bin/dart', buildArgs,
mode: ProcessStartMode.inheritStdio); mode: ProcessStartMode.inheritStdio);
await build.exitCode; await build.exitCode;
final generatePages = await Process.start( print('Copying generated sources into deploy/');
'dart', [...buildArgs, '--output=web:deploy'], // Advanced build magic because --output creates weird files that we don't
mode: ProcessStartMode.inheritStdio); // want.
await generatePages.exitCode; final graph = await PackageGraph.forThisPackage();
final env = IOEnvironment(graph);
final assets =
AssetGraph.deserialize(await (await _findAssetGraph()).readAsBytes());
final reader = BuildCacheReader(env.reader, assets, graph.root.name);
final output = Directory('deploy');
if (output.existsSync()) {
output.deleteSync(recursive: true);
}
output.createSync();
final idsToRead = assets.allNodes
.where((node) => !_shouldSkipNode(node, graph))
.map((e) => e.id);
for (final id in idsToRead) {
final file = File(p.join('deploy', p.relative(id.path, from: 'web/')));
file.parent.createSync(recursive: true);
await file.writeAsBytes(await reader.readAsBytes(id));
}
}
Future<File> _findAssetGraph() {
final dir = Directory('.dart_tool/build');
return dir.list().firstWhere((e) {
final base = p.basename(e.path);
return base != 'entrypoint' && base != 'generated';
}).then((dir) => File(p.join(dir.path, 'asset_graph.json')));
}
bool _shouldSkipNode(AssetNode node, PackageGraph packageGraph) {
if (!node.isReadable) return true;
if (node.isDeleted) return true;
if (!node.id.path.startsWith('web/') ||
node.id.package != packageGraph.root.name) {
return true;
}
if (node is InternalAssetNode) return true;
if (node is GeneratedAssetNode) {
if (!node.wasOutput ||
node.isFailure ||
node.state == NodeState.definitelyNeedsUpdate) {
return true;
}
}
return false;
} }

View File

@ -1,6 +1,6 @@
/// Flutter implementation for the moor database. This library merely provides /// Flutter implementation for the moor database. This library merely provides
/// a thin level of abstraction between the /// a thin level of abstraction between the
/// [sqflite](https://pub.dartlang.org/packages/sqflite) library and /// [sqflite](https://pub.dev/packages/sqflite) library and
/// [moor](https://github.com/simolus3/moor) /// [moor](https://github.com/simolus3/moor)
library moor_flutter; library moor_flutter;