Skip to content
This repository was archived by the owner on Feb 17, 2024. It is now read-only.

Commit c68a25a

Browse files
committed
📦 update files/folders
1 parent 2dab6aa commit c68a25a

File tree

10 files changed

+56
-35
lines changed

10 files changed

+56
-35
lines changed

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
"build:prod:json": "webpack --config webpack.prod.config.ts --json | webpack-bundle-size-analyzer",
2020
"ngc": "ngc -p tsconfig.aot.json",
2121
"prestart": "npm run build",
22-
"server": "nodemon dist/server/index.js",
22+
"server": "node dist/server/index.js",
23+
"server:dev": "nodemon dist/server/index.js",
2324
"debug:server": "node-nightly --inspect --debug-brk dist/server/index.js",
24-
"start": "npm run server",
25+
"start": "npm run server:dev",
2526
"debug:start": "npm run build && npm run debug:server",
2627
"predebug": "npm run build",
2728
"debug:build": "node --inspect --debug-brk node_modules/webpack/bin/webpack.js",
@@ -52,15 +53,16 @@
5253
"angular2-platform-node": "~2.1.0-rc.1",
5354
"angular2-universal": "~2.1.0-rc.1",
5455
"angular2-universal-polyfills": "~2.1.0-rc.1",
55-
"core-js": "2.4.1",
5656
"body-parser": "^1.15.2",
5757
"compression": "^1.6.2",
58+
"core-js": "2.4.1",
5859
"express": "^4.14.0",
5960
"js.clone": "0.0.3",
6061
"methods": "~1.1.2",
6162
"morgan": "^1.7.0",
6263
"preboot": "~4.5.2",
6364
"rxjs": "5.0.0-beta.12",
65+
"serialize-javascript": "^1.3.0",
6466
"webfontloader": "^1.6.26",
6567
"zone.js": "~0.6.26"
6668
},
@@ -76,7 +78,6 @@
7678
"@types/node": "^6.0.38",
7779
"@types/serve-static": "^1.7.27",
7880
"@types/webfontloader": "^1.6.27",
79-
"@ngtools/webpack": "~1.1.7",
8081
"angular2-template-loader": "^0.4.0",
8182
"awesome-typescript-loader": "^2.2.4",
8283
"cookie-parser": "^1.4.3",

src/+app/+home/home.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
22

3-
import { ModelService } from '../shared/model/model.service';
3+
import { HomeModel } from './model/home.model';
44

55
@Component({
66
changeDetection: ChangeDetectionStrategy.Default,
@@ -11,7 +11,7 @@ import { ModelService } from '../shared/model/model.service';
1111
})
1212
export class HomeComponent {
1313
data: any = {};
14-
constructor(public model: ModelService) {
14+
constructor(public model: HomeModel) {
1515

1616
// we need the data synchronously for the client to set the server response
1717
// we create another method so we have more control for testing

src/browser.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { CacheService } from './+app/shared/cache.service';
1111

1212
// Will be merged into @angular/platform-browser in a later release
1313
// see https://github.com/angular/angular/pull/12322
14-
import { Meta } from './angular2-meta';
14+
import { Meta } from '_ng/meta';
1515

1616
export function getLRU() {
1717
// use LRU for node

src/client.aot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// the polyfills must be the first thing imported
2-
import '_polyfills';
2+
import '_polyfills/browser';
33
import 'ts-helpers';
4-
import '_workaround'; // temporary until 2.1.1 things are patched in Core
4+
import '_workaround/browser'; // temporary until 2.1.1 things are patched in Core
55

66
// Angular 2
77
import { enableProdMode } from '@angular/core';

src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// the polyfills must be the first thing imported
2-
import '_polyfills';
2+
import '_polyfills/browser';
33
import 'ts-helpers';
4-
import '_workaround'; // temporary until 2.1.1 things are patched in Core
4+
import '_workaround/browser'; // temporary until 2.1.1 things are patched in Core
55

66
// Angular 2
77
import { enableProdMode } from '@angular/core';

src/node.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import * as serialize from 'serialize-javascript';
1313

1414
// Will be merged into @angular/platform-browser in a later release
1515
// see https://github.com/angular/angular/pull/12322
16-
import { Meta } from '_ng2/meta';
16+
import { Meta } from '_ng/meta';
1717

1818
export function getLRU() {
1919
// return lru || new LRU(10);
Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/server.aot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// The only modules to be imported higher - node modules with es6-promise 3.x or other Promise polyfill dependency
33
// (rule of thumb: do it if you have zone.js exception that it has been overwritten)
44
// if you are including modules that modify Promise, such as NewRelic,, you must include them before polyfills
5-
import '_polyfills';
5+
import '_polyfills/node';
66
import 'ts-helpers';
7-
import '_workaround'; // temporary until 2.1.1 things are patched in Core
7+
import '_workaround/node'; // temporary until 2.1.1 things are patched in Core
88

99
import * as fs from 'fs';
1010
import * as path from 'path';

src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// The only modules to be imported higher - node modules with es6-promise 3.x or other Promise polyfill dependency
33
// (rule of thumb: do it if you have zone.js exception that it has been overwritten)
44
// if you are including modules that modify Promise, such as NewRelic,, you must include them before polyfills
5-
import '_polyfills';
5+
import '_polyfills/node';
66
import 'ts-helpers';
7-
import '_workaround'; // temporary until 2.1.1 things are patched in Core
7+
import '_workaround/node'; // temporary until 2.1.1 things are patched in Core
88

99
import * as path from 'path';
1010
import * as express from 'express';

webpack.config.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var webpack = require('webpack');
2+
var fs = require('fs');
23
var path = require('path');
34
var clone = require('js.clone');
45
var webpackMerge = require('webpack-merge');
@@ -23,8 +24,7 @@ export var commonConfig = {
2324
// https://webpack.github.io/docs/configuration.html#devtool
2425
devtool: 'source-map',
2526
resolve: {
26-
extensions: ['.ts', '.js', '.json'],
27-
modules: [ root('node_modules') ]
27+
extensions: ['.ts', '.js', '.json']
2828
},
2929
context: __dirname,
3030
output: {
@@ -94,7 +94,24 @@ export var serverConfig = {
9494
],
9595
},
9696
externals: includeClientPackages(
97-
/@angularclass|@angular|angular2-|ng2-|ng-|@ng-|angular-|@ngrx|ngrx-|@angular2|ionic|@ionic|-angular2|-ng2|-ng/
97+
new RegExp([
98+
'@angularclass',
99+
'@angular',
100+
'angular2-',
101+
'ng2-',
102+
'ng-',
103+
'@ng-',
104+
'angular-',
105+
'@ngrx',
106+
'ngrx-',
107+
'@angular2',
108+
'ionic',
109+
'@ionic',
110+
'-angular2',
111+
'-ng2',
112+
'-ng',
113+
].join('|')),
114+
new RegExp( ('^' + getDirectories(root('src/node_modules')).join('|')) )
98115
),
99116
node: {
100117
global: true,
@@ -115,10 +132,13 @@ export default [
115132
];
116133

117134

118-
135+
export function getDirectories(srcpath) {
136+
return fs.readdirSync(srcpath)
137+
.filter(file => fs.statSync(path.join(srcpath, file)).isDirectory());
138+
}
119139

120140
// Helpers
121-
export function includeClientPackages(packages, localModule?: string[]) {
141+
export function includeClientPackages(packages: string[] | RegExp, localModule?: string[] | RegExp) {
122142
return function(context, request, cb) {
123143
if (localModule instanceof RegExp && localModule.test(request)) {
124144
return cb();

0 commit comments

Comments
 (0)