truecourse 0.4.0 → 0.4.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.
Files changed (4) hide show
  1. package/cli.mjs +41 -210798
  2. package/package.json +3 -2
  3. package/postinstall.cjs +12 -16
  4. package/server.mjs +43 -210800
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "truecourse",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Visualize your codebase architecture as an interactive graph",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,8 @@
16
16
  "@clack/prompts": "^1.2.0",
17
17
  "commander": "^12.1.0",
18
18
  "dotenv": "^16.4.0",
19
- "pyright": "^1.1.408"
19
+ "pyright": "^1.1.408",
20
+ "typescript": "^5.7.0"
20
21
  },
21
22
  "optionalDependencies": {
22
23
  "node-windows": "^1.0.0-beta.8",
package/postinstall.cjs CHANGED
@@ -42,30 +42,26 @@ try {
42
42
 
43
43
  const { execSync } = require('child_process');
44
44
 
45
- // Read versions from our own package.json to pin exact ranges
46
- let packages;
47
- try {
48
- const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8'));
49
- const opt = pkg.optionalDependencies || {};
50
- packages = ['tree-sitter', 'tree-sitter-typescript', 'tree-sitter-javascript', 'tree-sitter-python']
51
- .map(name => opt[name] ? `${name}@"${opt[name]}"` : name)
52
- .join(' ');
53
- } catch {
54
- packages = 'tree-sitter tree-sitter-typescript tree-sitter-javascript tree-sitter-python';
55
- }
45
+ // The optional-dep install already extracted tree-sitter's source into
46
+ // node_modules/tree-sitter/ — only its native .node binary failed to build
47
+ // (Node 24 needs C++20, default is C++17). `npm rebuild` runs the build
48
+ // scripts on the existing install with our CXXFLAGS, leaving manifests
49
+ // untouched so the install survives later `npm exec` integrity passes
50
+ // that would prune an `npm install --no-save` addition as extraneous.
51
+ const packages = ['tree-sitter', 'tree-sitter-typescript', 'tree-sitter-javascript', 'tree-sitter-python'];
56
52
 
57
- log('Installing tree-sitter with CXXFLAGS="-std=c++20"...');
53
+ log('Rebuilding tree-sitter with CXXFLAGS="-std=c++20"...');
58
54
 
59
55
  try {
60
- execSync(`npm install --no-save ${packages}`, {
56
+ execSync(`npm rebuild ${packages.join(' ')}`, {
61
57
  stdio: 'inherit',
62
58
  env: { ...process.env, CXXFLAGS: '-std=c++20' },
63
59
  });
64
- log('tree-sitter: installed OK');
60
+ log('tree-sitter: rebuilt OK');
65
61
  } catch {
66
- log('tree-sitter: install failed');
62
+ log('tree-sitter: rebuild failed');
67
63
  console.warn(
68
- '\n[TrueCourse] Could not install tree-sitter automatically.\n' +
64
+ '\n[TrueCourse] Could not rebuild tree-sitter automatically.\n' +
69
65
  'Fix: set the C++20 flag manually and reinstall:\n' +
70
66
  ' export CXXFLAGS="-std=c++20"\n' +
71
67
  ' npx truecourse\n\n' +