Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit d1198ae

Browse files
Merge branch 'rel/2.0.0-templates' into dev
2 parents a9ddf14 + 9528dd7 commit d1198ae

32 files changed

+102
-94
lines changed

templates/AngularSpa/ClientApp/boot.browser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { enableProdMode } from '@angular/core';
55
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
66
import { AppModule } from './app/app.module.browser';
77

8-
if (module['hot']) {
9-
module['hot'].accept();
10-
module['hot'].dispose(() => {
8+
if (module.hot) {
9+
module.hot.accept();
10+
module.hot.dispose(() => {
1111
// Before restarting the app, we create a new root element and dispose the old one
1212
const oldRootElem = document.querySelector('app');
1313
const newRootElem = document.createElement('app');
14-
oldRootElem.parentNode.insertBefore(newRootElem, oldRootElem);
14+
oldRootElem!.parentNode!.insertBefore(newRootElem, oldRootElem);
1515
modulePromise.then(appModule => appModule.destroy());
1616
});
1717
} else {

templates/AngularSpa/ClientApp/boot.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export default createServerRenderer(params => {
1717
];
1818

1919
return platformDynamicServer(providers).bootstrapModule(AppModule).then(moduleRef => {
20-
const appRef = moduleRef.injector.get(ApplicationRef);
20+
const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
2121
const state = moduleRef.injector.get(PlatformState);
2222
const zone = moduleRef.injector.get(NgZone);
2323

2424
return new Promise<RenderResult>((resolve, reject) => {
25-
zone.onError.subscribe(errorInfo => reject(errorInfo));
25+
zone.onError.subscribe((errorInfo: any) => reject(errorInfo));
2626
appRef.isStable.first(isStable => isStable).subscribe(() => {
2727
// Because 'onStable' fires before 'onError', we have to delay slightly before
2828
// completing the request in case there's an error to report

templates/AngularSpa/npm-shrinkwrap.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/AngularSpa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@angular/platform-server": "4.2.5",
1919
"@angular/router": "4.2.5",
2020
"@ngtools/webpack": "1.5.0",
21-
"@types/node": "8.0.8",
21+
"@types/webpack-env": "1.13.0",
2222
"angular2-template-loader": "0.6.2",
2323
"aspnet-prerendering": "^3.0.1",
2424
"aspnet-webpack": "^2.0.1",

templates/AngularSpa/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"compilerOptions": {
3+
"module": "es2015",
34
"moduleResolution": "node",
45
"target": "es5",
56
"sourceMap": true,
67
"experimentalDecorators": true,
78
"emitDecoratorMetadata": true,
89
"skipDefaultLibCheck": true,
10+
"skipLibCheck": true, // Workaround for https://github.com/angular/angular/issues/17863. Remove this if you upgrade to a fixed version of Angular.
11+
"strict": true,
912
"lib": [ "es6", "dom" ],
10-
"types": [ "node" ]
13+
"types": [ "webpack-env" ]
1114
},
1215
"exclude": [ "bin", "node_modules" ],
1316
"atom": { "rewriteTsconfig": false }

templates/AureliaSpa/npm-shrinkwrap.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/AureliaSpa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"jquery": "^3.2.1"
1515
},
1616
"devDependencies": {
17-
"@types/node": "^7.0.12",
17+
"@types/webpack-env": "^1.13.0",
1818
"aspnet-webpack": "^2.0.1",
1919
"aurelia-webpack-plugin": "^2.0.0-rc.2",
2020
"css-loader": "^0.28.0",

templates/AureliaSpa/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"compilerOptions": {
3+
"module": "es2015",
34
"moduleResolution": "node",
45
"target": "es5",
56
"sourceMap": true,
67
"experimentalDecorators": true,
78
"emitDecoratorMetadata": true,
89
"skipDefaultLibCheck": true,
10+
"strict": true,
911
"lib": [ "es2015", "dom" ],
10-
"types": [ "node" ]
12+
"types": [ "webpack-env" ]
1113
},
1214
"exclude": [ "bin", "node_modules" ],
1315
"atom": { "rewriteTsconfig": false }

templates/KnockoutSpa/ClientApp/boot.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import './css/site.css';
22
import 'bootstrap';
33
import * as ko from 'knockout';
4+
import { createBrowserHistory } from 'history';
45
import './webpack-component-loader';
56
import AppRootComponent from './components/app-root/app-root';
6-
const createHistory = require('history').createBrowserHistory;
7-
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
7+
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href')!;
88
const basename = baseUrl.substring(0, baseUrl.length - 1); // History component needs no trailing slash
99

1010
// Load and register the <app-root> component
1111
ko.components.register('app-root', AppRootComponent);
1212

1313
// Tell Knockout to start up an instance of your application
14-
ko.applyBindings({ history: createHistory({ basename }), basename });
14+
ko.applyBindings({ history: createBrowserHistory({ basename }), basename });
1515

1616
// Basic hot reloading support. Automatically reloads and restarts the Knockout app each time
1717
// you modify source files. This will not preserve any application state other than the URL.
18-
declare var module: any;
1918
if (module.hot) {
2019
module.hot.accept();
2120
module.hot.dispose(() => ko.cleanNode(document.body));

templates/KnockoutSpa/ClientApp/router.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as ko from 'knockout';
22
import * as $ from 'jquery';
33
import * as History from 'history';
4-
import crossroads = require('crossroads');
4+
import * as crossroads from 'crossroads';
55

66
// This module configures crossroads.js, a routing library. If you prefer, you
77
// can use any other routing library (or none at all) as Knockout is designed to
@@ -20,9 +20,9 @@ export class Router {
2020
// Reset and configure Crossroads so it matches routes and updates this.currentRoute
2121
crossroads.removeAllRoutes();
2222
crossroads.resetState();
23-
crossroads.normalizeFn = crossroads.NORM_AS_OBJECT;
23+
(crossroads as any).normalizeFn = crossroads.NORM_AS_OBJECT;
2424
routes.forEach(route => {
25-
crossroads.addRoute(route.url, (requestParams) => {
25+
crossroads.addRoute(route.url, (requestParams: any) => {
2626
this.currentRoute(ko.utils.extend(requestParams, route.params));
2727
});
2828
});

templates/KnockoutSpa/ClientApp/webpack-component-loader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ ko.components.loaders.unshift({
88
loadComponent: (name, componentConfig, callback) => {
99
if (typeof componentConfig === 'function') {
1010
// It's a lazy-loaded Webpack bundle
11-
(componentConfig as any)(loadedModule => {
11+
(componentConfig as any)((loadedModule: any) => {
1212
// Handle TypeScript-style default exports
1313
if (loadedModule.__esModule && loadedModule.default) {
1414
loadedModule = loadedModule.default;
1515
}
1616

1717
// Pass the loaded module to KO's default loader
18-
ko.components.defaultLoader.loadComponent(name, loadedModule, callback);
18+
ko.components.defaultLoader.loadComponent!(name, loadedModule as KnockoutComponentTypes.ComponentConfig, callback);
1919
});
2020
} else {
2121
// It's something else - let another component loader handle it
22-
callback(null);
22+
callback((null as any) as KnockoutComponentTypes.Definition); // workaround until https://github.com/DefinitelyTyped/DefinitelyTyped/pull/17999
2323
}
2424
}
2525
});

templates/KnockoutSpa/npm-shrinkwrap.json

Lines changed: 9 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/KnockoutSpa/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
"@types/core-js": "^0.9.34",
77
"@types/crossroads": "0.0.29",
88
"@types/es6-promise": "0.0.32",
9-
"@types/history": "^2.0.38",
9+
"@types/history": "^4.6.0",
1010
"@types/jquery": "^2.0.32",
11-
"@types/knockout": "^3.4.35",
12-
"@types/react-router": "^2.0.37",
13-
"@types/requirejs": "^2.1.26",
11+
"@types/knockout": "^3.4.41",
1412
"@types/signals": "0.0.16",
13+
"@types/webpack-env": "^1.13.0",
1514
"aspnet-webpack": "^2.0.1",
1615
"awesome-typescript-loader": "^3.0.0",
1716
"bootstrap": "^3.3.6",
@@ -21,7 +20,7 @@
2120
"event-source-polyfill": "^0.0.7",
2221
"extract-text-webpack-plugin": "^2.0.0-rc",
2322
"file-loader": "^0.9.0",
24-
"history": "^4.3.0",
23+
"history": "^4.6.3",
2524
"isomorphic-fetch": "^2.2.1",
2625
"jquery": "^2.2.1",
2726
"json-loader": "^0.5.4",

templates/KnockoutSpa/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"compilerOptions": {
3+
"module": "es2015",
34
"moduleResolution": "node",
45
"target": "es5",
56
"sourceMap": true,
67
"skipDefaultLibCheck": true,
7-
"types": ["es6-promise", "history", "requirejs"]
8+
"strict": true,
9+
"types": ["es6-promise", "webpack-env"]
810
},
911
"exclude": [
1012
"bin",

templates/ReactReduxSpa/ClientApp/boot-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as RoutesModule from './routes';
1212
let routes = RoutesModule.routes;
1313

1414
// Create browser history to use in the Redux store
15-
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
15+
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href')!;
1616
const history = createBrowserHistory({ basename: baseUrl });
1717

1818
// Get the application-wide store instance, prepopulating with state from the server where available.

templates/ReactReduxSpa/ClientApp/components/FetchData.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as WeatherForecastsState from '../store/WeatherForecasts';
88
type WeatherForecastProps =
99
WeatherForecastsState.WeatherForecastsState // ... state we've requested from the Redux store
1010
& typeof WeatherForecastsState.actionCreators // ... plus action creators we've requested
11-
& RouteComponentProps<{ startDateIndex: string }>; // ... plus incoming routing parameters
11+
& RouteComponentProps<{ startDateIndex: string }>; // ... plus incoming routing parameters
1212

1313
class FetchData extends React.Component<WeatherForecastProps, {}> {
1414
componentWillMount() {
@@ -56,8 +56,8 @@ class FetchData extends React.Component<WeatherForecastProps, {}> {
5656
}
5757

5858
private renderPagination() {
59-
let prevStartDateIndex = this.props.startDateIndex - 5;
60-
let nextStartDateIndex = this.props.startDateIndex + 5;
59+
let prevStartDateIndex = (this.props.startDateIndex || 0) - 5;
60+
let nextStartDateIndex = (this.props.startDateIndex || 0) + 5;
6161

6262
return <p className='clearfix text-center'>
6363
<Link className='btn btn-default pull-left' to={ `/fetchdata/${ prevStartDateIndex }` }>Previous</Link>

templates/ReactReduxSpa/ClientApp/configureStore.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer, Store } from 'redux';
1+
import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer, Store, StoreEnhancerStoreCreator, ReducersMapObject } from 'redux';
22
import thunk from 'redux-thunk';
33
import { routerReducer, routerMiddleware } from 'react-router-redux';
44
import * as StoreModule from './store';
@@ -12,7 +12,7 @@ export default function configureStore(history: History, initialState?: Applicat
1212
const devToolsExtension = windowIfDefined && windowIfDefined.devToolsExtension as () => GenericStoreEnhancer;
1313
const createStoreWithMiddleware = compose(
1414
applyMiddleware(thunk, routerMiddleware(history)),
15-
devToolsExtension ? devToolsExtension() : f => f
15+
devToolsExtension ? devToolsExtension() : <S>(next: StoreEnhancerStoreCreator<S>) => next
1616
)(createStore);
1717

1818
// Combine all reducers and instantiate the app-wide store instance
@@ -30,6 +30,6 @@ export default function configureStore(history: History, initialState?: Applicat
3030
return store;
3131
}
3232

33-
function buildRootReducer(allReducers) {
33+
function buildRootReducer(allReducers: ReducersMapObject) {
3434
return combineReducers<ApplicationState>(Object.assign({}, allReducers, { routing: routerReducer }));
3535
}

templates/ReactReduxSpa/ClientApp/store/WeatherForecasts.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AppThunkAction } from './';
77

88
export interface WeatherForecastsState {
99
isLoading: boolean;
10-
startDateIndex: number;
10+
startDateIndex?: number;
1111
forecasts: WeatherForecast[];
1212
}
1313

@@ -23,14 +23,14 @@ export interface WeatherForecast {
2323
// They do not themselves have any side-effects; they just describe something that is going to happen.
2424

2525
interface RequestWeatherForecastsAction {
26-
type: 'REQUEST_WEATHER_FORECASTS',
26+
type: 'REQUEST_WEATHER_FORECASTS';
2727
startDateIndex: number;
2828
}
2929

3030
interface ReceiveWeatherForecastsAction {
31-
type: 'RECEIVE_WEATHER_FORECASTS',
31+
type: 'RECEIVE_WEATHER_FORECASTS';
3232
startDateIndex: number;
33-
forecasts: WeatherForecast[]
33+
forecasts: WeatherForecast[];
3434
}
3535

3636
// Declare a 'discriminated union' type. This guarantees that all references to 'type' properties contain one of the
@@ -60,7 +60,7 @@ export const actionCreators = {
6060
// ----------------
6161
// REDUCER - For a given state and action, returns the new state. To support time travel, this must not mutate the old state.
6262

63-
const unloadedState: WeatherForecastsState = { startDateIndex: null, forecasts: [], isLoading: false };
63+
const unloadedState: WeatherForecastsState = { forecasts: [], isLoading: false };
6464

6565
export const reducer: Reducer<WeatherForecastsState> = (state: WeatherForecastsState, incomingAction: Action) => {
6666
const action = incomingAction as KnownAction;

templates/ReactReduxSpa/ClientApp/store/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import * as Counter from './Counter';
33

44
// The top-level state object
55
export interface ApplicationState {
6-
counter: Counter.CounterState,
7-
weatherForecasts: WeatherForecasts.WeatherForecastsState
6+
counter: Counter.CounterState;
7+
weatherForecasts: WeatherForecasts.WeatherForecastsState;
88
}
99

1010
// Whenever an action is dispatched, Redux will update each top-level application state property using

templates/ReactReduxSpa/npm-shrinkwrap.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/ReactReduxSpa/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"@types/history": "4.6.0",
77
"@types/react": "15.0.35",
88
"@types/react-dom": "15.5.1",
9+
"@types/react-hot-loader": "3.0.3",
910
"@types/react-redux": "4.4.45",
1011
"@types/react-router": "4.0.12",
1112
"@types/react-router-dom": "4.0.5",

0 commit comments

Comments
 (0)