-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
207 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/target | ||
craft.lock | ||
craft.lock | ||
node_modules |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"type": "module", | ||
"dependencies": { | ||
"express": "^4.18.2", | ||
"mongoose": "^5.9.7", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use std::fs; | ||
use std::path::Path; | ||
use fs_extra::dir::CopyOptions; | ||
|
||
pub fn copy_dir(from: &Path, to: &Path) -> Result<(), Box<dyn std::error::Error>> { | ||
if to.exists() { | ||
fs::remove_dir_all(&to).unwrap(); | ||
} | ||
|
||
fs::create_dir_all(&to).unwrap(); | ||
|
||
let options = CopyOptions::new().overwrite(true); | ||
|
||
copy_recursive(&from, &to, &options) | ||
} | ||
|
||
fn copy_recursive(from: &std::path::Path, to: &std::path::Path, options: &CopyOptions) -> Result<(), Box<dyn std::error::Error>> { | ||
let from_meta = fs::metadata(from)?; | ||
|
||
if from_meta.is_dir() { | ||
let dir_entries = fs::read_dir(from)?; | ||
|
||
for entry in dir_entries { | ||
let entry = entry?; | ||
let entry_path = entry.path(); | ||
let entry_name = entry.file_name().into_string().unwrap(); // Convert OsString to String | ||
|
||
let dest_path = to.join(&entry_name); | ||
|
||
if entry_path.is_dir() { | ||
fs::create_dir_all(&dest_path)?; | ||
copy_recursive(&entry_path, &dest_path, options)?; | ||
} else { | ||
fs_extra::copy_items(&vec![entry_path], &to, options)?; | ||
} | ||
} | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod copy; | ||
|
||
pub use copy::copy_dir; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ mod perf; | |
mod registry; | ||
mod tar; | ||
mod ui; | ||
mod fs; | ||
|
||
mod pipeline; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod file; | ||
mod shape; | ||
|
||
pub use file::LockFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::package::NpmPackage; | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct LockShape { | ||
pub package: NpmPackage, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,18 @@ | ||
use std::path::PathBuf; | ||
|
||
// ───────────────────────────────────────────────────────────────────────────── | ||
|
||
#[derive(Debug, Default)] | ||
pub struct LinkerArtifacts { | ||
pub artifacts: Vec<LinkArtifactItem>, | ||
} | ||
// ───────────────────────────────────────────────────────────────────────────── | ||
|
||
#[derive(Debug)] | ||
#[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
pub struct LinkArtifactItem { | ||
pub path: PathBuf, | ||
pub to: PathBuf, | ||
pub from: PathBuf, | ||
} | ||
|
||
// ───────────────────────────────────────────────────────────────────────────── | ||
|
||
impl LinkArtifactItem { | ||
pub fn new(path: PathBuf) -> Self { | ||
Self { path } | ||
pub fn new(from: PathBuf, to: PathBuf) -> Self { | ||
Self { from, to } | ||
} | ||
} | ||
|
||
impl LinkerArtifacts { | ||
pub fn add(&mut self, path: PathBuf) { | ||
self.artifacts.push(LinkArtifactItem::new(path)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.