Code Monkey home page Code Monkey logo

local-weather-app's Introduction

LocalCast Weather

Learn Angular, Angular Material, RxJS, and Signal fundamentals with LocalCast Weather using the Kanban method.

Discover stage management with NgRx and SignalStore.

View live demo: https://local-weather-app-duluca.vercel.app

See Changes section for important or breaking changes made to the project.

Angular Version CircleCI DeepScan grade Coverage Status Kanban Board

mat-style4

Chapter specific examples within projects have been renamed, from a ch format to stage. e.g. projects/ch2 would now be located under projects/stage2.

Get the book

LocalCast Weather has been developed to support my book Angular for Enterprise Applications. You can get the book at any major bookstore or find the links at https://AngularForEnterprise.com.

Watch the talk on Architecture for Scalable Angular Apps on Pluralsight.

Check out the slides for Architecture for Scalable Angular Apps free at Slides.com.

Check out LemonMart, an Angular Grocery Store LOB App implemented with a Router-first architecture with common recipes and patterns at https://github.com/duluca/lemon-mart. You can also use LemonMart as a template project to start your own app.

Build, debug and publish Docker images with npm Scripts for Docker and achieve Blue-Green deployments on AWS Fargate with npm Scripts for AWS.

Build

  • npm run build:prod is used to build a production-optimized version of the app.
  • npm run docker:debug to run tests and build a containerized version of the app.

Developers

This app was developed to demonstrate Angular fundamentals, unit testing, and different techniques for building Angular apps using reactive patterns. The app is a good blueprint if you intend to build a largely single-screen app experience. Questions? Consider creating an issue on this repo and buying my book at https://AngularForEnterprise.com.

Pre-requisites

  • Do NOT install @angular/cli or typescript globally to avoid version mismatch issues across multiple projects.
    • Note: When creating new projects in the future, execute npx @angular/cli new app-name --routing to create a new Angular app with basic routing wired.
    • If you have trouble with this command, try npx -p @angular/cli new app-name --routing
  • To run ng commands from within the project directory, preprend npx to commands, like npx ng build.
  • To continue using ng without having to prepend npx, configure shell autofallback as described here: https://www.npmjs.com/package/npx#shell-auto-fallback.

Adapting the template

  • Fork and clone this repo.
  • Rename the repo on GitHub to match the name of your project.
  • Search and replace references to lemon-mart with your project name and git repo.
  • Remove manager, pos, and inventory folders and references to them from app-routing.module.ts.
  • To fit your needs, you may modify profile.component.ts and view-user.component.ts under the user folder.
  • Edit lemonmart-theme.scss to match your desired color scheme.
  • Now you may begin implementing your own feature modules.

During Development

  • Run npm start for a development web server.
  • Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
  • Run npm test to execute the unit tests via Karma.
  • Run npm run e2e to execute the end-to-end tests via Cypress.

Code scaffolding

  • Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Further help with Angular CLI

To get more help on the Angular CLI, use ng help or go check out the Angular CLI README.

Full-Stack Setup with Docker Compose and Deploying to AWS

See the example project here https://github.com/duluca/lemon-mart-server

Changes

Changes are inevitable to keep the project up-to-date with libraries, tools, patterns and practices. Below are some notable changes that differ from the 1st, 2nd, and 3rd edition of my book.

Angular 17

  • Moved to control flow syntax
  • Implemented a nearly observable and subscribe-free version using SignalStore in projects/signal-store

Angular 16

  • Renamed projects from ch2 format to stage2, so they make sense in the 3rd edition.
  • Replaced tslint with eslint
  • Replaced protractor with cypress for e2e, added tests
  • Moved to Standalone configuration
  • Plan to add @ngrx/component-store example

Angular 13-15

  • Updated dev-norms.md
  • Introduced ngx-mock to supplement angular-unit-test-helper for mocking components
  • Replaced @angular/flex-layout with @ngbracket/ngx-layout
  • Removed jsbeautify and import-sort in prep for migration to eslint
  • Disabled code coverage in prep for migration to Jest
  • Updated style and lint scripts
  • Updated config.yml for CircleCI updates

Angular 12 configuration changes

  • Enabled bundle budgets
  • Introduction development configuration
  • Made production configuration the default one
  • Added npm run watch command
  • Strict settings on by default

Augury

Renamed master branch to main

If you already have a master branch locally, then execute the following commands:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

Now

  • now package has been replaced with vercel.
  • CircleCI variable renamed from $NOW_TOKEN to $VERCEL_TOKEN.
  • npm run now:publish renamed to npm run vercel:publish.
  • now v1 configuration with docker deployment is removed.

Waffle.io

Sadly Waffle.io no longer exists. I recommend using GitHub Projects as a free replacement.

Using Zeit Now with Docker

Unfortunately, Zeit Now no longer allows the publication of arbitrary Dockerfile images. Using Zeit v2 you can publish the output of your dist folder and still be able to host your application for free.

A replacement for publishing arbitrary Docker images would be a new service called Google Cloud Run. A sample command would look like gcloud beta run deploy --image localcast-weather.

Using Google Cloud Run with Docker

As of January 2024, Cloud Run has deprecated private container repositories, which breaks its integration with the docker command. This seemingly subtle change moves Cloud Run from an easy-to-use to a complicated-cloud-service category. For this reason, it has been removed from the book.

local-weather-app's People

Contributors

brendoncaulkins avatar dependabot-preview[bot] avatar duluca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

local-weather-app's Issues

Chapter 4 Code Examples - Already Fixed - Angular for Enterprise-Ready Web Applications

Currently working my way through the Angular for Enterprise-Ready Web Applications book.

It Chapter 4 it talks about the failing tests in projects/ch4 and the goes on to walk you through how to fix them and educate you on various related aspects as it does so.

Problem is all the 14 tests pass first time. Chapter 4 becomes more theoretical and less practical. This is a shame.

TypeError: angularCompiler.getDiagnosticsForFile is not a function

Got this Error while trying to serve the Chapter 3; any help on how to get past this

TypeError: angularCompiler.getDiagnosticsForFile is not a function
    at /Users/{user}/dev/local-weather-app2/node_modules/@angular-devkit/build-angular/node_modules/@ngtools/webpack/src/ivy/plugin.js:423:60
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Assertion failed: (napi_define_properties(env, exports, 3, descriptors) == napi_ok), function Init, file ../src/fsevents.c, line 128.
Abort trap: 6

Transition to eslint

  • Replace tslint with eslint
  • Replace import-sort with eslint-plugin-simple-import-sort
  • Update .vscode extensions

Nothing happens when I run npx @angular/cli new app-name --routing

Hi there, I have been following along in the book, did everything exactly as mentioned. I am just in chapter 2 now. And you said to run this command
npx @angular/cli new app-name --routing

When I do that, nothing happens on the screen (it is supposed to create a bunch of files). It doesnt even create a directory or any files, etc. No error messages are given either. I ran a command to see if I have any global packages installed, and nothing is installed globally. So I am not sure why this command is not working npx @angular/cli new app-name --routing

However, I was looking up stuff on google, and saw this command, so I tried it:
npx create-react-app my-app

and that worked fine. It created the directories, and files. And then I changed into my-app folder and then typed npm start....and it worked. I saw the basic react app.

Do you have any suggestions as to what I can do at this point? I am really bummed out that the first time I get to do real coding, that this command is not doing anything
npx @angular/cli new app-name --routing

PS On page 32 of the book is where I am at. And I am wondering, am I already supposed to have @anglular/cli installed before running the command npx @angular/cli new app-name --routing

Maybe I was supposed to install @angular/cli already, and I did not see that mentioned in your book.

EDIT: After googling some more, I tried this and it seems to work. But is this doing the same result as what you wrote on page 32 of the book?
npx -p @angular/cli ng new local-weather-app

After running that command, I have a working project I can run with npm start

Updating to Angular 7

I had Angular 7 already installed.
These steps updated the project from Angular 6
I'm new to Angular so there may be better ways of doing this.

npm install -g rxjs-tslint
rxjs-5-to-6-migrate -p src/tsconfig.app.json

ng update @angular/cli @angular/core
npm audit fix
npm audit fix --force

ng serve --got error

ERROR in node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(25,15): error TS2416: Property '_registry' in type 'MockMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type 'Map<string, MockMediaQueryList>' is not assignable to type 'Map<string, MediaQueryList>'.
Type 'MockMediaQueryList' is not assignable to type 'MediaQueryList'.
Property 'onchange' is missing in type 'MockMediaQueryList'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(63,22): error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'.
Property 'onchange' is missing in type 'MockMediaQueryList'.ERROR in node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(25,15): error TS2416: Property '_registry' in type 'MockMatchMedia' is not assignable to the same property in base type 'MatchMedia'.

This fixed the issue
ng update --all

ng serve --works successfully

Implement Dark Mode

Implement Dark Mode to demonstrate simple use case for signals and localStorage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.