@zygapp/kintone-plugin-devtool 0.1.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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/index.js ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+
7
+ const binaryPathFile = path.join(__dirname, "bin", ".binary-path");
8
+
9
+ let binaryPath;
10
+ if (fs.existsSync(binaryPathFile)) {
11
+ binaryPath = fs.readFileSync(binaryPathFile, "utf-8").trim();
12
+ } else {
13
+ // フォールバック: 現在のプラットフォームから推測
14
+ const platform = process.platform;
15
+ const arch = process.arch;
16
+
17
+ let platformDir;
18
+ if (platform === "darwin") {
19
+ platformDir = arch === "arm64" ? "darwin-arm64" : "darwin-x64";
20
+ } else if (platform === "linux") {
21
+ platformDir = arch === "arm64" ? "linux-arm64" : "linux-x64";
22
+ } else if (platform === "win32") {
23
+ platformDir = arch === "arm64" ? "win32-arm64" : "win32-x64";
24
+ } else {
25
+ console.error(`Unsupported platform: ${platform}`);
26
+ process.exit(1);
27
+ }
28
+
29
+ const binaryName = platform === "win32" ? "kpdev.exe" : "kpdev";
30
+ binaryPath = path.join(__dirname, "bin", platformDir, binaryName);
31
+ }
32
+
33
+ if (!fs.existsSync(binaryPath)) {
34
+ console.error(`Binary not found: ${binaryPath}`);
35
+ console.error("Please reinstall the package.");
36
+ process.exit(1);
37
+ }
38
+
39
+ const child = spawn(binaryPath, process.argv.slice(2), {
40
+ stdio: "inherit",
41
+ });
42
+
43
+ child.on("error", (err) => {
44
+ console.error(`Failed to start: ${err.message}`);
45
+ process.exit(1);
46
+ });
47
+
48
+ child.on("close", (code) => {
49
+ process.exit(code || 0);
50
+ });
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@zygapp/kintone-plugin-devtool",
3
+ "version": "0.1.0",
4
+ "description": "kintone プラグイン開発ツール - Vite + HMR による高速開発環境",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "kpdev": "index.js"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node postinstall.js"
11
+ },
12
+ "keywords": [
13
+ "kintone",
14
+ "plugin",
15
+ "vite",
16
+ "hmr",
17
+ "development"
18
+ ],
19
+ "author": "zygapp",
20
+ "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/zygapp/kintone-plugin-devtool.git"
24
+ },
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "files": [
29
+ "index.js",
30
+ "postinstall.js",
31
+ "bin/"
32
+ ]
33
+ }
package/postinstall.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const platform = process.platform;
7
+ const arch = process.arch;
8
+
9
+ let platformDir;
10
+ if (platform === "darwin") {
11
+ platformDir = arch === "arm64" ? "darwin-arm64" : "darwin-x64";
12
+ } else if (platform === "linux") {
13
+ platformDir = arch === "arm64" ? "linux-arm64" : "linux-x64";
14
+ } else if (platform === "win32") {
15
+ platformDir = arch === "arm64" ? "win32-arm64" : "win32-x64";
16
+ } else {
17
+ console.error(`Unsupported platform: ${platform}`);
18
+ process.exit(1);
19
+ }
20
+
21
+ const binaryName = platform === "win32" ? "kpdev.exe" : "kpdev";
22
+ const binaryPath = path.join(__dirname, "bin", platformDir, binaryName);
23
+
24
+ if (!fs.existsSync(binaryPath)) {
25
+ console.error(`Binary not found for ${platform}-${arch}`);
26
+ console.error(`Expected path: ${binaryPath}`);
27
+ process.exit(1);
28
+ }
29
+
30
+ // バイナリパスを記録
31
+ const binaryPathFile = path.join(__dirname, "bin", ".binary-path");
32
+ fs.writeFileSync(binaryPathFile, binaryPath);
33
+
34
+ console.log(`kpdev installed for ${platform}-${arch}`);