Skip to content
Merged

Dev #73

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 112 additions & 32 deletions builder/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 22 additions & 10 deletions builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fn run_script<T: AsRef<Path>, A: AsRef<OsStr>, P: AsRef<Path> + std::fmt::Displa
if exit_code == Some(0) || (exit_code.is_some() && !check_exit_code) {
Ok(())
} else {
Err(io::Error::other("npm exit code indicates failure."))
Err(io::Error::other("pnpm exit code indicates failure."))
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@ fn patch_file(patch: &str, before_patch: &str, file_path: &str) -> io::Result<()
Ok(())
}
/// After updating files in the client's Node files, perform some fix-ups.
fn patch_client_npm() -> io::Result<()> {
fn patch_client_libs() -> io::Result<()> {
// Apply a the fixes described in [issue
// 27](https://github.com/bjones1/CodeChat_Editor/issues/27).
patch_file(
Expand Down Expand Up @@ -333,8 +333,18 @@ fn patch_client_npm() -> io::Result<()> {
}

fn run_install(dev: bool) -> io::Result<()> {
run_script("npm", &["install"], "../client", true)?;
patch_client_npm()?;
if dev {
run_script("npm", &["install", "-g", "pnpm@latest-10"], ".", true)?;
}
// See [the client manifest](../../client/package.json5) for an explanation
// of `--no-frozen-lockfile`.
run_script(
"pnpm",
&["install", "--no-frozen-lockfile"],
"../client",
true,
)?;
patch_client_libs()?;
run_script("npm", &["install"], "../extensions/VSCode", true)?;
run_cmd!(
cargo fetch --manifest-path=../builder/Cargo.toml;
Expand All @@ -354,15 +364,15 @@ fn run_install(dev: bool) -> io::Result<()> {
}

fn run_update() -> io::Result<()> {
run_script("npm", &["update"], "../client", true)?;
patch_client_npm()?;
run_script("pnpm", &["update"], "../client", true)?;
patch_client_libs()?;
run_script("npm", &["update"], "../extensions/VSCode", true)?;
run_cmd!(
cargo update --manifest-path=../builder/Cargo.toml;
cargo update;
)?;
// Simply display outdated dependencies, but don't consider them an error.
run_script("npm", &["outdated"], "../client", false)?;
run_script("pnpm", &["outdated"], "../client", false)?;
run_script("npm", &["outdated"], "../extensions/VSCode", false)?;
run_cmd!(
cargo outdated --manifest-path=../builder/Cargo.toml;
Expand Down Expand Up @@ -501,7 +511,7 @@ fn run_change_version(new_version: &String) -> io::Result<()> {
)?;
let json_search_regex = r#"(\r?\n "version": ")[\d.]+(",\r?\n)"#;
search_and_replace_file(
"../client/package.json",
"../client/package.json5",
json_search_regex,
&replacement_string,
)?;
Expand All @@ -520,7 +530,7 @@ fn run_prerelease() -> io::Result<()> {
run_cmd!(
cargo test export_bindings;
)?;
run_script("npm", &["run", "dist"], "../client", true)?;
run_script("pnpm", &["run", "dist"], "../client", true)?;
Ok(())
}

Expand Down Expand Up @@ -581,7 +591,9 @@ fn main() -> io::Result<()> {
// Change to the `server/` directory, so it can be run from anywhere.
let mut root_path = PathBuf::from(env::current_exe().unwrap().parent().unwrap());
root_path.push("../../../server");
// Use `dunce.canonicalize`, since UNC paths booger up some of the build tools (cargo can't delete the builder's binary, NPM doesn't accept UNC paths.)
// Use `dunce.canonicalize`, since UNC paths booger up some of the build
// tools (cargo can't delete the builder's binary, NPM doesn't accept UNC
// paths.)
root_path = canonicalize(root_path).unwrap();
env::set_current_dir(root_path).unwrap();

Expand Down
Loading
Loading