-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from Web3-Builders-Alliance/main
- Loading branch information
Showing
70 changed files
with
6,836 additions
and
648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
[package] | ||
name = "soda-cli" | ||
version = "0.1.0" | ||
version = "0.0.1" | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
description = "Generates Solana Projects from an IDL" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde_json = "1.0.93" | ||
env_logger = "0.10" | ||
clap = { version = "4.1.8", features = ["derive"] } | ||
soda = { path = "../crate" } | ||
soda_sol = { path = "../crate" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@use_soda/soda-cli", | ||
"version": "0.0.1", | ||
"description": "Generates Solana Projects from an IDL", | ||
"main": "start.js", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"postinstall": "node ./pre-install.js", | ||
"uninstall": "node ./uninstall.js" | ||
}, | ||
"keywords": [], | ||
|
||
"license": "Apache-2.0", | ||
"files": [ | ||
"pre-install.js", | ||
"start.js", | ||
"uninstall.js", | ||
"README.md", | ||
"LICENSE" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
const { exec } = require("child_process"); | ||
const { homedir } = require("os"); | ||
|
||
const cargoDir = path.join(homedir(), ".cargo"); | ||
|
||
// check if directory exists | ||
if (fs.existsSync(cargoDir)) { | ||
// console.log("Cargo found."); | ||
} else { | ||
const setCargo = 'PATH="/$HOME/.cargo/bin:${PATH}"'; | ||
console.log("Installing deps [cargo]."); | ||
|
||
exec( | ||
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && ${setCargo}`, | ||
(error) => { | ||
if (error) { | ||
console.log( | ||
"curl failed! Curl may not be installed on the OS. View https://curl.se/download.html to install." | ||
); | ||
console.log(error); | ||
} | ||
} | ||
); | ||
} | ||
|
||
const features = process.env.npm_config_features ? `--features ${process.env.npm_config_features.replace(",", " ")}` : ""; | ||
|
||
console.log(`Installing and compiling soda-cli 0.0.1 ${features} ...`); | ||
exec(`cargo install soda-cli --vers 0.0.1 ${features}`, (error, stdout, stderr) => { | ||
console.log(stdout); | ||
if (error || stderr) { | ||
console.log(error || stderr); | ||
} else { | ||
console.log("install finished!"); | ||
} | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env node | ||
|
||
const { exec } = require("child_process"); | ||
|
||
const controller = typeof AbortController !== "undefined" ? new AbortController() : { abort: () => {}, signal: typeof AbortSignal !== "undefined" ? new AbortSignal() : undefined }; | ||
const { signal } = controller; | ||
|
||
exec("soda-cli", { signal }, (error, stdout, stderr) => { | ||
stdout && console.log(stdout); | ||
stderr && console.error(stderr); | ||
if (error !== null) { | ||
console.log(`exec error: ${error}`); | ||
} | ||
}); | ||
|
||
process.on("SIGTERM", () => { | ||
controller && controller.abort(); | ||
}); | ||
|
||
process.on("SIGINT", () => { | ||
controller && controller.abort(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
const { exec } = require("child_process"); | ||
const { homedir } = require("os"); | ||
|
||
const cargoDir = path.join(homedir(), ".cargo"); | ||
|
||
// check if directory exists | ||
if (fs.existsSync(cargoDir)) { | ||
// console.log("Cargo found."); | ||
} else { | ||
const setCargo = 'PATH="/$HOME/.cargo/bin:${PATH}"'; | ||
console.log("Installing deps [cargo]."); | ||
|
||
exec( | ||
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && ${setCargo}`, | ||
(error) => { | ||
if (error) { | ||
console.log( | ||
"curl failed! Curl may not be installed on the OS. View https://curl.se/download.html to install." | ||
); | ||
console.log(error); | ||
} | ||
} | ||
); | ||
} | ||
|
||
const binp = path.join(cargoDir, "bin", "soda-cli"); | ||
|
||
if (fs.existsSync(binp)) { | ||
console.log("Uninstalling soda-cli..."); | ||
exec(`cargo uninstall soda-cli`, (error, stdout, stderr) => { | ||
console.log(stdout); | ||
if (error || stderr) { | ||
console.log(error || stderr); | ||
} | ||
}); | ||
} else { | ||
console.log("soda-cli not found skipping!"); | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.