Skip to content

Commit

Permalink
feat: store dir structure compatible with pnpm (#166)
Browse files Browse the repository at this point in the history
Resolves #165

**Other changes:**
* A new crate named `pacquet-store-dir` has been created.
* The field `store-dir` in `Npmrc` has been changed from `PathBuf` to `StoreDir`.
* The function `write_sync` in `pacquet-cafs` has been replaced by 2 functions (8f98e73).
* The `pacquet-cafs` crate has been merged into `pacquet-store-dir` (db673ef).
* The `pacquet-tarball` crate now also writes index files (3b6e68a..8f98e73).
* The command `pacquet prune` now panics on `todo!()` for being incomplete (c8526d0).
  • Loading branch information
KSXGitHub authored Nov 2, 2023
1 parent a97eb4b commit 782a1ab
Show file tree
Hide file tree
Showing 37 changed files with 1,244 additions and 290 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ jobs:
clippy: true
save-cache: ${{ github.ref_name == 'main' }}

- name: Install pnpm (for compatibility check)
uses: pnpm/action-setup@v2
with:
version: 8.9.2
run_install: false
standalone: true

- name: Clippy
run: cargo clippy --locked -- -D warnings

Expand All @@ -48,7 +55,15 @@ jobs:
- name: Install cargo-nextest
uses: taiki-e/install-action@cargo-nextest

- run: cargo nextest run
- name: Test
shell: bash
run: |
# removing env vars is a temporary workaround for unit tests in pacquet relying on external environment
# this should be removed in the future
unset PNPM_HOME
unset XDG_DATA_HOME
cargo nextest run
typos:
name: Spell Check
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,21 @@ jobs:
- name: Install llvm-tools-preview for llvm-cov
run: rustup component add llvm-tools-preview

- name: Install pnpm (for compatibility check)
uses: pnpm/action-setup@v2
with:
version: 8.9.2
run_install: false
standalone: true

- name: Run
run: cargo codecov --lcov --output-path lcov.info
run: |
# removing env vars is a temporary workaround for unit tests in pacquet relying on external environment
# this should be removed in the future
unset PNPM_HOME
unset XDG_DATA_HOME
cargo codecov --lcov --output-path lcov.info
- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand Down
52 changes: 33 additions & 19 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
Expand Up @@ -23,13 +23,14 @@ pacquet-package-manager = { path = "crates/package-manager" }
pacquet-lockfile = { path = "crates/lockfile" }
pacquet-npmrc = { path = "crates/npmrc" }
pacquet-executor = { path = "crates/executor" }
pacquet-cafs = { path = "crates/cafs" }
pacquet-diagnostics = { path = "crates/diagnostics" }
pacquet-store-dir = { path = "crates/store-dir" }

# Dependencies
async-recursion = { version = "1.0.5" }
clap = { version = "4", features = ["derive", "string"] }
command-extra = { version = "1.0.0" }
base64 = { version = "0.21.5" }
dashmap = { version = "5.5.3" }
derive_more = { version = "1.0.0-beta.3", features = ["full"] }
dunce = { version = "1.0.4" }
Expand All @@ -49,6 +50,7 @@ serde = { version = "1.0.188", features = ["derive"] }
serde_ini = { version = "0.2.0" }
serde_json = { version = "1.0.107", features = ["preserve_order"] }
serde_yaml = { version = "0.9.1" }
sha2 = { version = "0.10.8" }
split-first-char = { version = "0.0.0" }
ssri = { version = "9.0.0" }
strum = { version = "0.25.0", features = ["derive"] }
Expand Down
20 changes: 0 additions & 20 deletions crates/cafs/Cargo.toml

This file was deleted.

97 changes: 0 additions & 97 deletions crates/cafs/src/lib.rs

This file was deleted.

3 changes: 2 additions & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ name = "pacquet"
path = "src/bin/main.rs"

[dependencies]
pacquet-cafs = { workspace = true }
pacquet-executor = { workspace = true }
pacquet-fs = { workspace = true }
pacquet-lockfile = { workspace = true }
Expand All @@ -35,6 +34,7 @@ pipe-trait = { workspace = true }
tokio = { workspace = true }

[dev-dependencies]
pacquet-store-dir = { workspace = true }
pacquet-testing-utils = { workspace = true }

assert_cmd = { workspace = true }
Expand All @@ -44,3 +44,4 @@ insta = { workspace = true }
pretty_assertions = { workspace = true }
serde_json = { workspace = true }
tempfile = { workspace = true }
walkdir = { workspace = true }
2 changes: 1 addition & 1 deletion crates/cli/src/cli_args/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl StoreCommand {
panic!("Not implemented")
}
StoreCommand::Prune => {
pacquet_cafs::prune_sync(&config().store_dir).wrap_err("pruning store")?;
config().store_dir.prune().wrap_err("pruning store")?;
}
StoreCommand::Path => {
println!("{}", config().store_dir.display());
Expand Down
Loading

0 comments on commit 782a1ab

Please sign in to comment.