@amadeus-it-group/ngrx-devtool 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # NgRx DevTool
2
+
3
+ A development tool for visualizing and debugging NgRx state management in Angular applications. Real-time action monitoring, effect tracking, state visualization, diff viewer, and performance metrics — no browser extensions needed.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @amadeus-it-group/ngrx-devtool
9
+ ```
10
+
11
+ > If your project uses a private npm registry and you get an E401 error:
12
+ > ```bash
13
+ > npm install @amadeus-it-group/ngrx-devtool --registry=https://registry.npmjs.org/
14
+ > ```
15
+
16
+ ## Setup
17
+
18
+ ```typescript
19
+ // app.config.ts
20
+ import { provideNgrxDevTool, createDevToolMetaReducer } from '@amadeus-it-group/ngrx-devtool';
21
+
22
+ export const appConfig: ApplicationConfig = {
23
+ providers: [
24
+ provideStore(
25
+ { /* your reducers */ },
26
+ { metaReducers: [createDevToolMetaReducer()] }
27
+ ),
28
+ provideEffects([YourEffects]),
29
+ provideNgrxDevTool({
30
+ wsUrl: 'ws://localhost:4000',
31
+ trackEffects: true,
32
+ }),
33
+ ]
34
+ };
35
+ ```
36
+
37
+ > **If you have a separate store module** (e.g. `RootStoreModule`), add `createDevToolMetaReducer()` inside that module's `StoreModule.forRoot()`, not in `app.config.ts`:
38
+ >
39
+ > ```typescript
40
+ > // store.module.ts
41
+ > @NgModule({
42
+ > imports: [
43
+ > StoreModule.forRoot(
44
+ > { /* your reducers */ },
45
+ > { metaReducers: [createDevToolMetaReducer()] }
46
+ > ),
47
+ > EffectsModule.forRoot([YourEffects])
48
+ > ]
49
+ > })
50
+ > export class RootStoreModule {}
51
+ >
52
+ > // app.config.ts - only add the devtool provider here
53
+ > providers: [
54
+ > provideNgrxDevTool({ wsUrl: 'ws://localhost:4000', trackEffects: true }),
55
+ > ]
56
+ > ```
57
+
58
+ ## Run
59
+
60
+ ```bash
61
+ npx ngrx-devtool
62
+ ```
63
+
64
+ > If your project uses a private registry:
65
+ > ```bash
66
+ > npm_config_registry=https://registry.npmjs.org/ npx ngrx-devtool
67
+ > ```
68
+
69
+ Open [http://localhost:3000](http://localhost:3000) and start your Angular app.
70
+
71
+ ## GitHub
72
+
73
+ [github.com/amadeusitgroup/ngrx-devtool](https://github.com/amadeusitgroup/ngrx-devtool)
74
+
75
+ ## License
76
+
77
+ MIT
package/index.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ var ws_1 = require("ws");
5
+ var path = require("path");
6
+ var express = require("express");
7
+ var http_1 = require("http");
8
+ var chalk = require('chalk');
9
+ var PORT_WS = 4000;
10
+ var PORT_UI = '3000';
11
+ var wss = new ws_1.WebSocketServer({ port: PORT_WS });
12
+ var clients = [];
13
+ var logo = "\n ***@ +**\n ** ******%\n @** .......-:: ++%\n #****% ................... *+\n ** . ..................... +\n #*.... .............:--=- :. =\n # . ...............:-%*%% %. =\n ** ..................*. *-+@. =\n %*** .......... ** ...... ....... +\n *# ....:::#********# .... .. .... =:\n * .. ...:::****+=@@@@@@@@@@@ ....... #=\n %* ..:. ...:: +*+.@@@@@@@@@@@@@@@@@@@@%###%%###*+\n # ... ...:::++=@@@@@@@@%%%%%%%%@@@@@@@@@#%%-## ** =\n *# . ..:::*++@@@@@@%%%%%%##%%%%%%%%@@@@@@@+###+:** ..\n ** ..:::=+-@@@@@%%% ##%%%%@@@@@@*.#@%+# ##..\n %* ..:::*=%@@@@%%%%% ##%%%%%%@@@@+%%%%%*# #. *\n *# ..:::.=@@@@@%%%%%%########* ####%%%%@@@@%*%## ## .\n * .::::+.@@@@%%%%%%%%%%%#####* @*###%%%%@%@#%%#%-@% #.\n * . :::::=@@%%%%%%%%%%#####%@= *####%%%%%%*### .%##%.\n * .. .::::=@@%%%%%%#### *####%%%%%%%## %-# .\n :* ..:::-@@%%%%####* @###*# *####%%%%%%#* ## -:\n ..*#* .:::-%@%%%%#### ######* *#####%%*##@ @# .:=*\n =+ + =..:::%@%%%%#### ######* *#####%%#* .. ..:@+\n %+ -= +..-: %%%%%####. ####%%%% =.. ... @#*\n *+ = . + .--%%%%%%####* % ##%%%#-.... ... # *-\n @*:++ : += -:%%%#######******#########%%%%%%%%%%%# =. #*:*\n ** ** : ++ =:%%%%##*********####%%%%%%%%%%%%%%@ :::...** :**\n ** ** . . .== . ### ++++++***####%%%%%%%%%%+ --:::: #* ::@#-\n . ** ## === %** .::-++*###%% :.+-:::::::::@*% =---##%\n . ** *#@ =--== :=**#%%%%% :..:....::.====-%**:.\n +#@## *-: %*###%%%###- :::==++==@%#%..\n +**:*## . .......:::::+===++==%%##.:.\n . **#=#### ....:::--------==.-===+%%%#%::.\n . . **#++#### .....:.::::::::-:::-====%%%*#%-:-:\n ... *##-+#####@ .. .::::::. .:::---%%%%#*#%---::\n ..:. **###*######%%@ .. ... @#%%%%%%#*#%.--=::\n .... **##%=*####%%%%%%%%%%%#%****## ---:::\n ..... .*****%#%#=+***--####%=-:-:-:::\n ::::====---- ===--=::::\n . .:.:::-:::--:::::::\n .........:\n";
14
+ console.log(chalk.magenta(logo));
15
+ console.log(chalk.dim('─'.repeat(60)));
16
+ console.log(chalk.bold.white(' Amadeus | NgRx DevTools Server'));
17
+ console.log(chalk.dim('─'.repeat(60)));
18
+ wss.on('connection', function (socket) {
19
+ clients.push(socket);
20
+ socket.on('message', function (message) {
21
+ clients.forEach(function (client) {
22
+ if (client !== socket && client.readyState === ws_1.WebSocket.OPEN) {
23
+ client.send(message);
24
+ }
25
+ });
26
+ });
27
+ });
28
+ var app = express();
29
+ app.use(express.static(path.resolve(__dirname, 'ngrx-devtool-ui/browser')));
30
+ app.get('*', function (_req, res) {
31
+ res.sendFile(path.resolve(__dirname, 'ngrx-devtool-ui/browser/index.html'));
32
+ });
33
+ var uiServer = (0, http_1.createServer)(app);
34
+ uiServer.listen(Number(PORT_UI), function () { });
35
+ uiServer.on('error', function (error) {
36
+ console.error(chalk.red(" \u2717 Failed to start UI server: ".concat(error.message)));
37
+ });
38
+ process.on('SIGINT', function () {
39
+ console.log(chalk.dim('\n\n Shutting down servers...'));
40
+ uiServer.close();
41
+ wss.close();
42
+ console.log(chalk.green(' ✓ Servers stopped. Goodbye!\n'));
43
+ process.exit(0);
44
+ });
45
+ console.log('');
46
+ console.log(chalk.green(" \u2713 WebSocket"), chalk.dim("ws://localhost:".concat(PORT_WS)));
47
+ console.log(chalk.green(" \u2713 UI Server"), chalk.dim("http://localhost:".concat(PORT_UI)));
48
+ console.log('');
49
+ console.log(chalk.dim('─'.repeat(60)));
50
+ console.log(chalk.dim(' Press'), chalk.white('Ctrl+C'), chalk.dim('to stop all servers'));
51
+ console.log(chalk.dim('─'.repeat(60)));
52
+ console.log('');