This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: Support globals and proto v0.15. (#5)
- Loading branch information
Showing
19 changed files
with
713 additions
and
234 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
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
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 |
---|---|---|
|
@@ -6,4 +6,5 @@ license = "MIT" | |
publish = false | ||
|
||
[dependencies] | ||
proto_pdk_api = { workspace = true } | ||
serde = { workspace = true } |
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,46 @@ | ||
use proto_pdk_api::ExecCommandInput; | ||
use std::path::Path; | ||
|
||
pub fn install_global(dependency: &str, globals_dir: &Path) -> ExecCommandInput { | ||
let mut cmd = ExecCommandInput::inherit( | ||
"npm", | ||
[ | ||
"install", | ||
"--global", | ||
"--loglevel", | ||
"warn", | ||
"--no-audit", | ||
"--no-update-notifier", | ||
dependency, | ||
], | ||
); | ||
|
||
cmd.env_vars | ||
.insert("PROTO_INSTALL_GLOBAL".into(), "true".into()); | ||
|
||
// Remove the /bin component | ||
cmd.env_vars.insert( | ||
"PREFIX".into(), | ||
globals_dir.parent().unwrap().to_string_lossy().to_string(), | ||
); | ||
|
||
cmd | ||
} | ||
|
||
pub fn uninstall_global(dependency: &str, globals_dir: &Path) -> ExecCommandInput { | ||
let mut cmd = ExecCommandInput::inherit( | ||
"npm", | ||
["uninstall", "--global", "--loglevel", "warn", dependency], | ||
); | ||
|
||
cmd.env_vars | ||
.insert("PROTO_INSTALL_GLOBAL".into(), "true".into()); | ||
|
||
// Remove the /bin component | ||
cmd.env_vars.insert( | ||
"PREFIX".into(), | ||
globals_dir.parent().unwrap().to_string_lossy().to_string(), | ||
); | ||
|
||
cmd | ||
} |
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,3 +1,4 @@ | ||
pub mod commands; | ||
mod node_dist; | ||
mod package_json; | ||
|
||
|
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.