Skip to content

Commit 36fddbe

Browse files
committed
spec: pkg.json "pivot"
part of #41
1 parent 3ed6612 commit 36fddbe

File tree

2 files changed

+75
-14
lines changed

2 files changed

+75
-14
lines changed

README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,52 @@
1-
# The Neovim package specification
1+
# pkg.json
2+
3+
- `pkg.json` is just a way to declare dependencies on URLs and versions
4+
- Decentralized ("federated", omg)
5+
- Subset of `package.json`
6+
- Upstream dependencies don't need a `pkg.json` file.
7+
- No client spec (yet)
8+
- No official client (yet)
9+
- TODO: support conflicting dependencies using git worktree.
10+
- Useful for: vim, nvim, emacs, (others?)
11+
- Used by:
12+
- [lazy.nvim](https://github.com/folke/lazy.nvim/)
13+
- TBD
14+
15+
## Build
16+
17+
brew install luarocks
18+
make
19+
make test
20+
21+
## Run tests
22+
23+
cd test-npm/
24+
npm ci
25+
npm run test
26+
27+
## What about LuaRocks?
28+
29+
LuaRocks is a natural as the Nvim plugin manager, but defining a ~~"plugin spec"~~ "federated package spec" also makes sense because:
30+
31+
- There is no "federated" plugin spec (corrections welcome!). LuaRocks is a "centralized" approach.
32+
- LuaRocks + Nvim is starting to see real progress in the form of https://github.com/nvim-neorocks , but thus far has not gained momentum. A decentralized, lowest-common-denominator, "infectious" approach is high-leverage, while work continues on the centralized LuaRocks approach at its own pace.
33+
- There's no central _asset_ registry, just a bunch of URLs.
34+
- Could have a central _list_ of plugins, but not assets.
35+
- We can do both, at low cost. `pkg.json` is a fairly "cheap" approach. LuaRocks
36+
37+
## Release
38+
39+
TBD
40+
41+
---
42+
43+
# OLD
244

345
The neovim package specification consists of three components:
446
1. Guidelines which provide guidance to package authors,
547
2. the `packspec` file format, and
648
3. guidelines for `packspec`-compatible plugin manager implementers
749

8-
This specification is an effort to improve the consistency and reliability of Neovim packages.
9-
1050
# Guidelines for plugin authors
1151

1252
### Semantic versioning

docs/README.md

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
11
# pkg.json
22

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+
313
- `pkg.json` is just a way to declare dependencies on URLs and versions
414
- Decentralized ("federated", omg)
515
- Subset of `package.json`
616
- 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.
818
- No official client (yet)
919
- TODO: support conflicting dependencies using git worktree.
1020
- Useful for: vim, nvim, emacs, (others?)
1121
- Used by:
1222
- [lazy.nvim](https://github.com/folke/lazy.nvim/)
1323
- TBD
1424

15-
## Build
25+
# Client requirements
26+
27+
- `git` (packages can live at any git URL)
28+
- JSON parser
1629

17-
brew install luarocks
18-
make
19-
make test
30+
# Package server requirements
2031

21-
## Run tests
32+
- Dependency URLs are expected to be git repos.
33+
- TODO: support other kinds of artifacts, like zip archives or binaries.
2234

23-
cd test-npm/
24-
npm ci
25-
npm run test
35+
# Design
2636

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.
2846

29-
TBD
47+
# References
3048

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

Comments
 (0)