Skip to content
This repository was archived by the owner on Sep 17, 2023. It is now read-only.

refactor: read monorepo manifest files in parallel #154

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 119 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "rust_typescript_tools"
name = "typescript_tools"
version = "0.0.0-semantically-released"
edition = "2021"

Expand All @@ -8,9 +8,11 @@ name = "monorepo"
path = "src/main.rs"

[dependencies]
anyhow = "1.0"
askama = "0.11"
clap = { version = "3.1.8", features = ["cargo", "derive"] }
globwalk = "0.8.1"
dpc-pariter = "0.5.1"
pathdiff = "0.2.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
Expand Down
7 changes: 4 additions & 3 deletions src/configuration_file.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use std::error::Error;
use std::path::{Path, PathBuf};

use anyhow::Result;

/// Configuration file for some component of the monorepo.
pub trait ConfigurationFile<T> {
/// Basename of the configuration file.
const FILENAME: &'static str;

/// Create an instance of this configuration file by reading
/// the specified file from this directory on disk.
fn from_directory<P>(monorepo_root: P, directory: P) -> Result<T, Box<dyn Error>>
fn from_directory<P>(monorepo_root: P, directory: P) -> Result<T>
where
P: AsRef<Path>;

Expand All @@ -20,5 +21,5 @@ pub trait ConfigurationFile<T> {
fn path(&self) -> PathBuf;

/// Write this configuration file to disk.
fn write(&self) -> Result<(), Box<dyn Error>>;
fn write(&self) -> Result<()>;
}
5 changes: 3 additions & 2 deletions src/io.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::error::Error;
use std::fs::File;
use std::io::{BufWriter, Write};
use std::path::Path;

use anyhow::Result;

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, PartialEq)]
Expand All @@ -19,7 +20,7 @@ pub struct TypescriptParentProjectReference {
pub fn write_project_references<P: AsRef<Path>>(
path: P,
references: &TypescriptParentProjectReference,
) -> Result<(), Box<dyn Error>> {
) -> Result<()> {
let file = File::create(&path)?;
let mut writer = BufWriter::new(file);
serde_json::to_writer_pretty(&mut writer, references)?;
Expand Down
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![forbid(unsafe_code)]

mod configuration_file;
mod io;
mod monorepo_manifest;
mod package_manifest;
mod typescript_config;

pub mod link;
pub mod lint;
pub mod make_depend;
pub mod opts;
pub mod pin;
pub mod query;
Loading