hyperstack-cli 0.3.10
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/README.md +45 -0
- package/bin/hs.js +38 -0
- package/package.json +42 -0
- package/scripts/postinstall.js +115 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Hyperstack CLI
|
|
2
|
+
|
|
3
|
+
Programmable data feeds for Solana. Hyperstack CLI lets you deploy feeds for any Solana data to our cloud.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx hyperstack-cli create my-app
|
|
9
|
+
cd my-app
|
|
10
|
+
npm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### npm (recommended for JS/TS developers)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g hyperstack-cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Cargo (for Rust developers)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cargo install hyperstack-cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
| Command | Description |
|
|
30
|
+
|---------|-------------|
|
|
31
|
+
| `hs create [name]` | Scaffold a new app from a template |
|
|
32
|
+
| `hs init` | Initialize a stack project |
|
|
33
|
+
| `hs up` | Deploy your stack |
|
|
34
|
+
| `hs status` | Show project overview |
|
|
35
|
+
| `hs auth login` | Authenticate with Hyperstack |
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
- [Getting Started](https://usehyperstack.com/docs)
|
|
40
|
+
- [CLI Reference](https://usehyperstack.com/docs/cli)
|
|
41
|
+
- [Stack Development](https://usehyperstack.com/docs/stacks)
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
Apache-2.0
|
package/bin/hs.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
|
|
7
|
+
const binName = process.platform === "win32" ? "hs.exe" : "hs";
|
|
8
|
+
const binPath = path.join(__dirname, binName);
|
|
9
|
+
|
|
10
|
+
if (!fs.existsSync(binPath)) {
|
|
11
|
+
console.error(
|
|
12
|
+
"Hyperstack CLI binary not found. This usually means the postinstall script failed.\n" +
|
|
13
|
+
"Try reinstalling: npm install hyperstack-cli\n" +
|
|
14
|
+
"\n" +
|
|
15
|
+
"If the problem persists, you can install the CLI via Cargo:\n" +
|
|
16
|
+
" cargo install hyperstack-cli"
|
|
17
|
+
);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const result = spawnSync(binPath, process.argv.slice(2), {
|
|
22
|
+
stdio: "inherit",
|
|
23
|
+
env: process.env,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (result.error) {
|
|
27
|
+
if (result.error.code === "EACCES") {
|
|
28
|
+
console.error(
|
|
29
|
+
"Permission denied. Try running:\n" +
|
|
30
|
+
` chmod +x "${binPath}"`
|
|
31
|
+
);
|
|
32
|
+
} else {
|
|
33
|
+
console.error("Failed to run Hyperstack CLI:", result.error.message);
|
|
34
|
+
}
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hyperstack-cli",
|
|
3
|
+
"version": "0.3.10",
|
|
4
|
+
"description": "Hyperstack CLI - Real-time Solana streaming pipelines",
|
|
5
|
+
"bin": {
|
|
6
|
+
"hs": "./bin/hs.js",
|
|
7
|
+
"hyperstack": "./bin/hs.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node scripts/postinstall.js"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/HyperTekOrg/hyperstack.git",
|
|
15
|
+
"directory": "packages/hyperstack"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://usehyperstack.com",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/HyperTekOrg/hyperstack/issues"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"hyperstack",
|
|
23
|
+
"solana",
|
|
24
|
+
"streaming",
|
|
25
|
+
"cli",
|
|
26
|
+
"blockchain",
|
|
27
|
+
"web3"
|
|
28
|
+
],
|
|
29
|
+
"author": "Hypertek",
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=16.0.0"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"bin",
|
|
39
|
+
"scripts",
|
|
40
|
+
"README.md"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const { execSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
const pkg = require("../package.json");
|
|
9
|
+
const version = pkg.version;
|
|
10
|
+
|
|
11
|
+
const PLATFORMS = {
|
|
12
|
+
"darwin-arm64": "hs-darwin-arm64",
|
|
13
|
+
"darwin-x64": "hs-darwin-x64",
|
|
14
|
+
"linux-x64": "hs-linux-x64",
|
|
15
|
+
"linux-arm64": "hs-linux-arm64",
|
|
16
|
+
"win32-x64": "hs-win32-x64.exe",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const platform = process.platform;
|
|
20
|
+
const arch = process.arch;
|
|
21
|
+
const key = `${platform}-${arch}`;
|
|
22
|
+
|
|
23
|
+
const binaryName = PLATFORMS[key];
|
|
24
|
+
if (!binaryName) {
|
|
25
|
+
console.warn(
|
|
26
|
+
`Hyperstack CLI does not have a prebuilt binary for ${key}.\n` +
|
|
27
|
+
"You can build from source: cargo install hyperstack-cli"
|
|
28
|
+
);
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const binDir = path.join(__dirname, "..", "bin");
|
|
33
|
+
const binPath = path.join(binDir, platform === "win32" ? "hs.exe" : "hs");
|
|
34
|
+
|
|
35
|
+
if (fs.existsSync(binPath)) {
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const url = `https://github.com/HyperTekOrg/hyperstack/releases/download/hyperstack-cli-v${version}/${binaryName}`;
|
|
40
|
+
|
|
41
|
+
console.log(`Downloading Hyperstack CLI v${version} for ${key}...`);
|
|
42
|
+
|
|
43
|
+
function download(url, dest) {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
const file = fs.createWriteStream(dest, { mode: 0o755 });
|
|
46
|
+
|
|
47
|
+
const request = (url) => {
|
|
48
|
+
https.get(url, (response) => {
|
|
49
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
50
|
+
request(response.headers.location);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (response.statusCode !== 200) {
|
|
55
|
+
fs.unlinkSync(dest);
|
|
56
|
+
reject(new Error(`Download failed: HTTP ${response.statusCode}`));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const total = parseInt(response.headers["content-length"], 10);
|
|
61
|
+
let downloaded = 0;
|
|
62
|
+
|
|
63
|
+
response.on("data", (chunk) => {
|
|
64
|
+
downloaded += chunk.length;
|
|
65
|
+
if (total && process.stdout.isTTY) {
|
|
66
|
+
const pct = Math.round((downloaded / total) * 100);
|
|
67
|
+
process.stdout.write(`\rDownloading... ${pct}%`);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
response.pipe(file);
|
|
72
|
+
|
|
73
|
+
file.on("finish", () => {
|
|
74
|
+
file.close();
|
|
75
|
+
if (process.stdout.isTTY) {
|
|
76
|
+
process.stdout.write("\n");
|
|
77
|
+
}
|
|
78
|
+
resolve();
|
|
79
|
+
});
|
|
80
|
+
}).on("error", (err) => {
|
|
81
|
+
fs.unlinkSync(dest);
|
|
82
|
+
reject(err);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
request(url);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function main() {
|
|
91
|
+
try {
|
|
92
|
+
if (!fs.existsSync(binDir)) {
|
|
93
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
await download(url, binPath);
|
|
97
|
+
|
|
98
|
+
if (platform !== "win32") {
|
|
99
|
+
fs.chmodSync(binPath, 0o755);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
console.log("Hyperstack CLI installed successfully.");
|
|
103
|
+
} catch (err) {
|
|
104
|
+
console.error(`\nFailed to download Hyperstack CLI: ${err.message}`);
|
|
105
|
+
console.error(
|
|
106
|
+
"\nYou can install manually via Cargo:\n" +
|
|
107
|
+
" cargo install hyperstack-cli\n" +
|
|
108
|
+
"\nOr download directly from:\n" +
|
|
109
|
+
` ${url}`
|
|
110
|
+
);
|
|
111
|
+
process.exit(0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
main();
|