Skip to content

Commit 82ec54c

Browse files
committed
chore(generator): update to ngx-library 5.4.0
1 parent e5acacc commit 82ec54c

23 files changed

+922
-1420
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ script: gulp test:ci
2222

2323
after_success: gulp coveralls
2424

25+
cache:
26+
yarn: true
27+

.yo-rc.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"generator-ngx-library": {
3-
"version": "4.3.0",
3+
"version": "5.4.0",
44
"authorName": "Tine Kondo",
55
"authorEmail": "kondotine@gmail.com",
66
"githubUsername": "tinesoft",
77
"projectName": "ngx-wow",
8-
"projectVersion": "0.0.1",
8+
"projectVersion": "1.0.0",
99
"projectDescription": "Angular module for WOW.js.",
1010
"projectKeywords": [
1111
"ng",
@@ -16,30 +16,30 @@
1616
"reveal",
1717
"animation"
1818
],
19-
"ngPrefix": "ngw",
2019
"ngVersion": "2.0.0",
2120
"ngModules": [
2221
"core",
2322
"common"
2423
],
25-
"useGreenkeeper": true,
24+
"otherDependencies": ["wowjs"],
25+
"dependenciesRange": ">=",
26+
"ngPrefix": "ngw",
27+
"useGreenkeeper": false,
2628
"useCompodoc": true,
2729
"enforceNgGitCommitMsg": true,
30+
"skipDemo": false,
31+
"skipSample": true,
32+
"skipStyles": true,
2833
"exclusions": [
29-
"src/module/component/lib.component.html",
30-
"src/module/component/lib.component.spec.ts",
31-
"src/module/component/lib.component.ts",
32-
"src/module/component/lib.component.scss",
33-
"src/module/service/lib.service.ts",
34-
"src/module/service/lib.service.spec.ts",
35-
"src/module/lib.module.ts",
36-
"src/tsconfig.lib.es5.json",
37-
"src/index.ts",
38-
"demo/src/app/home/home.component.html",
39-
"demo/src/app/home/home.component.scss",
40-
"demo/src/app/home/home.module.ts",
34+
"README.md",
35+
"CHANGELOG.md",
36+
"config/karma.conf",
37+
"demo/src/app/**",
38+
"demo/src/styles.scss",
39+
"demo/src/assets/logo.svg",
40+
"demo/src/index.html",
4141
"demo/src/favicon.ico",
42-
"demo/src/styles.scss"
42+
"src/**/*.*"
4343
]
4444
}
4545
}

config/webpack.test.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const helpers = require('./helpers');
22
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
33
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
4-
const {CheckerPlugin} = require('awesome-typescript-loader');
4+
const { CheckerPlugin } = require('awesome-typescript-loader');
55

66
const getConfig = (hasCoverage, isTddMode) => {
77

@@ -50,7 +50,7 @@ const getConfig = (hasCoverage, isTddMode) => {
5050
{
5151
loader: 'awesome-typescript-loader',
5252
options: {
53-
configFileName: helpers.root('src','tsconfig.spec.json'),
53+
configFileName: helpers.root('src', 'tsconfig.spec.json'),
5454
// use inline sourcemaps for "karma-remap-coverage" reporter (if coverage is activated)
5555
sourceMap: !hasCoverage,
5656
inlineSourceMap: hasCoverage,
@@ -66,15 +66,6 @@ const getConfig = (hasCoverage, isTddMode) => {
6666
],
6767
exclude: [/\.e2e\.ts$/]
6868
},
69-
{
70-
test: /\.css$/,
71-
loader: ['to-string-loader', 'css-loader']
72-
},
73-
{
74-
test: /\.(scss|sass)$/,
75-
use: ['to-string-loader', 'css-loader', 'sass-loader'],
76-
exclude: [helpers.root('src', 'scss')]
77-
},
7869
{
7970
test: /\.html$/,
8071
loader: 'raw-loader'
@@ -92,11 +83,11 @@ const getConfig = (hasCoverage, isTddMode) => {
9283
}),
9384
// Fixes linker warnings (see https://github.com/angular/angular/issues/11580)
9485
new ContextReplacementPlugin(
95-
// The (\\|\/) piece accounts for path separators in *nix and Windows
96-
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
97-
helpers.root('src'), // location of your src
98-
{} // a map of your routes
99-
),
86+
// fixes WARNING Critical dependency: the request of a dependency is an expression
87+
/(.+)?angular(\\|\/)core(.+)?/,
88+
helpers.root('src'), // location of your src
89+
{} // a map of your routes
90+
),
10091
].concat(extraPlugins),
10192

10293
performance: {

demo/.angular-cli.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
},
66
"apps": [
77
{
8+
"name": "bsr",
89
"root": "src",
9-
"outDir": "dist",
10+
"outDir": "dist/browser",
1011
"assets": [
1112
"assets",
1213
"favicon.ico"
@@ -27,13 +28,14 @@
2728
"environmentSource": "environments/environment.ts",
2829
"environments": {
2930
"dev": "environments/environment.ts",
31+
"hmr": "environments/environment.hmr.ts",
3032
"prod": "environments/environment.prod.ts"
3133
}
3234
},
3335
{
3436
"name": "ssr",
3537
"root": "src",
36-
"outDir": "dist-server",
38+
"outDir": "dist/server",
3739
"assets": [
3840
"assets",
3941
"favicon.ico"
@@ -49,7 +51,7 @@
4951
"styles.scss"
5052
],
5153
"scripts": [
52-
"../node_modules/wowjs/dist/wow.min.js"
54+
"../node_modules/wowjs/dist/wow.js"
5355
],
5456
"environmentSource": "environments/environment.ts",
5557
"environments": {

demo/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# compiled output
44
/dist
5-
/dist-server
65
/tmp
76
/out-tsc
87

demo/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ngx-wow-demo
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.4.1.
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.0.
44

55
## Development server
66

@@ -21,7 +21,6 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
2121
## Running end-to-end tests
2222

2323
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24-
Before running the tests make sure you are serving the app via `ng serve`.
2524

2625
## Further help
2726

demo/package.json

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,34 @@
1414
},
1515
"private": true,
1616
"dependencies": {
17-
"@angular/animations": "^4.2.4",
18-
"@angular/common": "^4.2.4",
19-
"@angular/compiler": "^4.2.4",
20-
"@angular/core": "^4.2.4",
21-
"@angular/forms": "^4.2.4",
22-
"@angular/http": "^4.2.4",
23-
"@angular/platform-browser": "^4.2.4",
24-
"@angular/platform-browser-dynamic": "^4.2.4",
25-
"@angular/router": "^4.2.4",
17+
"@angular/animations": "^5.0.0",
18+
"@angular/common": "^5.0.0",
19+
"@angular/compiler": "^5.0.0",
20+
"@angular/core": "^5.0.0",
21+
"@angular/forms": "^5.0.0",
22+
"@angular/http": "^5.0.0",
23+
"@angular/platform-browser": "^5.0.0",
24+
"@angular/platform-browser-dynamic": "^5.0.0",
25+
"@angular/router": "^5.0.0",
2626
"@ng-bootstrap/ng-bootstrap": "1.0.0-beta.3",
2727
"bootstrap": "4.0.0-beta",
2828
"core-js": "^2.4.1",
2929
"font-awesome": "^4.7.0",
3030
"include-media": "^1.4.9",
31-
"rxjs": "^5.4.2",
31+
"rxjs": "^5.5.2",
3232
"wowjs": "^1.1.3",
33-
"zone.js": "^0.8.14"
33+
"zone.js": "^0.8.14",
34+
"@angular/platform-server": "^5.0.0"
3435
},
3536
"devDependencies": {
36-
"@angular/cli": "1.4.7",
37-
"@angular/compiler-cli": "^4.2.4",
38-
"@angular/language-service": "^4.2.4",
39-
"@angular/platform-server": "^4.2.4",
37+
"@angular/cli": "1.6.0",
38+
"@angular/compiler-cli": "^5.0.0",
39+
"@angular/language-service": "^5.0.0",
40+
"@angularclass/hmr": "~2.1.3",
4041
"@types/jasmine": "~2.5.53",
4142
"@types/jasminewd2": "~2.0.2",
4243
"@types/node": "~6.0.60",
43-
"codelyzer": "~3.2.0",
44+
"codelyzer": "^4.0.1",
4445
"jasmine-core": "~2.6.2",
4546
"jasmine-spec-reporter": "~4.1.0",
4647
"karma": "~1.7.0",
@@ -52,11 +53,12 @@
5253
"protractor": "~5.1.2",
5354
"ts-node": "~3.2.0",
5455
"tslint": "~5.7.0",
55-
"typescript": "~2.3.3",
56+
"typescript": "~2.4.2",
5657
"ts-loader": "~2.3.7",
5758
"reflect-metadata": "~0.1.10",
5859
"webpack-node-externals": "~1.6.0",
59-
"@nguniversal/express-engine": "~1.0.0-beta.3",
60-
"@nguniversal/module-map-ngfactory-loader": "~1.0.0-beta.3"
60+
"express": "^4.16.2",
61+
"@nguniversal/express-engine": "^5.0.0-beta.5",
62+
"@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5"
6163
}
6264
}

demo/prerender.ts

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
11
// Load zone.js for the server.
22
import 'zone.js/dist/zone-node';
33
import 'reflect-metadata';
4-
import { readFileSync, writeFileSync } from 'fs';
4+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
55
import { join } from 'path';
66

7+
import { enableProdMode } from '@angular/core';
8+
// Faster server renders w/ Prod mode (dev mode never needed)
9+
enableProdMode();
10+
711
// Express Engine
812
import { ngExpressEngine } from '@nguniversal/express-engine';
913
// Import module map for lazy loading
1014
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
11-
1215
import { renderModuleFactory } from '@angular/platform-server';
16+
import { ROUTES } from './static.paths';
1317

1418
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
15-
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist-server/main.bundle');
16-
17-
const DIST_FOLDER = join(process.cwd(), 'dist');
18-
19-
// Load the index.html file containing references to your application bundle.
20-
const index = readFileSync(join(DIST_FOLDER, 'index.html'), 'utf8');
21-
22-
23-
// Writes rendered HTML to ./dist/index.html, replacing the file if it already exists.
24-
renderModuleFactory(AppServerModuleNgFactory, {
25-
document: index,
26-
url: '/',
27-
extraProviders: [
28-
provideModuleMap(LAZY_MODULE_MAP)
29-
]
30-
})
31-
.then(html => {
32-
console.log(`Replacing 'index.html' file at '${DIST_FOLDER}/index.html'`);
33-
writeFileSync(join(DIST_FOLDER, 'index.html'), html);
34-
console.log(`File 'index.html' successfully replaced with server-side version!`);
35-
});
19+
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle');
20+
21+
const BROWSER_FOLDER = join(process.cwd(), 'dist', 'browser');
22+
23+
// Load the index.html file containing referances to your application bundle.
24+
const index = readFileSync(join(BROWSER_FOLDER, 'index.html'), 'utf8');
25+
26+
let previousRender = Promise.resolve();
27+
28+
// Iterate each route path
29+
ROUTES.forEach(route => {
30+
var fullPath = join(BROWSER_FOLDER, route);
31+
32+
// Make sure the directory structure is there
33+
if(!existsSync(fullPath)){
34+
mkdirSync(fullPath);
35+
}
36+
37+
// Writes rendered HTML to index.html, replacing the file if it already exists.
38+
previousRender = previousRender.then(_ => renderModuleFactory(AppServerModuleNgFactory, {
39+
document: index,
40+
url: route,
41+
extraProviders: [
42+
provideModuleMap(LAZY_MODULE_MAP)
43+
]
44+
})).then(html => writeFileSync(join(fullPath, 'index.html'), html));
45+
});

demo/server.ts

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
// These are important and needed before anything else
12
import 'zone.js/dist/zone-node';
23
import 'reflect-metadata';
4+
35
import { renderModuleFactory } from '@angular/platform-server';
46
import { enableProdMode } from '@angular/core';
57

@@ -17,42 +19,39 @@ const PORT = process.env.PORT || 4000;
1719
const DIST_FOLDER = join(process.cwd(), 'dist');
1820

1921
// Our index.html we'll use as our template
20-
const template = readFileSync(join(DIST_FOLDER, 'index.html')).toString();
22+
const template = readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString();
2123

2224
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
23-
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist-server/main.bundle');
24-
25-
// Express Engine
26-
import { ngExpressEngine } from '@nguniversal/express-engine';
27-
// Import module map for lazy loading
28-
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
29-
30-
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
31-
app.engine('html', ngExpressEngine({
32-
bootstrap: AppServerModuleNgFactory,
33-
providers: [
34-
provideModuleMap(LAZY_MODULE_MAP)
35-
]
36-
}));
25+
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle');
26+
27+
const { provideModuleMap } = require('@nguniversal/module-map-ngfactory-loader');
28+
29+
app.engine('html', (_, options, callback) => {
30+
renderModuleFactory(AppServerModuleNgFactory, {
31+
// Our index.html
32+
document: template,
33+
url: options.req.url,
34+
// DI so that we can get lazy-loading to work differently (since we need it to just instantly render it)
35+
extraProviders: [
36+
provideModuleMap(LAZY_MODULE_MAP)
37+
]
38+
}).then(html => {
39+
callback(null, html);
40+
});
41+
});
3742

3843
app.set('view engine', 'html');
39-
app.set('views', DIST_FOLDER);
40-
41-
/* - Example Express Rest API endpoints -
42-
app.get('/api/**', (req, res) => { });
43-
*/
44+
app.set('views', join(DIST_FOLDER, 'browser'));
4445

45-
// Server static files from 'dist/'
46-
app.get('*.*', express.static(DIST_FOLDER, {
47-
maxAge: '1y'
48-
}));
46+
// Server static files from /browser
47+
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
4948

50-
// ALl regular routes use the Universal engine
49+
// All regular routes use the Universal engine
5150
app.get('*', (req, res) => {
52-
res.render('index', { req });
51+
res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req });
5352
});
5453

5554
// Start up the Node server
5655
app.listen(PORT, () => {
57-
console.log(`Node Express server listening on http://localhost:${PORT}`);
56+
console.log(`Node server listening on http://localhost:${PORT}`);
5857
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const environment = {
2+
production: false,
3+
hmr: true
4+
};

0 commit comments

Comments
 (0)