Skip to content

Commit bf1e804

Browse files
authored
Update build and serve commands to run in an isolate (#6)
Add example angular app to experiment with.
1 parent 7ce4e6a commit bf1e804

15 files changed

+134
-20
lines changed

webdev/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Experimental Usage
2+
3+
The example directory contains a package that is configured to work with
4+
`pub run webdev <command>`. Support for `pub global activate webdev` and simply
5+
adding a dev_dependency to your packages is coming soon.
6+
7+
## Commands
8+
9+
* __build__: Run builders to build a package.
10+
* __help__: Display help information for webdev.
11+
* __serve__: Run a local web development server and a file system watcher that
12+
re-builds on changes.

webdev/example/lib/app_component.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:host {
2+
/* This is equivalent of the 'body' selector of a page. */
3+
}

webdev/example/lib/app_component.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import 'package:angular/angular.dart';
2+
3+
import 'src/hello_world/hello_world.dart';
4+
5+
@Component(
6+
selector: 'my-app',
7+
styleUrls: const ['app_component.css'],
8+
templateUrl: 'app_component.html',
9+
directives: const [HelloWorldComponent],
10+
)
11+
class AppComponent {
12+
// Nothing here.
13+
}

webdev/example/lib/app_component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Webdev Example: Angular App</h1>
2+
3+
<hello-world></hello-world>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
div {
2+
color: teal;
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import 'package:angular/angular.dart';
2+
3+
@Component(
4+
selector: 'hello-world',
5+
styleUrls: const ['hello_world.css'],
6+
templateUrl: 'hello_world.html',
7+
)
8+
class HelloWorldComponent {
9+
// Nothing here.
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>Hello World<div>

webdev/example/pubspec.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: webdev_example_app
2+
description: A web app example for webdev CLI.
3+
version: 0.0.1
4+
5+
environment:
6+
sdk: ">=2.0.0-dev.3.0 <2.0.0"
7+
8+
dependencies:
9+
angular: ^5.0.0-alpha+3
10+
browser: ^0.10.0
11+
12+
dev_dependencies:
13+
webdev:
14+
path: ../
15+
##############################################################################
16+
# Temporary until build_runner exposes a function to generate it's script.
17+
build_runner:
18+
git:
19+
url: https://github.com/dart-lang/build.git
20+
path: build_runner
21+
##############################################################################
22+
23+
dependency_overrides:
24+
# Necessary with angular: ^5.0.0-alpha+1 dependency.
25+
analyzer: ^0.31.0-alpha.1

webdev/example/web/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>webdev example</title>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<script defer src="main.dart" type="application/dart"></script>
8+
<script defer src="packages/browser/dart.js"></script>
9+
<link rel="stylesheet" href="styles.css">
10+
</head>
11+
<body>
12+
<my-app>Loading...</my-app>
13+
</body>
14+
</html>

webdev/example/web/main.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import 'package:angular/angular.dart';
2+
import 'package:webdev_example_app/app_component.dart';
3+
import 'main.template.dart' as ng;
4+
5+
main() {
6+
bootstrapStatic(AppComponent, [/*providers*/], ng.initReflector);
7+
}

0 commit comments

Comments
 (0)