Skip to content

Commit b6338b7

Browse files
CopilotLayZeeDK
andcommitted
Complete @ngworker/router-store package implementation
Co-authored-by: LayZeeDK <[email protected]>
1 parent 95dc502 commit b6338b7

35 files changed

+1080
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ Thumbs.db
4343

4444
.cursor/rules/nx-rules.mdc
4545
.github/instructions/nx.instructions.md
46+
47+
.angular

knip.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
"angular": {
44
"config": ["project.json"]
55
},
6-
"include": ["nsExports", "nsTypes", "classMembers"],
6+
"include": ["nsExports", "nsTypes"],
77
"ignoreDependencies": [
88
"@angular-eslint/eslint-plugin",
99
"@angular-eslint/template-parser",
1010
"@angular/cli",
1111
"@angular/compiler",
12+
"@angular/forms",
1213
"@angular/language-service",
1314
"@ngrx/component-store",
1415
"@ngrx/signals",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
"yarn": "^1.22.22"
1515
},
1616
"dependencies": {
17+
"@angular/animations": "17.0.9",
1718
"@angular/common": "17.0.9",
1819
"@angular/compiler": "17.0.9",
1920
"@angular/core": "17.0.9",
21+
"@angular/forms": "17.0.9",
2022
"@angular/platform-browser": "17.0.9",
2123
"@angular/platform-browser-dynamic": "17.0.9",
2224
"@angular/router": "17.0.9",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"extends": [
8+
"plugin:@nx/angular",
9+
"plugin:@angular-eslint/template/process-inline-templates"
10+
],
11+
"rules": {
12+
"@angular-eslint/directive-selector": [
13+
"error",
14+
{
15+
"type": "attribute",
16+
"prefix": "ngworker",
17+
"style": "camelCase"
18+
}
19+
],
20+
"@angular-eslint/component-selector": [
21+
"error",
22+
{
23+
"type": "element",
24+
"prefix": "ngworker",
25+
"style": "kebab-case"
26+
}
27+
]
28+
}
29+
},
30+
{
31+
"files": ["*.html"],
32+
"extends": ["plugin:@nx/angular-template"],
33+
"rules": {}
34+
},
35+
{
36+
"files": ["*.json"],
37+
"parser": "jsonc-eslint-parser",
38+
"rules": {
39+
"@nx/dependency-checks": "error"
40+
}
41+
}
42+
]
43+
}

packages/router-store/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# router-store
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Running unit tests
6+
7+
Run `nx test router-store` to execute the unit tests.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'router-store',
4+
preset: '../../jest.preset.js',
5+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
6+
coverageDirectory: '../../coverage/packages/router-store',
7+
transform: {
8+
'^.+\\.(ts|mjs|js|html)$': [
9+
'jest-preset-angular',
10+
{
11+
tsconfig: '<rootDir>/tsconfig.spec.json',
12+
stringifyContentPathRegex: '\\.(html|svg)$',
13+
},
14+
],
15+
},
16+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17+
snapshotSerializers: [
18+
'jest-preset-angular/build/serializers/no-ng-attributes',
19+
'jest-preset-angular/build/serializers/ng-snapshot',
20+
'jest-preset-angular/build/serializers/html-comment',
21+
],
22+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3+
"dest": "../../dist/packages/router-store",
4+
"lib": {
5+
"entryFile": "src/index.ts"
6+
}
7+
}

packages/router-store/package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@ngworker/router-store",
3+
"version": "17.0.0",
4+
"description": "A strictly typed lightweight alternative to NgRx Router Store and ActivatedRoute using Angular Signals",
5+
"license": "MIT",
6+
"sideEffects": false,
7+
"peerDependencies": {
8+
"@angular/core": "^17.0.0",
9+
"@angular/router": "^17.0.0"
10+
},
11+
"dependencies": {},
12+
"keywords": [
13+
"angular",
14+
"router",
15+
"signals",
16+
"ngworker"
17+
],
18+
"author": {
19+
"name": "Lars Gyrup Brink Nielsen",
20+
"email": "[email protected]",
21+
"url": "https://github.com/LayZeeDK"
22+
},
23+
"contributors": [],
24+
"funding": [
25+
{
26+
"type": "individual",
27+
"url": "https://github.com/sponsors/LayZeeDK"
28+
}
29+
],
30+
"publishConfig": {
31+
"access": "public",
32+
"registry": "https://registry.npmjs.org/",
33+
"tag": "unknown"
34+
},
35+
"bugs": {
36+
"url": "https://github.com/ngworker/router-component-store/issue"
37+
},
38+
"homepage": "https://github.com/ngworker/router-component-store#readme",
39+
"repository": {
40+
"type": "git",
41+
"url": "https://github.com/ngworker/router-component-store"
42+
}
43+
}

packages/router-store/project.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "router-store",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "packages/router-store/src",
5+
"prefix": "ngworker",
6+
"tags": [],
7+
"projectType": "library",
8+
"targets": {
9+
"build": {
10+
"executor": "@nx/angular:package",
11+
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
12+
"options": {
13+
"project": "packages/router-store/ng-package.json"
14+
},
15+
"configurations": {
16+
"production": {
17+
"tsConfig": "packages/router-store/tsconfig.lib.prod.json"
18+
},
19+
"development": {
20+
"tsConfig": "packages/router-store/tsconfig.lib.json"
21+
}
22+
},
23+
"defaultConfiguration": "production"
24+
},
25+
"test": {
26+
"executor": "@nx/jest:jest",
27+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
28+
"options": {
29+
"jestConfig": "packages/router-store/jest.config.ts"
30+
}
31+
},
32+
"lint": {
33+
"executor": "@nx/eslint:lint",
34+
"outputs": ["{options.outputFile}"]
35+
}
36+
}
37+
}

packages/router-store/src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// GlobalRouterStore
2+
export * from './lib/global-router-store/provide-global-router-store';
3+
// Serializable route state
4+
export * from './lib/@ngrx/router-store/minimal-activated-route-state-snapshot';
5+
// LocalRouterStore
6+
export * from './lib/local-router-store/provide-local-router-store';
7+
// RouterStore
8+
export * from './lib/router-store';
9+
export * from './lib/strict-query-params';
10+
export * from './lib/strict-route-data';
11+
export * from './lib/strict-route-params';

0 commit comments

Comments
 (0)