|
1 | 1 | # pkg.json |
2 | 2 |
|
| 3 | +`pkg.json` allows artifacts to depend on other artifacts, by URLs. |
| 4 | +You can think of it as a "federated package spec": it's just a JSON file that |
| 5 | +lists URLs in a simple format that is dead simple to write a client for. |
| 6 | + |
| 7 | +The initial use-case is for Vim and Emacs plugins (which can be downloaded from |
| 8 | +anywhere). But the format is designed to be ecosystem-agnostic: it's just |
| 9 | +a formalized way to list dependencies by URL. |
| 10 | + |
| 11 | +# Features |
| 12 | + |
3 | 13 | - `pkg.json` is just a way to declare dependencies on URLs and versions |
4 | 14 | - Decentralized ("federated", omg) |
5 | 15 | - Subset of `package.json` |
6 | 16 | - Upstream dependencies don't need a `pkg.json` file. |
7 | | -- No client spec (yet) |
| 17 | +- No client spec (yet): only the format is specified, not client behavior. |
8 | 18 | - No official client (yet) |
9 | 19 | - TODO: support conflicting dependencies using git worktree. |
10 | 20 | - Useful for: vim, nvim, emacs, (others?) |
11 | 21 | - Used by: |
12 | 22 | - [lazy.nvim](https://github.com/folke/lazy.nvim/) |
13 | 23 | - TBD |
14 | 24 |
|
15 | | -## Build |
| 25 | +# Client requirements |
| 26 | + |
| 27 | +- `git` (packages can live at any git URL) |
| 28 | +- JSON parser |
16 | 29 |
|
17 | | - brew install luarocks |
18 | | - make |
19 | | - make test |
| 30 | +# Package server requirements |
20 | 31 |
|
21 | | -## Run tests |
| 32 | +- Dependency URLs are expected to be git repos. |
| 33 | +- TODO: support other kinds of artifacts, like zip archives or binaries. |
22 | 34 |
|
23 | | - cd test-npm/ |
24 | | - npm ci |
25 | | - npm run test |
| 35 | +# Design |
26 | 36 |
|
27 | | -## Release |
| 37 | +1. Support _all "assets" or "artifacts" of any kind_. |
| 38 | +1. Why JSON: |
| 39 | + - ubiquitous |
| 40 | + - "machine readable" (sandboxed by design): can recursively download an entire dependency tree before executing any code, including hooks. Aggregators such as https://neovimcraft.com/ can consume it. |
| 41 | + - Turing-complete formats (unlike JSON) invite sprawling, special-case behavior (nvim-lspconfig is a [living example](https://github.com/neovim/nvim-lspconfig/pull/2595)). |
| 42 | +1. Client requirements are only `git` and a JSON parser. |
| 43 | +1. Avoid fields that overlap with info provided by git. Git is a client requirement. Git is the "common case" for servers (but not a requirement). |
| 44 | +1. Strive to be a subset of NPM's `package.json`. Avoid unnecessary entropy. |
| 45 | +1. No side-effects: evaluating `pkg.json` not have side-effects, only input and output. |
28 | 46 |
|
29 | | -TBD |
| 47 | +# References |
30 | 48 |
|
| 49 | +- https://json-schema.org/ |
| 50 | +- lazy.nvim [pkg.json impl](https://github.com/folke/lazy.nvim/pull/910/files#diff-eeb8f2e48ace6e2f4c40bf159b7f59e5eb1208e056a3f9f1b9cc6822ecb45371) |
| 51 | +- [A way for artifacts to depend on other artifacts.](https://sink.io/jmk/artifact-system) |
0 commit comments