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

chore(core): refactor cargo crates #30130

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Cammisuli
Copy link
Member

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #

@Cammisuli Cammisuli self-assigned this Feb 20, 2025
Copy link

vercel bot commented Feb 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Feb 22, 2025 9:32pm

- Added new Rust crates for core Nx functionality:
  - nx_cache
  - nx_db
  - nx_hasher
  - nx_machine
  - nx_project_graph
  - nx_tasks
  - nx_terminal
  - nx_walker
  - nx_watch
  - nx_workspace

- Updated Cargo.toml and Cargo.lock to include new crates
- Refactored existing code to use new crate modules
- Prepared infrastructure for future Nx core improvements
- Moved `get_mod_time` and normalization utilities from `nx` and `nx_walker` to a new crate `nx_utils`.
- Updated references across the codebase to use `nx_utils` for these utilities.
- Added `hash_array_optional` function in `nx_hasher` and refactored its usage in `nx`.
- Updated `Cargo.toml` and `Cargo.lock` to include `nx_utils` and other dependency updates.
- Removed unused utilities and cleaned up imports in various modules.
- Removed `nx_machine` crate and its dependencies.
- Introduced a new `nx_logger` crate for logging functionality.
- Updated all references to the logger to use `nx_logger`.
- Adjusted `Cargo.toml` and `Cargo.lock` to reflect crate changes.
- Migrated shared logging utilities to `nx_logger`.
- Moved `ci` module from `nx/native/utils` to `nx_utils` crate for reusability.
- Refactored imports to use `nx_utils::ci` across affected files.
- Simplified code by optimizing path normalization and hash operations.
- Updated dependencies in `Cargo.toml` and `Cargo.lock` for latest versions.
- Relocated `normalize_nx_path` function from `path.rs` to `nx_utils`
- Updated usage of `normalize_nx_path` in both `Path` and `PathBuf` implementations
- Simplified `path.rs` by removing redundant functionality
@Cammisuli Cammisuli force-pushed the cammisuli/refactor-cargo-crates branch from d49ec0d to 4236404 Compare February 20, 2025 22:46
Copy link

nx-cloud bot commented Feb 20, 2025

View your CI Pipeline Execution ↗ for commit 407698f.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 5m 16s View ↗
nx run-many -t check-imports check-commit check... ❌ Failed 18s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check --base= --he... ✅ Succeeded 17s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 17s View ↗
nx documentation ✅ Succeeded 3m 11s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-22 21:44:13 UTC

- Removed `thiserror`, `parking_lot`, and `assert_fs` from `Cargo.toml` and `Cargo.lock`.
- Cleaned up unused logger import in `hash_planner.rs`.
- Corrected function declarations in `index.d.ts`, resolving duplication issues.
- Adjusted `hash_planner.rs` to return `External` directly without environment handling.
- Moved types related to project graph, inputs, and nx_json to a reusable crate, `nx_core`.
- Removed redundant `transfer_project_graph` function and refactored imports to use `nx_core`.
- Updated `nx_project_graph` and other crates to depend on `nx_core` for shared functionality.
- Migrated utility functions like `find_matching_projects` to `nx_project_graph/utils`.
- Refactored redundant imports and aligned with consolidated module structure.
- Moved `machine_id` module from `packages/nx` to `crates/nx_utils`.
- Updated imports in affected files across the project.
- Added `machine-uid` dependency to `nx_utils`.
- Refactored code to utilize the new `nx_utils::machine_id`.
- Simplified fallback logic in `nx_db` for database file naming.
- Moved pseudo-terminal-related implementation from `packages/nx`
  to a new standalone `nx_pty` crate for better modularity and reuse.
- Updated dependencies and Cargo project files to include `nx_pty`.
- Adjusted imports and references in original `packages/nx` code to use `nx_pty`.
- Fixed typings and adjusted method signatures to align with new structure.
- Removed inline native db and pseudo-terminal modules from `nx` package.
- Moved `pseudo_terminal` modules to `nx_pty` crate.
- Moved DB connection handling into `nx_db` crate under a new `napi` module.
- Updated dependencies and adjusted imports for modular separation.
- Dropped unused dependencies (`tokio`, `crossbeam-channel`, etc.) for cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant