twins-diff 0.1.5 → 0.9.0

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 (134) hide show
  1. package/README.md +17 -1
  2. package/bin/twins-diff.js +28 -0
  3. package/install.js +155 -0
  4. package/package.json +18 -27
  5. package/.next/BUILD_ID +0 -1
  6. package/.next/build-manifest.json +0 -44
  7. package/.next/cache/.tsbuildinfo +0 -4350
  8. package/.next/cache/eslint/.cache_18nhe9h +0 -1
  9. package/.next/cache/images/+Zw1yoIG58LhIbctWRJdnQ20Z33pxbv8Yx89yrrciig=/60.1660968780361.d0iuU8b1wK62QwdNTR3vF5OZnxX6XATD-2vLv5TWwM8=.webp +0 -0
  10. package/.next/cache/images/0xrgerf2ZzbcHEdoZ6TefISPxVGUUwuubfMubk-igXo=/60.1660970309382.oIVEJjaP88sNsekqHnnCxrtoTUVUOqT-ppQh5eEncuY=.webp +0 -0
  11. package/.next/cache/images/ENeE-64Do7fhlw5Gk82Wto6PXV9E53BoxLs5ULxRohY=/60.1660971805622.d0iuU8b1wK62QwdNTR3vF5OZnxX6XATD-2vLv5TWwM8=.webp +0 -0
  12. package/.next/cache/images/Ghi7tRvantuGRp1m-+8-64lETnFLX+Q23Ll34d1nWtg=/60.1660970309379.fW1M942fm1xC+j9+iGqJt36i25Jf7pOGou-AdC3NlVg=.webp +0 -0
  13. package/.next/cache/images/djH9cbmwUR1zP2VXTmdKD9RwTSn+jA+VpI3hDxyS4XI=/60.1660958430370.i3Z3MaWNKTvr8tu2TXTk46jxcSV1Umd6-M6QSHP+OjE=.webp +0 -0
  14. package/.next/cache/images/fE+LgDsCYzEUTEBf-Rt5SBZ9LMs3+Db9s8+cpDl4ncs=/60.1660970829151.i3Z3MaWNKTvr8tu2TXTk46jxcSV1Umd6-M6QSHP+OjE=.webp +0 -0
  15. package/.next/cache/images/ke6V98CYccvU2wnYjDciblCJAfTb0TZ01Ms2-WtUFIc=/60.1660971774982.yw18+VKryEXvNd+vU+N8HNkudpammH-NzGTLSkie+UY=.webp +0 -0
  16. package/.next/cache/images/qapnXyYMlxWECRvxBOkbwPvEfMPi4DSs+m42kVgveC4=/60.1660958452182.o9GzFQM0A3kGmNW6pzXqwHo4WxICmDl40ZkDKJ8L9k0=.webp +0 -0
  17. package/.next/cache/next-server.js.nft.json +0 -1
  18. package/.next/cache/webpack/client-development/0.pack +0 -0
  19. package/.next/cache/webpack/client-development/1.pack +0 -0
  20. package/.next/cache/webpack/client-development/10.pack +0 -0
  21. package/.next/cache/webpack/client-development/11.pack +0 -0
  22. package/.next/cache/webpack/client-development/12.pack +0 -0
  23. package/.next/cache/webpack/client-development/13.pack +0 -0
  24. package/.next/cache/webpack/client-development/14.pack +0 -0
  25. package/.next/cache/webpack/client-development/15.pack +0 -0
  26. package/.next/cache/webpack/client-development/16.pack +0 -0
  27. package/.next/cache/webpack/client-development/17.pack +0 -0
  28. package/.next/cache/webpack/client-development/2.pack +0 -0
  29. package/.next/cache/webpack/client-development/3.pack +0 -0
  30. package/.next/cache/webpack/client-development/4.pack +0 -0
  31. package/.next/cache/webpack/client-development/5.pack +0 -0
  32. package/.next/cache/webpack/client-development/6.pack +0 -0
  33. package/.next/cache/webpack/client-development/7.pack +0 -0
  34. package/.next/cache/webpack/client-development/8.pack +0 -0
  35. package/.next/cache/webpack/client-development/9.pack +0 -0
  36. package/.next/cache/webpack/client-development/index.pack +0 -0
  37. package/.next/cache/webpack/client-development/index.pack.old +0 -0
  38. package/.next/cache/webpack/client-development-fallback/0.pack +0 -0
  39. package/.next/cache/webpack/client-development-fallback/1.pack +0 -0
  40. package/.next/cache/webpack/client-development-fallback/index.pack +0 -0
  41. package/.next/cache/webpack/client-development-fallback/index.pack.old +0 -0
  42. package/.next/cache/webpack/client-production/0.pack +0 -0
  43. package/.next/cache/webpack/client-production/1.pack +0 -0
  44. package/.next/cache/webpack/client-production/10.pack +0 -0
  45. package/.next/cache/webpack/client-production/11.pack +0 -0
  46. package/.next/cache/webpack/client-production/2.pack +0 -0
  47. package/.next/cache/webpack/client-production/3.pack +0 -0
  48. package/.next/cache/webpack/client-production/4.pack +0 -0
  49. package/.next/cache/webpack/client-production/5.pack +0 -0
  50. package/.next/cache/webpack/client-production/6.pack +0 -0
  51. package/.next/cache/webpack/client-production/7.pack +0 -0
  52. package/.next/cache/webpack/client-production/8.pack +0 -0
  53. package/.next/cache/webpack/client-production/9.pack +0 -0
  54. package/.next/cache/webpack/client-production/index.pack +0 -0
  55. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  56. package/.next/cache/webpack/server-development/0.pack +0 -0
  57. package/.next/cache/webpack/server-development/1.pack +0 -0
  58. package/.next/cache/webpack/server-development/10.pack +0 -0
  59. package/.next/cache/webpack/server-development/11.pack +0 -0
  60. package/.next/cache/webpack/server-development/12.pack +0 -0
  61. package/.next/cache/webpack/server-development/13.pack +0 -0
  62. package/.next/cache/webpack/server-development/14.pack +0 -0
  63. package/.next/cache/webpack/server-development/15.pack +0 -0
  64. package/.next/cache/webpack/server-development/16.pack +0 -0
  65. package/.next/cache/webpack/server-development/17.pack +0 -0
  66. package/.next/cache/webpack/server-development/2.pack +0 -0
  67. package/.next/cache/webpack/server-development/3.pack +0 -0
  68. package/.next/cache/webpack/server-development/4.pack +0 -0
  69. package/.next/cache/webpack/server-development/5.pack +0 -0
  70. package/.next/cache/webpack/server-development/6.pack +0 -0
  71. package/.next/cache/webpack/server-development/7.pack +0 -0
  72. package/.next/cache/webpack/server-development/8.pack +0 -0
  73. package/.next/cache/webpack/server-development/9.pack +0 -0
  74. package/.next/cache/webpack/server-development/index.pack +0 -0
  75. package/.next/cache/webpack/server-development/index.pack.old +0 -0
  76. package/.next/cache/webpack/server-production/0.pack +0 -0
  77. package/.next/cache/webpack/server-production/1.pack +0 -0
  78. package/.next/cache/webpack/server-production/2.pack +0 -0
  79. package/.next/cache/webpack/server-production/3.pack +0 -0
  80. package/.next/cache/webpack/server-production/4.pack +0 -0
  81. package/.next/cache/webpack/server-production/5.pack +0 -0
  82. package/.next/cache/webpack/server-production/index.pack +0 -0
  83. package/.next/cache/webpack/server-production/index.pack.old +0 -0
  84. package/.next/export-marker.json +0 -1
  85. package/.next/images-manifest.json +0 -1
  86. package/.next/next-server.js.nft.json +0 -1
  87. package/.next/package.json +0 -1
  88. package/.next/prerender-manifest.json +0 -1
  89. package/.next/react-loadable-manifest.json +0 -1
  90. package/.next/required-server-files.json +0 -1
  91. package/.next/routes-manifest.json +0 -1
  92. package/.next/server/chunks/476.js +0 -163
  93. package/.next/server/chunks/664.js +0 -2356
  94. package/.next/server/chunks/952.js +0 -490
  95. package/.next/server/chunks/font-manifest.json +0 -1
  96. package/.next/server/font-manifest.json +0 -1
  97. package/.next/server/middleware-build-manifest.js +0 -1
  98. package/.next/server/middleware-manifest.json +0 -6
  99. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  100. package/.next/server/pages/404.html +0 -12
  101. package/.next/server/pages/500.html +0 -12
  102. package/.next/server/pages/_app.js +0 -48
  103. package/.next/server/pages/_app.js.nft.json +0 -1
  104. package/.next/server/pages/_document.js +0 -805
  105. package/.next/server/pages/_document.js.nft.json +0 -1
  106. package/.next/server/pages/_error.js +0 -148
  107. package/.next/server/pages/_error.js.nft.json +0 -1
  108. package/.next/server/pages/api/list-files.js +0 -62
  109. package/.next/server/pages/api/list-files.js.nft.json +0 -1
  110. package/.next/server/pages/api/read-files.js +0 -55
  111. package/.next/server/pages/api/read-files.js.nft.json +0 -1
  112. package/.next/server/pages/diff.html +0 -1
  113. package/.next/server/pages/diff.js.nft.json +0 -1
  114. package/.next/server/pages/index.html +0 -1
  115. package/.next/server/pages/index.js.nft.json +0 -1
  116. package/.next/server/pages-manifest.json +0 -10
  117. package/.next/server/webpack-api-runtime.js +0 -160
  118. package/.next/server/webpack-runtime.js +0 -229
  119. package/.next/static/axnuKXFPsELN8W-dg7sS4/_buildManifest.js +0 -1
  120. package/.next/static/axnuKXFPsELN8W-dg7sS4/_ssgManifest.js +0 -1
  121. package/.next/static/chunks/0e226fb0-00ab5d79f793009b.js +0 -1
  122. package/.next/static/chunks/899-0ca12ffda618fea1.js +0 -5
  123. package/.next/static/chunks/903-c300b11b24cd4fba.js +0 -14
  124. package/.next/static/chunks/framework-9b5d6ec4444c80fa.js +0 -35
  125. package/.next/static/chunks/main-3123a443c688934f.js +0 -1
  126. package/.next/static/chunks/pages/_app-1afd9bee96321e29.js +0 -1
  127. package/.next/static/chunks/pages/_error-7397496ca01950b1.js +0 -1
  128. package/.next/static/chunks/pages/diff-f4630dbf204984ba.js +0 -1
  129. package/.next/static/chunks/pages/index-9a3fffac4032ef82.js +0 -1
  130. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  131. package/.next/static/chunks/webpack-f58abffb4e180982.js +0 -1
  132. package/.next/static/css/2baeaa3c21764938.css +0 -1
  133. package/.next/trace +0 -2
  134. package/cli.js +0 -5
package/README.md CHANGED
@@ -1 +1,17 @@
1
- # Twins Diff
1
+ # @the-red/twins-diff
2
+
3
+ Web-based tool for comparing two directory trees.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @the-red/twins-diff
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ twins-diff /path/to/old /path/to/new
15
+ ```
16
+
17
+ See [GitHub repository](https://github.com/the-red/twins-diff) for more details.
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+
3
+ // twins-diff バイナリを実行するラッパースクリプト
4
+
5
+ const { spawn } = require("child_process");
6
+ const path = require("path");
7
+ const os = require("os");
8
+
9
+ const binaryName = os.platform() === "win32" ? "twins-diff.exe" : "twins-diff";
10
+ const binaryPath = path.join(__dirname, binaryName);
11
+
12
+ const child = spawn(binaryPath, process.argv.slice(2), {
13
+ stdio: "inherit",
14
+ });
15
+
16
+ child.on("error", (err) => {
17
+ if (err.code === "ENOENT") {
18
+ console.error("twins-diff binary not found. Try reinstalling the package:");
19
+ console.error(" npm uninstall @the-red/twins-diff && npm install @the-red/twins-diff");
20
+ } else {
21
+ console.error(`Failed to run twins-diff: ${err.message}`);
22
+ }
23
+ process.exit(1);
24
+ });
25
+
26
+ child.on("exit", (code) => {
27
+ process.exit(code ?? 0);
28
+ });
package/install.js ADDED
@@ -0,0 +1,155 @@
1
+ #!/usr/bin/env node
2
+
3
+ // GitHub Releases から twins-diff バイナリをダウンロードする postinstall スクリプト
4
+
5
+ const https = require("https");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const { execSync } = require("child_process");
9
+ const os = require("os");
10
+
11
+ const REPO = "the-red/twins-diff";
12
+ const BINARY_NAME = "twins-diff";
13
+
14
+ // package.json からバージョンを取得
15
+ const packageJson = require("./package.json");
16
+ const VERSION = packageJson.version;
17
+
18
+ // プラットフォームとアーキテクチャのマッピング
19
+ function getPlatformInfo() {
20
+ const platform = os.platform();
21
+ const arch = os.arch();
22
+
23
+ const platformMap = {
24
+ darwin: "darwin",
25
+ linux: "linux",
26
+ win32: "windows",
27
+ };
28
+
29
+ const archMap = {
30
+ x64: "amd64",
31
+ arm64: "arm64",
32
+ };
33
+
34
+ const mappedPlatform = platformMap[platform];
35
+ const mappedArch = archMap[arch];
36
+
37
+ if (!mappedPlatform || !mappedArch) {
38
+ throw new Error(
39
+ `Unsupported platform: ${platform} ${arch}. ` +
40
+ `Supported: darwin/linux/windows on amd64/arm64`
41
+ );
42
+ }
43
+
44
+ return {
45
+ platform: mappedPlatform,
46
+ arch: mappedArch,
47
+ ext: platform === "win32" ? ".zip" : ".tar.gz",
48
+ };
49
+ }
50
+
51
+ // ファイルをダウンロード
52
+ function downloadFile(url) {
53
+ return new Promise((resolve, reject) => {
54
+ const request = (url) => {
55
+ https
56
+ .get(url, (response) => {
57
+ // リダイレクト対応
58
+ if (response.statusCode >= 300 && response.statusCode < 400) {
59
+ if (response.headers.location) {
60
+ request(response.headers.location);
61
+ return;
62
+ }
63
+ }
64
+
65
+ if (response.statusCode !== 200) {
66
+ reject(new Error(`Failed to download: ${response.statusCode}`));
67
+ return;
68
+ }
69
+
70
+ const chunks = [];
71
+ response.on("data", (chunk) => chunks.push(chunk));
72
+ response.on("end", () => resolve(Buffer.concat(chunks)));
73
+ response.on("error", reject);
74
+ })
75
+ .on("error", reject);
76
+ };
77
+ request(url);
78
+ });
79
+ }
80
+
81
+ // tar.gz を解凍
82
+ function extractTarGz(buffer, destDir) {
83
+ const tempFile = path.join(os.tmpdir(), `twins-diff-${Date.now()}.tar.gz`);
84
+ fs.writeFileSync(tempFile, buffer);
85
+
86
+ try {
87
+ execSync(`tar -xzf "${tempFile}" -C "${destDir}"`, { stdio: "pipe" });
88
+ } finally {
89
+ fs.unlinkSync(tempFile);
90
+ }
91
+ }
92
+
93
+ // zip を解凍
94
+ function extractZip(buffer, destDir) {
95
+ const tempFile = path.join(os.tmpdir(), `twins-diff-${Date.now()}.zip`);
96
+ fs.writeFileSync(tempFile, buffer);
97
+
98
+ try {
99
+ // Windows では PowerShell を使用
100
+ if (os.platform() === "win32") {
101
+ execSync(
102
+ `powershell -Command "Expand-Archive -Path '${tempFile}' -DestinationPath '${destDir}' -Force"`,
103
+ { stdio: "pipe" }
104
+ );
105
+ } else {
106
+ execSync(`unzip -o "${tempFile}" -d "${destDir}"`, { stdio: "pipe" });
107
+ }
108
+ } finally {
109
+ fs.unlinkSync(tempFile);
110
+ }
111
+ }
112
+
113
+ async function main() {
114
+ const binDir = path.join(__dirname, "bin");
115
+
116
+ // bin ディレクトリがなければ作成
117
+ if (!fs.existsSync(binDir)) {
118
+ fs.mkdirSync(binDir, { recursive: true });
119
+ }
120
+
121
+ const { platform, arch, ext } = getPlatformInfo();
122
+ const assetName = `${BINARY_NAME}_${VERSION}_${platform}_${arch}${ext}`;
123
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${assetName}`;
124
+
125
+ console.log(`Downloading twins-diff v${VERSION} for ${platform}/${arch}...`);
126
+
127
+ try {
128
+ const buffer = await downloadFile(url);
129
+
130
+ console.log("Extracting...");
131
+
132
+ if (ext === ".zip") {
133
+ extractZip(buffer, binDir);
134
+ } else {
135
+ extractTarGz(buffer, binDir);
136
+ }
137
+
138
+ // 実行権限を付与(Unix系のみ)
139
+ const binaryPath = path.join(
140
+ binDir,
141
+ platform === "windows" ? `${BINARY_NAME}.exe` : BINARY_NAME
142
+ );
143
+ if (platform !== "windows" && fs.existsSync(binaryPath)) {
144
+ fs.chmodSync(binaryPath, 0o755);
145
+ }
146
+
147
+ console.log("twins-diff installed successfully!");
148
+ } catch (error) {
149
+ console.error(`Failed to install twins-diff: ${error.message}`);
150
+ console.error(`URL: ${url}`);
151
+ process.exit(1);
152
+ }
153
+ }
154
+
155
+ main();
package/package.json CHANGED
@@ -1,40 +1,31 @@
1
1
  {
2
2
  "name": "twins-diff",
3
- "version": "0.1.5",
4
- "bin": "./cli.js",
3
+ "version": "0.9.0",
4
+ "description": "Web-based tool for comparing two directory trees",
5
+ "bin": {
6
+ "twins-diff": "./bin/twins-diff.js"
7
+ },
5
8
  "scripts": {
6
- "dev": "next dev",
7
- "build": "next build",
8
- "start": "next start",
9
- "lint": "next lint"
9
+ "postinstall": "node install.js"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/the-red/twins-diff.git"
13
+ "url": "https://github.com/the-red/twins-diff.git"
14
14
  },
15
- "license": "MIT",
15
+ "homepage": "https://github.com/the-red/twins-diff",
16
16
  "bugs": {
17
17
  "url": "https://github.com/the-red/twins-diff/issues"
18
18
  },
19
- "homepage": "https://github.com/the-red/twins-diff#readme",
20
- "files": [
21
- ".next"
19
+ "keywords": [
20
+ "diff",
21
+ "directory",
22
+ "compare",
23
+ "file-comparison",
24
+ "web-ui"
22
25
  ],
23
- "dependencies": {
24
- "@primer/octicons-react": "^17.4.1",
25
- "next": "12.2.5",
26
- "react": "18.2.0",
27
- "react-diff-viewer": "^3.1.1",
28
- "react-dom": "18.2.0",
29
- "swr": "^1.3.0"
30
- },
31
- "devDependencies": {
32
- "@types/node": "18.7.8",
33
- "@types/react": "18.0.17",
34
- "@types/react-dom": "18.0.6",
35
- "eslint": "8.22.0",
36
- "eslint-config-next": "12.2.5",
37
- "prettier": "^2.7.1",
38
- "typescript": "4.0"
26
+ "author": "the-red",
27
+ "license": "MIT",
28
+ "engines": {
29
+ "node": ">=20"
39
30
  }
40
31
  }
package/.next/BUILD_ID DELETED
@@ -1 +0,0 @@
1
- axnuKXFPsELN8W-dg7sS4
@@ -1,44 +0,0 @@
1
- {
2
- "polyfillFiles": [
3
- "static/chunks/polyfills-c67a75d1b6f99dc8.js"
4
- ],
5
- "devFiles": [],
6
- "ampDevFiles": [],
7
- "lowPriorityFiles": [
8
- "static/axnuKXFPsELN8W-dg7sS4/_buildManifest.js",
9
- "static/axnuKXFPsELN8W-dg7sS4/_ssgManifest.js"
10
- ],
11
- "rootMainFiles": [],
12
- "pages": {
13
- "/": [
14
- "static/chunks/webpack-f58abffb4e180982.js",
15
- "static/chunks/framework-9b5d6ec4444c80fa.js",
16
- "static/chunks/main-3123a443c688934f.js",
17
- "static/chunks/0e226fb0-00ab5d79f793009b.js",
18
- "static/chunks/903-c300b11b24cd4fba.js",
19
- "static/chunks/pages/index-9a3fffac4032ef82.js"
20
- ],
21
- "/_app": [
22
- "static/chunks/webpack-f58abffb4e180982.js",
23
- "static/chunks/framework-9b5d6ec4444c80fa.js",
24
- "static/chunks/main-3123a443c688934f.js",
25
- "static/css/2baeaa3c21764938.css",
26
- "static/chunks/pages/_app-1afd9bee96321e29.js"
27
- ],
28
- "/_error": [
29
- "static/chunks/webpack-f58abffb4e180982.js",
30
- "static/chunks/framework-9b5d6ec4444c80fa.js",
31
- "static/chunks/main-3123a443c688934f.js",
32
- "static/chunks/pages/_error-7397496ca01950b1.js"
33
- ],
34
- "/diff": [
35
- "static/chunks/webpack-f58abffb4e180982.js",
36
- "static/chunks/framework-9b5d6ec4444c80fa.js",
37
- "static/chunks/main-3123a443c688934f.js",
38
- "static/chunks/903-c300b11b24cd4fba.js",
39
- "static/chunks/899-0ca12ffda618fea1.js",
40
- "static/chunks/pages/diff-f4630dbf204984ba.js"
41
- ]
42
- },
43
- "ampFirstPages": []
44
- }