| Crates.io | sublime_pkg_tools |
| lib.rs | sublime_pkg_tools |
| version | 0.0.27 |
| created_at | 2025-11-10 15:32:32.352626+00 |
| updated_at | 2026-01-14 09:46:24.197101+00 |
| description | Package and version management toolkit for Node.js projects with changeset support |
| homepage | |
| repository | https://github.com/websublime/workspace-tools |
| max_upload_size | |
| id | 1925710 |
| size | 3,632,430 |
A comprehensive Rust library for managing Node.js package versioning, changesets, changelogs, and dependency upgrades in both single-package projects and monorepos.
Add to your Cargo.toml:
[dependencies]
sublime_pkg_tools = "0.1.0"
use sublime_pkg_tools::config::{ConfigFormat, PackageToolsConfig};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Parse configuration from string content
let toml_content = r#"
[package_tools.changeset]
path = ".changesets"
[package_tools.version]
strategy = "independent"
"#;
let config = PackageToolsConfig::from_str(toml_content, ConfigFormat::Toml)?;
// Or use defaults
let config = PackageToolsConfig::default();
println!("Configuration loaded successfully!");
Ok(())
}
Note: This crate is configuration-agnostic. It does not search for or load configuration files from the filesystem. The CLI layer (
sublime_cli_tools) is responsible for discovering and reading configuration files, then passing the parsed content to this crate viaPackageToolsConfig::from_str().
The library uses TOML-based configuration. Create a package-tools.toml file in your project root:
[package_tools.changeset]
path = ".changesets"
available_environments = ["development", "staging", "production"]
[package_tools.version]
strategy = "independent" # or "unified" for monorepos
default_bump = "patch"
[package_tools.changelog]
enabled = true
format = "keep-a-changelog"
repository_url = "https://github.com/org/repo"
For a complete configuration reference, see:
Override any configuration setting using environment variables:
export SUBLIME_PKG_VERSION_STRATEGY="unified"
export SUBLIME_PKG_CHANGESET_PATH=".custom-changesets"
export SUBLIME_PKG_AUDIT_MIN_SEVERITY="info"
The library provides comprehensive configuration for all aspects of package management:
See the Configuration Guide for detailed documentation.
Check out the examples/ directory for:
TOML Examples:
basic-config.toml - Complete reference with all optionsminimal-config.toml - Quick start with minimal settingsmonorepo-config.toml - Advanced monorepo configurationCode Examples:
load_config.rs - Parsing configuration from string contentRun examples:
# Load configuration example
cargo run --example load_config
cargo doc --openMinimal configuration for a single npm package:
[package_tools.version]
strategy = "independent"
[package_tools.changelog]
repository_url = "https://github.com/org/package"
All packages share the same version:
[package_tools.version]
strategy = "unified"
[package_tools.changelog]
monorepo_mode = "both"
Using private npm registry with authentication:
[package_tools.upgrade.registry]
default_registry = "https://npm.pkg.github.com"
read_npmrc = true
[package_tools.upgrade.registry.scoped]
"@myorg" = "https://npm.pkg.github.com"
Working with prerelease versions (alpha, beta, RC):
use sublime_pkg_tools::types::{Version, VersionBump};
use sublime_pkg_tools::types::prerelease::{PrereleaseConfig, PrereleaseMode};
// Start with stable version 1.2.3
let version = Version::parse("1.2.3")?;
// Phase 1: Create beta prerelease for new features
let beta_config = PrereleaseConfig::create("beta".to_string());
let beta_0 = version.bump_with_prerelease(VersionBump::Minor, Some(&beta_config))?;
// Result: 1.3.0-beta.0
// Phase 2: Increment beta for fixes
let increment_config = PrereleaseConfig::increment("beta".to_string());
let beta_1 = beta_0.bump_with_prerelease(VersionBump::None, Some(&increment_config))?;
// Result: 1.3.0-beta.1
// Phase 3: Create release candidate
let rc_config = PrereleaseConfig::create("rc".to_string());
let rc_0 = beta_1.bump_with_prerelease(VersionBump::None, Some(&rc_config))?;
// Result: 1.3.0-rc.0
// Phase 4: Promote to stable release
let promote_config = PrereleaseConfig::promote("rc".to_string());
let stable = rc_0.bump_with_prerelease(VersionBump::None, Some(&promote_config))?;
// Result: 1.3.0 (stable)
Prerelease Modes:
SemVer Compliance:
MAJOR.MINOR.PATCH-PRERELEASE (e.g., 1.3.0-beta.0)[0-9A-Za-z-])alpha, beta, rc (release candidate)The library is organized into logical modules:
config - Configuration management and loadingchangeset - Changeset storage and managementversion - Version resolution and dependency propagationupgrade - External dependency upgrade detection and applicationchangelog - Changelog generation with multiple formatschanges - Working directory and commit range analysisaudit - Dependency audits and health checkstypes - Core data types and structureserror - Error types and handlingThis crate builds on:
sublime_standard_tools - File system, configuration, and Node.js abstractionssublime_git_tools - Git repository operationsThis library is under active development. Current status:
We follow strict code quality standards:
See our development rules for detailed guidelines.
[License information to be added]
For issues, questions, or contributions:
Part of the Sublime Tools ecosystem for Node.js project management in Rust.