Skip to content

Commit a31aae7

Browse files
author
roman
committed
Merge branch 'master' into feature/translate
2 parents befd061 + c4dcdd4 commit a31aae7

12 files changed

+153
-95
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ TASKS
3939
| Task | Description |
4040
|:----------------------------|:-----------------------------------------------------------------------|
4141
| `npm run start` | Prepare and start local dev server |
42-
| `npm run build:vendors` | Prepare 3rd party libraries for application |
42+
| `npm run build:vendors` | Prepare npm dependencies for linking |
4343
| `npm run server` | Local dev server |
4444
| `npm run server:dashboard` | Local dev server in dashboard mode |
4545
| `npm run clean` | Clean generated folders |
4646
| `npm run eslint` | Lint code (single run mode) |
4747
| `npm run gulp eslint:watch` | ESLint in watch mode |
4848
| `npm run t` | Run unit testing in single run mode |
49+
| `npm run test:ci` | Sequence of eslint, tschk and coverage tasks |
4950
| `npm run tests:w` | Run unit testing in watch mode |
5051
| `npm run up` | Update all dependencies one by one running tests after each |
5152
| `npm run tschk` | Run typescript compile but do not emit files (useful for typechecking) |
5253
| `npm run tschk:w` | tschk in watch mode |
5354
| `npm run build` | Build application, but not dependencies |
54-
| `npm run build:vendors` | Prepare dependencies for linking |
55-
| `npm run build:all` | Sequence of build:vendors > build |
55+
| `npm run build:all` | Sequence of build:vendors and build tasks |
56+
| `npm run build:release` | Clean rebuild all |
5657
| `npm run coverage` | Run test coverage with verbose reporing |
5758
| `npm run coverage:debug` | Run coverage task in debug mode |
5859
| `npm run p "t1" "t2"` | Run tasks in parallel |
5960
| `npm run stryker` | Run mutation tests |
6061

61-
6262
DEVELOPMENT TIPS
6363
---
6464
* Do not disable cache in devtools (network tab): this improves speed significantly, use Ctrl + F5 to clean cache.
@@ -101,6 +101,8 @@ RESOURCES
101101
* [Observable-based virtual scroll implementation in Angular](https://github.com/dinony/od-virtualscroll)
102102
* [Angular Update Guide](https://angular-update-guide.firebaseapp.com/)
103103
* [Intrinsic first flexbox grid](https://github.com/argyleink/ragrid)
104+
* [Fast JiT compiler for Angular testing](https://github.com/Quramy/ngx-zombie-compiler)
105+
* [A loading spinner for Angular 4](https://github.com/Zak-C/ngx-loading)
104106

105107
KNOWN ISSUES
106108
---

gulpfile.ts

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as Path from 'path';
77
import { Application } from '@types/express';;
88
import assert = require('assert');
99
const gulp = require('gulp');
10+
const glob = require('glob');
1011
const g = require('gulp-load-plugins')();
1112
const buildPath = Path.join(__dirname, 'build');
1213

@@ -56,26 +57,35 @@ gulp.task('server:prestart', done => {
5657
return done();
5758
}
5859
g.util.log(g.util.colors.yellow('Version changed or found changes in dependencies, rebuilding vendor libs'));
59-
_.forEach(d, (version, pkname) => {
60-
g.util.log(`${pkname} ${g.util.colors.cyan(version)}`);
61-
});
62-
} else {
63-
g.util.log(g.util.colors.yellow('Initial build of vendor libs'));
60+
_.forEach(d, (version, pkname) => g.util.log(`${pkname} ${g.util.colors.cyan(version)}`));
6461
}
65-
const proc = spawn('npm', ['run', 'build:vendor-libs'], { stdio: 'inherit' });
66-
proc.once('exit', () => {
67-
fs.writeFileSync(libsInfoFile, JSON.stringify(currentLibsInfo));
68-
done();
62+
let p = new Promise((resolve, reject) => {
63+
g.util.log(g.util.colors.yellow('Initial build of vendor libs'));
64+
const proc = spawn('npm', ['run', 'build:vendor-libs'], { stdio: 'inherit' });
65+
proc.on('error', reject);
66+
proc.once('exit', () => {
67+
fs.writeFileSync(libsInfoFile, JSON.stringify(currentLibsInfo));
68+
resolve();
69+
});
6970
});
71+
let [style] = glob.sync(`${buildPath}/style*.css`);
72+
if (!style) {
73+
p = p.then(() => new Promise((resolve, reject) => {
74+
g.util.log(g.util.colors.yellow('Initial build of vendor style'));
75+
const proc = spawn('npm', ['run', 'build:vendor-style'], { stdio: 'inherit' });
76+
proc.on('error', reject);
77+
proc.once('exit', resolve);
78+
}));
79+
}
80+
return p;
7081
});
7182

7283
gulp.task('check:build:prod', () => {
73-
const globby = require('globby');
74-
return globby(`${buildPath}/app*.js`).then(paths => {
75-
if (paths.length === 0) {
76-
return Promise.reject('build:prod task did not produce app javascript file.');
77-
}
78-
});
84+
let paths = glob.sync(`${buildPath}/app*.js`);
85+
if (paths.length === 0) {
86+
return Promise.reject('build:prod task did not produce app javascript file.');
87+
}
88+
return Promise.resolve();
7989
});
8090

8191
gulp.task('test:int', () => {
@@ -104,7 +114,7 @@ gulp.task('test:int', () => {
104114
gulp.task('stryker:source', () => {
105115
gulp.src('src/**/!(*.ts)', { base: 'src' })
106116
.pipe(gulp.dest(`${buildPath}/source`));
107-
let {compilerOptions} = require('./tsconfig.json');
117+
let { compilerOptions } = require('./tsconfig.json');
108118
Object.assign(compilerOptions, {
109119
target: 'es6',
110120
sourceMap: false,

package.json

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"compile:w": "tsc --watch",
1616
"tschk": "echo tsc --noEmit ... && tsc --noEmit --noUnusedLocals",
1717
"tschk:w": "npm run tschk -- --watch",
18-
"test": "npm run build:all && npm run eslint && npm run tschk && npm run coverage && npm run stryker",
18+
"test": "npm run build:all && npm run test:ci && npm run stryker",
19+
"test:ci": "npm run eslint && npm run tschk && npm run coverage",
1920
"t": "npm run karma -- --single-run",
2021
"tests": "npm run t",
2122
"tests:w": "npm run karma",
@@ -31,9 +32,8 @@
3132
"build:vendors": "npm run build:vendor-libs && npm run build:vendor-style",
3233
"build:all": "npm run build:vendors && npm run build",
3334
"build:all:prod": "npm run build:vendor-style:prod && npm run build:prod",
34-
"build:dist": "npm run clean && npm run build:all:prod",
35-
"~build:release": "npm run build:dist",
36-
"test:build:prod": "npm run clean && npm run build:prod && npm run gulp check:build:prod",
35+
"build:release": "npm run clean && npm run build:all:prod",
36+
"test:build:prod": "npm run build:release && npm run gulp check:build:prod",
3737
"test:int": "npm run gulp -- test:int",
3838
"postinstall": "npm run build:vendors",
3939
"yi": "yarn install --no-lockfile",
@@ -54,38 +54,39 @@
5454
"npm": ">=3"
5555
},
5656
"dependencies": {
57-
"@angular/common": "4.1.1",
58-
"@angular/compiler": "4.1.1",
59-
"@angular/core": "4.1.1",
60-
"@angular/forms": "4.1.1",
61-
"@angular/http": "4.1.1",
62-
"@angular/platform-browser": "4.1.1",
63-
"@angular/platform-browser-dynamic": "4.1.1",
64-
"@angular/router": "4.1.1",
57+
"@angular/common": "4.1.2",
58+
"@angular/compiler": "4.1.2",
59+
"@angular/core": "4.1.2",
60+
"@angular/forms": "4.1.2",
61+
"@angular/http": "4.1.2",
62+
"@angular/platform-browser": "4.1.2",
63+
"@angular/platform-browser-dynamic": "4.1.2",
64+
"@angular/router": "4.1.2",
6565
"@ngx-config/core": "0.2.0-rc.5",
6666
"@ngx-translate/core": "6.0.1",
6767
"@ngx-translate/http-loader": "0.0.3",
6868
"core-js": "2.4.1",
69-
"rxjs": "5.3.1",
70-
"tslib": "1.7.0",
69+
"rxjs": "5.4.0",
70+
"tslib": "1.7.1",
7171
"zone.js": "0.8.10"
7272
},
7373
"devDependencies": {
74-
"@angular/compiler-cli": "4.1.1",
74+
"@angular/compiler-cli": "4.1.2",
7575
"@angularclass/hmr": "1.2.2",
7676
"@angularclass/hmr-loader": "3.0.2",
77-
"@blueprintjs/core": "1.16.0",
77+
"@blueprintjs/core": "1.17.1",
7878
"@types/express": "4.0.35",
7979
"@types/jasmine": "2.5.47",
8080
"@types/karma": "0.13.35",
8181
"@types/lodash": "4.14.64",
8282
"@types/node": "7.0.18",
8383
"@types/webpack": "2.2.15",
8484
"@types/webpack-env": "1.13.0",
85-
"@ultimate/aot-loader": "0.1.15",
85+
"@ultimate/aot-loader": "0.1.16",
8686
"angular-router-loader": "0.6.0",
8787
"angular2-template-loader": "0.6.2",
88-
"autoprefixer": "7.0.0",
88+
"asset-inject-html-webpack-plugin": "0.6.2",
89+
"autoprefixer": "7.1.0",
8990
"awesome-typescript-loader": "3.1.3",
9091
"babel-eslint": "7.2.3",
9192
"concurrently": "3.4.0",
@@ -96,7 +97,7 @@
9697
"css-to-string-loader": "0.1.2",
9798
"ejs-loader": "0.3.0",
9899
"eslint": "3.19.0",
99-
"eslint-plugin-flowtype": "2.32.1",
100+
"eslint-plugin-flowtype": "2.33.0",
100101
"eslint-plugin-import": "2.2.0",
101102
"eslint-plugin-jasmine": "2.2.0",
102103
"eslint-plugin-lodash": "2.4.2",
@@ -133,16 +134,16 @@
133134
"karma-sourcemap-loader": "0.3.7",
134135
"karma-webpack": "2.0.3",
135136
"lodash": "4.17.4",
136-
"node-sass": "4.5.2",
137+
"node-sass": "4.5.3",
137138
"object-diff": "0.0.4",
138-
"postcss": "6.0.0",
139-
"postcss-import": "9.1.0",
140-
"postcss-loader": "1.3.3",
141-
"postcss-url": "6.0.4",
139+
"postcss": "6.0.1",
140+
"postcss-import": "10.0.0",
141+
"postcss-loader": "2.0.5",
142+
"postcss-url": "6.1.0",
142143
"raw-loader": "0.5.1",
143144
"read-pkg-up": "2.0.0",
144145
"rimraf": "2.6.1",
145-
"sass-loader": "6.0.3",
146+
"sass-loader": "6.0.5",
146147
"stryker": "0.6.1",
147148
"stryker-api": "0.5.0",
148149
"stryker-html-reporter": "0.4.1",
@@ -154,7 +155,7 @@
154155
"typescript-eslint-parser": "2.1.0",
155156
"updtr": "1.0.0",
156157
"url-loader": "0.5.8",
157-
"webpack": "2.5.0",
158+
"webpack": "2.5.1",
158159
"webpack-dashboard": "0.4.0",
159160
"webpack-dev-server": "2.4.5",
160161
"webpack-hot-middleware": "2.18.0"

src/app.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
.grid {
2-
display: grid;
1+
$font-family: 'Segoe UI';
2+
3+
.example {
4+
display: flex;
5+
transition: all .5s;
6+
user-select: none;
7+
background: linear-gradient(to bottom, white, black);
38
}
49

510
body {
6-
font-family: 'Segoe UI';
11+
font-family: $font-family;
712
}

src/app/home/home.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ <h2>Home</h2>
88
<input class="pt-input" [(ngModel)]="name">
99

1010
<p id="name-result">Hello {{name}}</p>
11+
12+
<img [src]="seedImage" alt="Seed image" />

src/app/home/home.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ import { Component } from '@angular/core';
77
})
88
export class HomeComponent {
99
name = 'Angular';
10+
public seedImage = require('../../shared/images/seed.png');
1011
}

src/index.ejs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
<meta charset="UTF-8">
66
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
77
<meta name="viewport" content="width=device-width, initial-scale=1">
8-
<link rel="stylesheet" type="text/css" href="style.css">
8+
<!-- css_inject_point_asset_style -->
99
<title>Angular App</title>
1010
</head>
1111
<body>
1212
<app>Loading...</app>
13-
<% if (htmlWebpackPlugin.options.config.dev) { %>
14-
<script src="libs.js"></script>
15-
<% } %>
13+
<!-- js_inject_point_asset_libs if_dev -->
1614
</body>
1715
</html>

src/shared/images/seed.png

4.59 KB
Loading

src/shared/shared.module.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { NgModule } from '@angular/core';
2+
3+
@NgModule({
4+
imports: [
5+
],
6+
declarations: [
7+
],
8+
})
9+
export class SharedModule { }

src/style.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Example of custom build from scss source.
2+
$output-bourbon-deprecation-warnings: false;
3+
@import "~@blueprintjs/core/src/common/resets";
4+
// Fix error by resolve-url-loader or sass-resources-loader
5+
// https://github.com/webpack-contrib/sass-loader#problems-with-url
6+
// @import "~@blueprintjs/core/src/common/font-imports";
7+
@import "~@blueprintjs/core/src/common/variables";
8+
@import "~@blueprintjs/core/src/common/colors";
9+
@import "~@blueprintjs/core/src/typography";
10+
@import "~@blueprintjs/core/src/icons";
11+
@import "~@blueprintjs/core/src/accessibility";
12+
13+
// @import "~@blueprintjs/core/src/components/button/button";
14+
// @import "~@blueprintjs/core/src/components/button/button-group";
15+
// @import "~@blueprintjs/core/src/components/forms/index";

stryker.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const webpack = require('webpack');
2-
const Path = require('path');
1+
// const webpack = require('webpack');
2+
// const Path = require('path');
33

44
module.exports = function(config) {
55
config.set({

0 commit comments

Comments
 (0)