Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions addon/ng2/blueprints/mobile/files/__path__/main-app-shell.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {provide} from '@angular/core';
import {APP_BASE_HREF} from '@angular/common';
import {<%= jsComponentName %>AppComponent} from './app/';
import {
REQUEST_URL,
ORIGIN_URL
} from 'angular2-universal';

export const options = {
directives: [
// The component that will become the main App Shell
<%= jsComponentName %>AppComponent
],
platformProviders: [
provide(ORIGIN_URL, {
useValue: ''
})
],
providers: [
// What URL should Angular be treating the app as if navigating
provide(APP_BASE_HREF, {useValue: '/'}),
provide(REQUEST_URL, {useValue: '/'})
],
async: true,
preboot: false
};

47 changes: 47 additions & 0 deletions addon/ng2/blueprints/mobile/files/__path__/manifest.webapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "<%= fullAppName %>",
"short_name": "<%= fullAppName %>",
"icons": [
{
"src": "/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image/png",
"density": 0.75
},
{
"src": "/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image/png",
"density": 1
},
{
"src": "/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image/png",
"density": 1.5
},
{
"src": "/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image/png",
"density": 2
},
{
"src": "/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image/png",
"density": 3
},
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"density": 4
}
],
"theme_color": "#000000",
"background_color": "#e0e0e0",
"start_url": "/index.html",
"display": "standalone",
"orientation": "portrait"
}
3 changes: 3 additions & 0 deletions addon/ng2/blueprints/mobile/files/__path__/system-import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
32 changes: 32 additions & 0 deletions addon/ng2/blueprints/mobile/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const stringUtils = require('ember-cli-string-utils');

module.exports = {
description: '',

availableOptions: [
{ name: 'source-dir', type: String, default: 'src', aliases: ['sd'] },
{ name: 'prefix', type: String, default: 'app', aliases: ['p'] },
{ name: 'mobile', type: Boolean, default: false }
],

locals: function (options) {
const fullAppName = stringUtils.dasherize(options.entity.name)
.replace(/-(.)/g, (_, l) => ' ' + l.toUpperCase())
.replace(/^./, (l) => l.toUpperCase());

return {
jsComponentName: stringUtils.classify(options.entity.name),
fullAppName: fullAppName,
sourceDir: options.sourceDir
};
},

fileMapTokens: function (options) {
// Return custom template variables here.
return {
__path__: () => {
return options.locals.sourceDir;
}
};
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: '<%= htmlComponentName %>-app',
templateUrl: '<%= htmlComponentName %>.component.html',
styleUrls: ['<%= dasherizedModuleName %>.component.<%= styleExt %>']
<% if (isMobile) { %>template: `
<h1>
{{title}}
</h1>
`,
styles: []<% } else { %>templateUrl: '<%= htmlComponentName %>.component.html',
styleUrls: ['<%= dasherizedModuleName %>.component.<%= styleExt %>']<% } %>
})
export class <%= jsComponentName %>AppComponent {
title = '<%= htmlComponentName %> works!';
Expand Down
47 changes: 35 additions & 12 deletions addon/ng2/blueprints/ng2/files/__path__/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,54 @@
{{#unless environment.production}}
<script src="/angular-cli-live-reload.js" type="text/javascript"></script>
{{/unless}}
<link rel="icon" type="image/x-icon" href="favicon.ico"><% if (isMobile) { %>
<link rel="manifest" href="/manifest.webapp"><% } %>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico"><% if (isMobile) { %>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="/manifest.webapp">
{{#each mobile.icons}}
<link rel="{{rel}}" {{#if sizes}}sizes="{{sizes}}" {{/if}}href="{{href}}">
{{/each}}

<!-- Service worker support is disabled by default.
Install the worker script and uncomment to enable.
Only enable service workers in production.
{{#if environment.production}}
<script type="text/javascript">
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/worker.js').catch(function(err) {
console.log('Error installing service worker: ', err);
});
}
</script>
-->
{{/if}}
<% } %>
</head>
<body>
<<%= htmlComponentName %>-app>Loading...</<%= htmlComponentName %>-app>

{{#each scripts.polyfills}}<script src="{{.}}"></script>{{/each}}
<% if (isMobile) { %>

{{#if environment.production}}
<script src="/app-concat.js" async></script>
{{else}}
{{#each scripts.polyfills}}<script src="{{.}}"></script>{{/each}}
<script>
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
</script>
{{/if}}

<% } else { %>

{{#each scripts.polyfills}}<script src="{{.}}"></script>{{/each}}
<script>
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
</script>

<% } %>



<script>
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
</script>
</body>
</html>
13 changes: 0 additions & 13 deletions addon/ng2/blueprints/ng2/files/__path__/manifest.webapp

This file was deleted.

3 changes: 2 additions & 1 deletion addon/ng2/blueprints/ng2/files/__path__/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},

"files": [
"main.ts",
"main.ts",<% if (isMobile) { %>
"main-app-shell.ts",<% } %>
"typings.d.ts"
]
}
3 changes: 1 addition & 2 deletions addon/ng2/blueprints/ng2/files/__path__/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/// <reference path="<%= refToTypings %>/typings/browser.d.ts" />

declare var module: { id: string };
<% if(!isMobile) { %>declare var module: { id: string };<% } %>
6 changes: 5 additions & 1 deletion addon/ng2/blueprints/ng2/files/angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"name": "<%= htmlComponentName %>"
},
"apps": [
{"main": "<%= sourceDir %>/main.ts", "tsconfig": "<%= sourceDir %>/tsconfig.json"}
{
"main": "<%= sourceDir %>/main.ts",
"tsconfig": "<%= sourceDir %>/tsconfig.json",
"mobile": <%= isMobile %>
}
],
"addons": [],
"packages": [],
Expand Down
8 changes: 7 additions & 1 deletion addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
"systemjs": "0.19.26",
"zone.js": "^0.6.12"
},
"devDependencies": {
"devDependencies": {<% if(isMobile) { %>
"@angular/platform-server": "2.0.0-rc.1",
"angular2-broccoli-prerender": "^0.11.0",
"angular2-service-worker": "0.1.11",
"angular2-universal":"^0.100.3",
"angular2-universal-polyfills": "^0.4.1",
"preboot": "^2.0.10",<% } %>
"angular-cli": "^<%= version %>",
"clang-format": "^1.0.35",
"codelyzer": "0.0.14",
Expand Down
3 changes: 2 additions & 1 deletion addon/ng2/blueprints/ng2/files/typings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"selenium-webdriver": "registry:dt/selenium-webdriver#2.44.0+20160317120654"
},
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"<% if (isMobile) {%>,
"node": "registry:dt/node#4.0.0+20160509154515" <% } %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

}
}
21 changes: 7 additions & 14 deletions addon/ng2/blueprints/ng2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ const stringUtils = require('ember-cli-string-utils');

module.exports = {
description: '',

availableOptions: [
{ name: 'source-dir', type: String, default: 'src', aliases: ['sd'] },
{ name: 'prefix', type: String, default: 'app', aliases: ['p'] },
{ name: 'mobile', type: Boolean, default: false }
],

afterInstall: function (options) {
if (options.mobile) {
return Blueprint.load(path.join(__dirname, '../mobile')).install(options);
}
},

locals: function(options) {
//TODO: pull value from config
this.styleExt = 'css';
Expand All @@ -35,19 +41,6 @@ module.exports = {
};
},

files: function() {
var fileList = Blueprint.prototype.files.call(this);

if (this.options && !this.options.mobile) {
fileList = fileList.filter(p => {
return p != path.join('__path__', 'manifest.webapp')
&& p != path.join('__path__', 'icon.png');
});
}

return fileList;
},

fileMapTokens: function (options) {
// Return custom template variables here.
return {
Expand Down
Loading