@fusillade-io/fusillade 0.7.1

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 (3) hide show
  1. package/bin/fusillade +22 -0
  2. package/install.js +77 -0
  3. package/package.json +30 -0
package/bin/fusillade ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const os = require('os');
6
+
7
+ const binaryName = os.platform() === 'win32' ? 'fusillade-bin.exe' : 'fusillade-bin';
8
+ const binaryPath = path.join(__dirname, binaryName);
9
+
10
+ const child = spawn(binaryPath, process.argv.slice(2), {
11
+ stdio: 'inherit'
12
+ });
13
+
14
+ child.on('close', (code) => {
15
+ process.exit(code);
16
+ });
17
+
18
+ child.on('error', (err) => {
19
+ console.error(`Failed to start subprocess: ${binaryPath}`);
20
+ console.error(err);
21
+ process.exit(1);
22
+ });
package/install.js ADDED
@@ -0,0 +1,77 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const https = require('https');
4
+ const { execSync } = require('child_process');
5
+ const packageJson = require('./package.json');
6
+
7
+ const VERSION = packageJson.version;
8
+ const PLATFORM = process.platform;
9
+ const ARCH = process.arch;
10
+
11
+ const BIN_DIR = path.join(__dirname, 'bin');
12
+ const BIN_NAME = PLATFORM === 'win32' ? 'fusillade-bin.exe' : 'fusillade-bin';
13
+ const BIN_PATH = path.join(BIN_DIR, BIN_NAME);
14
+
15
+ const MAPPING = {
16
+ 'darwin-x64': 'fusillade-macos-x64',
17
+ 'darwin-arm64': 'fusillade-macos-arm64',
18
+ 'linux-x64': 'fusillade-linux-x64',
19
+ 'win32-x64': 'fusillade-windows-x64.exe'
20
+ };
21
+
22
+ const key = `${PLATFORM}-${ARCH}`;
23
+ const artifactName = MAPPING[key];
24
+
25
+ if (!artifactName) {
26
+ console.error(`Unsupported platform/architecture: ${key}`);
27
+ process.exit(1);
28
+ }
29
+
30
+ const url = `https://github.com/Fusillade-io/Fusillade/releases/download/v${VERSION}/${artifactName}`;
31
+
32
+ console.log(`Downloading Fusillade v${VERSION} for ${key}...`);
33
+ console.log(`URL: ${url}`);
34
+
35
+ const file = fs.createWriteStream(BIN_PATH);
36
+
37
+ function download(downloadUrl) {
38
+ https.get(downloadUrl, (response) => {
39
+ if (response.statusCode === 302 || response.statusCode === 301) {
40
+ download(response.headers.location);
41
+ return;
42
+ }
43
+
44
+ if (response.statusCode !== 200) {
45
+ console.error(`Failed to download binary. Status code: ${response.statusCode}`);
46
+ console.error(`URL: ${downloadUrl}`);
47
+ process.exit(1);
48
+ }
49
+
50
+ response.pipe(file);
51
+
52
+ file.on('finish', () => {
53
+ file.close(() => {
54
+ console.log('Download completed.');
55
+ if (PLATFORM !== 'win32') {
56
+ try {
57
+ fs.chmodSync(BIN_PATH, 0o755);
58
+ console.log('Made binary executable.');
59
+ } catch (err) {
60
+ console.error('Failed to make binary executable:', err);
61
+ }
62
+ }
63
+ });
64
+ });
65
+ }).on('error', (err) => {
66
+ fs.unlink(BIN_PATH, () => { });
67
+ console.error('Error downloading binary:', err.message);
68
+ process.exit(1);
69
+ });
70
+ }
71
+
72
+ // Ensure bin directory exists
73
+ if (!fs.existsSync(BIN_DIR)) {
74
+ fs.mkdirSync(BIN_DIR, { recursive: true });
75
+ }
76
+
77
+ download(url);
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@fusillade-io/fusillade",
3
+ "version": "0.7.1",
4
+ "description": "High-performance load testing platform built in Rust",
5
+ "bin": {
6
+ "fusillade": "bin/fusillade"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node install.js"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/Fusillade-io/Fusillade.git"
14
+ },
15
+ "author": "Fusillade Maintainer",
16
+ "license": "MIT",
17
+ "os": [
18
+ "darwin",
19
+ "linux",
20
+ "win32"
21
+ ],
22
+ "cpu": [
23
+ "x64",
24
+ "arm64"
25
+ ],
26
+ "bugs": {
27
+ "url": "https://github.com/Fusillade-io/Fusillade/issues"
28
+ },
29
+ "homepage": "https://github.com/Fusillade-io/Fusillade#readme"
30
+ }