-
Notifications
You must be signed in to change notification settings - Fork 13
feat(service worker): add service worker functionality #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
DanielHabenicht
wants to merge
13
commits into
master
Choose a base branch
from
feat/add-service-worker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ffdf39a
fix(service-worker): remove service worker
DanielHabenicht 88007b9
chore(angular): remove unneeded copy files
DanielHabenicht 506f0e1
fix(service-worker): readd manifest with angular 8
DanielHabenicht 1c33423
fix(service-worker): remove ngsw paths
DanielHabenicht 0f96060
wip
DanielHabenicht a41ed37
Merge branch 'master' into feat/add-service-worker
DanielHabenicht a55e01b
chore(docker): update dockerignore
DanielHabenicht f3d4d9c
fix(nginx): remove 404 paths
DanielHabenicht a9e53f7
fix(docker): add ngsw-config.json
DanielHabenicht b3a0ad2
fix(angular): service worker
DanielHabenicht d4e2b18
fix(service-worker): update hashes in ngsw.json
DanielHabenicht 3b48b8b
fix(service-worker): fix replace string in non debug case
DanielHabenicht 36fe4cb
fix(service-worker): make it path agnostic
DanielHabenicht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| # This updates the hash of the index.html in the corresponding ngsw.json | ||
| # Execute it after replacing the environment variables | ||
|
|
||
| # Paths to folders containing the index.html files (where the hash should be recalculated) | ||
| paths=( "de" "en") | ||
|
|
||
| # The first parameter has to be the path to the directory with the language folders | ||
| if [[ -z $1 ]]; then | ||
| echo 'ERROR: No target file or directory given.' | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
|
|
||
| # Go to all folders containing index.html and ngsw.json | ||
| for i in "${paths[@]}" | ||
| do | ||
| # Calculate hash of index.html | ||
| replaceString=($(sha1sum $1/$i/index.html)) | ||
|
|
||
| if [ "$DEBUG" = true ] | ||
| then | ||
| # If DEBUG=true in order to log the replaced files | ||
| sed -i "s|\"\/$i\/index\.html\":\s\"\(.*\)\"|\"/""$i""/index.html\": \"""$replaceString""\"|Ig;w /dev/stdout" "$1/$i/ngsw.json" | ||
| else | ||
| # If DEBUG=false do it without logging | ||
| sed -i "s|\"\/$i\/index\.html\":\s\"\(.*\)\"|\"/""$i""/index.html\": \"""$replaceString""\"|Ig" "$1/$i/ngsw.json" | ||
| fi | ||
| done | ||
|
|
||
| # Execute all other parameters | ||
| exec "${@:2}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| { | ||
| "index": "/index.html", | ||
| "assetGroups": [ | ||
| { | ||
| "name": "app", | ||
| "installMode": "prefetch", | ||
| "resources": { | ||
| "files": [ | ||
| "/favicon.ico", | ||
| "/index.html", | ||
| "/manifest.webmanifest", | ||
| "/*.css", | ||
| "/*.js", | ||
| "/*.woff2", | ||
| "/*.woff", | ||
| "/*.svg", | ||
| "/*.ttf", | ||
| "/*.eot" | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "name": "assets", | ||
| "installMode": "prefetch", | ||
| "updateMode": "prefetch", | ||
| "resources": { | ||
| "files": [ | ||
| "/assets/**", | ||
| "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)" | ||
| ] | ||
| } | ||
| } | ||
| ], | ||
| "dataGroups": [ | ||
| { | ||
| "name": "api", | ||
| "urls": [ | ||
| "/api/**" | ||
| ], | ||
| "cacheConfig": { | ||
| "strategy": "performance", | ||
| "maxSize": 1, | ||
| "maxAge": "1h" | ||
| } | ||
| }, | ||
| { | ||
| "name": "pictures", | ||
| "urls": [ | ||
| "*.(jpg|png|webp|gif|svg)" | ||
| ], | ||
| "cacheConfig": { | ||
| "strategy": "freshness", | ||
| "timeout": "4s", | ||
| "maxSize": 1, | ||
| "maxAge": "1h" | ||
| } | ||
| } | ||
| ] | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,4 +115,4 @@ | |
| "path": "Phonebook.Frontend/node_modules/cz-customizable" | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.