Skip to content

Commit

Permalink
feat: upgrade to Angular 17, add selectSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt committed Dec 1, 2023
1 parent 0fd1fe5 commit 9813a74
Show file tree
Hide file tree
Showing 107 changed files with 3,475 additions and 11,380 deletions.
6 changes: 2 additions & 4 deletions .bundlemonrc.integration.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@
"maxPercentIncrease": 1
}
],
"reportOutput": [
"github"
]
}
"reportOutput": ["github"]
}
6 changes: 2 additions & 4 deletions .bundlemonrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,5 @@
"compression": "gzip"
}
],
"reportOutput": [
"github"
]
}
"reportOutput": ["github"]
}
6 changes: 2 additions & 4 deletions .bundlemonrc.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,5 @@
"compression": "gzip"
}
],
"reportOutput": [
"github"
]
}
"reportOutput": ["github"]
}
16 changes: 0 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,6 @@ jobs:
name: Run integration tests for the SSR build application
command: yarn test:ci:integration:ssr

integration_ng15_tests:
<<: *job_defaults
steps:
- *attach_workspace
# https://github.com/CircleCI-Public/browser-tools-orb/issues/75
- browser-tools/install-browser-tools:
chrome-version: '116.0.5845.96'
replace-existing-chrome: true
- run:
name: Run integration tests for ng15 application
command: yarn integration:ng15
- persist_to_workspace:
root: ~/workspace
paths:
- app/integrations/hello-world-ng15/dist-integration

integration_ng16_tests:
<<: *job_defaults
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# - ./.github/actions/download-integration-test-artifacts

name: download-integration-test-artifact
description: Downloads all integration test artifacts with names such as 'hello-world-ng15'.
description: Downloads all integration test artifacts with names such as 'hello-world-ng16'.

inputs:
path:
Expand All @@ -18,8 +18,8 @@ inputs:
runs:
using: 'composite'
steps:
- name: Download hello-world-ng15 artifacts
- name: Download hello-world-ng16 artifacts
uses: actions/download-artifact@v3
with:
name: hello-world-ng15
name: hello-world-ng16
path: ${{ inputs.path }}
1 change: 0 additions & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ runs:
~/.cache
./node_modules
./@ngxs
./integrations/hello-world-ng15/dist-integration
./integrations/hello-world-ng16/dist-integration
./integrations/hello-world-ng17/dist-integration
key: ${{ runner.os }}-node-${{ inputs.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}-branch-${{ inputs.github-ref-name }}-sha-${{ inputs.github-sha }}
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/upload-integration-test-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
# - ./.github/actions/upload-integration-test-artifact

name: upload-integration-test-artifact
description: Upload an integration test artifact with a name such as 'hello-world-ng15'.
description: Upload an integration test artifact with a name such as 'hello-world-ng16'.

inputs:
script:
description: A script with a name such as 'integration:ng15' that generates an integration test artifact.
description: A script with a name such as 'integration:ng16' that generates an integration test artifact.
required: true

runs:
Expand All @@ -21,7 +21,7 @@ runs:
id: artifact-name
shell: bash
run: |
echo "Replace colons with dashes, substring 'integration' with a substring 'hello-world'. Example result: hello-world-ng15"
echo "Replace colons with dashes, substring 'integration' with a substring 'hello-world'. Example result: hello-world-ng16"
echo "value=$(echo ${SCRIPT} | sed -r "s/:/-/g" | sed -r "s/integration/hello-world/g")" >> $GITHUB_OUTPUT
env:
SCRIPT: ${{ inputs.script }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ yarn-error.log
package-lock.json
dist-integration-server/
.cache
migrations.json
.nx/cache
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ build/**
coverage/**
@ngxs/**
**/dist/**

/.nx/cache
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ If you have ideas for creating unique libraries, you can join us. Email us at `n

#### Community

| Project | Package | Version | Links |
| ----------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Reset Plugin** | [`ngxs-reset-plugin`](https://npmjs.com/package/ngxs-reset-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-reset-plugin/latest.svg)](https://npmjs.com/package/ngxs-reset-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/ng-turkey/ngxs-reset-plugin/blob/master/README.md) |
| **NGXS-Loading-plugin** | [`ngxs-loading-plugin`](https://www.npmjs.com/package/ngxs-loading-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-loading-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-loading-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/sa-bangash/ngxs-plugin/blob/master/README.md) |
| **NGXS-History-plugin** | [`ngxs-history-plugin`](https://www.npmjs.com/package/ngxs-history-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-history-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-history-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/profanis/ngxs-history-plugin/blob/main/projects/ngxs-history-plugin/README.md) |
| Project | Package | Version | Links |
| ----------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Reset Plugin** | [`ngxs-reset-plugin`](https://npmjs.com/package/ngxs-reset-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-reset-plugin/latest.svg)](https://npmjs.com/package/ngxs-reset-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/ng-turkey/ngxs-reset-plugin/blob/master/README.md) |
| **NGXS-Loading-plugin** | [`ngxs-loading-plugin`](https://www.npmjs.com/package/ngxs-loading-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-loading-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-loading-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/sa-bangash/ngxs-plugin/blob/master/README.md) |
| **NGXS-History-plugin** | [`ngxs-history-plugin`](https://www.npmjs.com/package/ngxs-history-plugin) | [![latest](https://img.shields.io/npm/v/ngxs-history-plugin/latest.svg)](https://www.npmjs.com/package/ngxs-history-plugin) | [![README](https://img.shields.io/badge/README--green.svg)](https://github.com/profanis/ngxs-history-plugin/blob/main/projects/ngxs-history-plugin/README.md) |

# Contributors

Expand Down
6 changes: 3 additions & 3 deletions docs/advanced/selector-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Let's start with a common example. Here we have a small state containing animals

```ts
import { Injectable } from '@angular/core';
import { Selector,State } from '@ngxs/store';
import { Selector, State } from '@ngxs/store';

export interface AnimalsStateModel {
zebras: string[];
Expand All @@ -30,8 +30,8 @@ export interface AnimalsStateModel {
defaults: {
zebras: [],
pandas: [],
monkeys: [],
},
monkeys: []
}
})
@Injectable()
export class AnimalsState {}
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { NgxsModule } from '@ngxs/store';
import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';

@NgModule({
imports: [NgxsModule.forRoot([]), NgxsReduxDevtoolsPluginModule.forRoot()],
imports: [NgxsModule.forRoot([]), NgxsReduxDevtoolsPluginModule.forRoot()]
})
export class AppModule {}
```
Expand Down
4 changes: 1 addition & 3 deletions docs/plugins/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ import { RouterDataResolved } from '@ngxs/router-plugin';
import { map } from 'rxjs/operators';

@Component({
template: `
<app-some-component [data]="data$ | async"></app-some-component>
`
template: ` <app-some-component [data]="data$ | async"></app-some-component> `
})
export class AppComponent {
data$ = this.actions$.pipe(
Expand Down
5 changes: 2 additions & 3 deletions docs/recipes/component-events-from-ngxs.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ export class LoadBooks {

export class BooksState {
static getBooks(genre: Genre) {
return createSelector(
[BooksState],
(books: Book[]) => books.filter(book => book.genre === genre)
return createSelector([BooksState], (books: Book[]) =>
books.filter(book => book.genre === genre)
);
}
}
Expand Down
51 changes: 29 additions & 22 deletions docs/recipes/module-federation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,36 @@ For this purpose, the dependencies are specified in the shared object in `webpac
```js
plugins: [
new ModuleFederationPlugin({

name: "mfOne",
filename: "remoteEntry.js",
exposes: {
'./mfModuleX': './apps/mfOne/src/app/x/x.module.ts',
'./mfModuleY': './apps/mfOne/src/app/y/y.module.ts',
new ModuleFederationPlugin({
name: 'mfOne',
filename: 'remoteEntry.js',
exposes: {
'./mfModuleX': './apps/mfOne/src/app/x/x.module.ts',
'./mfModuleY': './apps/mfOne/src/app/y/y.module.ts'
},

shared: share({
'@angular/core': { singleton: true, strictVersion: true, requiredVersion: 'auto' },
'@angular/common': { singleton: true, strictVersion: true, requiredVersion: 'auto' },
'@angular/common/http': {
singleton: true,
strictVersion: true,
requiredVersion: 'auto'
},

shared: share({
"@angular/core": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@angular/common": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@angular/common/http": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@angular/router": {singleton: true, strictVersion: true, requiredVersion: 'auto'},
"@ngxs/devtools-plugin": {singleton: true, strictVersion: true, requiredVersion: '3.7.2'},
"@ngxs/store": {singleton: true, strictVersion: true, requiredVersion: '3.7.2'},
"rxjs": {singleton: true, strictVersion: true, requiredVersion: '6.6.7'},

...sharedMappings.getDescriptors()
})
}),
sharedMappings.getPlugin()
]
'@angular/router': { singleton: true, strictVersion: true, requiredVersion: 'auto' },
'@ngxs/devtools-plugin': {
singleton: true,
strictVersion: true,
requiredVersion: '3.7.2'
},
'@ngxs/store': { singleton: true, strictVersion: true, requiredVersion: '3.7.2' },
rxjs: { singleton: true, strictVersion: true, requiredVersion: '6.6.7' },

...sharedMappings.getDescriptors()
})
}),
sharedMappings.getPlugin()
];
```

## Into libraries
Expand Down
9 changes: 4 additions & 5 deletions integration/app/app-browser.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ApplicationConfig } from '@angular/platform-browser';
import { mergeApplicationConfig } from '@angular/core';
import { provideAnimations } from '@angular/platform-browser/animations';

import { appConfig } from './app.config';

// TODO: use `mergeApplicationConfig` in v16.
export const appBrowserConfig: ApplicationConfig = {
providers: [provideAnimations(), ...appConfig.providers]
};
export const appBrowserConfig = mergeApplicationConfig(appConfig, {
providers: [provideAnimations()]
});
11 changes: 5 additions & 6 deletions integration/app/app-server.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ApplicationConfig } from '@angular/platform-browser';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { mergeApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';

import { appConfig } from './app.config';

// TODO: use `mergeApplicationConfig` in v16.
export const appServerConfig: ApplicationConfig = {
providers: [provideNoopAnimations(), ...appConfig.providers]
};
export const appBrowserConfig = mergeApplicationConfig(appConfig, {
providers: [provideServerRendering()]
});
6 changes: 3 additions & 3 deletions integration/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="todo-list">
<div>
<h3>Reactive Form</h3>
<p>{{ injected$ | async }}</p>
<p>{{ injected() }}</p>
<form [formGroup]="pizzaForm" novalidate (ngSubmit)="onSubmit()" ngxsForm="todos.pizza">
Toppings: <input type="text" formControlName="toppings" /> <br />
Crust <input type="text" formControlName="crust" /> <br />
Expand All @@ -23,10 +23,10 @@ <h3>Todo Form</h3>
<input placeholder="New Todo" #text /> <button (click)="addTodo(text.value)">Add</button>
</div>
<ul>
<li class="todo" *ngFor="let todo of todos$ | async; let i = index">
<li class="todo" *ngFor="let todo of todos(); let i = index">
{{ todo }} <button (click)="removeTodo(i)">🗑</button>
</li>
<li *ngFor="let todo of pandas$ | async">🐼</li>
<li *ngFor="let todo of pandas()">🐼</li>
</ul>

<div class="menu">
Expand Down
Loading

0 comments on commit 9813a74

Please sign in to comment.