Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: store dir structure compatible with pnpm #166

Merged
merged 110 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 105 commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
54a81fd
feat: pacquet-store-dir
KSXGitHub Oct 29, 2023
13471c3
fix: file_path_by_hash_str
KSXGitHub Oct 30, 2023
30267c9
feat: serde
KSXGitHub Oct 30, 2023
b5ef876
feat: StoreDir::tmp
KSXGitHub Oct 30, 2023
a79c0a1
fix(cargo): path to a crate
KSXGitHub Oct 30, 2023
ddfeeb4
feat: impl From<PathBuf> for StoreDir
KSXGitHub Oct 30, 2023
b122d5c
test: StoreDir
KSXGitHub Oct 30, 2023
58c3837
feat: StoreDir::display
KSXGitHub Oct 30, 2023
68cfc31
feat: impl Eq for StoreDir
KSXGitHub Oct 30, 2023
6e4ed86
feat: StoreDir::file_path_by_content_address
KSXGitHub Oct 30, 2023
bb931d9
fix: borrow
KSXGitHub Oct 30, 2023
0ab7ff4
feat: use StoreDir
KSXGitHub Oct 30, 2023
c8526d0
feat: remove incomplete prune implementation
KSXGitHub Oct 30, 2023
1d716f2
fix: compile error
KSXGitHub Oct 30, 2023
e8c12fb
test(windows): fix
KSXGitHub Oct 30, 2023
90da00b
test(windows): fix
KSXGitHub Oct 30, 2023
6d43bce
refactor: remove unused items
KSXGitHub Oct 30, 2023
44c4f49
refactor: remove unnecessary `.to_path_buf()`
KSXGitHub Oct 30, 2023
185e4bf
test: file_path_by_content_address
KSXGitHub Oct 30, 2023
0c4e27c
refactor: StoreDir::new
KSXGitHub Oct 30, 2023
4e40463
refactor: combine `#[cfg(unix)]`
KSXGitHub Oct 30, 2023
deb1681
refactor: use sha2 directly
KSXGitHub Oct 30, 2023
c76724a
refactor: use `new_with_prefix`
KSXGitHub Oct 30, 2023
1ee7063
refactor: use `digest`
KSXGitHub Oct 30, 2023
5610e59
test: add back windows
KSXGitHub Oct 30, 2023
f1f4316
docs: add missing TODO
KSXGitHub Oct 30, 2023
b01abcd
refactor: pass suffix to write_sync
KSXGitHub Oct 30, 2023
4dfa84e
style: remove an empty line
KSXGitHub Oct 30, 2023
31148d3
feat: executable bits
KSXGitHub Oct 30, 2023
7b5d7bf
refactor: use early return
KSXGitHub Oct 30, 2023
dd430c6
feat: set executables as executable
KSXGitHub Oct 30, 2023
8d9eb49
fix: macos and windows
KSXGitHub Oct 30, 2023
3b6e68a
feat: index files
KSXGitHub Oct 31, 2023
871c8b6
fix: serde panics
KSXGitHub Oct 31, 2023
09c4222
docs: existing bugs
KSXGitHub Oct 31, 2023
9ea30e2
refactor: rename a function
KSXGitHub Oct 31, 2023
4fee0a3
refactor: StoreDir::file_path_by_hex_str
KSXGitHub Oct 31, 2023
8f98e73
fix: content address of the index files
KSXGitHub Oct 31, 2023
209e197
refactor: derive From for TaskError
KSXGitHub Oct 31, 2023
29e6901
refactor: move StoreDir to its own mod
KSXGitHub Oct 31, 2023
db673ef
refactor: move cafs into store-dir
KSXGitHub Oct 31, 2023
593dcdb
docs(store-dir): error type
KSXGitHub Oct 31, 2023
4c2141a
refactor: move TarballIndex into store-dir
KSXGitHub Oct 31, 2023
c7e8d9a
refactor: move a function to pacquet-fs
KSXGitHub Oct 31, 2023
b34a3f0
feat(fs): divide error variants into 2
KSXGitHub Oct 31, 2023
a77b775
refactor: rename
KSXGitHub Oct 31, 2023
e3821c1
refactor: correct categories
KSXGitHub Oct 31, 2023
1ef6d6f
refactor: remove unnecessary `pub(crate)`
KSXGitHub Oct 31, 2023
d9270f4
refactor: pass `executable` instead of `suffix`
KSXGitHub Oct 31, 2023
7d771db
refactor: remove FileSuffix and strum
KSXGitHub Oct 31, 2023
5f3050a
refactor: remove `Option` for `suffix`
KSXGitHub Oct 31, 2023
51c0672
refactor: rename a function
KSXGitHub Oct 31, 2023
fb18087
refactor: make_file_executable
KSXGitHub Oct 31, 2023
3ba5986
feat(fs): make_file_executable
KSXGitHub Oct 31, 2023
6782153
refactor: re-use make_file_executable
KSXGitHub Oct 31, 2023
b1c9e06
test: rename
KSXGitHub Oct 31, 2023
af24bd5
refactor: move some functions
KSXGitHub Oct 31, 2023
4bc61d0
fix: clippy on windows
KSXGitHub Oct 31, 2023
184cf13
test: tarball_index_file_path
KSXGitHub Oct 31, 2023
d31bd5e
fix: clippy on windows
KSXGitHub Oct 31, 2023
9a61217
chore(git): merge
KSXGitHub Oct 31, 2023
ac01df0
clippy: fix on windows
KSXGitHub Oct 31, 2023
8d46b55
chore(git): merge
KSXGitHub Oct 31, 2023
a757a85
fix: only make file executable when executable
KSXGitHub Oct 31, 2023
fa4562e
chore(git): merge from main
KSXGitHub Oct 31, 2023
2156131
feat: TarballIndexFileAttrs::checked_at
KSXGitHub Oct 31, 2023
d8c09da
test(cli): change dir to a sub dir
KSXGitHub Oct 31, 2023
0cae50e
feat: add .npmrc to every integration tests
KSXGitHub Oct 31, 2023
1c2e14a
refactor: remove unused, reuse available name
KSXGitHub Oct 31, 2023
bc55d2d
feat(test): create_npmrc parameter
KSXGitHub Oct 31, 2023
8166883
test: snapshot the store
KSXGitHub Oct 31, 2023
8fd6ec8
chore(git): merge
KSXGitHub Oct 31, 2023
ca61973
test(cli/install): correct snapshot
KSXGitHub Oct 31, 2023
bc80817
test: remove dirs from `get_all_files`
KSXGitHub Oct 31, 2023
b4c9edc
test(cli/install): exec files in the store
KSXGitHub Oct 31, 2023
b3f9d8c
test: remove dirs from `get_all_files`
KSXGitHub Oct 31, 2023
42b4a35
chore(git): merge
KSXGitHub Oct 31, 2023
e4e1773
style: use qualified
KSXGitHub Oct 31, 2023
00260a0
chore(git): merge
KSXGitHub Oct 31, 2023
791ac1e
chore(git): merge from main
KSXGitHub Oct 31, 2023
d91a355
docs: add a comment
KSXGitHub Oct 31, 2023
7966f5d
test(cli/install): snapshot all files
KSXGitHub Nov 1, 2023
aac7505
test(cli/install): snapshot last
KSXGitHub Nov 1, 2023
2750271
feat(config): default store dir to pnpm
KSXGitHub Nov 1, 2023
eea2459
perf: set mode at the same time as writing files
KSXGitHub Nov 1, 2023
50fb06d
refactor: clearer bit mask
KSXGitHub Nov 1, 2023
4f87522
refactor: rename TarballIndex -> PackageFilesIndex
KSXGitHub Nov 1, 2023
3883db0
refactor: rename some functions
KSXGitHub Nov 1, 2023
2d54d45
refactor: rename to PackageFileInfo
KSXGitHub Nov 1, 2023
3ab34b8
feat(tarball): don't panic on duplication
KSXGitHub Nov 1, 2023
7e0748d
docs: future tasks
KSXGitHub Nov 1, 2023
417e8dc
fix(docs): correct a link
KSXGitHub Nov 1, 2023
354b344
feat: only appends `-exec` when exec bits
KSXGitHub Nov 1, 2023
7014799
feat: set mode of all exec files to 755
KSXGitHub Nov 1, 2023
0980751
refactor: extract some expressions
KSXGitHub Nov 1, 2023
499ba6e
test: make sure executable modes are 755
KSXGitHub Nov 1, 2023
d31b6ae
refactor: rearrange code
KSXGitHub Nov 1, 2023
b847ecf
refactor: deduplicate
KSXGitHub Nov 1, 2023
c804271
refactor: remove unused constants
KSXGitHub Nov 1, 2023
14a3125
refactor: extract default npmrc
KSXGitHub Nov 1, 2023
ae2b85d
refactor: extract create_default_npmrc
KSXGitHub Nov 1, 2023
c265685
test: check against pnpm
KSXGitHub Nov 1, 2023
27f8a3f
ci: workaround
KSXGitHub Nov 1, 2023
9fb71f6
ci: fix codecov
KSXGitHub Nov 1, 2023
95741ef
test(windows): skip pnpm_compatibility
KSXGitHub Nov 1, 2023
0cd6cd5
chore(git): merge from main
KSXGitHub Nov 2, 2023
bbdfc2f
feat: support sha1 index files
KSXGitHub Nov 2, 2023
a3b0e4b
test(cli/install): index files
KSXGitHub Nov 2, 2023
3c505ba
test(cli/install): same index files as pnpm
KSXGitHub Nov 2, 2023
4d72247
docs: future plan
KSXGitHub Nov 2, 2023
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
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
50 changes: 31 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.

1 change: 0 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 Down
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,8 +29,8 @@
panic!("Not implemented")
}
StoreCommand::Prune => {
pacquet_cafs::prune_sync(&config().store_dir).wrap_err("pruning store")?;
config().store_dir.prune().wrap_err("pruning store")?;
}

Check warning on line 33 in crates/cli/src/cli_args/store.rs

View check run for this annotation

Codecov / codecov/patch

crates/cli/src/cli_args/store.rs#L32-L33

Added lines #L32 - L33 were not covered by tests
StoreCommand::Path => {
println!("{}", config().store_dir.display());
}
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/tests/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn should_install_all_dependencies() {
eprintln!("Ensure the manifest file ({manifest_path:?}) exists");
assert!(manifest_path.exists());

let virtual_store_dir = workspace.join("node_modules").join(".pacquet");
let virtual_store_dir = workspace.join("node_modules").join(".pnpm");

eprintln!("Ensure virtual store dir ({virtual_store_dir:?}) exists");
assert!(virtual_store_dir.exists());
Expand Down Expand Up @@ -51,7 +51,7 @@ pub fn should_symlink_correctly() {
eprintln!("Ensure the manifest file ({manifest_path:?}) exists");
assert!(manifest_path.exists());

let virtual_store_dir = workspace.join("node_modules").join(".pacquet");
let virtual_store_dir = workspace.join("node_modules").join(".pnpm");

eprintln!("Ensure virtual store dir ({virtual_store_dir:?}) exists");
assert!(virtual_store_dir.exists());
Expand Down
Loading