Skip to content

Commit a14b3e7

Browse files
committed
Merge branch 'release/0.0.2'
2 parents b5231c0 + cdfb339 commit a14b3e7

38 files changed

+585
-140
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ tmp
1515
.idea
1616
.awcache
1717
npm-debug.log
18+
npm-debug.log*
1819
/typings

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,97 @@ You can find the configurations in ```<root>/environment```.
182182
## HTML5 pushState routing
183183
By default pushState, also known as html5 routing, is enabled. The Webpack server is already configured to handle this but many webserver need
184184
extra confuration to enable this.
185+
186+
## Cordova - Mobile Development
187+
188+
### Installation
189+
Initiate cordova with the following commands:
190+
```shell
191+
npm install -g cordova
192+
npm run cordova:init
193+
```
194+
195+
Finally add the following code just before the ```</body>``` closing tag:
196+
```
197+
<!-- Cordova -->
198+
<script src="cordova.js"></script>
199+
```
200+
201+
Cordova has a issue in the way they serve the source code files to the WebView in the platforms. So we have to remove/alter the following code
202+
to make sure everything works in cordova.
203+
204+
Remove the following line in src/index.ejs
205+
```
206+
12: <base href="<%= htmlWebpackPlugin.options.baseUrl %>">
207+
```
208+
209+
Remove the following line in src/app/app.ts
210+
```
211+
8: config.options.pushState = true;
212+
```
213+
214+
Add those lines to the src/styles/_base.scss
215+
```
216+
html {
217+
-ms-touch-action: manipulation;
218+
touch-action: manipulation;
219+
-webkit-user-select: none; /* Chrome all / Safari all */
220+
-moz-user-select: none; /* Firefox all */
221+
-ms-user-select: none; /* IE 10+ */
222+
user-select: none; /* Likely future */
223+
}
224+
```css
225+
226+
Install the following Libraries
227+
```
228+
npm i hammerjs fastclick iscroll --save
229+
```
230+
231+
Install the following Libraries
232+
```
233+
npm i hammerjs fastclick --save
234+
```
235+
236+
Provide those Libraries for the whole app and to do so add this into the config/config-globals.js file.
237+
````
238+
...
239+
new webpack.ProvidePlugin({
240+
'moment': 'moment',
241+
'_': 'lodash',
242+
'Hammer': 'hammerjs',
243+
'FastClick': 'fastclick'
244+
})
245+
...
246+
```
247+
248+
Add this at the bottom of the src/main.ts file to activate FastClick and to prevent default by touchmoves.
249+
```
250+
/**
251+
* Disabels the scroll events from the generel page
252+
*/
253+
document.addEventListener('touchmove', e => e.preventDefault(), false);
254+
255+
/**
256+
* Activates Fastclick
257+
*/
258+
$(() => {
259+
FastClick.attach(document.body);
260+
});
261+
```
262+
263+
264+
### Run and build
265+
Cordova takes the ```www``` folder source to create the Cordova app. This ```www``` folder is a symlink to the ```dist``` folder.
266+
So make sure you run for example ```npm run build``` first before runing/buildinga Cordova app.
267+
268+
###
269+
270+
271+
272+
### Configs
273+
274+
bounce
275+
276+
### Plugins
277+
278+

TODO.ms

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
[X] Add google design icons with npm
66
[X] Add config mgmt
77
[X] Add logging system
8-
[ ] Add cordova
9-
[ ] Add travis
10-
[ ] Add greenkeeper
8+
[X] Animation
9+
[X] Layout Wrapper
1110
[X] Remove Bootstrap
1211
[X] Add bootstrap manual to the readme
13-
[X] Add all important libs like moment, lodash ...
12+
[X] Add all important libs like moment, lodash ...
13+
[ ] Add custome attribute example
14+
[ ] Add service example
15+
[X] Add cordova
16+
[ ] Add cordova docu and helpers and stuff
17+
[X] Add travis
18+
[ ] Add greenkeeper

config/config-globals.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ const webpack = require('webpack');
88
/**
99
* Global lib config
1010
*/
11-
const configGlobal = function (level) {
12-
return {
11+
const configGlobal = function(level) {
12+
return {
1313
plugins: [
1414
new webpack.ProvidePlugin({
1515
'moment': 'moment',
16-
'_': 'lodash',
17-
'Hammer': 'hammerjs'
16+
'_': 'lodash'
1817
})
1918
]
20-
};
19+
};
2120
};
22-
module.exports = configGlobal;
21+
module.exports = configGlobal;

config/init-cordova.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const exec = require('child_process').exec;
2+
const ncp = require('ncp').ncp;
3+
const rimraf = require('rimraf');
4+
const fs = require('fs');
5+
const path = require('path');
6+
7+
const pkg = require(path.join(process.cwd(), 'package.json'));
8+
const cordovaTemp = path.join(process.cwd(), 'cordova');
9+
const cordovaTarget = path.join(process.cwd());
10+
const cmd = `cordova create ${cordovaTemp} ch.w3tec.aurelia "${pkg.title}"`;
11+
12+
// Run command to create cordova in a temporary directory
13+
exec(cmd, (error) => {
14+
if (error) throw error;
15+
16+
// Copy cordova code to project root
17+
ncp(`${cordovaTemp}`, cordovaTarget, (error, files) => {
18+
if (error) throw error;
19+
20+
// Remove temporary directory
21+
rimraf(cordovaTemp, (error) => {
22+
if (error) throw error;
23+
24+
// Remove cordovas www folder
25+
rimraf(`${cordovaTarget}/www`, (error) => {
26+
if (error) throw error;
27+
28+
// Create symlink www to point to dist
29+
fs.symlink(`${cordovaTarget}/dist`, `${cordovaTarget}/www`, 'dir', (error) => {
30+
if (error) throw error;
31+
});
32+
});
33+
});
34+
});
35+
});

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "aurelia-ts-boilerplate",
33
"title": "Aurelia TS Boilerplate",
4-
"version": "1.0.0",
4+
"version": "0.0.2",
55
"description": "A starter kit for building a standard navigation-style app with Aurelia, typescript and webpack.",
66
"main": "dist/app.js",
77
"scripts": {
@@ -35,7 +35,8 @@
3535
"server:dev:hmr": "npm run server:dev -- --hot",
3636
"server:prod": "http-server dist --cors",
3737
"webpack": "cross-env ./node_modules/.bin/webpack",
38-
"webpack-dev-server": "cross-env ./node_modules/.bin/webpack-dev-server"
38+
"webpack-dev-server": "cross-env ./node_modules/.bin/webpack-dev-server",
39+
"cordova:init": "node ./config/init-cordova.js"
3940
},
4041
"repository": {
4142
"type": "git",
@@ -51,10 +52,10 @@
5152
"author": "w3tec <info@w3tec.ch> (http://w3tec.ch/)",
5253
"contributors": [
5354
{
54-
"name": "Gery Hirschfeld"
55+
"name": "Gery Hirschfeld <gery.hirschfeld@w3tec.ch> (https://github.com/hirsch88)"
5556
},
5657
{
57-
"name": "David Weber"
58+
"name": "David Weber <david.weber@w3tec.ch> (https://github.com/dweber019)"
5859
}
5960
],
6061
"bugs": {
@@ -70,13 +71,13 @@
7071
},
7172
"dependencies": {
7273
"animate.css": "^3.5.1",
73-
"aurelia-animator-velocity": "^1.0.0",
74+
"aurelia-animator-css": "^1.0.0",
7475
"aurelia-bootstrapper-webpack": "^1.0.0",
7576
"aurelia-event-aggregator": "^1.0.0",
7677
"aurelia-fetch-client": "^1.0.0",
7778
"aurelia-framework": "^1.0.2",
7879
"aurelia-history-browser": "^1.0.0",
79-
"aurelia-i18n": "^1.1.1",
80+
"aurelia-i18n": "git+https://a6a36e9d3ce3276f41c6a077296f46d12c271954:x-oauth-basic@github.com/w3tecch/i18n.git",
8081
"aurelia-loader-webpack": "^1.0.2",
8182
"aurelia-logging-console": "^1.0.0",
8283
"aurelia-materialize-bridge": "^0.13.0",
@@ -89,13 +90,13 @@
8990
"aurelia-templating-router": "^1.0.0",
9091
"aurelia-validation": "^0.11.0",
9192
"bluebird": "^3.4.3",
92-
"hammerjs": "^2.0.8",
93+
"intl": "^1.2.4",
9394
"isomorphic-fetch": "^2.2.1",
9495
"jquery": "2.2.4",
9596
"lodash": "^4.15.0",
97+
"material-design-icons": "3.0.0",
9698
"materialize-css": "^0.97.7",
97-
"moment": "^2.14.1",
98-
"material-design-icons": "3.0.0"
99+
"moment": "^2.14.1"
99100
},
100101
"devDependencies": {
101102
"@easy-webpack/config-aurelia": "^2.2.0",
@@ -141,7 +142,7 @@
141142
"karma-remap-istanbul": "^0.2.1",
142143
"karma-sourcemap-loader": "^0.3.7",
143144
"karma-webpack": "^1.8.0",
144-
"minimist": "^1.2.0",
145+
"ncp": "^2.0.0",
145146
"node-sass": "^3.8.0",
146147
"phantomjs-polyfill": "0.0.2",
147148
"phantomjs-prebuilt": "^2.1.12",

src/app/app.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<template>
2-
<require from="./common/nav-bar.html"></require>
32

4-
<nav-bar router.bind="router"></nav-bar>
3+
<header>
4+
<nav-bar router.bind="router"></nav-bar>
5+
</header>
56

6-
<div class="container">
7-
<router-view></router-view>
8-
</div>
9-
</template>
7+
<main>
8+
<div class="container">
9+
<router-view swap-order="after"></router-view>
10+
</div>
11+
</main>
12+
13+
<footer-bar></footer-bar>
14+
15+
</template>

src/app/app.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,40 @@
1+
import { inject } from 'aurelia-framework';
12
import { Router, RouterConfiguration } from 'aurelia-router';
3+
import { I18N } from 'aurelia-i18n';
24

5+
@inject(I18N)
36
export class App {
47
private router: Router;
58

9+
constructor(
10+
private i18n: I18N
11+
) { }
12+
613
public configureRouter(config: RouterConfiguration, router: Router): void {
7-
config.title = 'Aurelia';
14+
config.title = this.i18n.tr('SITE_TITLE');
815
config.options.pushState = true;
916
config.map([
10-
{ route: ['', 'welcome'], name: 'welcome', moduleId: './modules/welcome/welcome', nav: true, title: 'Welcome' },
11-
{ route: 'users', name: 'users', moduleId: './modules/users/users', nav: true, title: 'Github Users' },
12-
{ route: 'child-router', name: 'child-router', moduleId: './modules/child-router/child-router', nav: true, title: 'Child Router' }
17+
{
18+
route: ['', 'welcome'],
19+
name: 'welcome',
20+
moduleId: './modules/welcome/welcome',
21+
nav: true,
22+
title: this.i18n.tr('WELCOME.TITLE')
23+
},
24+
{
25+
route: 'users',
26+
name: 'users',
27+
moduleId: './modules/users/users',
28+
nav: true,
29+
title: this.i18n.tr('GIT_USERS.TITLE')
30+
},
31+
{
32+
route: 'child-router',
33+
name: 'child-router',
34+
moduleId: './modules/child-router/child-router',
35+
nav: true,
36+
title: this.i18n.tr('CHILD_ROUTER.TITLE')
37+
}
1338
]);
1439

1540
this.router = router;

src/app/common/nav-bar.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)