Thank you for your interest in contributing! ❤️ This document provides guidelines and instructions for contributing.
Important
Please be respectful and constructive in all interactions. We aim to maintain a welcoming environment for all contributors. 👉 Read more
The goal of vscode-npmx is to build a useful extension around npmx.dev, making it easier for developers to manage npm packages within VS Code.
- Getting started
- Development workflow
- Code style
- Testing
- Submitting changes
- Pre-commit hooks
- Using AI
- Questions
- License
-
fork and clone the repository
-
install dependencies:
pnpm install
-
start the development server:
pnpm dev
-
Press
F5to open the VS Code debugger and start the extension in a new VS Code window.
# Development
pnpm dev # Start development server
pnpm build # Production build
pnpm package # Save extension as vsix file to root
# Code Quality
pnpm lint # Run linter (oxlint + oxfmt)
pnpm lint:fix # Auto-fix lint issues
pnpm typecheck # TypeScript type checking
# Testing
pnpm test # Run testsplayground/ # Playground for testing
res/ # Assets (e.g. marketplace icon)
src/ # Extension source code
├── extractors/ # Extractors
├── providers/ # Providers
├── types/ # TypeScript types
├── utils/ # Utility functions
├── constants.ts # Constants
├── state.ts # State management
└── index.ts # Extension entry point
tests/ # Tests
When committing changes, try to keep an eye out for unintended formatting updates. These can make a pull request look noisier than it really is and slow down the review process. Sometimes IDEs automatically reformat files on save, which can unintentionally introduce extra changes.
If you want to get ahead of any formatting issues, you can also run pnpm lint:fix before committing to fix formatting across the whole project.
- We care about good types – never cast things to
any💪 - Validate rather than just assert
- Type imports first (
import type { ... }) - Internal aliases (
#constants,#utils/, etc.) - External packages (including
node:) - Relative imports (
./,../) - No blank lines between groups
import type { PackageVersionsInfoWithMetadata } from 'fast-npm-meta'
import { logger } from '#state'
import { getVersions } from 'fast-npm-meta'
import { memoize } from '../memoize'| Type | Convention | Example |
|---|---|---|
| Files/Folders | kebab-case | package-json.ts, pnpm-workspace-yaml.ts |
| Test files | kebab-case + .test |
memoize.test.ts |
| Functions | camelCase | fetchPackage, formatDate |
| Constants | SCREAMING_SNAKE_CASE | NPM_REGISTRY, ALLOWED_TAGS |
| Types/Interfaces | PascalCase | NpmSearchResponse, Extractor, ValidNode |
Write unit tests for core functionality using Vitest:
import { describe, expect, it } from 'vitest'
describe('featureName', () => {
it('should handle expected case', () => {
expect(result).toBe(expected)
})
})- ensure your code follows the style guidelines
- run linting:
pnpm lint:fix - run type checking:
pnpm typecheck - run tests:
pnpm test - write or update tests for your changes
- create a feature branch from
main - make your changes with clear, descriptive commits
- push your branch and open a pull request
- ensure CI checks pass (lint, type check, tests)
- request review from maintainers
Write clear, concise PR titles that explain the "why" behind changes.
We use Conventional Commits. Since we squash on merge, the PR title becomes the commit message in main, so it's important to get it right.
Format: type(scope): description
Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
Scopes (optional): docs, i18n, deps
Examples:
fix: resolve search pagination issuefeat: add package version comparisonfix(i18n): update French translationschore(deps): update vite to v6
Note
The subject must start with a lowercase letter. Individual commit messages within your PR don't need to follow this format since they'll be squashed.
If your pull request directly addresses an open issue, use the following inside your PR description.
Resolves | Fixes | Closes: #xxx
Replace #xxx with either a URL to the issue, or the number of the issue. For example:
Fixes:#123
or
Closes https://github.com/npmx-dev/vscode-npmx/issues/123
This provides the following benefits:
- it links the pull request to the issue (the merge icon will appear in the issue), so everybody can see there is an open PR
- when the pull request is merged, the linked issue is automatically closed
The project uses nano-staged with husky to automatically lint files on commit.
You're welcome to use AI tools to help you contribute. But there are two important ground rules:
When you write a comment, issue, or PR description, use your own words. Grammar and spelling don't matter – real connection does. AI-generated summaries tend to be long-winded, dense, and often inaccurate. Simplicity is an art. The goal is not to sound impressive, but to communicate clearly.
Feel free to use AI to write code, tests, or point you in the right direction. But always understand what it's written before contributing it. Take personal responsibility for your contributions. Don't say "ChatGPT says..." – tell us what you think.
For more context, see Using AI in open source.
If you have questions or need help, feel free to open an issue for discussion or join our Discord server.
By contributing to vscode-npmx, you agree that your contributions will be licensed under the MIT License.