const vendor dir name

This commit is contained in:
stelzo 2025-01-21 23:49:47 +01:00
parent ddec8feab3
commit 9256871d62
No known key found for this signature in database
GPG Key ID: FC4EF89052319374
2 changed files with 6 additions and 3 deletions

View File

@ -5,7 +5,7 @@ use typst::{
diag::{bail, HintedStrResult, Warned}, diag::{bail, HintedStrResult, Warned},
layout::PagedDocument, layout::PagedDocument,
}; };
use typst_kit::package::DEFAULT_PACKAGES_SUBDIR; use typst_kit::package::{DEFAULT_PACKAGES_SUBDIR, DEFAULT_VENDOR_SUBDIR};
use crate::{ use crate::{
args::VendorCommand, compile::print_diagnostics, set_failed, world::SystemWorld, args::VendorCommand, compile::print_diagnostics, set_failed, world::SystemWorld,
@ -46,7 +46,7 @@ pub fn vendor(command: &VendorCommand) -> HintedStrResult<()> {
} }
fn copy_deps(world: &mut SystemWorld) -> HintedStrResult<()> { fn copy_deps(world: &mut SystemWorld) -> HintedStrResult<()> {
let vendor_dir = world.workdir().join("vendor"); let vendor_dir = world.workdir().join(DEFAULT_VENDOR_SUBDIR);
match vendor_dir.try_exists() { match vendor_dir.try_exists() {
Ok(false) => { Ok(false) => {

View File

@ -21,6 +21,9 @@ pub const DEFAULT_NAMESPACE: &str = "preview";
/// The default packages sub directory within the package and package cache paths. /// The default packages sub directory within the package and package cache paths.
pub const DEFAULT_PACKAGES_SUBDIR: &str = "typst/packages"; pub const DEFAULT_PACKAGES_SUBDIR: &str = "typst/packages";
/// The default vendor sub directory within the project root.
pub const DEFAULT_VENDOR_SUBDIR: &str = "vendor";
/// Holds information about where packages should be stored and downloads them /// Holds information about where packages should be stored and downloads them
/// on demand, if possible. /// on demand, if possible.
#[derive(Debug)] #[derive(Debug)]
@ -84,7 +87,7 @@ impl PackageStorage {
// Read from vendor dir if it exists. // Read from vendor dir if it exists.
if let Some(project_root) = project_root { if let Some(project_root) = project_root {
let vendor_dir = project_root.join("vendor"); let vendor_dir = project_root.join(DEFAULT_VENDOR_SUBDIR);
if let Ok(true) = vendor_dir.try_exists() { if let Ok(true) = vendor_dir.try_exists() {
let dir = vendor_dir.join(&subdir); let dir = vendor_dir.join(&subdir);
if dir.exists() { if dir.exists() {