Bootstrap Angular app.

This commit is contained in:
Alexis Lahouze 2017-07-11 18:51:01 +02:00
parent 3ff0015690
commit f3c3ddfebf
9 changed files with 71 additions and 8 deletions

View File

@ -29,11 +29,20 @@
"less-loader": "^4.0.4",
"ngtemplate-loader": "^2.0.0",
"style-loader": "^0.18.2",
"ts-loader": "^2.2.2",
"typescript": "^2.4.1",
"url-loader": "^0.5.8",
"webpack": "^3.1.0",
"webpack-dev-server": "^2.5.1"
},
"dependencies": {
"@angular/common": "^4.2.6",
"@angular/compiler": "^4.2.6",
"@angular/core": "^4.2.6",
"@angular/platform-browser": "^4.2.6",
"@angular/platform-browser-dynamic": "^4.2.6",
"@angular/upgrade": "^4.2.6",
"@types/node": "^8.0.10",
"angular": "^1.6",
"angular-http-auth": "^1.5",
"angular-messages": "^1.6",
@ -49,7 +58,10 @@
"font-awesome": "^4.7.0",
"jquery": "^3.2",
"meanie-angular-storage": "^1.3.1",
"moment": "^2.18"
"moment": "^2.18",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.2",
"zone.js": "^0.8.12"
},
"scripts": {
"build": "webpack --config webpack.config.js",

View File

@ -30,7 +30,7 @@ var AccountBalancesFactory = require('./accountBalances.factory');
var AccountConfig = require('./account.config');
var AccountController = require('./account.controller');
module.exports = angular.module('accountant.accounts', [
export default angular.module('accountant.accounts', [
ngResource,
ngMessages,
ngUiNotification,

View File

@ -2,7 +2,7 @@ var operationsTmpl = require('./operations/operations.html');
var accountsTmpl = require('./accounts/accounts.html');
var schedulerTmpl = require('./scheduler/scheduler.html');
module.exports = function($routeProvider) {
export default function AppConfig($routeProvider) {
// Defining template and controller in function of route.
$routeProvider
.when('/account/:accountId/operations', {

27
src/app.module.ts Normal file
View File

@ -0,0 +1,27 @@
// vim: set tw=80 ts=2 sw=2 sts=2:
import 'zone.js';
import 'reflect-metadata';
import './app.ts';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { UpgradeModule } from '@angular/upgrade/static';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
@NgModule({
imports: [
BrowserModule,
UpgradeModule
]
})
export class AppModule {
constructor(private upgrade: UpgradeModule) { }
ngDoBootstrap() {
this.upgrade.bootstrap(document.body, ['accountant'], { strictDi: false });
}
}
platformBrowserDynamic().bootstrapModule(AppModule);

View File

@ -19,13 +19,14 @@
<html lang="fr">
<head>
<meta charset="UTF-8">
<base href="/">
<!-- Title -->
<title><% htmlWebpackPlugin.options.title %></title>
</head>
<!-- htmllint attr-bans="false" -->
<body style="padding-bottom: 50px; padding-top: 70px" ng-app="accountant">
<body style="padding-bottom: 50px; padding-top: 70px">
<!-- htmllint attr-bans="$previous" -->
<!-- Navbar -->
<nav class="navbar navbar-fixed-top navbar-inverse">

View File

@ -30,7 +30,7 @@ ngHttpAuth = 'http-auth-interceptor';
var LoginService = require('./login.service');
var LoginConfig = require('./login.config');
module.exports = angular.module('accountant.login', [
export default angular.module('accountant.login', [
ngHttpAuth,
ngStorage
])

View File

@ -28,7 +28,7 @@ var ScheduleConfig = require('./schedule.config');
var ScheduleController = require('./schedule.controller');
var ScheduleFactory = require('./schedule.factory');
module.exports = angular.module('accountant.scheduler', [
export default angular.module('accountant.scheduler', [
ngMessages,
ngUiNotification,
ngStrap

13
tsconfig.json Normal file
View File

@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true
}
}

View File

@ -5,7 +5,7 @@ const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: './app.ts',
entry: './app.module.ts',
devtool: 'source-map',
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.html'],
@ -17,7 +17,9 @@ module.exports = {
'@accountant/login': path.resolve(
__dirname, 'src/login/index.ts'),
'@accountant/scheduler': path.resolve(
__dirname, 'src/scheduler/index.ts')
__dirname, 'src/scheduler/index.ts'),
'@angular/upgrade/static': path.resolve(
__dirname, 'node_modules/@angular/upgrade/bundles/upgrade-static.umd.js'),
}
},
module: {
@ -67,6 +69,10 @@ module.exports = {
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}, {
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'ts-loader'
}, {
test: /\.html$/,
use: [
@ -99,6 +105,10 @@ module.exports = {
new webpack.ProvidePlugin({
"window.jQuery": "jquery"
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
path.resolve(__dirname, './')
)
],
output: {
path: path.resolve(__dirname, 'build'),