Skip to content

Commit

Permalink
perf(cli): ⚡️ created workspace in cli subcrates
Browse files Browse the repository at this point in the history
Subcrates now share a `target/` directory, and thus don't recompile shared dependencies.
  • Loading branch information
arctic-hen7 committed Sep 12, 2021
1 parent b7ad607 commit 3e11ecd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"conventionalCommits.scopes": ["i18n", "routing"]
"conventionalCommits.scopes": ["i18n", "routing", "cli"]
}
10 changes: 5 additions & 5 deletions packages/perseus-cli/src/prepare.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::errors::*;
use crate::extraction::extract_dir;
#[allow(unused_imports)]
use crate::PERSEUS_VERSION;
use cargo_toml::Manifest;
use include_dir::{include_dir, Dir};
Expand Down Expand Up @@ -76,13 +77,12 @@ pub fn prepare(dir: PathBuf) -> Result<()> {
)),
};
// Update the name of the user's crate (Cargo needs more than just a path and an alias)
// Also add an empty `[workspace]` key so we exclude from any of the user's workspace settings
// Also create a workspace so the subcrates share a `target/` directory (speeds up builds)
let updated_root_manifest = root_manifest_contents
.replace("perseus-example-cli", &user_crate_name)
+ "\n[workspace]";
let updated_server_manifest = server_manifest_contents
.replace("perseus-example-cli", &user_crate_name)
+ "\n[workspace]";
+ "\n[workspace]\nmembers = [ \"server\" ]";
let updated_server_manifest =
server_manifest_contents.replace("perseus-example-cli", &user_crate_name);

// If we're not in development, also update relative path references
#[cfg(not(debug_assertions))]
Expand Down

0 comments on commit 3e11ecd

Please sign in to comment.