analytics-node-agent 1.0.0 → 1.0.1

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.
Files changed (3) hide show
  1. package/README.md +93 -0
  2. package/index.js +2 -0
  3. package/package.json +4 -2
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # analytics-node-agent
2
+
3
+ A lightweight Node.js monitoring agent that runs as an independent Express-based service and exposes system/runtime analytics.
4
+
5
+ ## Install
6
+
7
+ Install globally to run it as a standalone command:
8
+
9
+ ```bash
10
+ npm install -g analytics-node-agent
11
+ ```
12
+
13
+ Install locally inside another project:
14
+
15
+ ```bash
16
+ npm install analytics-node-agent
17
+ ```
18
+
19
+ ## Run
20
+
21
+ After global installation, start the service directly from the terminal:
22
+
23
+ ```bash
24
+ analytics-node-agent
25
+ ```
26
+
27
+ If your package uses a configurable port through environment variables, export them before starting the service:
28
+
29
+ ```bash
30
+ PORT=4000 analytics-node-agent
31
+ ```
32
+
33
+ ## PM2
34
+
35
+ Run it under PM2 as a long-running background process:
36
+
37
+ ```bash
38
+ pm2 start analytics-node-agent --name analytics-node-agent
39
+ pm2 save
40
+ ```
41
+
42
+ If you prefer to run the npm start script from a project checkout, PM2 also supports starting npm directly:
43
+
44
+ ```bash
45
+ pm2 start npm --name analytics-node-agent -- start
46
+ ```
47
+
48
+ ## What it does
49
+
50
+ - Starts a Node.js service that can run independently after global installation through an executable configured with the `bin` field in `package.json`.[1][2]
51
+ - Can be installed globally so the command is linked into npm's global bin directory and run like any other CLI tool.[1][2]
52
+ - Can be managed with PM2 like other Node.js processes, including running via a direct executable or through `npm start`.[3][4]
53
+
54
+ ## Package setup
55
+
56
+ To work as a terminal command, the package should include:
57
+
58
+ ```json
59
+ {
60
+ "name": "analytics-node-agent",
61
+ "version": "1.0.1",
62
+ "type": "module",
63
+ "main": "index.js",
64
+ "bin": {
65
+ "analytics-node-agent": "./index.js"
66
+ },
67
+ "scripts": {
68
+ "start": "node index.js",
69
+ "dev": "nodemon index.js"
70
+ }
71
+ }
72
+ ```
73
+
74
+ Your entry file should begin with a shebang so the command can execute correctly when installed globally:[2]
75
+
76
+ ```js
77
+ #!/usr/bin/env node
78
+ ```
79
+
80
+ ## Publish updates
81
+
82
+ README changes only appear on the npm package page after publishing a new version, so bump the version and publish again after adding this file.[5]
83
+
84
+ ```bash
85
+ npm version patch
86
+ npm publish
87
+ ```
88
+
89
+ ## Notes
90
+
91
+ - Keep `README.md` in the package root so npm shows it on the package page.[5]
92
+ - Avoid shipping unnecessary files; npm publishes files from your package root into the tarball shown during publish.[5]
93
+ - For a production deployment, use PM2 logs and restart policies after confirming the service starts cleanly.[4]
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  import express from 'express'
2
4
  import si from 'systeminformation'
3
5
 
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
-
2
1
  {
3
2
  "name": "analytics-node-agent",
4
- "version": "1.0.0",
3
+ "version": "1.0.1",
5
4
  "type": "module",
6
5
  "main": "index.js",
6
+ "bin": {
7
+ "analytics-node-agent": "./index.js"
8
+ },
7
9
  "scripts": {
8
10
  "start": "node index.js",
9
11
  "dev": "nodemon index.js"