Skip to content

Commit f3d1c8b

Browse files
robertsLandoclaude
andcommitted
chore: drop root package-lock.json and standardize on yarn for pkg
package-lock.json was created by accident in #229 alongside the yarn lockfile. pkg's canonical package manager is yarn (see yarn.lock); the accidental npm lockfile drifts silently and confuses contributors. - Remove package-lock.json and gitignore it at the repo root so it cannot reappear. - Rewrite the dev-command references in CLAUDE.md, .claude/rules/*, .github/copilot-instructions.md and docs-site/development.md from "npm run <x>" to "yarn <x>", and spell out the split: pkg uses yarn, docs-site is the only place npm is used. User-facing install instructions (README, guide/getting-started, guide/ migration, guide/api) are unchanged — end users still "npm install -g @yao-pkg/pkg" and the CI recipe example still shows npm, since that reflects how consumers package their own projects. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 518d442 commit f3d1c8b

9 files changed

Lines changed: 51 additions & 8314 deletions

File tree

.claude/rules/development.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,27 @@ description: Build, lint, formatting, and TypeScript rules
44

55
# Development
66

7+
## Package manager
8+
9+
`pkg` uses **yarn** (see `yarn.lock`). **Never run `npm install` / `npm ci` / `npm run X` at the repo root** — it will create a spurious `package-lock.json`. `npm` is used only inside `docs-site/` (the VitePress site has its own `package-lock.json`).
10+
711
## Build
812

913
```bash
10-
npm run build # Required before testing — compiles lib/ to lib-es5/
11-
npm run start # Watch mode with auto-rebuild
14+
yarn build # Required before testing — compiles lib/ to lib-es5/
15+
yarn start # Watch mode with auto-rebuild
1216
```
1317

1418
## Lint & Format
1519

1620
```bash
17-
npm run lint # Check both ESLint + Prettier
18-
npm run fix # Auto-fix all issues
19-
npm run lint:code # ESLint only
20-
npm run lint:style # Prettier only
21+
yarn lint # Check both ESLint + Prettier
22+
yarn fix # Auto-fix all issues
23+
yarn lint:code # ESLint only
24+
yarn lint:style # Prettier only
2125
```
2226

23-
- Always run `npm run lint` before committing. Fix all issues — never push dirty code.
27+
- Always run `yarn lint` before committing. Fix all issues — never push dirty code.
2428
- Console statements are disallowed in production code but allowed in test files.
2529

2630
## TypeScript

.claude/rules/git-and-pr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ description: Git workflow, commit conventions, and PR rules
1818
## Before Committing
1919

2020
1. Clean test artifacts from test directories (`*.exe`, `*-linux`, `*-macos`, `*-win.exe`).
21-
2. Run `npm run lint` and fix all issues.
21+
2. Run `yarn lint` and fix all issues.
2222
3. Show `git status --short` and get user approval before committing.
2323

2424
## Release
2525

26-
Uses `release-it` with conventional commits (`npm run release`). This runs linting, generates changelog, creates a git tag, pushes to GitHub, and publishes to npm as `@yao-pkg/pkg`.
26+
Uses `release-it` with conventional commits (`yarn release`). This runs linting, generates changelog, creates a git tag, pushes to GitHub, and publishes to npm as `@yao-pkg/pkg`.

.claude/rules/project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This is `yao-pkg/pkg` — a maintained fork of the archived `vercel/pkg`.
1010

1111
## Repository Structure
1212

13-
- `lib/` — TypeScript source (compiled to `lib-es5/` via `npm run build`)
13+
- `lib/` — TypeScript source (compiled to `lib-es5/` via `yarn build`)
1414
- `prelude/` — Bootstrap code injected into packaged executables
1515
- `dictionary/` — Package-specific configs for known npm packages
1616
- `test/` — Numbered test directories (`test-XX-name/`)

.claude/rules/testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ paths:
99
## Commands
1010

1111
```bash
12-
npm run build # Always build first
13-
npm run test:22 # Test with Node.js 22
14-
npm run test:host # Test with host Node.js version
12+
yarn build # Always build first
13+
yarn test:22 # Test with Node.js 22
14+
yarn test:host # Test with host Node.js version
1515
node test/test.js node22 no-npm test-50-* # Run specific test pattern
1616
```
1717

.github/copilot-instructions.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ This is a TypeScript-based Node.js project that packages Node.js applications in
4040
Before running tests or making changes, always build the project:
4141

4242
```bash
43-
npm run build
43+
yarn build
4444
```
4545

4646
This compiles TypeScript from `lib/` to `lib-es5/` using the TypeScript compiler.
4747

4848
For continuous development with auto-rebuild:
4949

5050
```bash
51-
npm run start
51+
yarn start
5252
```
5353

5454
### Code Standards
5555

5656
#### Required Before Each Commit
5757

58-
- Run `npm run lint` to check both code style and ESLint rules
59-
- Run `npm run fix` to automatically fix formatting and linting issues
58+
- Run `yarn lint` to check both code style and ESLint rules
59+
- Run `yarn fix` to automatically fix formatting and linting issues
6060
- All changes must pass CI checks (linting, building, and tests)
6161

6262
#### Commit and Push Workflow
@@ -69,8 +69,8 @@ npm run start
6969
- These files may remain if a test failed before cleanup
7070

7171
2. **Verify no lint issues**:
72-
- ALWAYS run `npm run lint` before committing
73-
- Fix all linting errors with `npm run fix` or manually
72+
- ALWAYS run `yarn lint` before committing
73+
- Fix all linting errors with `yarn fix` or manually
7474
- NEVER commit or push with lint errors present
7575

7676
3. **Request approval before commit/push**:
@@ -89,14 +89,14 @@ This workflow ensures code quality, prevents accidental commits of test artifact
8989

9090
- Uses Prettier for code formatting
9191
- Single quotes for strings (configured in package.json)
92-
- Run `npm run lint:style` to check formatting
92+
- Run `yarn lint:style` to check formatting
9393
- Format files with: `prettier -w "{lib,prelude,test}/**/*.{ts,js}"`
9494

9595
#### Linting
9696

9797
- Uses ESLint with TypeScript support
9898
- Configuration: `eslint-config-airbnb-typescript` and `eslint-config-prettier`
99-
- Run `npm run lint:code` to check for linting issues
99+
- Run `yarn lint:code` to check for linting issues
100100
- Console statements are disallowed in production code (lint error), but allowed in test files and scripts
101101

102102
### Testing
@@ -105,15 +105,15 @@ The test suite is extensive and organized in numbered directories:
105105

106106
```bash
107107
# Build first (required)
108-
npm run build
108+
yarn build
109109

110110
# Run all tests
111-
npm test
111+
yarn test
112112

113113
# Run tests for specific Node.js version
114-
npm run test:20 # Test with Node.js 20
115-
npm run test:22 # Test with Node.js 22
116-
npm run test:host # Test with host Node.js version
114+
yarn test:20 # Test with Node.js 20
115+
yarn test:22 # Test with Node.js 22
116+
yarn test:host # Test with host Node.js version
117117

118118
# Run specific test pattern
119119
node test/test.js node20 no-npm test-50-*
@@ -181,7 +181,7 @@ assert(__dirname === process.cwd());
181181
The project uses `release-it` with conventional commits:
182182

183183
```bash
184-
npm run release
184+
yarn release
185185
```
186186

187187
This interactive process:
@@ -284,9 +284,9 @@ The project uses GitHub Actions workflows:
284284
## Important Notes for Copilot Coding Agent
285285

286286
1. **NEVER commit without user approval**: Always show changes with `git status --short`, present a summary, and wait for explicit user confirmation before running `git commit` or `git push`
287-
2. **ALWAYS check lint before committing**: Run `npm run lint` before every commit and fix all issues - NEVER commit with lint errors
287+
2. **ALWAYS check lint before committing**: Run `yarn lint` before every commit and fix all issues - NEVER commit with lint errors
288288
3. **Clean test artifacts before staging**: Remove any test-generated executables (`*.exe`, `*-linux`, `*-macos`, `*-win.exe`) from test directories before committing
289-
4. **Always build before testing**: Run `npm run build` before running any tests
289+
4. **Always build before testing**: Run `yarn build` before running any tests
290290
5. **Use correct Node.js version**: The project requires Node.js >= 20.0.0
291291
6. **Use Yarn for package management**: This project uses `yarn`, not `npm`, for dependency management
292292
7. **Respect TypeScript compilation**: Edit `lib/*.ts` files, not `lib-es5/*.js` files

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# dependencies
55
/node_modules
66

7+
# pkg uses yarn — a root package-lock.json is always accidental
8+
/package-lock.json
9+
710
# logs
811
npm-debug.log
912

CLAUDE.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
## Quick Reference
44

55
```bash
6-
npm run build # Build (required before testing)
7-
npm run lint # Check lint + formatting
8-
npm run fix # Auto-fix lint + formatting
9-
npm run start # Watch mode (rebuild on change)
10-
npm run test:22 # Run tests for Node.js 22
6+
yarn build # Build (required before testing)
7+
yarn lint # Check lint + formatting
8+
yarn fix # Auto-fix lint + formatting
9+
yarn start # Watch mode (rebuild on change)
10+
yarn test:22 # Run tests for Node.js 22
1111
```
1212

13+
> `pkg` uses **yarn** for dependency management. `npm` is only used in `docs-site/` (the VitePress docs). Do not create a root `package-lock.json`.
14+
1315
Detailed project rules are in `.claude/rules/` — they are loaded automatically.
1416
Shared instructions for GitHub Copilot are in `.github/copilot-instructions.md`.

docs-site/development.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ description: Local development setup for pkg itself — build, test, release —
77

88
This document aims to help you get started with `pkg` development.
99

10+
::: tip Package manager
11+
`pkg` uses **yarn** for development. Run `yarn install` once, then `yarn build` / `yarn lint` / `yarn test:22` for everyday tasks. `npm` is only used inside `docs-site/` — never at the repo root, since that would create a spurious `package-lock.json`.
12+
:::
13+
1014
## Release Process
1115

1216
In order to create release just run the command:
1317

1418
```bash
15-
npm run release
19+
yarn release
1620
```
1721

1822
This command will start an interactive process that will guide you through the release process using [release-it](https://github.com/release-it/release-it)
@@ -22,11 +26,11 @@ This command will start an interactive process that will guide you through the r
2226
Before running tests ensure you have build the project by running:
2327

2428
```bash
25-
npm run build
29+
yarn build
2630
```
2731

2832
> [!NOTE]
29-
> Remember to run again `npm run build` after changing source code (everything inside `lib` folder).
33+
> Remember to run again `yarn build` after changing source code (everything inside `lib` folder).
3034
3135
Then you can use the following command to run tests:
3236

@@ -88,7 +92,7 @@ Explaining the code above:
8892

8993
## Hacking on this docs site
9094

91-
The documentation you're reading lives under `docs-site/` and is built with [VitePress](https://vitepress.dev). It's a separate npm workspace from `pkg` itself — its own `package.json` and lockfile.
95+
The documentation you're reading lives under `docs-site/` and is built with [VitePress](https://vitepress.dev). It's a separate package with its own `package.json` and `package-lock.json` — this is the **only** place `npm` is used in the repo; `pkg` itself uses `yarn`.
9296

9397
```bash
9498
cd docs-site

0 commit comments

Comments
 (0)