blueprint-go 1.0.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.
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+
3
+ const os = require("os");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const https = require("https");
7
+
8
+ const platform = os.platform();
9
+ const arch = os.arch();
10
+
11
+ let binary = "";
12
+
13
+ if (platform === "win32") binary = "blueprint-windows-amd64.exe";
14
+ else if (platform === "darwin" && arch === "arm64") binary = "blueprint-darwin-arm64";
15
+ else if (platform === "darwin") binary = "blueprint-darwin-amd64";
16
+ else if (platform === "linux") binary = "blueprint-linux-amd64";
17
+
18
+ if (!binary) {
19
+ console.error("Unsupported platform");
20
+ process.exit(1);
21
+ }
22
+
23
+ const url =
24
+ "https://github.com/vidurapriyadarshana/blueprint/tree/release/v1.0.0" +
25
+ binary;
26
+
27
+ const dest = path.join(__dirname, platform === "win32" ? "blueprint.exe" : "blueprint");
28
+
29
+ function download(url, dest) {
30
+ return new Promise((resolve, reject) => {
31
+ const file = fs.createWriteStream(dest);
32
+ https.get(url, res => {
33
+ res.pipe(file);
34
+ file.on("finish", () => file.close(resolve));
35
+ }).on("error", reject);
36
+ });
37
+ }
38
+
39
+ (async () => {
40
+ try {
41
+ await download(url, dest);
42
+ fs.chmodSync(dest, 0o755);
43
+ } catch (err) {
44
+ console.error("Failed to install blueprint:", err);
45
+ process.exit(1);
46
+ }
47
+ })();
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "blueprint-go",
3
+ "version": "1.0.0",
4
+ "description": "Project scaffolding CLI",
5
+ "bin": {
6
+ "blueprint": "bin/blueprint.js"
7
+ },
8
+ "os": ["darwin", "linux", "win32"],
9
+ "cpu": ["x64", "arm64"]
10
+ }