Skip to content

Commit

Permalink
feat(cli): improve DX by showing more information when deploying (#606)
Browse files Browse the repository at this point in the history
* feat(cli): improve DX by showing more information when deploying

* fix(cli): only show --prod help when not deploying to prod
  • Loading branch information
QuiiBz authored Feb 20, 2023
1 parent a89bc08 commit cde118f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-doors-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lagon/cli': patch
---

Improve DX by showing more information when deploying
33 changes: 28 additions & 5 deletions crates/cli/src/utils/deployments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ impl FunctionConfig {
}
None => {
let index = Input::<String>::new()
.with_prompt(info("Path to your Function's entrypoint?"))
.with_prompt(format!(
"{} {}",
info("Path to your Function's entrypoint?"),
debug(
format!("(relative to {:?})", root.canonicalize().unwrap())
.as_str()
),
))
.interact_text()?;
PathBuf::from(index)
}
Expand All @@ -79,7 +86,14 @@ impl FunctionConfig {
{
true => {
let assets = Input::<String>::new()
.with_prompt(info("Path to your Function's public directory?"))
.with_prompt(format!(
"{} {}",
info("Path to your Function's public directory?"),
debug(
format!("(relative to {:?})", root.canonicalize().unwrap())
.as_str()
),
))
.interact_text()?;
let assets = PathBuf::from(assets);

Expand Down Expand Up @@ -243,10 +257,14 @@ pub fn bundle_function(function_config: &FunctionConfig, root: &Path) -> Result<
}

if let Some(assets) = &function_config.assets {
let msg = format!("Found public directory ({:?}), bundling assets...", assets);
let assets = root.join(assets);
let msg = format!(
"Found public directory ({:?}), bundling assets...",
assets.canonicalize().unwrap()
);
let end_progress = print_progress(&msg);

let files = WalkDir::new(root.join(assets))
let files = WalkDir::new(&assets)
.into_iter()
.collect::<Vec<walkdir::Result<DirEntry>>>();

Expand All @@ -270,7 +288,7 @@ pub fn bundle_function(function_config: &FunctionConfig, root: &Path) -> Result<
));
}

let diff = diff_paths(path, root.join(assets))
let diff = diff_paths(path, &assets)
.unwrap()
.to_str()
.unwrap()
Expand Down Expand Up @@ -398,6 +416,11 @@ pub async fn create_deployment(

println!();
println!("{}", success("Function deployed!"));

if !prod {
println!("{}", debug("Use --prod to deploy to production"));
}

println!();
println!(
" {} {}",
Expand Down

4 comments on commit cde118f

@vercel
Copy link

@vercel vercel bot commented on cde118f Feb 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

storybook – ./packages/ui

storybook-swart-eight.vercel.app
ui.lagon.app
storybook-git-main-lagon.vercel.app
storybook-lagon.vercel.app

@vercel
Copy link

@vercel vercel bot commented on cde118f Feb 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./packages/docs

lagon-docs.vercel.app
docs-lagon.vercel.app
docs-git-main-lagon.vercel.app
docs.lagon.app

@vercel
Copy link

@vercel vercel bot commented on cde118f Feb 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

www – ./www

www-git-main-lagon.vercel.app
lagon.dev
www-lagon.vercel.app
lagon.app

@vercel
Copy link

@vercel vercel bot commented on cde118f Feb 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dashboard – ./packages/dashboard

dashboard-lagon.vercel.app
dashboard-git-main-lagon.vercel.app
dash.lagon.app

Please sign in to comment.