Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
Update web templates (#353)
Browse files Browse the repository at this point in the history
* update web templates

* add web-angular-quickstart
* remove web-polymer
* update web-angular

* Update CHANGELING and version

* make tests pass

* tweak web-angular description

* Fix copyright year.
  • Loading branch information
kwalrath authored Dec 1, 2016
1 parent 0f37e71 commit 9874957
Show file tree
Hide file tree
Showing 32 changed files with 287 additions and 208 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.19
- Added `web-angular-quickstart`, a copy of the Angular docs' first example.
- Removed `web-polymer`.
- Updated `web-angular` to `^2.2.0`.

## 1.0.18
- Added platform_directives & platform_pipes back to the `web-angular` pubspec.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Kit and Yeoman.
* `console-simple` - A simple command-line application.
* `package-simple` - A starting point for Dart libraries or applications.
* `server-shelf` - A web server built using the shelf package.
* `web-angular` - A web app built using Angular 2.
* `web-polymer` - A web app built using polymer.dart.
* `web-angular` - A web app built using the latest version of Angular.
* `web-angular-quickstart` - A minimalist example app used in docs.
* `web-simple` - An absolute bare-bones web app.

## Installation
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/web_angular.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import 'web_angular_data.dart';
*/
class WebAngularGenerator extends DefaultGenerator {
WebAngularGenerator()
: super('web-angular', 'Angular 2 Web Application',
'A web app built using Angular 2.',
: super('web-angular', 'Angular Web Application',
'A web app built using the latest version of Angular.',
categories: const ['dart', 'web']) {
for (TemplateFile file in decodeConcatenatedData(data)) {
addTemplateFile(file);
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/web_angular_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ZW1wbGF0ZVVybDogJ2FwcF9jb21wb25lbnQuaHRtbCcpCmNsYXNzIEFwcENvbXBvbmVudCB7fQo=""",
"text",
"""bmFtZTogX19wcm9qZWN0TmFtZV9fCmRlc2NyaXB0aW9uOiBBIERhcnQgYXBwIHRoYXQgdXNlcyBB
bmd1bGFyIDIKdmVyc2lvbjogMC4wLjEKZW52aXJvbm1lbnQ6CiAgc2RrOiAnPj0xLjE5LjAgPDIu
MC4wJwpkZXBlbmRlbmNpZXM6CiAgYW5ndWxhcjI6IF4yLjAuMApkZXZfZGVwZW5kZW5jaWVzOgog
MC4wJwpkZXBlbmRlbmNpZXM6CiAgYW5ndWxhcjI6IF4yLjIuMApkZXZfZGVwZW5kZW5jaWVzOgog
IGJyb3dzZXI6IF4wLjEwLjAKICBkYXJ0X3RvX2pzX3NjcmlwdF9yZXdyaXRlcjogXjEuMC4xCnRy
YW5zZm9ybWVyczoKLSBhbmd1bGFyMjoKICAgIHBsYXRmb3JtX2RpcmVjdGl2ZXM6CiAgICAtICdw
YWNrYWdlOmFuZ3VsYXIyL2NvbW1vbi5kYXJ0I0NPTU1PTl9ESVJFQ1RJVkVTJwogICAgcGxhdGZv
Expand Down
26 changes: 26 additions & 0 deletions lib/generators/web_angular_quickstart.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2016, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

import '../stagehand.dart';
import '../src/common.dart';
import 'web_angular_quickstart_data.dart';

/**
* The QuickStart example used in AngularDart docs.
*/
class WebAngularQuickstartGenerator extends DefaultGenerator {
WebAngularQuickstartGenerator()
: super('web-angular-quickstart', 'Angular QuickStart Example',
'A minimalist example app used in docs.',
categories: const ['dart', 'web']) {
for (TemplateFile file in decodeConcatenatedData(data)) {
addTemplateFile(file);
}

setEntrypoint(getFile('web/index.html'));
}

String getInstallInstructions() => "${super.getInstallInstructions()}\n"
"to run your app, use 'pub serve'";
}
87 changes: 87 additions & 0 deletions lib/generators/web_angular_quickstart_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Copyright (c) 2014, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

const List<String> data = const [
".analysis_options",
"text",
"""IyBUaGlzIGZpbGUgYWxsb3dzIHlvdSB0byBjb25maWd1cmUgdGhlIERhcnQgYW5hbHl6ZXIuCiMK
IyBUaGUgY29tbWVudGVkIHBhcnQgYmVsb3cgaXMganVzdCBmb3IgaW5zcGlyYXRpb24uIFJlYWQg
dGhlIGd1aWRlIGhlcmU6CiMgICBodHRwczovL3d3dy5kYXJ0bGFuZy5vcmcvZ3VpZGVzL2xhbmd1
YWdlL2FuYWx5c2lzLW9wdGlvbnMKCiMgYW5hbHl6ZXI6CiMgICBzdHJvbmctbW9kZTogdHJ1ZQoj
ICAgZXhjbHVkZToKIyAgICAgLSBwYXRoL3RvL2V4Y2x1ZGVkL2ZpbGVzLyoqCiMgbGludGVyOgoj
ICAgcnVsZXM6CiMgICAgICMgc2VlIGNhdGFsb2cgaGVyZTogaHR0cDovL2RhcnQtbGFuZy5naXRo
dWIuaW8vbGludGVyL2xpbnRzLwojICAgICAtIGhhc2hfYW5kX2VxdWFscwo=""",
".gitignore",
"text",
"""IyBGaWxlcyBhbmQgZGlyZWN0b3JpZXMgY3JlYXRlZCBieSBwdWIKLnBhY2thZ2VzCi5wdWIvCmJ1
aWxkLwpwYWNrYWdlcwojIFJlbW92ZSB0aGUgZm9sbG93aW5nIHBhdHRlcm4gaWYgeW91IHdpc2gg
dG8gY2hlY2sgaW4geW91ciBsb2NrIGZpbGUKcHVic3BlYy5sb2NrCgojIEZpbGVzIGNyZWF0ZWQg
YnkgZGFydDJqcwoqLmRhcnQuanMKKi5wYXJ0LmpzCiouanMuZGVwcwoqLmpzLm1hcAoqLmluZm8u
anNvbgoKIyBEaXJlY3RvcnkgY3JlYXRlZCBieSBkYXJ0ZG9jCmRvYy9hcGkvCgojIEpldEJyYWlu
cyBJREVzCi5pZGVhLwoqLmltbAoqLmlwcgoqLml3cwo=""",
"lib/app_component.dart",
"text",
"""aW1wb3J0ICdwYWNrYWdlOmFuZ3VsYXIyL2NvcmUuZGFydCc7CgpAQ29tcG9uZW50KHNlbGVjdG9y
OiAnbXktYXBwJywgdGVtcGxhdGU6ICc8aDE+SGVsbG8ge3tuYW1lfX08L2gxPicpCmNsYXNzIEFw
cENvbXBvbmVudCB7CiAgdmFyIG5hbWUgPSAnQW5ndWxhcic7Cn0K""",
"pubspec.yaml",
"text",
"""bmFtZTogX19wcm9qZWN0TmFtZV9fCmRlc2NyaXB0aW9uOiBRdWlja1N0YXJ0CnZlcnNpb246IDAu
MC4xCmVudmlyb25tZW50OgogIHNkazogJz49MS4xOS4wIDwyLjAuMCcKZGVwZW5kZW5jaWVzOgog
IGFuZ3VsYXIyOiBeMi4yLjAKZGV2X2RlcGVuZGVuY2llczoKICBicm93c2VyOiBeMC4xMC4wCiAg
ZGFydF90b19qc19zY3JpcHRfcmV3cml0ZXI6IF4xLjAuMQp0cmFuc2Zvcm1lcnM6Ci0gYW5ndWxh
cjI6CiAgICBwbGF0Zm9ybV9kaXJlY3RpdmVzOgogICAgLSAncGFja2FnZTphbmd1bGFyMi9jb21t
b24uZGFydCNDT01NT05fRElSRUNUSVZFUycKICAgIHBsYXRmb3JtX3BpcGVzOgogICAgLSAncGFj
a2FnZTphbmd1bGFyMi9jb21tb24uZGFydCNDT01NT05fUElQRVMnCiAgICBlbnRyeV9wb2ludHM6
IHdlYi9tYWluLmRhcnQKLSBkYXJ0X3RvX2pzX3NjcmlwdF9yZXdyaXRlcgo=""",
"web/index.html",
"text",
"""PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPHRpdGxlPkhlbGxvIEFuZ3VsYXI8
L3RpdGxlPgogICAgPG1ldGEgY2hhcnNldD0iVVRGLTgiPgogICAgPG1ldGEgbmFtZT0idmlld3Bv
cnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13a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rZ3JvdW5kLWNvbG9yOiAjRUVFOwogIG1h
cmdpbjogLjVlbTsKICBwYWRkaW5nOiAuM2VtIDA7CiAgaGVpZ2h0OiAxLjZlbTsKICBib3JkZXIt
cmFkaXVzOiA0cHg7Cn0KLml0ZW1zIGxpOmhvdmVyIHsKICBjb2xvcjogIzYwN0Q4QjsKICBiYWNr
Z3JvdW5kLWNvbG9yOiAjREREOwogIGxlZnQ6IC4xZW07Cn0KLml0ZW1zIGxpLnNlbGVjdGVkIHsK
ICBiYWNrZ3JvdW5kLWNvbG9yOiAjQ0ZEOERDOwogIGNvbG9yOiB3aGl0ZTsKfQouaXRlbXMgbGku
c2VsZWN0ZWQ6aG92ZXIgewogIGJhY2tncm91bmQtY29sb3I6ICNCQkQ4REM7Cn0KLml0ZW1zIC50
ZXh0IHsKICBwb3NpdGlvbjogcmVsYXRpdmU7CiAgdG9wOiAtM3B4Owp9Ci5pdGVtcyAuYmFkZ2Ug
ewogIGRpc3BsYXk6IGlubGluZS1ibG9jazsKICBmb250LXNpemU6IHNtYWxsOwogIGNvbG9yOiB3
aGl0ZTsKICBwYWRkaW5nOiAwLjhlbSAwLjdlbSAwIDAuN2VtOwogIGJhY2tncm91bmQtY29sb3I6
ICM2MDdEOEI7CiAgbGluZS1oZWlnaHQ6IDFlbTsKICBwb3NpdGlvbjogcmVsYXRpdmU7CiAgbGVm
dDogLTFweDsKICB0b3A6IC00cHg7CiAgaGVpZ2h0OiAxLjhlbTsKICBtYXJnaW4tcmlnaHQ6IC44
ZW07CiAgYm9yZGVyLXJhZGl1czogNHB4IDAgMCA0cHg7Cn0KLyogZXZlcnl3aGVyZSBlbHNlICov
CiogewogIGZvbnQtZmFtaWx5OiBBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmOwp9Cg=="""
];
2 changes: 1 addition & 1 deletion lib/src/cli_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:usage/usage_io.dart';
const String APP_NAME = 'stagehand';

// This version must be updated in tandem with the pubspec version.
const String APP_VERSION = '1.0.18';
const String APP_VERSION = '1.0.19';

const String APP_PUB_INFO =
'https://pub.dartlang.org/packages/${APP_NAME}.json';
Expand Down
4 changes: 2 additions & 2 deletions lib/stagehand.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import 'generators/console_simple.dart';
import 'generators/package_simple.dart';
import 'generators/server_shelf.dart';
import 'generators/web_angular.dart';
import 'generators/web_polymer.dart';
import 'generators/web_angular_quickstart.dart';
import 'generators/web_simple.dart';
import 'src/common.dart';

Expand All @@ -41,7 +41,7 @@ final List<Generator> generators = [
new PackageSimpleGenerator(),
new ServerShelfGenerator(),
new WebAngularGenerator(),
new WebPolymerGenerator(),
new WebAngularQuickstartGenerator(),
new WebSimpleGenerator()
]..sort();

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: stagehand
# When changing this version, change the lib/src/cli_app.dart version as well.
version: 1.0.18
version: 1.0.19
description: >
A scaffolding generator for your Dart projects. Stagehand helps you get set
up!
Expand Down
4 changes: 2 additions & 2 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ <h1 id="usage">Usage</h1>
<li>console-simple - <em>A simple command-line application.</em></li>
<li>package-simple - <em>A starting point for Dart libraries or applications.</em></li>
<li>server-shelf - <em>A web server built using the shelf package.</em></li>
<li>web-angular - <em>A web app built using Angular 2.</em></li>
<li>web-polymer - <em>A web app built using polymer.dart.</em></li>
<li>web-angular - <em>A web app built using the latest version of Angular.</em></li>
<li>web-angular-quickstart - <em>A minimalist example app used in docs.</em></li>
<li>web-simple - <em>An absolute bare-bones web app.</em></li>
</ul>

Expand Down
6 changes: 6 additions & 0 deletions templates/web-angular-quickstart/lib/app_component.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:angular2/core.dart';

@Component(selector: 'my-app', template: '<h1>Hello {{name}}</h1>')
class AppComponent {
var name = 'Angular';
}
18 changes: 18 additions & 0 deletions templates/web-angular-quickstart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: __projectName__
description: QuickStart
version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: ^2.2.0
dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
- dart_to_js_script_rewriter
15 changes: 15 additions & 0 deletions templates/web-angular-quickstart/web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Hello Angular</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">

<script defer src="main.dart" type="application/dart"></script>
<script defer src="packages/browser/dart.js"></script>
</head>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>
7 changes: 7 additions & 0 deletions templates/web-angular-quickstart/web/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:angular2/platform/browser.dart';

import 'package:__projectName__/app_component.dart';

void main() {
bootstrap(AppComponent);
}
111 changes: 111 additions & 0 deletions templates/web-angular-quickstart/web/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* Master Styles */
h1 {
color: #369;
font-family: Arial, Helvetica, sans-serif;
font-size: 250%;
}
h2, h3 {
color: #444;
font-family: Arial, Helvetica, sans-serif;
font-weight: lighter;
}
body {
margin: 2em;
}
body, input[text], button {
color: #888;
font-family: Cambria, Georgia;
}
a {
cursor: pointer;
cursor: hand;
}
button {
font-family: Arial;
background-color: #eee;
border: none;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
cursor: hand;
}
button:hover {
background-color: #cfd8dc;
}
button:disabled {
background-color: #eee;
color: #aaa;
cursor: auto;
}

/* Navigation link styles */
nav a {
padding: 5px 10px;
text-decoration: none;
margin-top: 10px;
display: inline-block;
background-color: #eee;
border-radius: 4px;
}
nav a:visited, a:link {
color: #607D8B;
}
nav a:hover {
color: #039be5;
background-color: #CFD8DC;
}
nav a.active {
color: #039be5;
}

/* items class */
.items {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 24em;
}
.items li {
cursor: pointer;
position: relative;
left: 0;
background-color: #EEE;
margin: .5em;
padding: .3em 0;
height: 1.6em;
border-radius: 4px;
}
.items li:hover {
color: #607D8B;
background-color: #DDD;
left: .1em;
}
.items li.selected {
background-color: #CFD8DC;
color: white;
}
.items li.selected:hover {
background-color: #BBD8DC;
}
.items .text {
position: relative;
top: -3px;
}
.items .badge {
display: inline-block;
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color: #607D8B;
line-height: 1em;
position: relative;
left: -1px;
top: -4px;
height: 1.8em;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}
/* everywhere else */
* {
font-family: Arial, Helvetica, sans-serif;
}
2 changes: 1 addition & 1 deletion templates/web-angular/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 0.0.1
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: ^2.0.0
angular2: ^2.2.0
dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
Expand Down
5 changes: 0 additions & 5 deletions templates/web-polymer/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit 9874957

Please sign in to comment.