mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
const vendor dir name
This commit is contained in:
parent
ddec8feab3
commit
9256871d62
@ -5,7 +5,7 @@ use typst::{
|
||||
diag::{bail, HintedStrResult, Warned},
|
||||
layout::PagedDocument,
|
||||
};
|
||||
use typst_kit::package::DEFAULT_PACKAGES_SUBDIR;
|
||||
use typst_kit::package::{DEFAULT_PACKAGES_SUBDIR, DEFAULT_VENDOR_SUBDIR};
|
||||
|
||||
use crate::{
|
||||
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<()> {
|
||||
let vendor_dir = world.workdir().join("vendor");
|
||||
let vendor_dir = world.workdir().join(DEFAULT_VENDOR_SUBDIR);
|
||||
|
||||
match vendor_dir.try_exists() {
|
||||
Ok(false) => {
|
||||
|
@ -21,6 +21,9 @@ pub const DEFAULT_NAMESPACE: &str = "preview";
|
||||
/// The default packages sub directory within the package and package cache paths.
|
||||
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
|
||||
/// on demand, if possible.
|
||||
#[derive(Debug)]
|
||||
@ -84,7 +87,7 @@ impl PackageStorage {
|
||||
|
||||
// Read from vendor dir if it exists.
|
||||
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() {
|
||||
let dir = vendor_dir.join(&subdir);
|
||||
if dir.exists() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user