@anxin233/gitviz 1.0.0 β†’ 1.0.3

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/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@anxin233/gitviz",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "🎨 Beautiful, interactive Git repository visualizations - Transform your Git history into stunning visual stories",
5
5
  "type": "module",
6
6
  "bin": {
7
- "gitviz": "./dist/cli.js"
7
+ "gitviz": "./dist/cli.cjs"
8
8
  },
9
9
  "scripts": {
10
10
  "dev": "node --loader ts-node/esm src/cli/index.ts",
11
- "build": "tsc && node scripts/bundle.js",
11
+ "build": "node scripts/build-esbuild.js",
12
+ "build:tsc": "tsc && node scripts/bundle.js",
12
13
  "build:bun": "bun build src/cli/index.ts --outfile dist/cli.js --target node --minify",
13
14
  "build:web": "cd src/web && vite build",
14
15
  "preview": "cd src/web && vite preview",
@@ -46,6 +47,7 @@
46
47
  "@types/node": "^20.11.0",
47
48
  "@types/d3": "^7.4.3",
48
49
  "typescript": "^5.3.3",
50
+ "esbuild": "^0.20.0",
49
51
  "vite": "^5.0.12",
50
52
  "@vitejs/plugin-react": "^4.2.1",
51
53
  "react": "^18.2.0",
@@ -0,0 +1,48 @@
1
+ import { build } from 'esbuild';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname, join } from 'path';
4
+ import { readFileSync, writeFileSync } from 'fs';
5
+
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ const rootDir = join(__dirname, '..');
8
+
9
+ console.log('πŸ“¦ Building with esbuild...');
10
+
11
+ build({
12
+ entryPoints: [join(rootDir, 'src', 'cli', 'index.ts')],
13
+ bundle: true,
14
+ platform: 'node',
15
+ target: 'node18',
16
+ format: 'cjs',
17
+ outfile: join(rootDir, 'dist', 'cli.cjs'),
18
+ external: [
19
+ 'fs',
20
+ 'path',
21
+ 'url',
22
+ 'util',
23
+ 'events',
24
+ 'stream',
25
+ 'child_process',
26
+ 'os',
27
+ 'crypto'
28
+ ],
29
+ minify: false,
30
+ sourcemap: false,
31
+ logLevel: 'info'
32
+ }).then(() => {
33
+ // θ―»ε–η”Ÿζˆηš„ζ–‡δ»Ά
34
+ const outputPath = join(rootDir, 'dist', 'cli.cjs');
35
+ let content = readFileSync(outputPath, 'utf-8');
36
+
37
+ // ζ£€ζŸ₯ζ˜―ε¦ε·²ζœ‰ shebangοΌŒε¦‚ζžœζ²‘ζœ‰ζ‰ζ·»εŠ 
38
+ if (!content.startsWith('#!/usr/bin/env node')) {
39
+ content = '#!/usr/bin/env node\n' + content;
40
+ writeFileSync(outputPath, content, 'utf-8');
41
+ }
42
+
43
+ console.log('βœ… Build successful!');
44
+ console.log('πŸ“ Output: dist/cli.cjs');
45
+ }).catch((error) => {
46
+ console.error('❌ Build failed:', error);
47
+ process.exit(1);
48
+ });