claude-usage-dashboard 1.0.3 → 1.0.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/server/index.js +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-usage-dashboard",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Dashboard that visualizes Claude Code usage from local session logs",
5
5
  "main": "server/index.js",
6
6
  "bin": {
package/server/index.js CHANGED
@@ -1,15 +1,20 @@
1
1
  import express from 'express';
2
2
  import path from 'path';
3
3
  import os from 'os';
4
+ import { createRequire } from 'module';
4
5
  import { fileURLToPath } from 'url';
5
6
  import { createApiRouter } from './routes/api.js';
6
7
 
7
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+ const require = createRequire(import.meta.url);
8
10
  const PORT = process.env.PORT || 3000;
9
11
  const LOG_DIR = path.join(os.homedir(), '.claude', 'projects');
10
12
 
13
+ // Resolve d3 via Node module resolution so it works when dependencies are hoisted (e.g. npx)
14
+ const d3Dir = path.dirname(require.resolve('d3/dist/d3.min.js'));
15
+
11
16
  const app = express();
12
- app.use('/lib/d3', express.static(path.join(__dirname, '..', 'node_modules', 'd3', 'dist')));
17
+ app.use('/lib/d3', express.static(d3Dir));
13
18
  app.use(express.static(path.join(__dirname, '..', 'public')));
14
19
  app.use('/api', createApiRouter(LOG_DIR));
15
20