Skip to content

Commit

Permalink
feat(operators): introduce @ngrx/operators package (#4097)
Browse files Browse the repository at this point in the history
Closes #4057
  • Loading branch information
brandonroberts authored Oct 26, 2023
1 parent f28ea71 commit e93ead4
Show file tree
Hide file tree
Showing 81 changed files with 3,008 additions and 61 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ The following is the list of supported scopes:
- **entity**
- **eslint-plugin**
- **example**
- **operators**
- **router-store**
- **schematics**
- **signals**
Expand Down
3 changes: 1 addition & 2 deletions build/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export const packages: PackageDescription[] = fs
return false;
}

// TODO: Remove signals when released as a stable package
if (path.includes('eslint-plugin') || path.includes('signals')) {
if (path.includes('eslint-plugin')) {
return false;
}

Expand Down
3 changes: 1 addition & 2 deletions build/copy-schematics-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const copySchematics = createBuilder([

copySchematics({
scope: '@ngrx',
// TODO: Remove signals when released as a stable package
packages: [...packages, { name: 'signals' }],
packages: [...packages],
}).catch((err) => {
console.error(err);
process.exit(1);
Expand Down
2 changes: 2 additions & 0 deletions build/publish-latest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export async function publishLatestToNpm() {
'schematics',
'eslint-plugin',
'data',
'signals',
'operators',
];

for (let pkg of publishablePackages) {
Expand Down
2 changes: 2 additions & 0 deletions build/publish-next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export async function publishNextToNpm() {
'schematics',
'eslint-plugin',
'data',
'signals',
'operators',
];

for (let pkg of publishablePackages) {
Expand Down
1 change: 1 addition & 0 deletions modules/component-store/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/modules/component-store",
"assets": ["migrations/**/*.json", "schematics/**/*.json", "**/files/**/*"],
"allowedNonPeerDependencies": ["@ngrx/operators"],
"lib": {
"entryFile": "index.ts"
}
Expand Down
8 changes: 5 additions & 3 deletions modules/component-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngrx/component-store",
"version": "16.3.0",
"version": "17.0.0-beta.0",
"description": "Reactive store for component state",
"repository": {
"type": "git",
Expand All @@ -22,7 +22,7 @@
},
"homepage": "https://github.com/ngrx/platform#readme",
"peerDependencies": {
"@angular/core": "^16.0.0",
"@angular/core": "^17.0.0-rc.0",
"rxjs": "^6.5.3 || ^7.5.0"
},
"schematics": "./schematics/collection.json",
Expand All @@ -38,11 +38,13 @@
"@ngrx/store-devtools",
"@ngrx/component-store",
"@ngrx/component",
"@ngrx/eslint-plugin"
"@ngrx/eslint-plugin",
"@ngrx/signals"
],
"migrations": "./migrations/migration.json"
},
"dependencies": {
"@ngrx/operators": "17.0.0-beta.0",
"tslib": "^2.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const platformVersion = '^16.3.0';
export const platformVersion = '^17.0.0-beta.0';
1 change: 1 addition & 0 deletions modules/component-store/spec/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export const compilerOptions = () => ({
experimentalDecorators: true,
paths: {
'@ngrx/component-store': ['./modules/component-store'],
'@ngrx/operators': ['./modules/operators'],
},
});
2 changes: 1 addition & 1 deletion modules/component-store/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './component-store';
export * from './tap-response';
export { tapResponse } from '@ngrx/operators';
export {
provideComponentStore,
OnStateInit,
Expand Down
4 changes: 3 additions & 1 deletion modules/component-store/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"noImplicitReturns": true,
"downlevelIteration": true,
"outDir": "../../dist/modules/component-store",
"paths": {},
"paths": {
"@ngrx/operators": ["./dist/modules/operators"]
},
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
Expand Down
9 changes: 5 additions & 4 deletions modules/component/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngrx/component",
"version": "16.3.0",
"version": "17.0.0-beta.0",
"description": "Reactive Extensions for Angular Components",
"repository": {
"type": "git",
Expand All @@ -20,8 +20,8 @@
},
"homepage": "https://github.com/ngrx/platform#readme",
"peerDependencies": {
"@angular/common": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/common": "^17.0.0-rc.0",
"@angular/core": "^17.0.0-rc.0",
"rxjs": "^6.5.3 || ^7.5.0"
},
"schematics": "./schematics/collection.json",
Expand All @@ -37,7 +37,8 @@
"@ngrx/store-devtools",
"@ngrx/component-store",
"@ngrx/component",
"@ngrx/eslint-plugin"
"@ngrx/eslint-plugin",
"@ngrx/signals"
],
"migrations": "./migrations/migration.json"
},
Expand Down
2 changes: 1 addition & 1 deletion modules/component/schematics-core/utility/libs-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const platformVersion = '^16.3.0';
export const platformVersion = '^17.0.0-beta.0';
15 changes: 8 additions & 7 deletions modules/data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngrx/data",
"version": "16.3.0",
"version": "17.0.0-beta.0",
"description": "API management for NgRx",
"repository": {
"type": "git",
Expand All @@ -20,11 +20,11 @@
},
"homepage": "https://github.com/ngrx/platform#readme",
"peerDependencies": {
"@angular/common": "^16.0.0",
"@angular/core": "^16.0.0",
"@ngrx/store": "16.3.0",
"@ngrx/effects": "16.3.0",
"@ngrx/entity": "16.3.0",
"@angular/common": "^17.0.0-rc.0",
"@angular/core": "^17.0.0-rc.0",
"@ngrx/store": "17.0.0-beta.0",
"@ngrx/effects": "17.0.0-beta.0",
"@ngrx/entity": "17.0.0-beta.0",
"rxjs": "^6.5.3 || ^7.5.0"
},
"schematics": "./schematics/collection.json",
Expand All @@ -39,7 +39,8 @@
"@ngrx/store-devtools",
"@ngrx/component-store",
"@ngrx/component",
"@ngrx/eslint-plugin"
"@ngrx/eslint-plugin",
"@ngrx/signals"
],
"migrations": "./migrations/migration.json"
},
Expand Down
2 changes: 1 addition & 1 deletion modules/data/schematics-core/utility/libs-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const platformVersion = '^16.3.0';
export const platformVersion = '^17.0.0-beta.0';
1 change: 1 addition & 0 deletions modules/effects/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/modules/effects",
"assets": ["migrations/**/*.json", "schematics/**/*.json", "**/files/**/*"],
"allowedNonPeerDependencies": ["@ngrx/operators"],
"lib": {
"entryFile": "index.ts"
}
Expand Down
10 changes: 6 additions & 4 deletions modules/effects/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngrx/effects",
"version": "16.3.0",
"version": "17.0.0-beta.0",
"description": "Side effect model for @ngrx/store",
"repository": {
"type": "git",
Expand All @@ -21,8 +21,8 @@
},
"homepage": "https://github.com/ngrx/platform#readme",
"peerDependencies": {
"@angular/core": "^16.0.0",
"@ngrx/store": "16.3.0",
"@angular/core": "^17.0.0-rc.0",
"@ngrx/store": "17.0.0-beta.0",
"rxjs": "^6.5.3 || ^7.5.0"
},
"schematics": "./schematics/collection.json",
Expand All @@ -37,12 +37,14 @@
"@ngrx/store-devtools",
"@ngrx/component-store",
"@ngrx/component",
"@ngrx/eslint-plugin"
"@ngrx/eslint-plugin",
"@ngrx/signals"
],
"migrations": "./migrations/migration.json"
},
"sideEffects": false,
"dependencies": {
"@ngrx/operators": "17.0.0-beta.0",
"tslib": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion modules/effects/schematics-core/utility/libs-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const platformVersion = '^16.3.0';
export const platformVersion = '^17.0.0-beta.0';
1 change: 1 addition & 0 deletions modules/effects/spec/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const compilerOptions = () => ({
paths: {
'@ngrx/store': ['./modules/store'],
'@ngrx/effects': ['./modules/effects'],
'@ngrx/operators': ['./modules/operators'],
rxjs: ['../npm/node_modules/rxjs', './node_modules/rxjs'],
},
});
2 changes: 1 addition & 1 deletion modules/effects/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export {
OnInitEffects,
} from './lifecycle_hooks';
export { USER_PROVIDED_EFFECTS } from './tokens';
export { concatLatestFrom } from './concat_latest_from';
export { concatLatestFrom } from '@ngrx/operators';
export { provideEffects } from './provide_effects';
4 changes: 3 additions & 1 deletion modules/effects/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"noImplicitReturns": true,
"downlevelIteration": true,
"outDir": "../../dist/modules/effects",
"paths": {},
"paths": {
"@ngrx/operators": ["./dist/modules/operators"]
},
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
Expand Down
9 changes: 5 additions & 4 deletions modules/entity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngrx/entity",
"version": "16.3.0",
"version": "17.0.0-beta.0",
"description": "Common utilities for entity reducers",
"repository": {
"type": "git",
Expand All @@ -20,8 +20,8 @@
},
"homepage": "https://github.com/ngrx/platform#readme",
"peerDependencies": {
"@angular/core": "^16.0.0",
"@ngrx/store": "16.3.0",
"@angular/core": "^17.0.0-rc.0",
"@ngrx/store": "17.0.0-beta.0",
"rxjs": "^6.5.3 || ^7.5.0"
},
"schematics": "./schematics/collection.json",
Expand All @@ -36,7 +36,8 @@
"@ngrx/store-devtools",
"@ngrx/component-store",
"@ngrx/component",
"@ngrx/eslint-plugin"
"@ngrx/eslint-plugin",
"@ngrx/signals"
],
"migrations": "./migrations/migration.json"
},
Expand Down
2 changes: 1 addition & 1 deletion modules/entity/schematics-core/utility/libs-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const platformVersion = '^16.3.0';
export const platformVersion = '^17.0.0-beta.0';
5 changes: 3 additions & 2 deletions modules/eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngrx/eslint-plugin",
"version": "16.3.0",
"version": "17.0.0-beta.0",
"description": "NgRx ESLint Plugin",
"repository": {
"type": "git",
Expand Down Expand Up @@ -30,7 +30,8 @@
"@ngrx/store-devtools",
"@ngrx/component-store",
"@ngrx/component",
"@ngrx/eslint-plugin"
"@ngrx/eslint-plugin",
"@ngrx/signals"
],
"migrations": "./migrations/migration.json"
},
Expand Down
26 changes: 26 additions & 0 deletions modules/operators/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "schematics-core"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"parserOptions": {
"project": ["modules/operators/tsconfig.*?.json"]
},
"rules": {
"@angular-eslint/directive-selector": "off",
"@angular-eslint/component-selector": "off"
},
"plugins": ["@typescript-eslint"]
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
3 changes: 3 additions & 0 deletions modules/operators/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Change Log

See [CHANGELOG.md](https://github.com/ngrx/platform/blob/main/CHANGELOG.md)
3 changes: 3 additions & 0 deletions modules/operators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @ngrx/operators

The sources for this package are in the main [NgRx](https://github.com/ngrx/platform) repo. Please file issues and pull requests against that repo.
7 changes: 7 additions & 0 deletions modules/operators/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* DO NOT EDIT
*
* This file is automatically generated at build
*/

export * from './src/index';
22 changes: 22 additions & 0 deletions modules/operators/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'Operators',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/modules/operators',
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
4 changes: 4 additions & 0 deletions modules/operators/migrations/migration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {}
}
8 changes: 8 additions & 0 deletions modules/operators/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/modules/operators",
"assets": ["migrations/**/*.json", "schematics/**/*.json", "**/files/**/*"],
"lib": {
"entryFile": "index.ts"
}
}
Loading

0 comments on commit e93ead4

Please sign in to comment.