Skip to content

Commit 744a58c

Browse files
authored
refactor: migrate to monorepo (#81)
* refactor: migrate to monorepo * fix lint and tests * update * up * Update README.md * update
1 parent 0e1a17d commit 744a58c

75 files changed

Lines changed: 477 additions & 386 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ jobs:
2626
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2727

2828
- name: Generate .vsix file
29+
working-directory: extensions/vscode
2930
run: pnpm package
3031

3132
- name: Publish Extension
33+
working-directory: extensions/vscode
3234
run: npx vsxpub --no-dependencies
3335
env:
3436
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"runtimeExecutable": "${execPath}",
99
"args": [
1010
"--disable-extensions",
11-
"--extensionDevelopmentPath=${workspaceFolder}",
11+
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode",
1212
"${workspaceFolder}/playground"
1313
],
1414
"outFiles": [
15-
"${workspaceFolder}/dist/**/*.js"
15+
"${workspaceFolder}/extensions/vscode/dist/**/*.js"
1616
]
1717
}
1818
]

CONTRIBUTING.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Thank you for your interest in contributing! ❤️ This document provides guide
88
99
## Goals
1010

11-
The goal of [vscode-npmx](https://marketplace.visualstudio.com/items?itemName=npmx-dev.vscode-npmx) is to build a useful extension around [npmx.dev](https://npmx.dev), making it easier for developers to manage npm packages within VS Code.
11+
The goal of this project is to build useful editor extensions around [npmx.dev](https://npmx.dev), making it easier for developers to manage npm packages within their editors. Currently, the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=npmx-dev.vscode-npmx) is the primary package.
1212

1313
## Table of Contents
1414

@@ -62,44 +62,52 @@ The goal of [vscode-npmx](https://marketplace.visualstudio.com/items?itemName=np
6262
### Available commands
6363

6464
```bash
65-
# Development
65+
# Development (run from extensions/vscode/)
6666
pnpm dev # Start development server
6767
pnpm build # Production build
68-
pnpm package # Save extension as vsix file to root
68+
pnpm package # Save extension as vsix file
6969

70-
# Code Quality
70+
# Code Quality (run from root)
7171
pnpm lint # Run linter (ESLint)
7272
pnpm lint:fix # Auto-fix lint issues
7373
pnpm typecheck # TypeScript type checking (tsgo)
7474

75-
# Testing
75+
# Testing (run from root)
7676
pnpm test # Run tests
7777
```
7878

7979
### Project structure
8080

81+
This project is organized as a monorepo using pnpm workspaces:
82+
8183
```
84+
extensions/
85+
└── vscode/ # VS Code extension
86+
├── src/ # Extension source code
87+
│ ├── api/ # API clients (package, replacement, vulnerability)
88+
│ ├── commands/ # Command handlers (vscode API only, no reactive-vscode)
89+
│ ├── composables/ # Composables (reactive-vscode hooks)
90+
│ ├── core/ # Core logic
91+
│ │ ├── extractors/ # Extractors (JSON, YAML)
92+
│ │ └── workspace.ts # Workspace context resolution
93+
│ ├── providers/ # Providers
94+
│ │ ├── code-actions/ # Code action providers (quick fixes)
95+
│ │ ├── completion-item/ # Completion providers (version autocomplete)
96+
│ │ ├── diagnostics/ # Diagnostic providers
97+
│ │ ├── document-link/ # Document link providers (package links)
98+
│ │ └── hover/ # Hover providers
99+
│ ├── types/ # TypeScript types
100+
│ ├── utils/ # Utility functions
101+
│ ├── index.ts # Extension entry point
102+
│ └── state.ts # State management
103+
├── package.json
104+
└── tsdown.config.ts
105+
shared/ # Shared code across packages
106+
├── constants.ts
107+
├── meta.ts # Auto-generated extension metadata
108+
└── types.ts
82109
playground/ # Playground for testing
83110
res/ # Assets (e.g. marketplace icon)
84-
src/ # Extension source code
85-
├── commands/ # Command handlers (vscode API only, no reactive-vscode)
86-
├── composables/ # Composables (reactive-vscode hooks)
87-
├── core/ # Core logic
88-
│ ├── extractors/ # Extractors (JSON, YAML)
89-
│ └── workspace.ts # Workspace context resolution
90-
├── providers/ # Providers
91-
│ ├── code-actions/ # Code action providers (quick fixes)
92-
│ ├── completion-item/ # Completion providers (version autocomplete)
93-
│ ├── diagnostics/ # Diagnostic providers
94-
│ ├── document-link/ # Document link providers (package links)
95-
│ └── hover/ # Hover providers
96-
├── types/ # TypeScript types
97-
├── utils/ # Utility functions
98-
│ └── api/ # API clients (package, replacement, vulnerability)
99-
├── constants.ts # Constants
100-
├── generated-meta.ts # Auto-generated extension metadata
101-
├── state.ts # State management
102-
└── index.ts # Extension entry point
103111
tests/ # Tests
104112
├── __setup__/ # Test setup and utilities
105113
├── code-actions/ # Code action tests
@@ -110,7 +118,7 @@ tests/ # Tests
110118

111119
### Key concepts
112120

113-
- **Extractor** – Parses a supported file (`package.json`, `pnpm-workspace.yaml`, `.yarnrc.yml`) and extracts dependency information with AST ranges. Each file format has its own extractor in `src/core/extractors/`.
121+
- **Extractor** – Parses a supported file (`package.json`, `pnpm-workspace.yaml`, `.yarnrc.yml`) and extracts dependency information with AST ranges. Each file format has its own extractor in `extensions/vscode/src/core/extractors/`.
114122
- **WorkspaceContext** – Holds per-workspace-folder state: detected package manager, resolved catalogs, and memoized dependency info. Created lazily and invalidated when workspace-level files change.
115123
- **ResolvedDependencyInfo** – A dependency with its protocol resolved (e.g., `catalog:` → actual version, `npm:alias@version` → underlying package). Providers consume resolved dependencies instead of raw AST data.
116124
- **Provider** – VS Code language feature (hover, completion, diagnostics, etc.) that operates on resolved dependencies.

README.md

Lines changed: 6 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,16 @@
22
<img src="https://github.com/npmx-dev/vscode-npmx/blob/main/res/logo.png?raw=true" alt="npmx" height="150">
33
</p>
44

5-
<h1 align="center">npmx <sup>VS Code</sup></h1>
6-
7-
<p align="center">
8-
<a href="https://marketplace.visualstudio.com/items?itemName=npmx-dev.vscode-npmx">
9-
<img src="https://img.shields.io/visual-studio-marketplace/v/npmx-dev.vscode-npmx?color=blue&label=VS%20Code%20Marketplace" alt="VS Code Marketplace">
10-
</a>
11-
<a href="https://kermanx.github.io/reactive-vscode/" target="__blank"><img src="https://img.shields.io/badge/made_with-reactive--vscode-%23007ACC?style=flat&labelColor=%23229863" alt="Made with reactive-vscode" /></a>
12-
</p>
5+
<h1 align="center">npmx Extensions</h1>
136

147
> [!NOTE]
15-
> 🚧 **Preview Version** - This extension is under active development. Some features and configurations may change.
8+
> 🚧 **Preview Version** - These extensions are under active development. Some features and configurations may change.
169
17-
## Installation
10+
## Packages
1811

19-
- [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=npmx-dev.vscode-npmx)
20-
- [Open VSX](https://open-vsx.org/extension/npmx-dev/vscode-npmx)
21-
- Run:
22-
```bash
23-
code --install-extension npmx-dev.vscode-npmx
24-
```
12+
| Package | Description |
13+
| ------- | ----------- |
14+
| [`extensions/vscode`](./extensions/vscode) | [VS Code extension](https://marketplace.visualstudio.com/items?itemName=npmx-dev.vscode-npmx) for npmx |
2515

2616
## Features
2717

@@ -42,65 +32,6 @@
4232
- Open [npmx.dev](https://npmx.dev) in external browser
4333
- Open `node_modules` files on [npmx.dev](https://npmx.dev) code viewer with syntax highlighting (from editor title, editor context menu, explorer context menu, or command palette)
4434

45-
## Commands
46-
47-
<!-- commands -->
48-
49-
| Command | Title |
50-
| --------------------- | --------------------------------------- |
51-
| `npmx.openInBrowser` | npmx: Open npmx.dev in external browser |
52-
| `npmx.openFileInNpmx` | npmx: Open file on npmx.dev |
53-
54-
<!-- commands -->
55-
56-
## Configuration
57-
58-
<!-- configs -->
59-
60-
| Key | Description | Type | Default |
61-
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------- |
62-
| `npmx.hover.enabled` | Enable hover information for packages | `boolean` | `true` |
63-
| `npmx.completion.version` | Version completion behavior | `string` | `"provenance-only"` |
64-
| `npmx.completion.excludePrerelease` | Exclude prerelease versions (alpha, beta, rc, canary, etc.) from completion suggestions | `boolean` | `true` |
65-
| `npmx.diagnostics.upgrade` | Show hints when a newer version of a package is available | `boolean` | `true` |
66-
| `npmx.diagnostics.deprecation` | Show warnings for deprecated packages | `boolean` | `true` |
67-
| `npmx.diagnostics.replacement` | Show suggestions for package replacements | `boolean` | `true` |
68-
| `npmx.diagnostics.vulnerability` | Show warnings for packages with known vulnerabilities | `boolean` | `true` |
69-
| `npmx.diagnostics.distTag` | Show warnings when a dependency uses a dist tag | `boolean` | `true` |
70-
| `npmx.diagnostics.engineMismatch` | Show warnings when dependency engines mismatch with the current package | `boolean` | `true` |
71-
| `npmx.packageLinks` | Enable clickable links for package names | `string` | `"declared"` |
72-
| `npmx.ignore.upgrade` | Ignore list for upgrade diagnostics ("name" or "name@version"). See [Ignore Diagnostics](https://github.com/npmx-dev/vscode-npmx#ignore-diagnostics) | `array` | `[]` |
73-
| `npmx.ignore.deprecation` | Ignore list for deprecation diagnostics ("name" or "name@version"). See [Ignore Diagnostics](https://github.com/npmx-dev/vscode-npmx#ignore-diagnostics) | `array` | `[]` |
74-
| `npmx.ignore.replacement` | Ignore list for replacement diagnostics ("name" only). See [Ignore Diagnostics](https://github.com/npmx-dev/vscode-npmx#ignore-diagnostics) | `array` | `[]` |
75-
| `npmx.ignore.vulnerability` | Ignore list for vulnerability diagnostics ("name" or "name@version"). See [Ignore Diagnostics](https://github.com/npmx-dev/vscode-npmx#ignore-diagnostics) | `array` | `[]` |
76-
77-
<!-- configs -->
78-
79-
## Ignore Diagnostics
80-
81-
`npmx` supports ignore lists for selected diagnostics.
82-
83-
Matching rules:
84-
85-
- `npmx.ignore.upgrade`, `npmx.ignore.deprecation`, and `npmx.ignore.vulnerability` support `name` and `name@version`.
86-
- `npmx.ignore.replacement` supports `name` only.
87-
88-
When a diagnostic supports ignore actions, quick fixes can add entries directly:
89-
90-
- `Ignore ... (Workspace)` updates workspace settings.
91-
- `Ignore ... (User)` updates user settings.
92-
93-
### Example
94-
95-
```json
96-
{
97-
"npmx.ignore.upgrade": ["lodash", "@babel/core@7.0.0"],
98-
"npmx.ignore.deprecation": ["request"],
99-
"npmx.ignore.replacement": ["find-up"],
100-
"npmx.ignore.vulnerability": ["express@4.18.0"]
101-
}
102-
```
103-
10435
## Related
10536

10637
- [npmx.dev](https://npmx.dev) &ndash; A fast, modern browser for the npm registry

extensions/vscode/LICENSE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE.md

0 commit comments

Comments
 (0)