{"id":17268138,"url":"https://github.com/kingdarboja/example-angular-ng-toolkit","last_synced_at":"2025-02-24T23:31:10.658Z","repository":{"id":38658605,"uuid":"220897795","full_name":"KingDarBoja/example-angular-ng-toolkit","owner":"KingDarBoja","description":"Sample angular 8 app using latest ng-toolkit packages.","archived":true,"fork":false,"pushed_at":"2023-05-07T06:12:00.000Z","size":1995,"stargazers_count":2,"open_issues_count":12,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T14:32:04.222Z","etag":null,"topics":["ng-toolkit","pwa","schematics","serverless","universal"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KingDarBoja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-11T03:59:23.000Z","updated_at":"2024-06-24T13:51:20.000Z","dependencies_parsed_at":"2022-08-26T02:41:30.563Z","dependency_job_id":null,"html_url":"https://github.com/KingDarBoja/example-angular-ng-toolkit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingDarBoja%2Fexample-angular-ng-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingDarBoja%2Fexample-angular-ng-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingDarBoja%2Fexample-angular-ng-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingDarBoja%2Fexample-angular-ng-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KingDarBoja","download_url":"https://codeload.github.com/KingDarBoja/example-angular-ng-toolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240575601,"owners_count":19823232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ng-toolkit","pwa","schematics","serverless","universal"],"created_at":"2024-10-15T08:12:36.273Z","updated_at":"2025-02-24T23:31:10.080Z","avatar_url":"https://github.com/KingDarBoja.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Universal Website\n\nThis is the experimental universal project developed by KingDarBoja in order to ensure proper functionality of `@ng-toolkit` packages.\nPlease refer to each section of the readme to gain insight about the building steps of this website.\n\n## Install Dependencies\n\nThis project uses Bootstrap v4 along with ngx-bootstrap v5 for style customisation and provide some useful components (tooltips, modals, accordion). For customisation and setup, please read the [Getting started guide](https://github.com/valor-software/ngx-bootstrap/blob/master/docs/getting-started/bootstrap.md) from ngx-boostrap.\n\nAs quick tip, all app styles are inside `styles` folder, being loaded as partial files on _`styles.scss`_ in order to generate a single bundled file as recommended by most tutorials.\n\nIn order to support _Server Side Rendering_ (SSR) features along with _Progressive Web App_ (PWA), the following packages according to the official Angular and Universal documentation were installed, either manually (M) or internally (I):\n\n- @angular/pwa (M)\n- @nguniversal/common (I)\n- @nguniversal/express-engine (I)\n- @nguniversal/module-map-ngfactory-loader (I)\n\nThese packages are required as stated on [ng-toolkit](https://github.com/maciejtreder/ng-toolkit) in order to properly install the next packages:\n\n- @ng-toolkit/pwa\n- @ng-toolkit/serverless\n- @ng-toolkit/universal\n\n## Serverless + SSR + PWA with ng-toolkit\n\nThe advantage of using `ng-toolkit` package is the interchangeably between schematics so we can apply them in any order. Based on that, ran `ng add @ng-toolkit/serverless --provider aws` command on the workspace root so the app is deployable on serverless environment. As the current version of the `ng-toolkit` package at the time writting this readme was `7.1.2`, there were some bugfixes applied to the _`serverless.yml`_ like as upgrading node version and provide a fixed bucket name (which has to be generated manually on AWS first).\n\nFollowing the fixes, just deploy the app by running the command:\n\n`npm run build:prod:deploy`\n\nBear in mind that we must configure a custom domain for API gateway in order to properly load files and so on.\n\nAfter deploying and configuring our custom domain for API Gateway using _AWS Route53_ along with _AWS Certificate Manager_, we will navigate to our app url and probably get this console error:\n\n`Failed to load module script: The server responded with a non-JavaScript MIME type of \"text/html\". Strict MIME type checking is enforced for module scripts per HTML spec.`\n\nPlease refer to this [Angular issue](https://github.com/angular/angular/issues/30835) to understand why the previous error was being generated and the proposed fix.\n\nThe provided fix is setting at `tsconfig.json` the target option with `es5` as follow:\n`\"target\": \"es5\"`.\n\nAfter these steps, just ran `ng add @ng-toolkit/universal@7.1.2`(Yeah, there is a bug with the installed version if you don't specify it) to enable **SSR** feature and then `ng add @ng-toolkit/pwa` (after `ng add @angular/pwa`) for the **PWA** one.\n\n## Webpack Config\n\nAs you should know, the schematic `@ng-toolkit/universal` internally ran `ng add @nguniversal/express-engine` and hence generated a webpack server configuration file _`webpack.server.config.js`_. This file got changed to **Typescript** language to support _ES Module Import_ but the drawback was **NodeJS** not being able to recognize such imports.\n\nTo fix this, follow the [Configuration Languages](https://webpack.js.org/configuration/configuration-languages/) documentation at webpack site.\n\n## Improve Audit Scoring\n\nTo improve audit scoring, extra steps were made for each following item:\n\n- Perfomance\n\n    - **Enable file compression on API Gateway**  \n    Check out this medium article about [gzip content from aws api gateway](https://medium.com/@OneMuppet_/gzip-deflate-content-from-aws-api-gateway-using-serverless-36e208da4270).  \n    As resume, the serverless framework does not support `MinimumCompressionSize` settings, so we have to install `serverless-api-compression` by running the command `npm install --save-dev serverless-api-compression`. And after that, include the proper lines of code as stated on the [npm package](https://www.npmjs.com/package/serverless-api-compression).\n\n- PWA\n\n    - **Provide apple-touch-icon**  \n        The `@ng-toolkit/pwa` does add different icon sizes and handles the manifest for these assets as desired. However, as Apple’s iOS iis a bit behind on PWA support (as stated [here](https://stackoverflow.com/questions/52302780/ios-12-pwa-support)), we must add at _`index.html`_ the following link at the `head` tag:  \n        `\u003clink rel=\"apple-touch-icon\" href=\"/assets/icons/icon-512x512.png\" /\u003e`\n\n    - **Provide meta tags**  \n        This one is pretty quick, just add the basic meta tags. If you wish to add more, please check this [awesome GitHub repository](https://github.com/joshbuchea/HEAD) to check them out. This also includes social tags and much more for your website.\n\n- Accessibility\n\n    - **Background and foreground colors do not have a sufficient contrast ratio**  \n    Checkout this [color contrast analyzer](https://dequeuniversity.com/rules/axe/3.3/color-contrast) to test background color against text color and find out if it satisfy the rule.\n    - **Links do not have a discernible name**\n    Provide `aria-label` attributes for link text (and alternate text for images, when used as links).\n\n## Extra Documentation\n\nIf you wish to learn how to improve Angular application, I do recommend reading this [Angular Perfomance Checklist](https://github.com/mgechev/angular-performance-checklist/blob/master/README.es-ES.md) document.\n\n## Angular Generated Info\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.0.\n\n### Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n### Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n### Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.\n\n### Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n### Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).\n\n### Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingdarboja%2Fexample-angular-ng-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingdarboja%2Fexample-angular-ng-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingdarboja%2Fexample-angular-ng-toolkit/lists"}