jscan 0.2.0 → 0.2.2
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/jscan +22 -26
- package/package.json +7 -13
- package/platforms/darwin-arm64/bin/.gitkeep +0 -0
- package/platforms/darwin-arm64/bin/jscan +0 -0
- package/platforms/darwin-arm64/package.json +22 -0
- package/platforms/linux-arm64/bin/.gitkeep +0 -0
- package/platforms/linux-arm64/bin/jscan +0 -0
- package/platforms/linux-arm64/package.json +22 -0
- package/platforms/linux-x64/bin/.gitkeep +0 -0
- package/platforms/linux-x64/bin/jscan +0 -0
- package/platforms/linux-x64/package.json +22 -0
- package/platforms/windows-x64/bin/.gitkeep +0 -0
- package/platforms/windows-x64/bin/jscan.exe +0 -0
- package/platforms/windows-x64/package.json +22 -0
- package/scripts/download-binary.js +0 -130
package/bin/jscan
CHANGED
|
@@ -1,39 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { spawn } = require("child_process");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const fs = require("fs");
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
darwin: "darwin",
|
|
13
|
-
linux: "linux",
|
|
14
|
-
win32: "windows",
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const archMap = {
|
|
18
|
-
x64: "amd64",
|
|
19
|
-
arm64: "arm64",
|
|
5
|
+
const platformPackages = {
|
|
6
|
+
"darwin-arm64": "jscan-darwin-arm64",
|
|
7
|
+
"linux-x64": "jscan-linux-x64",
|
|
8
|
+
"linux-arm64": "jscan-linux-arm64",
|
|
9
|
+
"win32-x64": "jscan-windows-x64",
|
|
20
10
|
};
|
|
21
11
|
|
|
22
|
-
const
|
|
23
|
-
const
|
|
12
|
+
const key = `${process.platform}-${process.arch}`;
|
|
13
|
+
const pkg = platformPackages[key];
|
|
24
14
|
|
|
25
|
-
if (!
|
|
26
|
-
console.error(
|
|
15
|
+
if (!pkg) {
|
|
16
|
+
console.error(
|
|
17
|
+
`Unsupported platform: ${process.platform}-${process.arch}\n` +
|
|
18
|
+
`jscan supports: ${Object.keys(platformPackages).join(", ")}`
|
|
19
|
+
);
|
|
27
20
|
process.exit(1);
|
|
28
21
|
}
|
|
29
22
|
|
|
30
|
-
const ext = platform === "win32" ? ".exe" : "";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console.error(
|
|
36
|
-
|
|
23
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
24
|
+
let binaryPath;
|
|
25
|
+
try {
|
|
26
|
+
binaryPath = require.resolve(`${pkg}/bin/jscan${ext}`);
|
|
27
|
+
} catch {
|
|
28
|
+
console.error(
|
|
29
|
+
`Could not find the jscan binary for ${process.platform}-${process.arch}.\n` +
|
|
30
|
+
`The platform package "${pkg}" may not be installed.\n` +
|
|
31
|
+
`Try reinstalling: npm install jscan`
|
|
32
|
+
);
|
|
37
33
|
process.exit(1);
|
|
38
34
|
}
|
|
39
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jscan",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Code quality analyzer for JavaScript/TypeScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -25,19 +25,13 @@
|
|
|
25
25
|
"bin": {
|
|
26
26
|
"jscan": "./bin/jscan"
|
|
27
27
|
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"postinstall": "node scripts/download-binary.js"
|
|
30
|
-
},
|
|
31
28
|
"engines": {
|
|
32
29
|
"node": ">=14"
|
|
33
30
|
},
|
|
34
|
-
"
|
|
35
|
-
"darwin",
|
|
36
|
-
"linux",
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"x64",
|
|
41
|
-
"arm64"
|
|
42
|
-
]
|
|
31
|
+
"optionalDependencies": {
|
|
32
|
+
"jscan-darwin-arm64": "0.2.2",
|
|
33
|
+
"jscan-linux-arm64": "0.2.2",
|
|
34
|
+
"jscan-linux-x64": "0.2.2",
|
|
35
|
+
"jscan-windows-x64": "0.2.2"
|
|
36
|
+
}
|
|
43
37
|
}
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jscan-darwin-arm64",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "jscan binary for macOS ARM64",
|
|
5
|
+
"os": [
|
|
6
|
+
"darwin"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"arm64"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"jscan": "./bin/jscan"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/ludo-technologies/jscan.git"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jscan-linux-arm64",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "jscan binary for Linux ARM64",
|
|
5
|
+
"os": [
|
|
6
|
+
"linux"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"arm64"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"jscan": "./bin/jscan"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/ludo-technologies/jscan.git"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jscan-linux-x64",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "jscan binary for Linux x64",
|
|
5
|
+
"os": [
|
|
6
|
+
"linux"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"x64"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"jscan": "./bin/jscan"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/ludo-technologies/jscan.git"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jscan-windows-x64",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "jscan binary for Windows x64",
|
|
5
|
+
"os": [
|
|
6
|
+
"win32"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"x64"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"jscan": "./bin/jscan.exe"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/ludo-technologies/jscan.git"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,130 +0,0 @@
|
|
|
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 packageJson = require("../package.json");
|
|
9
|
-
const version = packageJson.version;
|
|
10
|
-
|
|
11
|
-
const platform = process.platform;
|
|
12
|
-
const arch = process.arch;
|
|
13
|
-
|
|
14
|
-
// Map Node.js platform/arch to Go build names
|
|
15
|
-
const platformMap = {
|
|
16
|
-
darwin: "darwin",
|
|
17
|
-
linux: "linux",
|
|
18
|
-
win32: "windows",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const archMap = {
|
|
22
|
-
x64: "amd64",
|
|
23
|
-
arm64: "arm64",
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const platformName = platformMap[platform];
|
|
27
|
-
const archName = archMap[arch];
|
|
28
|
-
|
|
29
|
-
if (!platformName || !archName) {
|
|
30
|
-
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const ext = platform === "win32" ? ".exe" : "";
|
|
35
|
-
const binaryName = `jscan-${platformName}-${archName}${ext}`;
|
|
36
|
-
const archiveName = `jscan_${version}_${platformName}_${archName}.tar.gz`;
|
|
37
|
-
const downloadUrl = `https://github.com/ludo-technologies/jscan/releases/download/v${version}/${archiveName}`;
|
|
38
|
-
|
|
39
|
-
const binDir = path.join(__dirname, "..", "bin");
|
|
40
|
-
const tempDir = path.join(__dirname, "..", ".tmp");
|
|
41
|
-
const binaryPath = path.join(binDir, binaryName);
|
|
42
|
-
const archivePath = path.join(tempDir, archiveName);
|
|
43
|
-
|
|
44
|
-
// Skip download if binary already exists
|
|
45
|
-
if (fs.existsSync(binaryPath)) {
|
|
46
|
-
console.log(`jscan binary already exists at ${binaryPath}`);
|
|
47
|
-
process.exit(0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Create directories if they don't exist
|
|
51
|
-
if (!fs.existsSync(binDir)) {
|
|
52
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
53
|
-
}
|
|
54
|
-
if (!fs.existsSync(tempDir)) {
|
|
55
|
-
fs.mkdirSync(tempDir, { recursive: true });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
console.log(`Downloading jscan v${version} for ${platformName}-${archName}...`);
|
|
59
|
-
console.log(`URL: ${downloadUrl}`);
|
|
60
|
-
|
|
61
|
-
function download(url, dest) {
|
|
62
|
-
return new Promise((resolve, reject) => {
|
|
63
|
-
const file = fs.createWriteStream(dest);
|
|
64
|
-
|
|
65
|
-
const request = (url) => {
|
|
66
|
-
https
|
|
67
|
-
.get(url, (response) => {
|
|
68
|
-
// Handle redirects
|
|
69
|
-
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
70
|
-
request(response.headers.location);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (response.statusCode !== 200) {
|
|
75
|
-
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
response.pipe(file);
|
|
80
|
-
file.on("finish", () => {
|
|
81
|
-
file.close();
|
|
82
|
-
resolve();
|
|
83
|
-
});
|
|
84
|
-
})
|
|
85
|
-
.on("error", (err) => {
|
|
86
|
-
fs.unlink(dest, () => {});
|
|
87
|
-
reject(err);
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
request(url);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async function main() {
|
|
96
|
-
try {
|
|
97
|
-
// Download the archive
|
|
98
|
-
await download(downloadUrl, archivePath);
|
|
99
|
-
console.log("Download complete.");
|
|
100
|
-
|
|
101
|
-
// Extract the archive to temp directory
|
|
102
|
-
console.log("Extracting...");
|
|
103
|
-
execSync(`tar -xzf "${archivePath}" -C "${tempDir}"`, { stdio: "inherit" });
|
|
104
|
-
|
|
105
|
-
// Move binary to bin directory with platform-specific name
|
|
106
|
-
const extractedBinary = path.join(tempDir, `jscan${ext}`);
|
|
107
|
-
if (fs.existsSync(extractedBinary)) {
|
|
108
|
-
fs.renameSync(extractedBinary, binaryPath);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Make it executable (Unix only)
|
|
112
|
-
if (platform !== "win32") {
|
|
113
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Clean up
|
|
117
|
-
fs.unlinkSync(archivePath);
|
|
118
|
-
fs.rmdirSync(tempDir);
|
|
119
|
-
|
|
120
|
-
console.log(`jscan v${version} installed successfully!`);
|
|
121
|
-
} catch (error) {
|
|
122
|
-
console.error(`Failed to install jscan: ${error.message}`);
|
|
123
|
-
console.error("");
|
|
124
|
-
console.error("You can manually download the binary from:");
|
|
125
|
-
console.error(`https://github.com/ludo-technologies/jscan/releases/tag/v${version}`);
|
|
126
|
-
process.exit(1);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
main();
|