saml.dep-manager
v1.0.5
Published
is a simple dependency manager based on github repositories
Readme
🚀 Dependency Manager
This project provides a lightweight, straightforward dependency manager that leverages Git repositories. It's designed for simplicity and efficiency, allowing you to manage project dependencies directly from their source repositories without the complexity of larger package managers.
This tool is actively used in real-world projects, which ensures it is continuously improved and enhanced with practical features based on actual usage.
💾 Installation
Install the Dependency Manager globally using npm:
npm install -g saml.dep-manager[!NOTE] A global installation (
-g) makes thedepcommand available from any directory in your terminal.
💻 CLI Usage
You can interact with the dependency manager in two ways:
- Interactive Mode: Run
depwithout any arguments to open an interactive command-line interface. - Direct Command: Execute commands directly, for example:
dep list.
Commands
| Command | Usage | Description |
|---|---|---|
| list | dep list | Lists all dependencies configured in dep.mysaml.json. |
| add | dep add <repo_url> [name] | Adds a new dependency to your configuration. |
| remove| dep remove <name_or_repo_url> | Removes a dependency using its name or repository URL. |
| install| dep install [name...]| Clones and sets up all dependencies, or specific ones. |
| uninstall| dep uninstall [name...]| Removes the files of all, or specific, dependencies. |
| output |dep output <name_or_repo_url> <output_path> [source_path] | Configures the output directory for a dependency's files. |
⚙️ Configuration File (dep.mysaml.json)
All dependencies are defined in a dep.mysaml.json file located in your project's root directory. This file contains a JSON array of dependency objects.
Schema and Examples
Here’s a look at the structure of a dep.mysaml.json file:
[
{
"name": "my-library",
"repo": "https://github.com/user/my-library.git",
"branch": "main",
"out": "libs/my-library"
},
{
"name": "another-dependency",
"repo": "https://github.com/user/another.git",
"out": {
"src/": "public/js/another-dep/",
"assets/css/": "public/css/"
}
}
]Fields Explained
name(string): A unique identifier for the dependency. If you don't provide one with theaddcommand, a name will be generated from the repository URL.repo(string): The full HTTPS or SSH URL for the Git repository.branch(string, optional): The name of the branch you want to clone. If omitted, the repository's default branch is used.out(string | string[] | object, optional): Defines where the dependency's files should be placed.- As a string: The entire repository is cloned into this single path.
- As a string array: The repository content is copied to each path in the array.
- As an object: A map where keys are source paths within the repository and values are the destination paths in your project. You can use
'/'as a key to refer to the repository's root.
