-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move hot restart script into a separate package (#94)
- Loading branch information
Showing
13 changed files
with
781 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# https://dart.dev/guides/libraries/private-files | ||
# Created by `dart pub` | ||
.dart_tool/ | ||
!pubspec.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Spot Hot-Restart timeline CLI | ||
|
||
File watcher, automatically rebuilding the timeline files (in `build/timeline`) when the source files are modified. | ||
|
||
|
||
## Usage | ||
|
||
```bash | ||
dart run bin/main.dart | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This file configures the analyzer to use the lint rule set from `package:lint` | ||
|
||
# include: package:lint/strict.yaml # For production apps | ||
include: package:lint/casual.yaml # For code samples, hackathons and other non-production code | ||
# include: package:lint/package.yaml # Use this for packages with public API | ||
|
||
|
||
# You might want to exclude auto-generated files from dart analysis | ||
analyzer: | ||
exclude: | ||
#- '**.freezed.dart' | ||
#- '**.g.dart' | ||
|
||
# You can customize the lint rules set to your own liking. A list of all rules | ||
# can be found at https://dart-lang.github.io/linter/lints/options/options.html | ||
linter: | ||
rules: | ||
# Util classes are awesome! | ||
# avoid_classes_with_only_static_members: false | ||
|
||
# Make constructors the first thing in every class | ||
# sort_constructors_first: true | ||
|
||
# Choose wisely, but you don't have to | ||
# prefer_double_quotes: true | ||
# prefer_single_quotes: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:hot_restart_timeline/hot_restart_timeline.dart' | ||
as hot_restart_timeline; | ||
|
||
Future<void> main(List<String> arguments) async { | ||
ProcessSignal.sigint.watch().listen((event) { | ||
exit(0); | ||
}); | ||
await hot_restart_timeline.main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:dartx/dartx_io.dart'; | ||
import 'package:hot_restart_timeline/hot_restart_timeline.dart'; | ||
import 'package:server_nano/server_nano.dart'; | ||
|
||
void startServer(Directory timelineHotReloadDir) { | ||
final server = Server(); | ||
server.static(spotPackageRoot.directory('build/timeline/').path); | ||
server.get('/', (req, resp) { | ||
final timelines = timelineHotReloadDir | ||
.listSync(recursive: true) | ||
.where((file) => file.path.endsWith('.html')) | ||
.map((file) { | ||
final relative = file.path.split('build/timeline/').last; | ||
return '<li><a href="/$relative">$relative</a></li>\n'; | ||
}).join('\n'); | ||
resp.sendHtmlText( | ||
'<h1>Spot timelines</h1>\n\n' | ||
'<ul>\n$timelines</ul>', | ||
); | ||
}); | ||
|
||
server.listen(port: 5907); | ||
} |
Oops, something went wrong.