|
18 | 18 |
|
19 | 19 | use std::{collections::HashMap, io::BufReader}; |
20 | 20 |
|
21 | | -use vite_install::package_manager::{PackageManager, PackageManagerType}; |
| 21 | +use vite_install::package_manager::PackageManager; |
22 | 22 | use vite_path::AbsolutePath; |
23 | 23 | use vite_shared::{PrependOptions, prepend_to_path_env}; |
24 | 24 |
|
@@ -97,37 +97,6 @@ pub async fn build_package_manager(cwd: &AbsolutePath) -> Result<PackageManager, |
97 | 97 | } |
98 | 98 | } |
99 | 99 |
|
100 | | -/// Build a PackageManager, falling back to a default npm instance when no |
101 | | -/// package.json is found. Uses `build()` instead of `build_with_default()` |
102 | | -/// to skip the interactive package manager selection prompt on the fallback path. |
103 | | -/// |
104 | | -/// Requires `prepend_js_runtime_to_path_env` to be called first so npm is on PATH. |
105 | | -pub async fn build_package_manager_or_npm_default( |
106 | | - cwd: &AbsolutePath, |
107 | | -) -> Result<PackageManager, Error> { |
108 | | - match PackageManager::builder(cwd).build().await { |
109 | | - Ok(pm) => Ok(pm), |
110 | | - Err(vite_error::Error::WorkspaceError(vite_workspace::Error::PackageJsonNotFound(_))) |
111 | | - | Err(vite_error::Error::UnrecognizedPackageManager) => { |
112 | | - Ok(default_npm_package_manager(cwd)) |
113 | | - } |
114 | | - Err(e) => Err(e.into()), |
115 | | - } |
116 | | -} |
117 | | - |
118 | | -fn default_npm_package_manager(cwd: &AbsolutePath) -> PackageManager { |
119 | | - PackageManager { |
120 | | - client: PackageManagerType::Npm, |
121 | | - package_name: "npm".into(), |
122 | | - version: "latest".into(), |
123 | | - hash: None, |
124 | | - bin_name: "npm".into(), |
125 | | - workspace_root: cwd.to_absolute_path_buf(), |
126 | | - is_monorepo: false, |
127 | | - install_dir: cwd.to_absolute_path_buf(), |
128 | | - } |
129 | | -} |
130 | | - |
131 | 100 | pub mod release; |
132 | 101 |
|
133 | 102 | // Category B: JS Script Commands |
|
0 commit comments