node-mac-recorder 1.0.1 → 1.0.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 (2) hide show
  1. package/install.js +71 -0
  2. package/package.json +1 -1
package/install.js ADDED
@@ -0,0 +1,71 @@
1
+ const { spawn } = require("child_process");
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+
5
+ console.log("šŸ”Ø Building native macOS recorder module...\n");
6
+
7
+ // Check if we're on macOS
8
+ if (process.platform !== "darwin") {
9
+ console.error("āŒ This package only works on macOS");
10
+ process.exit(1);
11
+ }
12
+
13
+ // Check if Xcode Command Line Tools are installed
14
+ console.log("šŸ” Checking Xcode Command Line Tools...");
15
+ const xcodebuild = spawn("xcode-select", ["--print-path"], { stdio: "pipe" });
16
+
17
+ xcodebuild.on("close", (code) => {
18
+ if (code !== 0) {
19
+ console.error("āŒ Xcode Command Line Tools not found!");
20
+ console.log("šŸ“¦ Please install with: xcode-select --install");
21
+ process.exit(1);
22
+ }
23
+
24
+ console.log("āœ… Xcode Command Line Tools found");
25
+ buildNativeModule();
26
+ });
27
+
28
+ function buildNativeModule() {
29
+ console.log("\nšŸ—ļø Building native module...");
30
+
31
+ // Run node-gyp rebuild
32
+ const nodeGyp = spawn("node-gyp", ["rebuild"], {
33
+ stdio: "inherit",
34
+ env: { ...process.env, npm_config_build_from_source: "true" },
35
+ });
36
+
37
+ nodeGyp.on("close", (code) => {
38
+ if (code === 0) {
39
+ console.log("\nāœ… Native module built successfully!");
40
+ console.log("šŸŽ‰ node-mac-recorder is ready to use");
41
+
42
+ // Check if build output exists
43
+ const buildPath = path.join(
44
+ __dirname,
45
+ "build",
46
+ "Release",
47
+ "mac_recorder.node"
48
+ );
49
+ if (fs.existsSync(buildPath)) {
50
+ console.log("šŸ“ Native module location:", buildPath);
51
+ }
52
+ } else {
53
+ console.error("\nāŒ Build failed with code:", code);
54
+ console.log("\nšŸ”§ Troubleshooting:");
55
+ console.log(
56
+ "1. Make sure Xcode Command Line Tools are installed: xcode-select --install"
57
+ );
58
+ console.log("2. Check Node.js version (requires 14.0.0+)");
59
+ console.log("3. Try: npm run clean && npm run build");
60
+ process.exit(1);
61
+ }
62
+ });
63
+
64
+ nodeGyp.on("error", (error) => {
65
+ console.error("\nāŒ Build error:", error.message);
66
+ console.log(
67
+ "\nšŸ“¦ Make sure node-gyp is installed: npm install -g node-gyp"
68
+ );
69
+ process.exit(1);
70
+ });
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [