mirror of
https://github.com/typst/typst
synced 2025-05-15 01:25: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},
|
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) => {
|
||||||
|
@ -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() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user