Skip to content

Commit

Permalink
Improve binary size, other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrichton committed Jul 1, 2024
1 parent b396198 commit 0d5628f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[workspace]
resolver = "2"
members = ["crates/*"]
members = ["crates/*"]

[profile.release]
strip = true
lto = true
opt-level = "z"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Alternatively, you can follow one of these installation methods:

```
cargo install depot-js --locked
depot setup
```

### From source
Expand All @@ -46,6 +47,7 @@ cargo install depot-js --locked
git clone https://github.com/cognitive-engineering-lab/depot
cd depot
cargo install --path crates/depot --locked
depot setup
```

## Usage
Expand Down
15 changes: 7 additions & 8 deletions crates/depot/src/commands/new.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(clippy::items_after_statements, clippy::too_many_lines)]

use anyhow::{ensure, Result};
use anyhow::{ensure, Context, Result};
use indexmap::{indexmap, IndexMap};
use package_json_schema as pj;
use serde_json::{json, Value};
Expand Down Expand Up @@ -514,10 +514,12 @@ export default defineConfig(({{ mode }}) => ({{
}

fn update_typedoc_config(&self, ws: &Workspace) -> Result<()> {
let path = ws.root.join("typedoc.json");
let mut f = OpenOptions::new()
.read(true)
.write(true)
.open(ws.root.join("typedoc.json"))?;
.open(&path)
.with_context(|| format!("Failed to open file: {}", path.display()))?;
let mut config: Value = {
let reader = BufReader::new(&mut f);
serde_json::from_reader(reader)?
Expand Down Expand Up @@ -710,11 +712,8 @@ export default defineConfig(({{ mode }}) => ({{

dev_dependencies.push("normalize.css");

let css_path = if self.args.sass {
"index.scss"
} else {
"index.css"
};
let css_name = if self.args.vike { "base" } else { "index" };
let css_path = format!("{css_name}.{}", if self.args.sass { "scss" } else { "css" });

if self.args.vike {
ensure!(self.args.react, "Currently must use --react with --vike");
Expand Down Expand Up @@ -762,7 +761,7 @@ export default () => {

files.push((
"index.html".into(),
Self::make_index_html(js_path, css_path).into(),
Self::make_index_html(js_path, &css_path).into(),
));

utils::create_dir(root.join("styles"))?;
Expand Down

0 comments on commit 0d5628f

Please sign in to comment.