Skip to content

Commit

Permalink
feat(packaging): add basic PWA support (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliy-bobrov authored and Wassim Chegham committed Sep 4, 2018
1 parent e4788b5 commit 3bb9535
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 11 deletions.
31 changes: 24 additions & 7 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
"assets": [
"src/favicon.ico",
"src/assets",
{ "glob": "**/*", "input": "node_modules/ngx-monaco-editor/assets/monaco", "output": "./assets/monaco/" }
{
"glob": "**/*",
"input": "node_modules/ngx-monaco-editor/assets/monaco",
"output": "./assets/monaco/"
},
"src/manifest.json"
],
"styles": [
{
Expand Down Expand Up @@ -49,7 +54,8 @@
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false
"buildOptimizer": false,
"serviceWorker": true
},
"hmr": {
"fileReplacements": [
Expand Down Expand Up @@ -96,14 +102,23 @@
"src/styles.css"
],
"scripts": [],
"assets": ["src/favicon.ico", "src/assets"]
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
Expand All @@ -123,11 +138,13 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": ["**/node_modules/**"]
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "angular-sketch"
}
}
31 changes: 31 additions & 0 deletions ngsw-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"index": "/index.html",
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
],
"urls": [
"https://fonts.googleapis.com/**",
"https://www.googletagmanager.com/**",
"https://www.google-analytics.com/**"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/*",
"/assets/icons/**",
"/assets/contributions/**"
]
}
}]
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"@angular/material": "^6.1.1",
"@angular/platform-browser": "^6.1.1",
"@angular/platform-browser-dynamic": "^6.1.1",
"@angular/pwa": "^0.7.5",
"@angular/router": "^6.1.1",
"@angular/service-worker": "^6.1.1",
"@ngxs/store": "^3.0.1",
"angular-resizable-element": "^3.0.0",
"big-integer": "^1.6.30",
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { Route, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { CoreModule } from './core/core.module';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';

export const routes: Route[] = [{
path: '', redirectTo: '/home', pathMatch: 'full'
Expand All @@ -20,7 +22,8 @@ export const routes: Route[] = [{
imports: [
BrowserModule,
NoopAnimationsModule,
RouterModule.forRoot(routes, {useHash: true})
RouterModule.forRoot(routes, {useHash: true}),
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
],
bootstrap: [AppComponent]
})
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/state/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// export * from './page.state';
export * from './ui.state';
export * from './ui.state';
Binary file added src/assets/icons/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/icon-144x144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/icon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/icon-384x384.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/icon-72x72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/icon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@manekinekko">
<meta name="twitter:title" content="xLayers (by Wassim Chegham)">
<meta name="twitter:description" content="Preview and Convert SketchApp files into Angular Components.">

<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#212121">
</head>

<body class="bg-pattern">
Expand All @@ -37,6 +39,7 @@
gtag('config', 'UA-120660908-1');
</script>

<noscript>Please enable JavaScript to continue using this application.</noscript>
</body>

</html>
</html>
52 changes: 52 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "xLayer",
"short_name": "xLayer",
"description":"xLayer - convert Sketch files into Angular components",
"theme_color": "#212121",
"background_color": "#ff6c5f",
"display": "standalone",
"scope": "/",
"start_url": "/#/editor",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "assets/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "assets/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "assets/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

0 comments on commit 3bb9535

Please sign in to comment.