From 3e11ecd6da6b618a5b94c5abfc33264e37304482 Mon Sep 17 00:00:00 2001 From: arctic_hen7 Date: Sun, 12 Sep 2021 15:49:06 +1000 Subject: [PATCH] =?UTF-8?q?perf(cli):=20=E2=9A=A1=EF=B8=8F=20created=20wor?= =?UTF-8?q?kspace=20in=20cli=20subcrates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subcrates now share a `target/` directory, and thus don't recompile shared dependencies. --- .vscode/settings.json | 2 +- packages/perseus-cli/src/prepare.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 49300a14fd..5d04000c5f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "conventionalCommits.scopes": ["i18n", "routing"] + "conventionalCommits.scopes": ["i18n", "routing", "cli"] } diff --git a/packages/perseus-cli/src/prepare.rs b/packages/perseus-cli/src/prepare.rs index e608cfc683..58a808d809 100644 --- a/packages/perseus-cli/src/prepare.rs +++ b/packages/perseus-cli/src/prepare.rs @@ -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}; @@ -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))]