https://github.com/ldm-org/ldm
Wire-up fragmented codes and files from various sources with a single command.
https://github.com/ldm-org/ldm
automation cd ci dependency dx github jsdelivr ldm loose-dependency-manager manager
Last synced: 4 months ago
JSON representation
Wire-up fragmented codes and files from various sources with a single command.
- Host: GitHub
- URL: https://github.com/ldm-org/ldm
- Owner: ldm-org
- License: mit
- Created: 2025-02-05T00:29:15.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-03T00:23:16.000Z (about 1 year ago)
- Last Synced: 2025-08-23T12:09:35.736Z (10 months ago)
- Topics: automation, cd, ci, dependency, dx, github, jsdelivr, ldm, loose-dependency-manager, manager
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/loose-dependency-manager
- Size: 593 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Loose Dependency Manager
Wire-up fragmented codes and files from various sources with a single command.
Documentation | Getting Started | Examples
What is loose dependency manager?
## What is loose dependency manager?
Loose Dependency Manager (`ldm`) is a tool that helps you manage dependencies from various sources in a single file.
You can think of it as a sophisticated form of [scp](https://en.wikipedia.org/wiki/Secure_copy_protocol) command
that can be configured with a single specification file (`ldm.yaml`)
and that supports versioning (if the remote source supports it) and locking mechanism.
Currently, it supports the following sources:
| Provider | Versioning Support | Can Download | URI Format |
| --- | --- | --- | --- |
| HTTP(S) | ❌ | only files | HTTP(S) URL |
| [GitHub](https://github.com/) | ✅ | files & directories | `:///path/to/file` |
| [JSDelivr (npm)](https://www.jsdelivr.com/) | ✅ | files & directories | `://default` or `:///path/to/file` |
| [JSDelivr (github)](https://www.jsdelivr.com/?docs=gh) | ✅ | files & directories | `:///path/to/file` |
## Installation
Before installing `ldm`, you need to have [Node.js](https://nodejs.org/en/download) installed.
```sh
npm install -g loose-dependency-manager
```
## Quick Start
### Write a dependency specification file
You write a dependency specification file named `ldm.yaml`.
> [!IMPORTANT]
> **It is stronlgly recommended to set `auth.token` with personal access token**
> **when using GitHub as a source provider (even if you're using for public repositories).**
> Github API imposes a harsh rate limit of 60 requests per hour for unauthenticated requests,
> so you may run into rate limit issues without a token.
```yaml
version: "1"
dependencies:
primitive.ts:
uri: "@ts-essentials/ts-essentials:///lib/primitive/index.ts"
version: latest
destination: src/types/primitive.ts
camel-case:
uri: "@ts-essentials/ts-essentials:///lib/camel-case"
version: latest
destination: src/types/camel-case
jquery:
uri: jquery://default
version: ^3.6.4
destinations:
- src/core.min.js
- public/js/core.min.js
reset.css:
uri: https://meyerweb.com/eric/tools/css/reset/reset200802.css
destination: public/css/reset.css
pico.css:
uri: "@picocss/pico:///css/pico.min.css"
version: ^2.0.0
destination: public/css/pico.min.css
sources:
"@ts-essentials/ts-essentials":
provider: github
uri: ts-essentials/ts-essentials
auth:
token: ${GITHUB_TOKEN}
jquery:
provider: jsdelivr:npm
uri: jquery
"@picocss/pico":
provider: jsdelivr:npm
uri: "@picocss/pico"
config:
envFile: .env
deleteFilesOnRemove: true
```
#### YAML Validation for VSCode
For better editing experience,
YAML validation is supported thanks to JSON schema and [YAML VSCode Extension (by RedHat)](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml).
To enable YAML validation,
- Install [YAML VSCode Extension (by RedHat)](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)
- Add the following configuration to your `.vscode/settings.json` file.
```json
{
"yaml.schemas": {
"https://raw.githubusercontent.com/ldm-org/ldm/refs/heads/master/schema.json": "**/ldm.yaml"
}
}
```
### Install dependencies
Then in terminal, run the following command.
```sh
ldm install
```
This will produce the following file sturcture,
assuming that `ldm.yaml` is the only file in the directory.
```
|- ldm.yaml
|- ldm-lock.yaml
|--- src/
|----- core.min.js
|----- types/
|------- primitive.ts
|------- camel-case/
|--------- index.ts
|--------- README.md
|--- public/
|----- css/
|------- reset.css
|------- pico.min.css
|----- js/
|------- core.min.js
```
The example above can be summarized as following diagram.

## Documentation
Documentation is not written yet.
I'll try my best to write it as soon as possible.
## Examples
You can find examples at e2e test scenarios.
Compare `given` and `expected` directory in each scenario
to see what the execution of `scenario.ts#scenario.command` will produce.
- [install](./tests/install/scenarios)
- [upgrade](./tests/upgrade/scenarios)
## Contribution
See [Contributing Guide](./.github/CONTRIBUTING.md)
## License
[MIT](./LICENSE) License © 2025-Present [Joseph Hwang](https://github.com/01Joseph-Hwang10)