You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Update to recommend workspace + deno.jsonc for dependency management
This commit updates the Denops documentation to reflect the new recommended
approach for managing dependencies using workspace configuration and import maps.
Key changes:
- Explain workspace + deno.jsonc pattern as the recommended approach
- Clarify separation between development config (root) and runtime deps (plugin)
- Update all examples to use deno.jsonc instead of direct URL imports
- Add import map support to all tutorials (Hello World and Maze)
- Document support for import_map.json(c) as an alternative
- Explain why plugin-specific config prevents conflicts in merged runtime paths
The documentation now properly guides users to:
1. Use root deno.jsonc for development tools (lint, fmt, test)
2. Use plugin-specific deno.jsonc for runtime dependencies
3. Understand that both deno.json and import_map.json formats are supported
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
If developers use `function` module instead, they can benefit from features like
228
235
auto-completion and type checking provided by LSP (Language Server Protocol).
229
236
237
+
## Managing Dependencies with Workspace and Import Maps
238
+
239
+
While the examples above use direct URL imports, the recommended approach for Denops plugins is to separate development configuration from runtime dependencies:
240
+
241
+
-**Development configuration**: The root `deno.jsonc` with workspace settings enables development tools (`deno lint`, `deno fmt`, etc.) to work from the project root
242
+
-**Runtime dependencies**: The plugin-specific `deno.jsonc` contains only the import map needed at runtime
243
+
-**No conflicts**: Since each Denops plugin has a unique directory under `denops/`, their configuration files never conflict when installed
244
+
-**Clean separation**: Development tools configuration stays in the repository root, while runtime dependencies are isolated per plugin
245
+
-**Flexible format**: Both `deno.json` and `deno.jsonc` are supported, but `deno.jsonc` is recommended for its comment support
246
+
247
+
### Separation of Development and Runtime Configuration
248
+
249
+
The workspace pattern serves two distinct purposes:
250
+
251
+
1.**Development Time**: The root `deno.jsonc` enables development commands to work properly:
252
+
```json
253
+
{
254
+
"workspace": [
255
+
"./denops/your-plugin-name"
256
+
],
257
+
"lint": {
258
+
"rules": {
259
+
"tags": ["recommended"]
260
+
}
261
+
},
262
+
"fmt": {
263
+
"indentWidth": 2
264
+
}
265
+
}
266
+
```
267
+
268
+
2.**Runtime**: The plugin's `deno.jsonc` contains only what's needed for execution:
269
+
```json
270
+
{
271
+
"imports": {
272
+
"@denops/std": "jsr:@denops/std@^7.0.0"
273
+
}
274
+
}
275
+
```
276
+
277
+
### Why This Separation Matters
278
+
279
+
When Vim/Neovim loads plugins, it merges all plugin directories into the runtime path. If runtime dependencies were in the root configuration file, they would conflict:
280
+
281
+
```
282
+
# After installation, plugins are merged:
283
+
~/.vim/pack/plugins/start/
284
+
├── plugin-a/
285
+
│ ├── deno.jsonc # Development config (not used at runtime)
The `deno.json` file in your Denops plugin directory should contain all the dependencies your plugin needs. This keeps dependency management isolated to each plugin while avoiding conflicts in the merged runtime directory.
420
+
421
+
For example, if your plugin uses additional npm packages:
0 commit comments