@manica/agent 0.0.0 → 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/manica-agent.js +35 -0
- package/package.json +16 -6
- package/README.md +0 -3
- package/index.js +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The `manica-agent` command of the @manica/agent npm package: runs the
|
|
3
|
+
// executable of the platform package the package manager installed next to
|
|
4
|
+
// it. Signals are forwarded, so a SIGTERM still lets running jobs finish.
|
|
5
|
+
import { spawn } from 'node:child_process'
|
|
6
|
+
import { createRequire } from 'node:module'
|
|
7
|
+
|
|
8
|
+
const name = `@manica/agent-${process.platform}-${process.arch}`
|
|
9
|
+
|
|
10
|
+
let binary
|
|
11
|
+
try {
|
|
12
|
+
binary = createRequire(import.meta.url).resolve(`${name}/bin/manica-agent`)
|
|
13
|
+
} catch {
|
|
14
|
+
console.error(
|
|
15
|
+
`manica-agent: ${name} is not installed. Either ${process.platform}-${process.arch} is not supported, or optional dependencies were skipped while installing @manica/agent.`,
|
|
16
|
+
)
|
|
17
|
+
process.exit(1)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' })
|
|
21
|
+
for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
22
|
+
process.on(signal, () => child.kill(signal))
|
|
23
|
+
}
|
|
24
|
+
child.on('error', (error) => {
|
|
25
|
+
console.error(`manica-agent: ${error.message}`)
|
|
26
|
+
process.exit(1)
|
|
27
|
+
})
|
|
28
|
+
child.on('exit', (code, signal) => {
|
|
29
|
+
if (signal) {
|
|
30
|
+
process.removeAllListeners(signal)
|
|
31
|
+
process.kill(process.pid, signal)
|
|
32
|
+
} else {
|
|
33
|
+
process.exit(code ?? 1)
|
|
34
|
+
}
|
|
35
|
+
})
|
package/package.json
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manica/agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "Stub package for npm trusted publishing setup",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"homepage": "https://github.com/getmanica/manica",
|
|
9
5
|
"repository": {
|
|
10
6
|
"type": "git",
|
|
11
7
|
"url": "git+https://github.com/getmanica/manica.git",
|
|
12
8
|
"directory": "apps/agent"
|
|
9
|
+
},
|
|
10
|
+
"description": "Run your own GitHub Actions runners on your own machines",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"bin": {
|
|
13
|
+
"manica-agent": "bin/manica-agent.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"bin"
|
|
17
|
+
],
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@manica/agent-darwin-arm64": "0.2.0",
|
|
20
|
+
"@manica/agent-darwin-x64": "0.2.0",
|
|
21
|
+
"@manica/agent-linux-arm64": "0.2.0",
|
|
22
|
+
"@manica/agent-linux-x64": "0.2.0"
|
|
13
23
|
}
|
|
14
24
|
}
|
package/README.md
DELETED
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = {};
|