@blackrose28/hapi 0.17.3 → 0.17.4
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/hapi.cjs +25 -11
- package/package.json +6 -6
package/bin/hapi.cjs
CHANGED
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
const { execFileSync } = require('child_process');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
// Load package.json to get the current package name and repository
|
|
8
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
9
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
10
|
+
const MAIN_PKG_NAME = pkg.name;
|
|
11
|
+
const [SCOPE, BASE_NAME] = MAIN_PKG_NAME.startsWith('@')
|
|
12
|
+
? MAIN_PKG_NAME.split('/')
|
|
13
|
+
: ['', MAIN_PKG_NAME];
|
|
14
|
+
|
|
15
|
+
const RELEASE_URL = pkg.repository?.url
|
|
16
|
+
? pkg.repository.url.replace(/^git\+/, '').replace(/\.git$/, '') + '/releases'
|
|
17
|
+
: 'https://github.com/daudaudinang/hapi/releases';
|
|
5
18
|
|
|
6
|
-
const platform = process.platform;
|
|
7
|
-
const arch = process.arch;
|
|
8
|
-
const RELEASE_URL = 'https://github.com/tiann/hapi/releases';
|
|
9
19
|
const OFFICIAL_NPM_REGISTRY = 'https://registry.npmjs.org';
|
|
10
20
|
const SUPPORTED_PLATFORMS = [
|
|
11
21
|
{
|
|
@@ -30,16 +40,18 @@ const SUPPORTED_PLATFORMS = [
|
|
|
30
40
|
},
|
|
31
41
|
];
|
|
32
42
|
|
|
33
|
-
function getPlatformKey(platformName = platform, archName = arch) {
|
|
43
|
+
function getPlatformKey(platformName = process.platform, archName = process.arch) {
|
|
34
44
|
return `${platformName}-${archName}`;
|
|
35
45
|
}
|
|
36
46
|
|
|
37
|
-
function isSupportedPlatform(platformName = platform, archName = arch) {
|
|
47
|
+
function isSupportedPlatform(platformName = process.platform, archName = process.arch) {
|
|
38
48
|
return SUPPORTED_PLATFORMS.some((item) => item.key === getPlatformKey(platformName, archName));
|
|
39
49
|
}
|
|
40
50
|
|
|
41
|
-
function getBinaryPath(platformName = platform, archName = arch) {
|
|
42
|
-
const pkgName =
|
|
51
|
+
function getBinaryPath(platformName = process.platform, archName = process.arch) {
|
|
52
|
+
const pkgName = SCOPE
|
|
53
|
+
? `${SCOPE}/${BASE_NAME}-${platformName}-${archName}`
|
|
54
|
+
: `${BASE_NAME}-${platformName}-${archName}`;
|
|
43
55
|
|
|
44
56
|
try {
|
|
45
57
|
// Try to find the platform-specific package
|
|
@@ -83,7 +95,7 @@ function reportExecutionFailure(error, binPath, args, log = console.error) {
|
|
|
83
95
|
return { status, signal };
|
|
84
96
|
}
|
|
85
97
|
|
|
86
|
-
function reportUnsupportedPlatform(platformName = platform, archName = arch, log = console.error) {
|
|
98
|
+
function reportUnsupportedPlatform(platformName = process.platform, archName = process.arch, log = console.error) {
|
|
87
99
|
log(`Unsupported platform: ${platformName}-${archName}`);
|
|
88
100
|
log('');
|
|
89
101
|
log('Supported platforms:');
|
|
@@ -95,15 +107,17 @@ function reportUnsupportedPlatform(platformName = platform, archName = arch, log
|
|
|
95
107
|
log(` ${RELEASE_URL}`);
|
|
96
108
|
}
|
|
97
109
|
|
|
98
|
-
function reportMissingPlatformPackage(platformName = platform, archName = arch, log = console.error) {
|
|
99
|
-
const platformPackage =
|
|
110
|
+
function reportMissingPlatformPackage(platformName = process.platform, archName = process.arch, log = console.error) {
|
|
111
|
+
const platformPackage = SCOPE
|
|
112
|
+
? `${SCOPE}/${BASE_NAME}-${platformName}-${archName}`
|
|
113
|
+
: `${BASE_NAME}-${platformName}-${archName}`;
|
|
100
114
|
log(`Missing platform package: ${platformPackage}`);
|
|
101
115
|
log('');
|
|
102
116
|
log(`Detected platform ${platformName}-${archName} is supported, but the platform binary package was not installed.`);
|
|
103
117
|
log('This may happen when using a registry mirror that has not synced all optionalDependencies.');
|
|
104
118
|
log('');
|
|
105
119
|
log('Try reinstalling with the official npm registry:');
|
|
106
|
-
log(` npm install -g
|
|
120
|
+
log(` npm install -g ${MAIN_PKG_NAME} --registry=${OFFICIAL_NPM_REGISTRY}`);
|
|
107
121
|
log('');
|
|
108
122
|
log('Or download the binary manually from:');
|
|
109
123
|
log(` ${RELEASE_URL}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackrose28/hapi",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"description": "App for agentic coding - access coding agent anywhere",
|
|
5
5
|
"author": "daudaudinang",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"NOTICE"
|
|
21
21
|
],
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@blackrose28/hapi-darwin-arm64": "0.17.
|
|
24
|
-
"@blackrose28/hapi-darwin-x64": "0.17.
|
|
25
|
-
"@blackrose28/hapi-linux-arm64": "0.17.
|
|
26
|
-
"@blackrose28/hapi-linux-x64": "0.17.
|
|
27
|
-
"@blackrose28/hapi-win32-x64": "0.17.
|
|
23
|
+
"@blackrose28/hapi-darwin-arm64": "0.17.4",
|
|
24
|
+
"@blackrose28/hapi-darwin-x64": "0.17.4",
|
|
25
|
+
"@blackrose28/hapi-linux-arm64": "0.17.4",
|
|
26
|
+
"@blackrose28/hapi-linux-x64": "0.17.4",
|
|
27
|
+
"@blackrose28/hapi-win32-x64": "0.17.4"
|
|
28
28
|
}
|
|
29
29
|
}
|