Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
build
*.log
.DS_Store
coverage
.pnpm-debug.log
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
auto-install-peers=true
strict-peer-dependencies=false
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
# pnpmtest
# pnpmtest

A sample repository for testing that pnpm lockfiles are used as precedence for dependency collection.

## Structure

This repository demonstrates a basic pnpm workspace with multiple packages:

- `packages/package-a`: A simple package with a lodash dependency
- `packages/package-b`: A package that depends on package-a (workspace dependency)

## Setup

```bash
pnpm install
```

## Build

```bash
pnpm build
```

## Features

- **pnpm lockfile**: Contains `pnpm-lock.yaml` with locked dependency versions
- **Workspace dependencies**: package-b depends on package-a using `workspace:*` protocol
- **External dependencies**: Includes both lodash and axios with specific locked versions
- **pnpm configuration**: Includes `.npmrc` for pnpm settings

## Testing Lockfile Precedence

This repository is specifically designed to test that dependency collection tools prioritize the `pnpm-lock.yaml` file over `package.json` when determining exact dependency versions. The lockfile contains:

- Locked versions for all direct and transitive dependencies
- Workspace link information
- Integrity hashes for verification
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "pnpmtest",
"version": "1.0.0",
"description": "A sample repository for testing pnpm workspaces",
"private": true,
"scripts": {
"test": "echo \"No tests yet\"",
"build": "pnpm -r build"
},
"keywords": [
"pnpm",
"workspace",
"test"
],
"author": "",
"license": "ISC"
}
13 changes: 13 additions & 0 deletions packages/package-a/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@pnpmtest/package-a",
"version": "1.0.0",
"description": "Sample package A",
"main": "src/index.js",
"scripts": {
"build": "echo 'Building package-a'",
"test": "echo 'Testing package-a'"
},
"dependencies": {
"lodash": "^4.17.21"
}
}
7 changes: 7 additions & 0 deletions packages/package-a/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const _ = require('lodash');

function greet(name) {
return _.capitalize(`hello, ${name}!`);
}

module.exports = { greet };
14 changes: 14 additions & 0 deletions packages/package-b/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@pnpmtest/package-b",
"version": "1.0.0",
"description": "Sample package B",
"main": "src/index.js",
"scripts": {
"build": "echo 'Building package-b'",
"test": "echo 'Testing package-b'"
},
"dependencies": {
"@pnpmtest/package-a": "workspace:*",
"axios": "^1.6.0"
}
}
9 changes: 9 additions & 0 deletions packages/package-b/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { greet } = require('@pnpmtest/package-a');

function welcome(name) {
const greeting = greet(name);
console.log(greeting);
return greeting;
}

module.exports = { welcome };
220 changes: 220 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- 'packages/*'
Loading