diff --git a/package.json b/package.json index c993a2a8..4f4338dc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "dev": "webpack --config webpack.dev.js", "dev:watch": "webpack --config webpack.dev.js --watch", "lint": "tslint src/**/*.ts || true", - "lint:fix": "tslint src/**/*.ts --fix" + "lint:fix": "tslint src/**/*.ts --fix", + "server": "webpack-dev-server --inline --progress --port 8080 --config webpack.dev.js" }, "devDependencies": { "clean-webpack-plugin": "^0.1.17", @@ -24,6 +25,7 @@ "tslint-loader": "^3.5.3", "typescript": "^2.5.3", "webpack": "^3.8.1", + "webpack-dev-server": "^2.11.0", "webpack-merge": "^4.1.0" }, "dependencies": { diff --git a/src/app/accounts/login.component.html b/src/app/accounts/login.component.html new file mode 100644 index 00000000..2cc33690 --- /dev/null +++ b/src/app/accounts/login.component.html @@ -0,0 +1,3 @@ +
+ Login form. +
diff --git a/src/app/accounts/login.component.ts b/src/app/accounts/login.component.ts new file mode 100644 index 00000000..88335241 --- /dev/null +++ b/src/app/accounts/login.component.ts @@ -0,0 +1,16 @@ +import * as template from './login.component.html'; + +import { + Component, + OnInit, +} from '@angular/core'; + +@Component({ + selector: 'app-login', + template: template, +}) +export class LoginComponent implements OnInit { + ngOnInit() { + // TODO? + } +} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts new file mode 100644 index 00000000..d15d75b9 --- /dev/null +++ b/src/app/app-routing.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { + RouterModule, + Routes, +} from '@angular/router'; + +import { LoginComponent } from './accounts/login.component'; + +const routes: Routes = [ + { path: '', redirectTo: '/login', pathMatch: 'full' }, + { path: 'login', component: LoginComponent }, +]; + +@NgModule({ + imports: [RouterModule.forRoot(routes/*, { enableTracing: true }*/)], + exports: [RouterModule], +}) +export class AppRoutingModule { } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d180239c..2498bd90 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,15 +1,9 @@ import { Component } from '@angular/core'; @Component({ - selector: 'my-app', - styles: [''], - template: ` -
-

The App Lives!

-

{{ message }}

-
- `, + selector: 'app-root', + styles: [], + template: 'App
', }) export class AppComponent { - message = 'This is the sample message.'; } diff --git a/src/app/app.d.ts b/src/app/app.d.ts new file mode 100644 index 00000000..7bf7506f --- /dev/null +++ b/src/app/app.d.ts @@ -0,0 +1 @@ +declare module '*.html'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6da4fbdc..c6d6f58a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,12 +1,22 @@ import 'zone.js/dist/zone'; -import { NgModule } from '@angular/core'; +import { AppRoutingModule } from './app-routing.module'; import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; + import { AppComponent } from './app.component'; +import { LoginComponent } from './accounts/login.component'; @NgModule({ - imports: [BrowserModule], - declarations: [AppComponent], + imports: [ + BrowserModule, + AppRoutingModule, + ], + declarations: [ + AppComponent, + LoginComponent, + ], + providers: [], bootstrap: [AppComponent], }) export class AppModule { } diff --git a/src/index.html b/src/index.html index 90c978b3..ea3ed4b3 100644 --- a/src/index.html +++ b/src/index.html @@ -1,11 +1,12 @@ - + bitwarden + - - + + diff --git a/src/app/main.ts b/src/main.ts similarity index 57% rename from src/app/main.ts rename to src/main.ts index 2470c959..541acb2b 100644 --- a/src/app/main.ts +++ b/src/main.ts @@ -1,4 +1,6 @@ +import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app.module'; + +import { AppModule } from './app/app.module'; platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/webpack.common.js b/webpack.common.js index cd7602f2..04105a2b 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -15,8 +15,14 @@ const isVendorModule = (module) => { }; module.exports = { + devServer: { + contentBase: './src', + historyApiFallback: true, + quiet: true, + stats: 'minimal' + }, entry: { - 'app': './src/app/main.ts' + 'app': './src/main.ts' }, module: { rules: [ @@ -41,17 +47,17 @@ module.exports = { path.resolve(__dirname, 'build/*') ]), new webpack.optimize.CommonsChunkPlugin({ - name: 'app/vendor', + name: 'vendor', chunks: ['app'], minChunks: isVendorModule }), new HtmlWebpackPlugin({ template: './src/index.html', filename: 'index.html', - chunks: ['app/vendor', 'app'] + chunks: ['vendor', 'app'] }), new CopyWebpackPlugin([ - + ]) ], resolve: {