diff --git a/angular.json b/angular.json index c136d6e..5bf4787 100644 --- a/angular.json +++ b/angular.json @@ -3,7 +3,7 @@ "version": 1, "newProjectRoot": "projects", "projects": { - "socket-app": { + "greenvironment": { "root": "", "sourceRoot": "src", "projectType": "application", @@ -17,14 +17,15 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/socket-app", + "outputPath": "dist/greenvironment", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", "assets": [ "src/favicon.ico", - "src/assets" + "src/assets", + "src/manifest.webmanifest" ], "styles": [ "src/styles/greenvironment-material-theme.scss", @@ -55,25 +56,27 @@ "maximumWarning": "2mb", "maximumError": "5mb" } - ] + ], + "serviceWorker": true, + "ngswConfigPath": "ngsw-config.json" } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "socket-app:build" + "browserTarget": "greenvironment:build" }, "configurations": { "production": { - "browserTarget": "socket-app:build:production" + "browserTarget": "greenvironment:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "socket-app:build" + "browserTarget": "greenvironment:build" } }, "test": { @@ -90,7 +93,8 @@ "scripts": [], "assets": [ "src/favicon.ico", - "src/assets" + "src/assets", + "src/manifest.webmanifest" ] } }, @@ -108,7 +112,7 @@ } } }, - "socket-app-e2e": { + "greenvironment-e2e": { "root": "e2e/", "projectType": "application", "prefix": "", @@ -117,11 +121,11 @@ "builder": "@angular-devkit/build-angular:protractor", "options": { "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "socket-app:serve" + "devServerTarget": "greenvironment:serve" }, "configurations": { "production": { - "devServerTarget": "socket-app:serve:production" + "devServerTarget": "greenvironment:serve:production" } } }, @@ -137,5 +141,5 @@ } } }, - "defaultProject": "socket-app" -} \ No newline at end of file + "defaultProject": "greenvironment" +} diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts index 22f7cd7..b4f721a 100644 --- a/e2e/src/app.e2e-spec.ts +++ b/e2e/src/app.e2e-spec.ts @@ -9,6 +9,6 @@ describe('workspace-project App', () => { it('should display welcome message', () => { page.navigateTo(); - expect(page.getParagraphText()).toEqual('Welcome to socket-app!'); + expect(page.getParagraphText()).toEqual('Welcome to greenvironment!'); }); }); diff --git a/ngsw-config.json b/ngsw-config.json new file mode 100644 index 0000000..4ddf1a7 --- /dev/null +++ b/ngsw-config.json @@ -0,0 +1,29 @@ +{ + "$schema": "./node_modules/@angular/service-worker/config/schema.json", + "index": "/index.html", + "assetGroups": [ + { + "name": "app", + "installMode": "prefetch", + "resources": { + "files": [ + "/favicon.ico", + "/index.html", + "/manifest.webmanifest", + "/*.css", + "/*.js" + ] + } + }, { + "name": "assets", + "installMode": "lazy", + "updateMode": "prefetch", + "resources": { + "files": [ + "/assets/**", + "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)" + ] + } + } + ] +} diff --git a/package-lock.json b/package-lock.json index 60fde46..e0e0d51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "socket-app", + "name": "greenvironment", "version": "0.0.0", "lockfileVersion": 1, "requires": true, @@ -607,6 +607,14 @@ "tslib": "^1.9.0" } }, + "@angular/service-worker": { + "version": "8.2.14", + "resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-8.2.14.tgz", + "integrity": "sha512-Xv1ES5bXDRxPJ5uyRqeKw6mGKaJVzKK0oFcR0mr4OSdyLXGZ+x6fC2S/QcLy4ugpb64fyEksrnHhHjeMVzGh2Q==", + "requires": { + "tslib": "^1.9.0" + } + }, "@babel/code-frame": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", diff --git a/package.json b/package.json index 162d32b..a12f028 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "socket-app", + "name": "greenvironment", "version": "0.0.0", "scripts": { "ng": "ng", @@ -23,6 +23,7 @@ "@angular/platform-browser": "8.2.14", "@angular/platform-browser-dynamic": "^8.2.14", "@angular/router": "~8.2.14", + "@angular/service-worker": "^8.2.14", "apollo-angular": "^1.8.0", "apollo-angular-link-http": "^1.9.0", "apollo-cache-inmemory": "^1.6.5", diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index c38ca0a..9da27bb 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -16,16 +16,16 @@ describe('AppComponent', () => { expect(app).toBeTruthy(); }); - it(`should have as title 'socket-app'`, () => { + it(`should have as title 'greenvironment'`, () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('socket-app'); + expect(app.title).toEqual('greenvironment'); }); it('should render title in a h1 tag', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('Welcome to socket-app!'); + expect(compiled.querySelector('h1').textContent).toContain('Welcome to greenvironment!'); }); }); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6a32cee..73b2909 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -20,7 +20,6 @@ import {DialogCreateEventComponent, GroupComponent} from './components/group/gro import {ChatmanagerComponent} from './components/chatmanager/chatmanager.component'; import {ChatlistComponent} from './components/chatlist/chatlist.component'; import {PostlistComponent} from './components/feed/postlist/postlist.component'; -import {GraphQLModule} from './graphql.module'; import {HttpClientModule} from '@angular/common/http'; import {ProfileComponent} from './components/profile/profile.component'; import {ImprintComponent} from './components/imprint/imprint.component'; @@ -63,6 +62,8 @@ import {MatDatepickerModule} from '@angular/material/datepicker'; import {MatNativeDateModule, MatProgressBarModule} from '@angular/material/'; import {MatSnackBarModule} from '@angular/material/snack-bar'; import {DialogFileUploadComponent} from './components/profile/fileUpload/fileUpload.component'; +import { ServiceWorkerModule } from '@angular/service-worker'; +import { environment } from '../environments/environment'; const config: SocketIoConfig = {url: 'http://localhost:4444', options: {}}; @@ -110,7 +111,6 @@ const appRoutes: Routes = [ FormsModule, HttpModule, SocketIoModule.forRoot(config), - GraphQLModule, HttpClientModule, InfiniteScrollModule, MatDatepickerModule, @@ -149,6 +149,7 @@ const appRoutes: Routes = [ MatDatepickerModule, MatSnackBarModule, MatProgressBarModule, + ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), ], entryComponents: [ DialogCreateGroupComponent, diff --git a/src/app/components/profile/fileUpload/fileUploadDialog.component.html b/src/app/components/profile/fileUpload/fileUploadDialog.component.html index 3ed10fd..cc54317 100644 --- a/src/app/components/profile/fileUpload/fileUploadDialog.component.html +++ b/src/app/components/profile/fileUpload/fileUploadDialog.component.html @@ -1,5 +1,5 @@