Git Product home page Git Product logo

stefanoslig / angular-ngrx-nx-realworld-example-app Goto Github PK

View Code? Open in Web Editor NEW
822.0 26.0 252.0 26.23 MB

Real world application built with Angular 17, NgRx 17, nrwl/nx 17

Home Page: https://angular-ngrx-nx.netlify.app/

License: MIT License

TypeScript 83.28% HTML 12.60% CSS 0.13% JavaScript 1.00% SCSS 0.08% Gherkin 2.92%
ngrx nx-workspace ngrx-store ngrx-effects angular nrwl-nx nx nrwl standalone-components component-store

angular-ngrx-nx-realworld-example-app's Introduction

RealWorld Example App

This project is already migrated to Angular v17 and to the new Control Flow and Deferred Loading. I'm also migrating it from NgRx Store to NgRx Signal Store. The Auth library, the Article library and the Profile library have already migrated. You can already have a look.

Netlify Status

Angular, ngrx/platform, nrwl/nx codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Angular, ngrx/platform, nrwl/nx including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Angular community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

Functionality overview

The example application is a social blogging site (i.e. a Medium.com clone) called "Conduit". It uses a custom API for all requests, including authentication.

General functionality:

  • Authenticate users via JWT (login/signup pages + logout button on settings page)
  • CRU* users (sign up & settings page - no deleting required)
  • CRUD Articles
  • CR*D Comments on articles (no updating required)
  • GET and display paginated lists of articles
  • Favorite articles
  • Follow other users

The general page breakdown looks like this:

  • Home page (URL: /#/ )
    • List of tags
    • List of articles pulled from either Feed, Global, or by Tag
    • Pagination for list of articles
  • Sign in/Sign up pages (URL: /#/login, /#/register )
    • Uses JWT (store the token in localStorage)
    • Authentication can be easily switched to session/cookie based
  • Settings page (URL: /#/settings )
  • Editor page to create/edit articles (URL: /#/editor, /#/editor/article-slug-here )
  • Article page (URL: /#/article/article-slug-here )
    • Delete article button (only shown to article's author)
    • Render markdown from server client side
    • Comments section at bottom of page
    • Delete comment button (only shown to comment's author)
  • Profile page (URL: /#/profile/:username, /#/profile/:username/favorites )
    • Show basic user info
    • List of articles populated from author's created articles or author's favorited articles

Commands

Run the application

npm run start

Unit tests

Run all the tests: nx run-many -t test

Lint

nx run-many -t lint

Architecture

Folders/Libs structure

For this project I created a monorepo. There is one app for the moment (conduit) which consumes the libraries under the libs folder.

The folder structure is:

├── libs
│   ├── articles
│   │   ├── data-access
│   │   ├── feature-article-edit
│   │   ├── feature-article
│   │   ├── feature-articles-list
│   ├── auth
│   │   ├── data-access
│   │   ├── feature-auth
│   ├── core
│   │   ├── api-types
│   │   ├── error-handler
│   │   ├── http-client
│   │   ├── forms
│   ├── profile
│   │   ├── data-access
│   │   ├── feature-profile
│   ├── ui
│   │   ├── components

I used two classifiers to name my libraries. The first classifier is the scope and the second the type. The main reason is that I want every developer when he looks a library to understand where this library can be used and which kind of services/components/etc contains.

The scope is the section (domain) of the app the library can be used. It gives a clear indication that a feature belongs to a specific domain. For example the libraries under users scope, are used in the users and favourite users pages. The ibraries under the core scope can be reused between all the sections of the app. The core scope will be rename soon to shared.

The type indicates the purpose of a library. I have used a number of different types (feature, data-access, ui, api-types) The feature-... type contains smart components. These are components which enable the communication with the data-sources (most likely they inject api services). The data-access type contains code for interacting with the server. The ui type contains dumb (presentational) components. These components are reusable in the scope of this library

Standalone components

I have used only standalone components. You won't see any modules in the app.

Lazy loaded components

As you can see from the route configuration, the two main pages in the app are loaded lazily. This will make the initial loading time of the app faster.

 {
  path: '',
  redirectTo: 'home',
  pathMatch: 'full',
},
{
  path: 'home',
  loadChildren: () => import('@realworld/home/src/lib/home.routes').then((home) => home.HOME_ROUTES),
},
{
  path: 'login',
  loadComponent: () => import('@realworld/auth/feature-auth').then((m) => m.LoginComponent),
},
{
  path: 'register',
  loadComponent: () => import('@realworld/auth/feature-auth').then((m) => m.RegisterComponent),
},
{
  path: 'article',
  loadChildren: () => import('@realworld/articles/article').then((m) => m.ARTICLE_ROUTES),
},
{
  path: 'settings',
  loadComponent: () =>
    import('@realworld/settings/feature-settings').then((settings) => settings.SettingsComponent),
},
{
  path: 'editor',
  loadChildren: () => import('@realworld/articles/article-edit').then((article) => article.ARTICLE_EDIT_ROUTES),
  canActivate: [authGuard],
},
{
  path: 'profile',
  loadChildren: () => import('@realworld/profile/feature-profile').then((profile) => profile.PROFILE_ROUTES),
},

State management

TBD

The smart-dumb components design pattern for the components:

There is a clear distinction in the codebase between the smart and dumb components. The main reason behind this decision is that I want most of my components to be reusable and easier to be tested. That means that they should not have dependencies and they just consume the data they get from the smart component. Also it makes clearer a compoenent's responsibility.

Avoid using external dependencies

As you can see in the package.json, we didn't include external libraries, like angular-material, libs for the ui components, state management,etc. The reason is that it might be tempting to use a library like this in the short term to develop something fast, but in the long term they can introduce many problems:

  • opinionated styles
  • make the migration to newer versions of Angular more difficult
  • not full control on them

Testing

TBD

angular-ngrx-nx-realworld-example-app's People

Contributors

andrzejpindor avatar angular-cli avatar chulphan avatar colesanders avatar danielsofomo avatar dependabot[bot] avatar juristr avatar mathisvester avatar mfp22 avatar renovate[bot] avatar stefanoslig avatar stephanmullernl avatar tamara-dimeska 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-ngrx-nx-realworld-example-app's Issues

API Domain change

Hello!

Due to governance changes, we are now using the realworld.io domain for the RealWorld demo (both client and API).
Requests from conduit.productionready.io are redirected to api.realworld.io, but such a redirection might lead to inconsistent responses.

We encourage domain change for the community.
If this repository is maintained anymore, we'll consider hosting a demo of your implementation in a few weeks with the domain change.

The demo link will be added to the RealWorld documentation.

lib/core doesn't exist

I found that the lib/core doesn't exist.
On the other hand, is only referred by 1 test and used (another import but doesn't use it)
A work around my suffice too

Thanks

turned out to be a reference issue... changed the core to auth and found the resource.

Error compiling

Hello guys i just clones and npm installed your app, but i'm getting the following compile error:
WARNING in Circular dependency detected:
libs\ngrx-forms\src\lib+state\ngrx-forms.actions.ts -> libs\ngrx-forms\src\lib+state\ngrx-forms.reducer.ts -> libs\ngrx-forms\src\lib+state\ngrx-forms.actions.ts

WARNING in Circular dependency detected:
libs\ngrx-forms\src\lib+state\ngrx-forms.reducer.ts -> libs\ngrx-forms\src\lib+state\ngrx-forms.actions.ts -> libs\ngrx-forms\src\lib+state\ngrx-forms.reducer.ts

WARNING in Circular dependency detected:
libs\profile\src\lib+state\profile.actions.ts -> libs\profile\src\lib+state\profile.reducer.ts -> libs\profile\src\lib+state\profile.actions.ts

WARNING in Circular dependency detected:
libs\profile\src\lib+state\profile.reducer.ts -> libs\profile\src\lib+state\profile.actions.ts -> libs\profile\src\lib+state\profile.reducer.ts
ERROR in F:/Workspaces/Source/angular-ngrx-nx-realworld-example-app/libs/editor/src/lib/+state/editor.actions.ts 36:12-23
"export 'ArticleData' was not found in '@angular-ngrx-nx-realworld-example-app/api'
ERROR in F:/Workspaces/Source/angular-ngrx-nx-realworld-example-app/libs/ngrx-forms/src/lib/+state/ngrx-forms.actions.ts 46:12-18
"export 'Errors' was not found in './ngrx-forms.reducer'
ERROR in F:/Workspaces/Source/angular-ngrx-nx-realworld-example-app/libs/profile/src/lib/+state/profile.actions.ts 30:12-19
"export 'Profile' was not found in './profile.reducer'
ERROR in F:/Workspaces/Source/angular-ngrx-nx-realworld-example-app/libs/profile/src/lib/+state/profile.actions.ts 57:12-19
"export 'Profile' was not found in './profile.reducer'
ERROR in F:/Workspaces/Source/angular-ngrx-nx-realworld-example-app/libs/profile/src/lib/+state/profile.actions.ts 84:12-19
"export 'Profile' was not found in './profile.reducer'

Thanks! in advance for help

Does not compile

ERROR in node_modules/@types/jasmine/index.d.ts(14,18): error TS2300: Duplicate identifier 'describe'. node_modules/@types/jasmine/index.d.ts(15,18): error TS2300: Duplicate identifier 'fdescribe'. node_modules/@types/jasmine/index.d.ts(16,18): error TS2300: Duplicate identifier 'xdescribe'. node_modules/@types/jasmine/index.d.ts(25,18): error TS2300: Duplicate identifier 'it'. node_modules/@types/jasmine/index.d.ts(34,18): error TS2300: Duplicate identifier 'fit'. node_modules/@types/jasmine/index.d.ts(35,18): error TS2300: Duplicate identifier 'xit'. node_modules/@types/jasmine/index.d.ts(50,18): error TS2300: Duplicate identifier 'beforeEach'. node_modules/@types/jasmine/index.d.ts(57,18): error TS2300: Duplicate identifier 'afterEach'. node_modules/@types/jasmine/index.d.ts(65,18): error TS2300: Duplicate identifier 'beforeAll'. node_modules/@types/jasmine/index.d.ts(73,18): error TS2300: Duplicate identifier 'afterAll'. node_modules/@types/jasmine/index.d.ts(79,18): error TS2451: Cannot redeclare block-scoped variable 'expect'. node_modules/@types/jasmine/index.d.ts(85,18): error TS2451: Cannot redeclare block-scoped variable 'expect'. node_modules/@types/jasmine/index.d.ts(91,18): error TS2451: Cannot redeclare block-scoped variable 'expect'. node_modules/@types/jasmine/index.d.ts(96,18): error TS2451: Cannot redeclare block-scoped variable 'expect'. node_modules/@types/jasmine/index.d.ts(135,9): error TS2300: Duplicate identifier 'clock'. node_modules/@types/jasmine/index.d.ts(181,15): error TS2428: All declarations of 'ArrayContaining' must have identical type parameters. node_modules/@types/jasmine/index.d.ts(188,15): error TS2428: All declarations of 'ObjectContaining' must have identical type parameters. node_modules/@types/jasmine/index.d.ts(219,10): error TS2300: Duplicate identifier 'CustomEqualityTester'. node_modules/@types/jasmine/index.d.ts(228,10): error TS2300: Duplicate identifier 'CustomMatcherFactory'. node_modules/@types/jasmine/index.d.ts(710,16): error TS2451: Cannot redeclare block-scoped variable 'DEFAULT_TIMEOUT_INTERVAL'. node_modules/@types/jasminewd2/index.d.ts(9,18): error TS2300: Duplicate identifier 'it'. node_modules/@types/jasminewd2/index.d.ts(10,18): error TS2300: Duplicate identifier 'fit'. node_modules/@types/jasminewd2/index.d.ts(11,18): error TS2300: Duplicate identifier 'xit'. node_modules/@types/jasminewd2/index.d.ts(12,18): error TS2300: Duplicate identifier 'beforeEach'. node_modules/@types/jasminewd2/index.d.ts(13,18): error TS2300: Duplicate identifier 'afterEach'. node_modules/@types/jasminewd2/index.d.ts(14,18): error TS2300: Duplicate identifier 'beforeAll'. node_modules/@types/jasminewd2/index.d.ts(15,18): error TS2300: Duplicate identifier 'afterAll'. node_modules/@types/jest/index.d.ts(22,13): error TS2300: Duplicate identifier 'beforeAll'. node_modules/@types/jest/index.d.ts(23,13): error TS2300: Duplicate identifier 'beforeEach'. node_modules/@types/jest/index.d.ts(24,13): error TS2300: Duplicate identifier 'afterAll'. node_modules/@types/jest/index.d.ts(25,13): error TS2300: Duplicate identifier 'afterEach'. node_modules/@types/jest/index.d.ts(26,13): error TS2300: Duplicate identifier 'describe'. node_modules/@types/jest/index.d.ts(27,13): error TS2300: Duplicate identifier 'fdescribe'. node_modules/@types/jest/index.d.ts(28,13): error TS2300: Duplicate identifier 'xdescribe'. node_modules/@types/jest/index.d.ts(29,13): error TS2300: Duplicate identifier 'it'. node_modules/@types/jest/index.d.ts(30,13): error TS2300: Duplicate identifier 'fit'. node_modules/@types/jest/index.d.ts(31,13): error TS2300: Duplicate identifier 'xit'. node_modules/@types/jest/index.d.ts(35,15): error TS2451: Cannot redeclare block-scoped variable 'expect'. node_modules/@types/jest/index.d.ts(933,9): error TS2451: Cannot redeclare block-scoped variable 'DEFAULT_TIMEOUT_INTERVAL'. node_modules/@types/jest/index.d.ts(934,14): error TS2300: Duplicate identifier 'clock'. node_modules/@types/jest/index.d.ts(937,46): error TS2314: Generic type 'ArrayContaining<T>' requires 1 type argument(s). node_modules/@types/jest/index.d.ts(938,45): error TS2314: Generic type 'ObjectContaining<T>' requires 1 type argument(s). node_modules/@types/jest/index.d.ts(964,15): error TS2428: All declarations of 'ArrayContaining' must have identical type parameters. node_modules/@types/jest/index.d.ts(970,15): error TS2428: All declarations of 'ObjectContaining' must have identical type parameters. node_modules/@types/jest/index.d.ts(1078,9): error TS2374: Duplicate string index signature. node_modules/@types/jest/index.d.ts(1081,10): error TS2300: Duplicate identifier 'CustomMatcherFactory'. node_modules/@types/jest/index.d.ts(1089,10): error TS2300: Duplicate identifier 'CustomEqualityTester'. node_modules/@types/jest/index.d.ts(1098,9): error TS2687: All declarations of 'message' must have identical modifiers. node_modules/@types/jest/index.d.ts(1098,9): error TS2717: Subsequent property declarations must have the same type. Property 'message' must be of type 'string', but here has type 'string | (() => string)'. node_modules/@types/jest/index.d.ts(1103,9): error TS2375: Duplicate number index signature.

absolute imports

Is there a reason why absolute imports are not configured in any examples on GitHub. I searched for real-world application. This repo looks great but for example in file:

/// angular-ngrx-nx-realworld-example-app/libs/article-list/src/index.ts 
export { ArticleListModule } from './lib/article-list.module';
export * from './lib/+state/article-list.reducer';
export * from './lib/+state/article-list.actions';
export * from './lib/+state/article-list.facade';

Would it be possible to have something like this?

/// angular-ngrx-nx-realworld-example-app/libs/article-list/src/index.ts 
export { ArticleListModule } from 'lib/article-list.module';
export * from 'lib/+state/article-list.reducer';
export * from 'lib/+state/article-list.actions';
export * from 'lib/+state/article-list.facade';

This may seem like a small change but it makes the code easier to read and easier to refactor. 🤔

Edit: I guess I could just prepend the package @name but somehow that seems worse than ./lib because @ looks like a 3rd party library.

TSLint still in recommended plugins

"ms-vscode.vscode-typescript-tslint-plugin" is still in the recommended plugins list for VSCode. I think this should be changed to the eslint plugin.

Jest tests fail

I'm trying to run unit tests in this repository but they fail with some jest errors I can't solve. Reproduction steps:

git clone https://github.com/stefanoslig/angular-ngrx-nx-realworld-example-app.git ./
npm install
npm install -g nx
nx run-many --target=test --all

The result of running the tests is the following error:

 ● Test suite failed to run

TypeError: Cannot read properties of undefined (reading 'html')

  at new JSDOMEnvironment (../../../node_modules/jest-environment-jsdom/build/index.js:72:44)
  at async TestScheduler.scheduleTests (../../../node_modules/@jest/core/build/TestScheduler.js:317:13)
  at async runJest (../../../node_modules/@jest/core/build/runJest.js:407:19)
  at async _run10000 (../../../node_modules/@jest/core/build/cli/index.js:339:7)
  at async runCLI (../../../node_modules/@jest/core/build/cli/index.js:190:3)`

After some googling I fixed this with running this command:

npm install --save-dev jest-environment-jsdom

But then I get errors like this:

● Test suite failed to run
                                                                                                                                
Jest encountered an unexpected token                                                                                            
                                                                                                                                
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.                                                                                        
                                                                                                                                
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. 

By default "node_modules" folder is ignored by transformers.

Here's what you can do:
 • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
 • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
 • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.    
 • If you need a custom transformation specify a "transform" option in your config.
 • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation

Details:

C:\Users\redzi\Documents\repos\angular-ngrx-nx-realworld-example-app-main\node_modules\rxjs\dist\esm5\index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { Observable } from './internal/Observable';
                                                                                  ^^^^^^

SyntaxError: Unexpected token 'export'

  at Runtime.createScriptFromCode (../../node_modules/jest-runner/node_modules/jest-runtime/build/index.js:1796:14)
  at Object.<anonymous> (../../node_modules/@angular/core/fesm2020/core.mjs:7:69)

FAIL   conduit  apps/conduit/src/app/layout/footer/footer.component.spec.ts`

I presume it's an issue with something I'm doing or my setup since I've noticed CI/CD pipelines configured which would report this issue, but I've tried it on two PCs with the same results. What am I doing wrong?

Article follow/unfollow duplicated effects

I noticed that articlesActions.favorite and articlesActions.unfavorite have effects in:

For this reason when user follows there steps:

  1. enter products list (articles-list feature store is loaded)
  2. enter product page (article feature store is loaded)
  3. clicks favorite button on article details page
  4. both effects from both feature stores are fired, causing duplicated request for backend

Is it intended behavior? What would be the best clean solution to deal with this situation if we need to get rid off this duplicated request?

Fresh Install Doesn't Run

`ERROR in libs/ngrx-forms/src/lib/+state/ngrx-forms.facade.ts:3:10 - error TS2305: Module '"./ngrx-forms.interfaces"' has no exported member 'NgrxFormsState'.

3 import { NgrxFormsState } from './ngrx-forms.interfaces';`

Question about the architecture

Hi Stefano...
I am debugging your app for learning purposes. Thumbs up, I think it's very well coded.
I have a question regarding your architecture choices:

Why are you creating an ArticleGuardService to only dispatch this.facade.loadArticle - why are you not just calling loadArticle and loadComments in ngOnInit of the article.component ?

Thanks!

Replace placeholder in email login input

The placeholder of the email input shows: "Username". It suggests that the user can put in username. It would be better to replace it with "Email" because authentication with username is not supported.

Migrate home lib to ngrx v8

Based on what I have done for the other libraries, I want to use the new features of NgRx in this lib as well

@ngrx/store: The feature name "auth" does not exist in the state

nx run conduit:test [existing outputs match the cache, left as is]
 PASS   conduit  apps/conduit/src/app/layout/footer/footer.component.spec.ts
 PASS   conduit  apps/conduit/src/app/layout/navbar/navbar.component.spec.ts
 PASS   conduit  apps/conduit/src/app/app.component.spec.ts
  ● Console

    console.warn
      @ngrx/store: The feature name "auth" does not exist in the state, therefore createFeatureSelector cannot access it.  Be sure it is imported in a loaded module using StoreModule.forRoot('auth', ...) or StoreModule.forFeature('auth', ...).  If the default state is intended to be undefined, as is the case with router state, this development-only warning message can be ignored.

      at ../../modules/store/src/selector.ts:755:17
      at ../../modules/store/src/selector.ts:574:64
          at Array.map (<anonymous>)
      at defaultStateFn (../../modules/store/src/selector.ts:574:52)
      at ../../modules/store/src/selector.ts:718:30
      at memoized (../../modules/store/src/selector.ts:101:33)
      at ../../modules/store/src/selector.ts:574:64
          at Array.map (<anonymous>)


Test Suites: 3 passed, 3 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        6.461 s
Ran all test suites.

Cannot read property 'split' of undefined

I have an issue while build the project
`$ ng serve --verbose

nx run conduit:serve --verbose
Cannot read properties of undefined (reading 'split')
TypeError: Cannot read properties of undefined (reading 'split')
at WorkspaceNodeModulesArchitectHost.resolveBuilder (/home/projects/ser/angular-ngrx-nx-realworld-example-app/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:110:55)
at ArchitectTargetJobRegistry._resolveBuilder (/home/projects/ser/angular-ngrx-nx-realworld-example-app/node_modules/@angular-devkit/architect/src/architect.js:101:54)
at MergeMapSubscriber.project (/home/projects/ser/angular-ngrx-nx-realworld-example-app/node_modules/@angular-devkit/architect/src/architect.js:161:25)
at MergeMapSubscriber._tryNext (/home/projects/ser/angular-ngrx-nx-realworld-example-app/node_modules/@angular-devkit/architect/node_modules/rxjs/internal/operators/mergeMap.js:67:27)
at MergeMapSubscriber._next (/home/projects/ser/angular-ngrx-nx-realworld-example-app/node_modules/@angular-devkit/architect/node_modules/rxjs/internal/operators/mergeMap.js:57:18)
at MergeMapSubscriber.Subscriber.next (/home/projects/ser/angular-ngrx-nx-realworld-example-app/node_modules/@angular-devkit/architect/node_modules/rxjs/internal/Subscriber.js:66:18)
at /home/projects/ser/angular-ngrx-nx-realworld-example-app/node_modules/@angular-devkit/architect/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24

———————————————————————————————————————————————

NX ERROR Running target "conduit:serve" failed

Failed tasks:

  • conduit:serve

Hint: run the command with --verbose for more details.

`

$ node -v
v16.10.0

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/node to v18.19.31
  • chore(deps): update dependency ng-mocks to v14.12.2
  • chore(deps): update dependency ts-jest to v29.1.2
  • chore(deps): update dependency cypress to v13.8.1
  • chore(deps): update dependency eslint to v8.57.0
  • chore(deps): update dependency eslint-config-prettier to v9.1.0
  • chore(deps): update dependency prettier to v3.2.5
  • chore(deps): update dependency typescript to v5.4.5
  • chore(deps): update react monorepo to v18.3.1 (react, react-dom)
  • fix(deps): update dependency marked to v5.1.2
  • fix(deps): update ngrx monorepo to v17.2.0 (@ngrx/component-store, @ngrx/effects, @ngrx/router-store, @ngrx/signals, @ngrx/store, @ngrx/store-devtools)
  • fix(deps): update nrwl monorepo to v18.3.4 (@nx/angular, @nx/cypress, @nx/eslint, @nx/eslint-plugin, @nx/jest, @nx/workspace, nx)
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency @badeball/cypress-cucumber-preprocessor to v20
  • chore(deps): update dependency @types/marked to v6
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency eslint-plugin-cypress to v3
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency jest-preset-angular to v14
  • chore(deps): update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • fix(deps): update dependency marked to v12
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/production.yml
  • actions/checkout v4
  • actions/setup-node v3
  • South-Paw/action-netlify-deploy v1.2.1
npm
package.json
  • @angular/animations 17.3.1
  • @angular/common 17.3.1
  • @angular/compiler 17.3.1
  • @angular/core 17.3.1
  • @angular/forms 17.3.1
  • @angular/platform-browser 17.3.1
  • @angular/platform-browser-dynamic 17.3.1
  • @angular/router 17.3.1
  • @ngrx/component-store 17.1.1
  • @ngrx/effects 17.1.1
  • @ngrx/router-store 17.1.1
  • @ngrx/store 17.1.1
  • @ngrx/signals 17.1.1
  • @nx/angular 18.0.6
  • core-js 3.31.0
  • eslint-plugin-ngrx 2.1.4
  • marked 5.0.1
  • rxjs 7.8.1
  • tslib 2.6.2
  • zone.js 0.14.4
  • @angular-devkit/architect 0.1703.1
  • @angular-devkit/build-angular 17.3.1
  • @angular-devkit/core 17.3.1
  • @angular-devkit/schematics 17.3.1
  • @angular-eslint/eslint-plugin 17.3.0
  • @angular-eslint/eslint-plugin-template 17.3.0
  • @angular-eslint/template-parser 17.3.0
  • @angular/cli 17.3.1
  • @angular/compiler-cli 17.3.1
  • @angular/language-service 17.3.1
  • @ngrx/store-devtools 17.1.1
  • @nx/cypress 18.0.6
  • @nx/eslint-plugin 18.0.6
  • @nx/jest 18.0.6
  • @nx/workspace 18.0.6
  • @schematics/angular 17.0.0
  • @types/jest 29.5.4
  • @types/marked 4.3.1
  • @types/node 18.19.21
  • @typescript-eslint/eslint-plugin 6.21.0
  • @typescript-eslint/parser 6.21.0
  • cypress ^13.6.0
  • @badeball/cypress-cucumber-preprocessor ^19.2.0
  • @bahmutov/cypress-esbuild-preprocessor ^2.2.0
  • dotenv 10.0.0
  • eslint 8.56.0
  • eslint-config-prettier 9.0.0
  • eslint-plugin-cypress 2.14.0
  • eslint-plugin-rxjs ^5.0.3
  • husky 1.3.1
  • jasmine-marbles 0.9.2
  • jest 29.6.4
  • jest-environment-jsdom 29.6.4
  • jest-preset-angular 13.1.4
  • ng-mocks 14.12.1
  • nx 18.0.6
  • prettier 3.1.0
  • react ^18.2.0
  • react-dom ^18.2.0
  • ts-jest 29.1.1
  • ts-node 10.9.1
  • typescript 5.3.3
  • webpack 5.88.2
  • @nx/eslint 18.0.6

  • Check this box to trigger a request for Renovate to run again on this repository

multiple forms

Is it possible to have multiple dynamic-forms on the same page (component). It forms structure seems to get overridden by the latter form.

tsconfig.app.json

I'm just wondering, why do you include all these libs in your tsconfig.app.json?

  "include": [
    "**/*.d.ts",
    "../../libs/home/src/index.ts",
    "../../libs/editor/src/index.ts",
    "../../libs/settings/src/index.ts",
    "../../libs/article/src/index.ts",
    "../../libs/profile/src/index.ts"
  ],

Is the reason behind this, just to have all these modules included in the main bundle?
Or you just want the ready as soon as the apps is loaded?

Cause I think more elegant solution would be setting the preloadingStrategy to:

RouterModule.forRoot( routes, {
   preloadingStrategy: PreloadAllModules
})

what do you think?

Not running libs tests

git clone github.com:stefanoslig/angular-ngrx-nx-realworld-example-app.git ./
npm install
ng test
[email protected] test /Users/vuvgag/Repositories/vuvgag/math-checker
> ng test


> nx run conduit:test 
 PASS   conduit  apps/conduit/src/app/layout/footer/footer.component.spec.ts
 PASS   conduit  apps/conduit/src/app/layout/navbar/navbar.component.spec.ts
 PASS   conduit  apps/conduit/src/app/app.component.spec.ts
  ● Console

    console.warn
      @ngrx/store: The feature name "auth" does not exist in the state, therefore createFeatureSelector cannot access it.  Be sure it is imported in a loaded module using StoreModule.forRoot('auth', ...) or StoreModule.forFeature('auth', ...).  If the default state is intended to be undefined, as is the case with router state, this development-only warning message can be ignored.

      at ../../modules/store/src/selector.ts:755:17
      at ../../modules/store/src/selector.ts:574:64
          at Array.map (<anonymous>)
      at defaultStateFn (../../modules/store/src/selector.ts:574:52)
      at ../../modules/store/src/selector.ts:718:30
      at memoized (../../modules/store/src/selector.ts:101:33)
      at ../../modules/store/src/selector.ts:574:64
          at Array.map (<anonymous>)


Test Suites: 3 passed, 3 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        2.055 s
Ran all test suites.

———————————————————————————————————————————————

>  NX   SUCCESS  Running target "test" succeeded

Expected it to run all the tests from the libs folder. Tests continue to not run even when changing the code of a libs module.

Enhance Observables subscribion

Subscribed observables should be unsubscribed after the component being destroyed. I would even prefer moving the observable subscribing to HTML template and subscribing using Async pipe to guarantee unsubscribing will be managed automatically.

Suggestion: consider adding a second app

Thank you for your time creating this repo!

I suggest creating a second app for this repo so that the real world example is more true to real life. Please consider that one of the main motivations for using a mono repo is to reuse libraries in other apps, and seeing this in practice, I believe, would help users understand how to use nx in a multi application.

What are your opinions regarding my suggestion?
Thanks in advance

`npm run test` is failing due to ngrxPush pipe not found

I forked and ran the application in an effort to learn more about using Cypress in a real world app using NX and NGRX. I am getting a couple of linting and Jest errors when running npm run test command. @stefanoslig Can you please help me?

 PASS  apps/conduit/src/app/layout/footer/footer.component.spec.ts
 PASS  apps/conduit/src/app/layout/navbar/navbar.component.spec.ts
 FAIL  apps/conduit/src/app/app.component.spec.ts
  ● AppComponent › should create

    Template parse errors:
    The pipe 'ngrxPush' could not be found ("<conduit-navbar [isLoggedIn]="[ERROR ->]isLoggedIn$ | ngrxPush" [user]="user$ | ngrxPush"></conduit-navbar>
    "): ng:///DynamicTestModule/AppComponent.html@0:30
    The pipe 'ngrxPush' could not be found ("<conduit-navbar [isLoggedIn]="isLoggedIn$ | ngrxPush" [user]="[ERROR ->]user$ | ngrxPush"></conduit-navbar>
    <router-outlet></router-outlet>
    <conduit-footer></conduit-foote"): ng:///DynamicTestModule/AppComponent.html@0:62

      at syntaxError (../../../packages/compiler/src/util.ts:100:17)
      at TemplateParser.Object.<anonymous>.TemplateParser.parse (../../../packages/compiler/src/template_parser/template_parser.ts:106:13)
      at JitCompiler.Object.<anonymous>.JitCompiler._parseTemplate (../../../packages/compiler/src/jit/compiler.ts:297:33)
      at JitCompiler.Object.<anonymous>.JitCompiler._compileTemplate (../../../packages/compiler/src/jit/compiler.ts:275:11)
      at ../../../packages/compiler/src/jit/compiler.ts:206:42
          at Set.forEach (<anonymous>)
      at JitCompiler.Object.<anonymous>.JitCompiler._compileComponents (../../../packages/compiler/src/jit/compiler.ts:206:15)
      at ../../../packages/compiler/src/jit/compiler.ts:117:12
      at Object.then (../../../packages/compiler/src/util.ts:89:74)

Circular Dependencies on main

It seems to me that there are circular dependencies introduced in the project because api.service.ts references the environments that are inside the conduit app.

circular-deps-issue

From my experience, we usually had the environments as a different folder in the root directory. I can upload a small PR to fix this!

Thanks for all this effort by the way, your repo is amazing.

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.