nosleepp 0.2.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.
- package/bin/nosleepp-darwin-arm64 +0 -0
- package/bin/nosleepp-darwin-x64 +0 -0
- package/bin/nosleepp-win32-x64.exe +0 -0
- package/index.js +21 -0
- package/lib/resolve-binary.js +34 -0
- package/package.json +30 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const { resolveBinary } = require("./lib/resolve-binary");
|
|
5
|
+
|
|
6
|
+
const resolved = resolveBinary(process.platform, process.arch, __dirname);
|
|
7
|
+
if (!resolved.ok) {
|
|
8
|
+
console.error(resolved.error);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const result = spawnSync(resolved.path, process.argv.slice(2), {
|
|
13
|
+
stdio: "inherit"
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (result.error) {
|
|
17
|
+
console.error(`Failed to run nosleepp: ${result.error.message}`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
|
|
4
|
+
const supportedTargets = {
|
|
5
|
+
"win32-x64": "nosleepp-win32-x64.exe",
|
|
6
|
+
"darwin-arm64": "nosleepp-darwin-arm64",
|
|
7
|
+
"darwin-x64": "nosleepp-darwin-x64"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function resolveBinary(platform, arch, rootDir) {
|
|
11
|
+
const target = `${platform}-${arch}`;
|
|
12
|
+
const fileName = supportedTargets[target];
|
|
13
|
+
if (!fileName) {
|
|
14
|
+
return {
|
|
15
|
+
ok: false,
|
|
16
|
+
error: `Unsupported platform: ${target}. Supported targets: ${Object.keys(supportedTargets).join(", ")}.`
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const binaryPath = path.join(rootDir, "bin", fileName);
|
|
21
|
+
if (!fs.existsSync(binaryPath)) {
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
error: `Missing nosleepp binary for ${target}: ${binaryPath}. Rebuild the npm package before publishing.`
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return { ok: true, path: binaryPath };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = {
|
|
32
|
+
resolveBinary,
|
|
33
|
+
supportedTargets
|
|
34
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nosleepp",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Keep your PC awake while AI agents are working",
|
|
5
|
+
"bin": {
|
|
6
|
+
"nosleepp": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"index.js",
|
|
10
|
+
"lib/resolve-binary.js",
|
|
11
|
+
"bin/nosleepp-win32-x64.exe",
|
|
12
|
+
"bin/nosleepp-darwin-arm64",
|
|
13
|
+
"bin/nosleepp-darwin-x64"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"nosleepp",
|
|
17
|
+
"agents",
|
|
18
|
+
"cli",
|
|
19
|
+
"caffeinate",
|
|
20
|
+
"windows",
|
|
21
|
+
"macos"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "node --test"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
}
|
|
30
|
+
}
|