mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-10 16:08:29 -05:00
perf: less dirs in the virtual store directory
Reduce the number of directories in the virtual store directory. Don't create a subdirectory for the package version. Append the package version to the package name directory. close #2521 PR #2531
This commit is contained in:
15
.changeset/afraid-taxis-applaud.md
Normal file
15
.changeset/afraid-taxis-applaud.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
"@pnpm/constants": major
|
||||
"@pnpm/headless": major
|
||||
"@pnpm/hoist": major
|
||||
"@pnpm/modules-cleaner": major
|
||||
"@pnpm/package-requester": major
|
||||
"@pnpm/package-store": major
|
||||
"@pnpm/plugin-commands-rebuild": major
|
||||
"@pnpm/plugin-commands-store": major
|
||||
"@pnpm/server": major
|
||||
"pnpm": major
|
||||
"supi": minor
|
||||
---
|
||||
|
||||
Reduce the number of directories in the virtual store directory. Don't create a subdirectory for the package version. Append the package version to the package name directory.
|
||||
@@ -2,6 +2,6 @@ export const WANTED_LOCKFILE = 'pnpm-lock.yaml'
|
||||
export const LOCKFILE_VERSION = 5.1
|
||||
|
||||
export const ENGINE_NAME = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}`
|
||||
export const LAYOUT_VERSION = 3
|
||||
export const LAYOUT_VERSION = 4
|
||||
|
||||
export const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml'
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
"@pnpm/modules-cleaner": "workspace:8.0.17-alpha.2",
|
||||
"@pnpm/modules-yaml": "workspace:6.0.2",
|
||||
"@pnpm/package-requester": "workspace:12.0.0-alpha.2",
|
||||
"@pnpm/pkgid-to-filename": "2.0.0",
|
||||
"@pnpm/pkgid-to-filename": "3.0.0-0",
|
||||
"@pnpm/read-package-json": "workspace:3.1.0",
|
||||
"@pnpm/read-project-manifest": "workspace:1.0.5",
|
||||
"@pnpm/store-controller-types": "workspace:8.0.0-alpha.2",
|
||||
|
||||
@@ -43,7 +43,7 @@ test('installing a simple project', async (t) => {
|
||||
t.ok(project.requireModule('colors'), 'optional dep installed')
|
||||
|
||||
// test that independent leaves is false by default
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors`) // colors is not symlinked from the store
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors@1.2.0`) // colors is not symlinked from the store
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
|
||||
@@ -274,10 +274,10 @@ test('installing with independent-leaves and hoistPattern=*', async (t) => {
|
||||
await project.has('.pnpm/node_modules/path-is-absolute')
|
||||
|
||||
// wrappy is linked directly from the store
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/wrappy/1.0.2`)
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/wrappy@1.0.2`)
|
||||
await project.storeHas('wrappy', '1.0.2')
|
||||
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf/2.5.1`)
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf@2.5.1`)
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
|
||||
@@ -556,8 +556,8 @@ test('independent-leaves: installing a simple project', async (t) => {
|
||||
t.ok(project.requireModule('rimraf'), 'prod dep installed')
|
||||
t.ok(project.requireModule('is-negative'), 'dev dep installed')
|
||||
t.ok(project.requireModule('colors'), 'optional dep installed')
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf`) // rimraf is not symlinked from the store
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors`) // colors is symlinked from the store
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf@2.7.1`) // rimraf is not symlinked from the store
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors@1.2.0`) // colors is symlinked from the store
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
|
||||
@@ -605,7 +605,7 @@ test('installing with hoistPattern=*', async (t) => {
|
||||
t.ok(project.requireModule('colors'), 'optional dep installed')
|
||||
|
||||
// test that independent leaves is false by default
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors`) // colors is not symlinked from the store
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors@1.2.0`) // colors is not symlinked from the store
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
await project.isExecutable('.pnpm/node_modules/.bin/hello-world-js-bin')
|
||||
@@ -665,7 +665,7 @@ test('installing with hoistPattern=* and shamefullyHoist=true', async (t) => {
|
||||
t.ok(project.requireModule('colors'), 'optional dep installed')
|
||||
|
||||
// test that independent leaves is false by default
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors`) // colors is not symlinked from the store
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/colors@1.2.0`) // colors is not symlinked from the store
|
||||
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
await project.isExecutable('.bin/hello-world-js-bin')
|
||||
@@ -725,7 +725,7 @@ test.skip('using side effects cache', async (t) => {
|
||||
}, {}, {}, { packageImportMethod: 'copy' })
|
||||
await headless(opts)
|
||||
|
||||
const cacheIntegrityPath = path.join(opts.storeDir, `localhost+${REGISTRY_MOCK_PORT}/diskusage/1.1.3/side_effects/${ENGINE_DIR}/integrity.json`)
|
||||
const cacheIntegrityPath = path.join(opts.storeDir, `localhost+${REGISTRY_MOCK_PORT}/diskusage@1.1.3/side_effects/${ENGINE_DIR}/integrity.json`)
|
||||
const cacheIntegrity = await loadJsonFile(cacheIntegrityPath)
|
||||
t.ok(cacheIntegrity['build/Makefile'])
|
||||
delete cacheIntegrity['build/Makefile']
|
||||
@@ -771,7 +771,7 @@ test.skip('using side effects cache and hoistPattern=*', async (t) => {
|
||||
const project = assertProject(t, lockfileDir)
|
||||
await project.has('.pnpm/node_modules/es6-promise') // verifying that a flat node_modules was created
|
||||
|
||||
const cacheBuildDir = path.join(opts.storeDir, `localhost+${REGISTRY_MOCK_PORT}/diskusage/1.1.3/side_effects/${ENGINE_DIR}/package/build`)
|
||||
const cacheBuildDir = path.join(opts.storeDir, `localhost+${REGISTRY_MOCK_PORT}/diskusage@1.1.3/side_effects/${ENGINE_DIR}/package/build`)
|
||||
fse.writeFileSync(path.join(cacheBuildDir, 'new-file.txt'), 'some new content')
|
||||
|
||||
await rimraf(path.join(lockfileDir, 'node_modules'))
|
||||
@@ -853,7 +853,7 @@ test('independent-leaves: installing in a workspace', async (t) => {
|
||||
const projectBar = assertProject(t, path.join(workspaceFixture, 'bar'))
|
||||
|
||||
await projectBar.has('foo')
|
||||
t.ok(await exists(path.join(workspaceFixture, `node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/express/4.16.4/node_modules/array-flatten`)), 'independent package linked')
|
||||
t.ok(await exists(path.join(workspaceFixture, `node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/express@4.16.4/node_modules/array-flatten`)), 'independent package linked')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
"@pnpm/lockfile-types": "workspace:2.0.0",
|
||||
"@pnpm/lockfile-utils": "workspace:2.0.11",
|
||||
"@pnpm/lockfile-walker": "workspace:2.0.2",
|
||||
"@pnpm/pkgid-to-filename": "2.0.0",
|
||||
"@pnpm/pkgid-to-filename": "3.0.0-0",
|
||||
"@pnpm/symlink-dependency": "workspace:3.0.4",
|
||||
"@pnpm/types": "workspace:5.0.0",
|
||||
"dependency-path": "workspace:4.0.6",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"@pnpm/lockfile-types": "workspace:2.0.0",
|
||||
"@pnpm/lockfile-utils": "workspace:2.0.11",
|
||||
"@pnpm/package-bins": "workspace:4.0.3",
|
||||
"@pnpm/pkgid-to-filename": "^3.0.0-0",
|
||||
"@pnpm/read-modules-dir": "workspace:2.0.1",
|
||||
"@pnpm/read-package-json": "workspace:3.1.0",
|
||||
"@pnpm/store-controller-types": "workspace:8.0.0-alpha.2",
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from '@pnpm/lockfile-types'
|
||||
import { packageIdFromSnapshot } from '@pnpm/lockfile-utils'
|
||||
import logger from '@pnpm/logger'
|
||||
import pkgIdToFilename from '@pnpm/pkgid-to-filename'
|
||||
import readModulesDir from '@pnpm/read-modules-dir'
|
||||
import { StoreController } from '@pnpm/store-controller-types'
|
||||
import {
|
||||
@@ -140,7 +141,7 @@ export default async function prune (
|
||||
}
|
||||
|
||||
await Promise.all(orphanDepPaths.map(async (orphanDepPath) => {
|
||||
const pathToRemove = path.join(opts.virtualStoreDir, orphanDepPath, 'node_modules')
|
||||
const pathToRemove = path.join(opts.virtualStoreDir, pkgIdToFilename(orphanDepPath, opts.lockfileDir), 'node_modules')
|
||||
removalLogger.debug(pathToRemove)
|
||||
try {
|
||||
await vacuum(pathToRemove, {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@pnpm/cafs": "workspace:1.0.0-alpha.2",
|
||||
"@pnpm/core-loggers": "workspace:4.0.1",
|
||||
"@pnpm/fetcher-base": "workspace:7.0.0-alpha.2",
|
||||
"@pnpm/pkgid-to-filename": "2.0.0",
|
||||
"@pnpm/pkgid-to-filename": "3.0.0-0",
|
||||
"@pnpm/read-package-json": "workspace:3.1.0",
|
||||
"@pnpm/resolver-base": "workspace:7.0.0",
|
||||
"@pnpm/store-controller-types": "workspace:8.0.0-alpha.2",
|
||||
|
||||
@@ -496,7 +496,7 @@ function fetchToStore (
|
||||
await fs.writeFile(path.join(target, TARBALL_INTEGRITY_FILENAME), opts.resolution['integrity'], 'utf8') // tslint:disable-line:no-string-literal
|
||||
}
|
||||
|
||||
ctx.storeIndex[targetRelative] = ctx.storeIndex[targetRelative] || []
|
||||
ctx.storeIndex[opts.pkgId] = ctx.storeIndex[opts.pkgId] || []
|
||||
files.resolve({
|
||||
filesIndex: integrity,
|
||||
fromStore: false,
|
||||
|
||||
@@ -4,6 +4,7 @@ import localResolver from '@pnpm/local-resolver'
|
||||
import { streamParser } from '@pnpm/logger'
|
||||
import createResolver from '@pnpm/npm-resolver'
|
||||
import createPackageRequester, { PackageFilesResponse, PackageResponse } from '@pnpm/package-requester'
|
||||
import pkgIdToFilename from '@pnpm/pkgid-to-filename'
|
||||
import { ResolveFunction } from '@pnpm/resolver-base'
|
||||
import createFetcher from '@pnpm/tarball-fetcher'
|
||||
import { DependencyManifest } from '@pnpm/types'
|
||||
@@ -62,7 +63,7 @@ test('request package', async t => {
|
||||
|
||||
t.equal(pkgResponse.body.id, 'registry.npmjs.org/is-positive/1.0.0', 'responded with correct package ID')
|
||||
t.equal(pkgResponse.body.resolvedVia, 'npm-registry', 'responded with correct resolvedVia')
|
||||
t.equal(pkgResponse.body.inStoreLocation, path.join(storeDir, 'registry.npmjs.org', 'is-positive', '1.0.0'), 'package location in store returned')
|
||||
t.equal(pkgResponse.body.inStoreLocation, path.join(storeDir, 'registry.npmjs.org', 'is-positive@1.0.0'), 'package location in store returned')
|
||||
t.equal(pkgResponse.body.isLocal, false, 'package is not local')
|
||||
t.equal(typeof pkgResponse.body.latest, 'string', 'latest is returned')
|
||||
t.equal(pkgResponse.body.manifest.name, 'is-positive', 'package manifest returned')
|
||||
@@ -108,7 +109,7 @@ test('request package but skip fetching', async t => {
|
||||
t.ok(pkgResponse.body, 'response has body')
|
||||
|
||||
t.equal(pkgResponse.body.id, 'registry.npmjs.org/is-positive/1.0.0', 'responded with correct package ID')
|
||||
t.equal(pkgResponse.body.inStoreLocation, path.join('.store', 'registry.npmjs.org', 'is-positive', '1.0.0'), 'package location in store returned')
|
||||
t.equal(pkgResponse.body.inStoreLocation, path.join('.store', 'registry.npmjs.org', 'is-positive@1.0.0'), 'package location in store returned')
|
||||
t.equal(pkgResponse.body.isLocal, false, 'package is not local')
|
||||
t.equal(typeof pkgResponse.body.latest, 'string', 'latest is returned')
|
||||
t.equal(pkgResponse.body.manifest.name, 'is-positive', 'package manifest returned')
|
||||
@@ -163,7 +164,7 @@ test('request package but skip fetching, when resolution is already available',
|
||||
t.ok(pkgResponse.body, 'response has body')
|
||||
|
||||
t.equal(pkgResponse.body.id, 'registry.npmjs.org/is-positive/1.0.0', 'responded with correct package ID')
|
||||
t.equal(pkgResponse.body.inStoreLocation, path.join('.store', 'registry.npmjs.org', 'is-positive', '1.0.0'), 'package location in store returned')
|
||||
t.equal(pkgResponse.body.inStoreLocation, path.join('.store', 'registry.npmjs.org', 'is-positive@1.0.0'), 'package location in store returned')
|
||||
t.equal(pkgResponse.body.isLocal, false, 'package is not local')
|
||||
t.equal(typeof pkgResponse.body.latest, 'string', 'latest is returned')
|
||||
t.equal(pkgResponse.body.manifest.name, 'is-positive', 'package manifest returned')
|
||||
@@ -717,7 +718,7 @@ test('refetch package to store if it has been modified', async (t) => {
|
||||
|
||||
t.ok(reporter.calledWithMatch({
|
||||
level: 'warn',
|
||||
message: `Refetching ${path.join(storeDir, pkgId)} to store. It was either modified or had no integrity checksums`,
|
||||
message: `Refetching ${path.join(storeDir, pkgIdToFilename(pkgId, process.cwd()))} to store. It was either modified or had no integrity checksums`,
|
||||
name: 'pnpm:package-requester',
|
||||
prefix: lockfileDir,
|
||||
}), 'refetch logged')
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@pnpm/fetcher-base": "workspace:7.0.0-alpha.2",
|
||||
"@pnpm/fs-locker": "3.0.1",
|
||||
"@pnpm/package-requester": "workspace:12.0.0-alpha.2",
|
||||
"@pnpm/pkgid-to-filename": "2.0.0",
|
||||
"@pnpm/pkgid-to-filename": "3.0.0-0",
|
||||
"@pnpm/resolver-base": "workspace:7.0.0",
|
||||
"@pnpm/store-controller-types": "workspace:8.0.0-alpha.2",
|
||||
"@pnpm/types": "workspace:5.0.0",
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
"@pnpm/lockfile-walker": "workspace:2.0.2",
|
||||
"@pnpm/modules-yaml": "workspace:6.0.2",
|
||||
"@pnpm/normalize-registries": "workspace:1.0.0",
|
||||
"@pnpm/pkgid-to-filename": "2.0.0",
|
||||
"@pnpm/pkgid-to-filename": "3.0.0-0",
|
||||
"@pnpm/sort-packages": "workspace:1.0.9",
|
||||
"@pnpm/store-connection-manager": "workspace:0.3.0-alpha.2",
|
||||
"@pnpm/store-controller-types": "workspace:8.0.0-alpha.2",
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
///<reference path="../../../typings/index.d.ts" />
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { rebuild } from '@pnpm/plugin-commands-rebuild'
|
||||
import prepare, { prepareEmpty, preparePackages } from '@pnpm/prepare'
|
||||
import prepare, { prepareEmpty } from '@pnpm/prepare'
|
||||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||
import { copyFixture } from '@pnpm/test-fixtures'
|
||||
import { PackageManifest } from '@pnpm/types'
|
||||
import execa = require('execa')
|
||||
import path = require('path')
|
||||
import exists = require('path-exists')
|
||||
import sinon = require('sinon')
|
||||
import test = require('tape')
|
||||
import { promisify } from 'util'
|
||||
import './recursive'
|
||||
import { DEFAULT_OPTS } from './utils'
|
||||
|
||||
const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/`
|
||||
const pnpmBin = path.join(__dirname, '../../pnpm/bin/pnpm.js')
|
||||
|
||||
test('rebuilds dependencies', async (t) => {
|
||||
const project = prepareEmpty(t)
|
||||
const storeDir = path.resolve('store')
|
||||
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'--save-dev',
|
||||
'pre-and-postinstall-scripts-example',
|
||||
@@ -75,7 +75,8 @@ test('rebuild does not fail when a linked package is present', async (t) => {
|
||||
const storeDir = path.resolve('store')
|
||||
await copyFixture('local-pkg', path.resolve('..', 'local-pkg'))
|
||||
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'link:../local-pkg',
|
||||
'is-positive',
|
||||
@@ -101,7 +102,8 @@ test('rebuild does not fail when a linked package is present', async (t) => {
|
||||
test('rebuilds specific dependencies', async (t) => {
|
||||
const project = prepareEmpty(t)
|
||||
const storeDir = path.resolve('store')
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'--save-dev',
|
||||
'pre-and-postinstall-scripts-example',
|
||||
@@ -134,7 +136,8 @@ test('rebuilds specific dependencies', async (t) => {
|
||||
test('rebuild with pending option', async (t) => {
|
||||
const project = prepareEmpty(t)
|
||||
const storeDir = path.resolve('store')
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'pre-and-postinstall-scripts-example',
|
||||
'--registry',
|
||||
@@ -143,7 +146,8 @@ test('rebuild with pending option', async (t) => {
|
||||
storeDir,
|
||||
'--ignore-scripts',
|
||||
])
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'zkochan/install-scripts-example',
|
||||
'--registry',
|
||||
@@ -198,7 +202,8 @@ test('rebuild dependencies in correct order', async (t) => {
|
||||
const project = prepareEmpty(t)
|
||||
const storeDir = path.resolve('store')
|
||||
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'with-postinstall-a',
|
||||
'--registry',
|
||||
@@ -212,7 +217,7 @@ test('rebuild dependencies in correct order', async (t) => {
|
||||
t.ok(modules)
|
||||
t.doesNotEqual(modules!.pendingBuilds.length, 0)
|
||||
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b/1.0.0/node_modules/with-postinstall-b/output.json`)
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b@1.0.0/node_modules/with-postinstall-b/output.json`)
|
||||
await project.hasNot('with-postinstall-a/output.json')
|
||||
|
||||
await rebuild.handler({
|
||||
@@ -226,7 +231,7 @@ test('rebuild dependencies in correct order', async (t) => {
|
||||
t.ok(modules)
|
||||
t.equal(modules!.pendingBuilds.length, 0)
|
||||
|
||||
t.ok(+project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b/1.0.0/node_modules/with-postinstall-b/output.json`)[0] < +project.requireModule('with-postinstall-a/output.json')[0])
|
||||
t.ok(+project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b@1.0.0/node_modules/with-postinstall-b/output.json`)[0] < +project.requireModule('with-postinstall-a/output.json')[0])
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -234,7 +239,8 @@ test('rebuild dependencies in correct order when node_modules uses independent-l
|
||||
const project = prepareEmpty(t)
|
||||
const storeDir = path.resolve('store')
|
||||
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'with-postinstall-a',
|
||||
'--registry',
|
||||
@@ -250,7 +256,7 @@ test('rebuild dependencies in correct order when node_modules uses independent-l
|
||||
t.ok(modules)
|
||||
t.doesNotEqual(modules!.pendingBuilds.length, 0)
|
||||
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b/1.0.0/node_modules/with-postinstall-b/output.json`)
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b@1.0.0/node_modules/with-postinstall-b/output.json`)
|
||||
await project.hasNot('with-postinstall-a/output.json')
|
||||
|
||||
await rebuild.handler({
|
||||
@@ -265,7 +271,7 @@ test('rebuild dependencies in correct order when node_modules uses independent-l
|
||||
t.ok(modules)
|
||||
t.equal(modules!.pendingBuilds.length, 0)
|
||||
|
||||
t.ok(+project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b/1.0.0/node_modules/with-postinstall-b/output.json`)[0] < +project.requireModule('with-postinstall-a/output.json')[0])
|
||||
t.ok(+project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b@1.0.0/node_modules/with-postinstall-b/output.json`)[0] < +project.requireModule('with-postinstall-a/output.json')[0])
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -273,7 +279,8 @@ test('rebuild links bins', async (t) => {
|
||||
const project = prepareEmpty(t)
|
||||
const storeDir = path.resolve('store')
|
||||
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'has-generated-bins-as-dep',
|
||||
'generated-bins',
|
||||
@@ -316,7 +323,8 @@ test(`rebuild should not fail on incomplete ${WANTED_LOCKFILE}`, async (t) => {
|
||||
})
|
||||
const storeDir = path.resolve('store')
|
||||
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'install',
|
||||
'--registry',
|
||||
REGISTRY,
|
||||
|
||||
@@ -8,6 +8,8 @@ import test = require('tape')
|
||||
import writeYamlFile = require('write-yaml-file')
|
||||
import { DEFAULT_OPTS, REGISTRY } from './utils'
|
||||
|
||||
const pnpmBin = path.join(__dirname, '../../pnpm/bin/pnpm.js')
|
||||
|
||||
test('pnpm recursive rebuild', async (t) => {
|
||||
const projects = preparePackages(t, [
|
||||
{
|
||||
@@ -29,7 +31,8 @@ test('pnpm recursive rebuild', async (t) => {
|
||||
])
|
||||
|
||||
const { allProjects, selectedProjectsGraph } = await readProjects(process.cwd(), [])
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'install',
|
||||
'-r',
|
||||
'--registry',
|
||||
@@ -109,7 +112,8 @@ test.skip('rebuild multiple packages in correct order', async (t) => {
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['project-1'] })
|
||||
|
||||
const { allProjects, selectedProjectsGraph } = await readProjects(process.cwd(), [])
|
||||
await execa('pnpm', [
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'install',
|
||||
'-r',
|
||||
'--registry',
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
"@pnpm/normalize-registries": "workspace:1.0.0",
|
||||
"@pnpm/parse-wanted-dependency": "workspace:1.0.0",
|
||||
"@pnpm/pick-registry-for-package": "workspace:1.0.0",
|
||||
"@pnpm/pkgid-to-filename": "^3.0.0-0",
|
||||
"@pnpm/store-connection-manager": "workspace:0.3.0-alpha.2",
|
||||
"@pnpm/store-controller-types": "workspace:8.0.0-alpha.2",
|
||||
"@pnpm/store-path": "^4.0.0-0",
|
||||
|
||||
@@ -2,6 +2,7 @@ import { getFilePathInCafs } from '@pnpm/cafs'
|
||||
import { getContextForSingleImporter } from '@pnpm/get-context'
|
||||
import { nameVerFromPkgSnapshot } from '@pnpm/lockfile-utils'
|
||||
import { streamParser } from '@pnpm/logger'
|
||||
import pkgIdToFilename from '@pnpm/pkgid-to-filename'
|
||||
import * as dp from 'dependency-path'
|
||||
import dint = require('dint')
|
||||
import loadJsonFile = require('load-json-file')
|
||||
@@ -46,7 +47,7 @@ export default async function (maybeOpts: StoreStatusOptions) {
|
||||
? getFilePathInCafs(cafsDir, integrity, 'index')
|
||||
: path.join(storeDir, pkgPath, 'integrity.json')
|
||||
const pkgIndex = await loadJsonFile(pkgIndexFilePath)
|
||||
return (await dint.check(path.join(virtualStoreDir, pkgPath, 'node_modules', name), pkgIndex)) === false
|
||||
return (await dint.check(path.join(virtualStoreDir, pkgIdToFilename(pkgPath, opts.dir), 'node_modules', name), pkgIndex)) === false
|
||||
})
|
||||
|
||||
if (reporter) {
|
||||
|
||||
@@ -17,7 +17,7 @@ test('CLI fails when store status finds modified packages', async function (t) {
|
||||
|
||||
await execa('node', [pnpmBin, 'add', 'is-positive@3.1.0', '--store-dir', storeDir, '--registry', REGISTRY, '--verify-store-integrity'])
|
||||
|
||||
await rimraf(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/3.1.0/node_modules/is-positive/index.js`)
|
||||
await rimraf(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@3.1.0/node_modules/is-positive/index.js`)
|
||||
|
||||
let err!: PnpmError
|
||||
try {
|
||||
|
||||
@@ -41,7 +41,7 @@ test('global installation to custom directory with --global-dir', async (t: tape
|
||||
|
||||
await execPnpm(['add', '--global', '--global-dir=../global', 'is-positive'])
|
||||
|
||||
const isPositive = require(path.resolve('../global/3/node_modules/is-positive'))
|
||||
const isPositive = require(path.resolve(`../global/${LAYOUT_VERSION}/node_modules/is-positive`))
|
||||
t.ok(typeof isPositive === 'function', 'isPositive() is available')
|
||||
})
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ test('using a custom virtual-store-dir location', async (t: tape.Test) => {
|
||||
|
||||
await execPnpm(['install', '--virtual-store-dir=.pnpm'])
|
||||
|
||||
t.ok(await exists(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf/2.5.1/node_modules/rimraf/package.json`))
|
||||
t.ok(await exists(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf@2.5.1/node_modules/rimraf/package.json`))
|
||||
t.ok(await exists('.pnpm/lock.yaml'))
|
||||
t.ok(await exists('.pnpm/node_modules/once/package.json'))
|
||||
|
||||
@@ -457,7 +457,7 @@ test('using a custom virtual-store-dir location', async (t: tape.Test) => {
|
||||
|
||||
await execPnpm(['install', '--virtual-store-dir=.pnpm', '--frozen-lockfile'])
|
||||
|
||||
t.ok(await exists(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf/2.5.1/node_modules/rimraf/package.json`))
|
||||
t.ok(await exists(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/rimraf@2.5.1/node_modules/rimraf/package.json`))
|
||||
t.ok(await exists('.pnpm/lock.yaml'))
|
||||
t.ok(await exists('.pnpm/node_modules/once/package.json'))
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { LAYOUT_VERSION } from '@pnpm/constants'
|
||||
import { tempDir } from '@pnpm/prepare'
|
||||
import isWindows = require('is-windows')
|
||||
import path = require('path')
|
||||
@@ -30,8 +31,8 @@ test('pnpm root -g', async (t: tape.Test) => {
|
||||
t.equal(result.status, 0)
|
||||
|
||||
if (isWindows()) {
|
||||
t.equal(result.stdout.toString(), path.join(global, 'npm/pnpm-global/3/node_modules') + '\n')
|
||||
t.equal(result.stdout.toString(), path.join(global, `npm/pnpm-global/${LAYOUT_VERSION}/node_modules`) + '\n')
|
||||
} else {
|
||||
t.equal(result.stdout.toString(), path.join(global, 'pnpm-global/3/node_modules') + '\n')
|
||||
t.equal(result.stdout.toString(), path.join(global, `pnpm-global/${LAYOUT_VERSION}/node_modules`) + '\n')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -123,7 +123,7 @@ test('fetchPackage', async t => {
|
||||
lockfileDir: process.cwd(),
|
||||
}),
|
||||
{
|
||||
dir: path.join(storeDir, pkgId, 'node_modules', 'is-positive'),
|
||||
dir: path.join(storeDir, 'registry.npmjs.org/is-positive@1.0.0/node_modules/is-positive'),
|
||||
isBuilt: false,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@pnpm/normalize-registries": "workspace:1.0.0",
|
||||
"@pnpm/package-requester": "workspace:12.0.0-alpha.2",
|
||||
"@pnpm/parse-wanted-dependency": "workspace:1.0.0",
|
||||
"@pnpm/pkgid-to-filename": "2.0.0",
|
||||
"@pnpm/pkgid-to-filename": "3.0.0-0",
|
||||
"@pnpm/prune-lockfile": "workspace:2.0.7",
|
||||
"@pnpm/read-modules-dir": "workspace:2.0.1",
|
||||
"@pnpm/read-package-json": "workspace:3.1.0",
|
||||
|
||||
@@ -119,7 +119,7 @@ test('a subdependency is from a github repo with different name', async (t: tape
|
||||
await project.isExecutable('has-aliased-git-dependency/node_modules/.bin/hi')
|
||||
await project.isExecutable('has-aliased-git-dependency/node_modules/.bin/szia')
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/has-say-hi-peer/1.0.0_say-hi@1.0.0/node_modules/has-say-hi-peer`)),
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/has-say-hi-peer@1.0.0_say-hi@1.0.0/node_modules/has-say-hi-peer`)),
|
||||
'aliased name used to resolve a peer dependency')
|
||||
})
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ test('installing with independent-leaves and hoistPattern', async (t) => {
|
||||
await project.has('.pnpm/node_modules/dep-of-pkg-with-1-dep')
|
||||
|
||||
// wrappy is linked directly from the store
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep/100.0.0`)
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep@100.0.0`)
|
||||
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0')
|
||||
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep/100.0.0`)
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep@100.0.0`)
|
||||
})
|
||||
|
||||
@@ -262,7 +262,7 @@ test('run lifecycle scripts of dependent packages after running scripts of their
|
||||
|
||||
await addDependenciesToPackage({}, ['with-postinstall-a'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
t.ok(+project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b/1.0.0/node_modules/with-postinstall-b/output.json`)[0] < +project.requireModule('with-postinstall-a/output.json')[0])
|
||||
t.ok(+project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/with-postinstall-b@1.0.0/node_modules/with-postinstall-b/output.json`)[0] < +project.requireModule('with-postinstall-a/output.json')[0])
|
||||
})
|
||||
|
||||
test('run prepare script for git-hosted dependencies', async (t: tape.Test) => {
|
||||
|
||||
@@ -457,10 +457,10 @@ test('concurrent circular deps', async (t: tape.Test) => {
|
||||
const m = project.requireModule('es6-iterator')
|
||||
|
||||
t.ok(m, 'es6-iterator is installed')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es6-iterator/2.0.0/node_modules/es5-ext`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es6-iterator/2.0.1/node_modules/es5-ext`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es5-ext/0.10.31/node_modules/es6-iterator`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es5-ext/0.10.31/node_modules/es6-symbol`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es6-iterator@2.0.0/node_modules/es5-ext`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es6-iterator@2.0.1/node_modules/es5-ext`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es5-ext@0.10.31/node_modules/es6-iterator`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/es5-ext@0.10.31/node_modules/es6-symbol`)))
|
||||
})
|
||||
|
||||
test('concurrent installation of the same packages', async (t) => {
|
||||
@@ -733,7 +733,7 @@ test('lockfile locks npm dependencies', async (t: tape.Test) => {
|
||||
status: 'found_in_store',
|
||||
} as ProgressLog), 'logged that package was found in store')
|
||||
|
||||
const m = project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep/100.0.0/node_modules/dep-of-pkg-with-1-dep/package.json`)
|
||||
const m = project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep@100.0.0/node_modules/dep-of-pkg-with-1-dep/package.json`)
|
||||
|
||||
t.equal(m.version, '100.0.0', `dependency specified in ${WANTED_LOCKFILE} is installed`)
|
||||
})
|
||||
@@ -833,7 +833,7 @@ test("don't fail on case insensitive filesystems when package has 2 files with s
|
||||
test('reinstalls missing packages to node_modules', async (t) => {
|
||||
prepareEmpty(t)
|
||||
const reporter = sinon.spy()
|
||||
const depLocation = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0/node_modules/is-positive`)
|
||||
const depLocation = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0/node_modules/is-positive`)
|
||||
const missingDepLog = {
|
||||
level: 'debug',
|
||||
missing: depLocation,
|
||||
@@ -869,7 +869,7 @@ test('reinstalls missing packages to node_modules', async (t) => {
|
||||
test('reinstalls missing packages to node_modules during headless install', async (t) => {
|
||||
prepareEmpty(t)
|
||||
const reporter = sinon.spy()
|
||||
const depLocation = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0/node_modules/is-positive`)
|
||||
const depLocation = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0/node_modules/is-positive`)
|
||||
const missingDepLog = {
|
||||
level: 'debug',
|
||||
missing: depLocation,
|
||||
@@ -998,7 +998,7 @@ test('all the subdeps of dependencies are linked when a node_modules is partiall
|
||||
], await testDefaults({ preferFrozenLockfile: false }))
|
||||
|
||||
t.deepEqual(
|
||||
await fs.readdir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobarqar/1.0.1/node_modules`)),
|
||||
await fs.readdir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobarqar@1.0.1/node_modules`)),
|
||||
[
|
||||
'bar',
|
||||
'foo',
|
||||
@@ -1085,7 +1085,7 @@ test('subdep symlinks are updated if the lockfile has new subdep versions specif
|
||||
},
|
||||
], await testDefaults({ preferFrozenLockfile: false }))
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep/100.0.0/node_modules/dep-of-pkg-with-1-dep/package.json`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep@100.0.0/node_modules/dep-of-pkg-with-1-dep/package.json`)))
|
||||
})
|
||||
|
||||
test("store metadata is always saved, even if there's a fatal error", async (t: tape.Test) => {
|
||||
|
||||
@@ -66,8 +66,8 @@ test('install only the dependencies of the specified importer', async (t) => {
|
||||
await projects['project-2'].hasNot('is-negative')
|
||||
|
||||
const rootNodeModules = assertProject(t, process.cwd())
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`)
|
||||
await rootNodeModules.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative/1.0.0`)
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`)
|
||||
await rootNodeModules.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative@1.0.0`)
|
||||
})
|
||||
|
||||
test('install only the dependencies of the specified importer. The current lockfile has importers that do not exist anymore', async (t) => {
|
||||
@@ -194,9 +194,9 @@ test('dependencies of other importers are not pruned when installing for a subse
|
||||
await projects['project-2'].has('is-negative')
|
||||
|
||||
const rootNodeModules = assertProject(t, process.cwd())
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/2.0.0`)
|
||||
await rootNodeModules.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`)
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative/1.0.0`)
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@2.0.0`)
|
||||
await rootNodeModules.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`)
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative@1.0.0`)
|
||||
|
||||
const lockfile = await rootNodeModules.readCurrentLockfile()
|
||||
t.deepEqual(Object.keys(lockfile.importers), ['project-1', 'project-2'])
|
||||
@@ -259,9 +259,9 @@ test('dependencies of other importers are not pruned when (headless) installing
|
||||
await projects['project-2'].has('is-negative')
|
||||
|
||||
const rootNodeModules = assertProject(t, process.cwd())
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/2.0.0`)
|
||||
await rootNodeModules.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`)
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative/1.0.0`)
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@2.0.0`)
|
||||
await rootNodeModules.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`)
|
||||
await rootNodeModules.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative@1.0.0`)
|
||||
})
|
||||
|
||||
test('adding a new dev dependency to project that uses a shared lockfile', async (t) => {
|
||||
@@ -532,9 +532,9 @@ test('partial installation in a monorepo does not remove dependencies of other w
|
||||
},
|
||||
], await testDefaults())
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/2.0.0/node_modules/is-positive`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep/100.0.0/node_modules/pkg-with-1-dep`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep/100.1.0/node_modules/dep-of-pkg-with-1-dep`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@2.0.0/node_modules/is-positive`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep@100.0.0/node_modules/pkg-with-1-dep`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep@100.1.0/node_modules/dep-of-pkg-with-1-dep`)))
|
||||
})
|
||||
|
||||
test('partial installation in a monorepo does not remove dependencies of other workspace projects when lockfile is frozen', async (t: tape.Test) => {
|
||||
@@ -625,9 +625,9 @@ test('partial installation in a monorepo does not remove dependencies of other w
|
||||
},
|
||||
], await testDefaults({ frozenLockfile: true }))
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0/node_modules/is-positive`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep/100.0.0/node_modules/pkg-with-1-dep`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep/100.1.0/node_modules/dep-of-pkg-with-1-dep`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0/node_modules/is-positive`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-1-dep@100.0.0/node_modules/pkg-with-1-dep`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-pkg-with-1-dep@100.1.0/node_modules/dep-of-pkg-with-1-dep`)))
|
||||
})
|
||||
|
||||
test('adding a new dependency with the workspace: protocol', async (t) => {
|
||||
@@ -829,8 +829,8 @@ test('remove dependencies of a project that was removed from the workspace (duri
|
||||
t.deepEqual(Object.keys(currentLockfile.importers), ['project-1', 'project-2'])
|
||||
t.deepEqual(Object.keys(currentLockfile.packages), ['/is-negative/1.0.0', '/is-positive/1.0.0'])
|
||||
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`)
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative/1.0.0`)
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`)
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative@1.0.0`)
|
||||
}
|
||||
|
||||
await mutateModules(importers.slice(0, 1), await testDefaults({ preferFrozenLockfile: false }))
|
||||
@@ -839,7 +839,7 @@ test('remove dependencies of a project that was removed from the workspace (duri
|
||||
t.deepEqual(Object.keys(currentLockfile.importers), ['project-1'])
|
||||
t.deepEqual(Object.keys(currentLockfile.packages), ['/is-positive/1.0.0'])
|
||||
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0`)
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative/1.0.0`)
|
||||
await project.has(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0`)
|
||||
await project.hasNot(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-negative@1.0.0`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -70,7 +70,7 @@ test('skip optional dependency that does not support the current OS', async (t:
|
||||
|
||||
await project.hasNot('not-compatible-with-any-os')
|
||||
await project.storeHas('not-compatible-with-any-os', '1.0.0')
|
||||
t.notOk(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-optional-pkg/1.0.0`)), "isn't linked into node_modules")
|
||||
t.notOk(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/dep-of-optional-pkg@1.0.0`)), "isn't linked into node_modules")
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
t.ok(lockfile.packages['/not-compatible-with-any-os/1.0.0'], 'lockfile contains optional dependency')
|
||||
@@ -213,8 +213,8 @@ test('optional subdependency is skipped', async (t: tape.Test) => {
|
||||
t.deepEqual(modulesInfo.skipped, ['/not-compatible-with-any-os/1.0.0'], 'optional subdep skipped')
|
||||
}
|
||||
|
||||
t.ok(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-optional/1.0.0`), 'regular dependency linked')
|
||||
t.notOk(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/not-compatible-with-any-os/1.0.0`), 'optional dependency not linked')
|
||||
t.ok(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-optional@1.0.0`), 'regular dependency linked')
|
||||
t.notOk(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/not-compatible-with-any-os@1.0.0`), 'optional dependency not linked')
|
||||
|
||||
const logMatcher = sinon.match({
|
||||
package: {
|
||||
@@ -240,7 +240,7 @@ test('optional subdependency is skipped', async (t: tape.Test) => {
|
||||
await testDefaults({ force: true, frozenLockfile: true }),
|
||||
)
|
||||
|
||||
t.ok(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/not-compatible-with-any-os/1.0.0`), 'optional dependency linked after forced headless install')
|
||||
t.ok(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/not-compatible-with-any-os@1.0.0`), 'optional dependency linked after forced headless install')
|
||||
|
||||
{
|
||||
const modulesInfo = await readYamlFile<{ skipped: string[] }>(path.join('node_modules', '.modules.yaml'))
|
||||
@@ -354,10 +354,10 @@ test('only skip optional dependencies', async (t: tape.Test) => {
|
||||
},
|
||||
}, await testDefaults({ fastUnpack: false, preferredVersions }))
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/duplexify/3.6.0`)), 'duplexify is linked into node_modules')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/stream-shift/1.0.0`)), 'stream-shift is linked into node_modules')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/duplexify@3.6.0`)), 'duplexify is linked into node_modules')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/stream-shift@1.0.0`)), 'stream-shift is linked into node_modules')
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/got/3.3.1/node_modules/duplexify`)), 'duplexify is linked into node_modules of got')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/got@3.3.1/node_modules/duplexify`)), 'duplexify is linked into node_modules of got')
|
||||
})
|
||||
|
||||
test('skip optional dependency that does not support the current OS, when doing install on a subset of workspace projects', async (t: tape.Test) => {
|
||||
|
||||
@@ -32,7 +32,7 @@ test('peer dependency is grouped with dependency when peer is resolved not from
|
||||
const opts = await testDefaults()
|
||||
let manifest = await addDependenciesToPackage({}, ['using-ajv'], opts)
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords/1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency is linked')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency is linked')
|
||||
t.equal(deepRequireCwd(['using-ajv', 'ajv-keywords', 'ajv', './package.json']).version, '4.10.4')
|
||||
|
||||
const storeIndex = await loadJsonFile<object>(path.join(opts.storeDir, 'store.json'))
|
||||
@@ -44,7 +44,7 @@ test('peer dependency is grouped with dependency when peer is resolved not from
|
||||
await rimraf(path.resolve('..', '.store'))
|
||||
manifest = await install(manifest, await testDefaults())
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords/1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency is linked')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency is linked')
|
||||
t.equal(deepRequireCwd(['using-ajv', 'ajv-keywords', 'ajv', './package.json']).version, '4.10.4')
|
||||
|
||||
await addDependenciesToPackage(manifest, ['using-ajv'], await testDefaults({ update: true }))
|
||||
@@ -66,8 +66,8 @@ test('nothing is needlessly removed from node_modules', async (t: tape.Test) =>
|
||||
const opts = await testDefaults()
|
||||
const manifest = await addDependenciesToPackage({}, ['using-ajv', 'ajv-keywords@1.5.0'], opts)
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords/1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency is linked')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords/1.5.0/node_modules/ajv-keywords`)), 'root dependency resolution is present')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency is linked')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0/node_modules/ajv-keywords`)), 'root dependency resolution is present')
|
||||
t.equal(deepRequireCwd(['using-ajv', 'ajv-keywords', 'ajv', './package.json']).version, '4.10.4')
|
||||
|
||||
await mutateModules([
|
||||
@@ -79,8 +79,8 @@ test('nothing is needlessly removed from node_modules', async (t: tape.Test) =>
|
||||
},
|
||||
], opts)
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords/1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency link is not removed')
|
||||
t.notOk(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'ajv-keywords', '1.5.0/node_modules/ajv-keywords')), 'root dependency resolution is removed')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency link is not removed')
|
||||
t.notOk(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0/node_modules/ajv-keywords`)), 'root dependency resolution is removed')
|
||||
})
|
||||
|
||||
test('peer dependency is grouped with dependent when the peer is a top dependency', async (t: tape.Test) => {
|
||||
@@ -94,7 +94,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
message: `localhost+${REGISTRY_MOCK_PORT}/ajv-keywords/1.5.0 requires a peer of ajv@>=4.10.0 but none was installed.`,
|
||||
}), 'no warning is logged about unresolved peer dep')
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'ajv-keywords', '1.5.0_ajv@4.10.4/node_modules/ajv-keywords')), 'dependent is grouped with top peer dep')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0_ajv@4.10.4/node_modules/ajv-keywords`)), 'dependent is grouped with top peer dep')
|
||||
})
|
||||
|
||||
test('the right peer dependency is used in every workspace package', async (t: tape.Test) => {
|
||||
@@ -260,8 +260,8 @@ test('top peer dependency is linked on subsequent install', async (t: tape.Test)
|
||||
|
||||
await addDependenciesToPackage(manifest, ['ajv-keywords@1.5.0'], await testDefaults())
|
||||
|
||||
t.notOk(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'ajv-keywords', '1.5.0/node_modules/ajv-keywords')), 'dependency without peer is prunned')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'ajv-keywords', '1.5.0_ajv@4.10.4/node_modules/ajv')), 'peer dependency is linked')
|
||||
t.notOk(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0/node_modules/ajv-keywords`)), 'dependency without peer is prunned')
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0_ajv@4.10.4/node_modules/ajv`)), 'peer dependency is linked')
|
||||
})
|
||||
|
||||
async function okFile (t: tape.Test, filename: string) {
|
||||
@@ -277,7 +277,7 @@ test('peer dependencies are linked when running one named installation', async (
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['abc-grand-parent-with-c', 'abc-parent-with-ab', 'peer-c@2.0.0'], await testDefaults())
|
||||
|
||||
const pkgVariationsDir = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'abc', '1.0.0')
|
||||
const pkgVariationsDir = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/abc@1.0.0`)
|
||||
|
||||
const pkgVariation1 = path.join(pkgVariationsDir + '_165e1e08a3f7e7f77ddb572ad0e55660/node_modules')
|
||||
await okFile(t, path.join(pkgVariation1, 'abc'))
|
||||
@@ -309,7 +309,7 @@ test('peer dependencies are linked when running two separate named installations
|
||||
const manifest = await addDependenciesToPackage({}, ['abc-grand-parent-with-c', 'peer-c@2.0.0'], await testDefaults())
|
||||
await addDependenciesToPackage(manifest, ['abc-parent-with-ab'], await testDefaults())
|
||||
|
||||
const pkgVariationsDir = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'abc', '1.0.0')
|
||||
const pkgVariationsDir = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/abc@1.0.0`)
|
||||
|
||||
const pkgVariation1 = path.join(pkgVariationsDir + '_165e1e08a3f7e7f77ddb572ad0e55660/node_modules')
|
||||
await okFile(t, path.join(pkgVariation1, 'abc'))
|
||||
@@ -341,7 +341,7 @@ test.skip('peer dependencies are linked', async (t: tape.Test) => {
|
||||
},
|
||||
}, await testDefaults())
|
||||
|
||||
const pkgVariationsDir = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'abc', '1.0.0')
|
||||
const pkgVariationsDir = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/abc@1.0.0`)
|
||||
|
||||
const pkgVariation1 = path.join(pkgVariationsDir, '165e1e08a3f7e7f77ddb572ad0e55660/node_modules')
|
||||
await okFile(t, path.join(pkgVariation1, 'abc'))
|
||||
@@ -367,7 +367,7 @@ test('scoped peer dependency is linked', async (t: tape.Test) => {
|
||||
prepareEmpty(t)
|
||||
await addDependenciesToPackage({}, ['for-testing-scoped-peers'], await testDefaults())
|
||||
|
||||
const pkgVariation = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, '@having', 'scoped-peer', '1.0.0_@scoped+peer@1.0.0/node_modules')
|
||||
const pkgVariation = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/@having/scoped-peer@1.0.0_@scoped+peer@1.0.0/node_modules`)
|
||||
await okFile(t, path.join(pkgVariation, '@having', 'scoped-peer'))
|
||||
await okFile(t, path.join(pkgVariation, '@scoped', 'peer'))
|
||||
})
|
||||
@@ -377,7 +377,7 @@ test('peer bins are linked', async (t: tape.Test) => {
|
||||
|
||||
await addDependenciesToPackage({}, ['for-testing-peers-having-bins'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const pkgVariation = path.join(`.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'pkg-with-peer-having-bin', '1.0.0_peer-with-bin@1.0.0/node_modules')
|
||||
const pkgVariation = path.join(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-peer-having-bin@1.0.0_peer-with-bin@1.0.0/node_modules`)
|
||||
|
||||
await project.isExecutable(path.join(pkgVariation, 'pkg-with-peer-having-bin/node_modules/.bin', 'peer-with-bin'))
|
||||
|
||||
@@ -389,11 +389,11 @@ test('run pre/postinstall scripts of each variations of packages with peer depen
|
||||
prepareEmpty(t)
|
||||
await addDependenciesToPackage({}, ['parent-of-pkg-with-events-and-peers', 'pkg-with-events-and-peers', 'peer-c@2.0.0'], await testDefaults({ fastUnpack: false }))
|
||||
|
||||
const pkgVariation1 = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'pkg-with-events-and-peers', '1.0.0_peer-c@1.0.0/node_modules')
|
||||
const pkgVariation1 = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-events-and-peers@1.0.0_peer-c@1.0.0/node_modules`)
|
||||
await okFile(t, path.join(pkgVariation1, 'pkg-with-events-and-peers', 'generated-by-preinstall.js'))
|
||||
await okFile(t, path.join(pkgVariation1, 'pkg-with-events-and-peers', 'generated-by-postinstall.js'))
|
||||
|
||||
const pkgVariation2 = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'pkg-with-events-and-peers', '1.0.0_peer-c@2.0.0/node_modules')
|
||||
const pkgVariation2 = path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-events-and-peers@1.0.0_peer-c@2.0.0/node_modules`)
|
||||
await okFile(t, path.join(pkgVariation2, 'pkg-with-events-and-peers', 'generated-by-preinstall.js'))
|
||||
await okFile(t, path.join(pkgVariation2, 'pkg-with-events-and-peers', 'generated-by-postinstall.js'))
|
||||
})
|
||||
@@ -409,7 +409,7 @@ test('package that resolves its own peer dependency', async (t: tape.Test) => {
|
||||
|
||||
t.equal(deepRequireCwd(['pkg-with-resolved-peer', 'peer-c', './package.json']).version, '1.0.0')
|
||||
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-resolved-peer/1.0.0/node_modules/pkg-with-resolved-peer`)))
|
||||
t.ok(await exists(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/pkg-with-resolved-peer@1.0.0/node_modules/pkg-with-resolved-peer`)))
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
|
||||
@@ -444,10 +444,10 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
await addDependenciesToPackage({}, ['ajv@4.10.4', 'ajv-keywords@1.5.0'], await testDefaults({ reporter, lockfileDir: path.resolve('..') }))
|
||||
|
||||
t.notOk(reporter.calledWithMatch({
|
||||
message: `localhost+${REGISTRY_MOCK_PORT}/ajv-keywords/1.5.0 requires a peer of ajv@>=4.10.0 but none was installed.`,
|
||||
message: `localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0 requires a peer of ajv@>=4.10.0 but none was installed.`,
|
||||
}), 'no warning is logged about unresolved peer dep')
|
||||
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'ajv-keywords', '1.5.0_ajv@4.10.4/node_modules/ajv-keywords')))
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/ajv-keywords@1.5.0_ajv@4.10.4/node_modules/ajv-keywords`)))
|
||||
|
||||
const lockfile = await readYamlFile<Lockfile>(path.join('..', WANTED_LOCKFILE))
|
||||
|
||||
@@ -477,7 +477,7 @@ test('peer dependency is grouped correctly with peer installed via separate inst
|
||||
}, await testDefaults({ reporter, lockfileDir }))
|
||||
await addDependenciesToPackage(manifest, ['peer-c@2.0.0'], await testDefaults({ reporter, lockfileDir }))
|
||||
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'abc', '1.0.0_peer-c@2.0.0/node_modules/dep-of-pkg-with-1-dep')))
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/abc@1.0.0_peer-c@2.0.0/node_modules/dep-of-pkg-with-1-dep`)))
|
||||
})
|
||||
|
||||
test('peer dependency is grouped with dependent when the peer is a top dependency and external node_modules is used', async (t: tape.Test) => {
|
||||
@@ -623,7 +623,7 @@ test('external lockfile: peer dependency is grouped with dependent even after a
|
||||
})
|
||||
}
|
||||
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'abc-parent-with-ab', '1.0.0_peer-c@2.0.0/node_modules/is-positive')))
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/abc-parent-with-ab@1.0.0_peer-c@2.0.0/node_modules/is-positive`)))
|
||||
})
|
||||
|
||||
test('regular dependencies are not removed on update from transitive packages that have children with peers resolved from above', async (t: tape.Test) => {
|
||||
@@ -639,7 +639,7 @@ test('regular dependencies are not removed on update from transitive packages th
|
||||
await addDistTag({ package: 'peer-c', version: '1.0.1', distTag: 'latest' })
|
||||
await install(manifest, await testDefaults({ lockfileDir, update: true, depth: 2 }))
|
||||
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}`, 'abc-parent-with-ab', '1.0.1_peer-c@1.0.1/node_modules/is-positive')))
|
||||
t.ok(await exists(path.join(`../node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/abc-parent-with-ab@1.0.1_peer-c@1.0.1/node_modules/is-positive`)))
|
||||
})
|
||||
|
||||
test('peer dependency is resolved from parent package', async (t) => {
|
||||
|
||||
@@ -210,11 +210,11 @@ test('node_modules is pruned after linking', async (t: tape.Test) => {
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['is-positive@1.0.0'], await testDefaults())
|
||||
|
||||
t.ok(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0/node_modules/is-positive/package.json`))
|
||||
t.ok(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0/node_modules/is-positive/package.json`))
|
||||
|
||||
await link(['../is-positive'], path.resolve('node_modules'), await testDefaults({ manifest, dir: process.cwd() }))
|
||||
|
||||
t.notOk(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0/node_modules/is-positive/package.json`), 'pruned')
|
||||
t.notOk(await exists(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/is-positive@1.0.0/node_modules/is-positive/package.json`), 'pruned')
|
||||
})
|
||||
|
||||
test('relative link uses realpath when contained in a symlinked dir', async (t: tape.Test) => {
|
||||
|
||||
@@ -161,7 +161,7 @@ test("lockfile doesn't lock subdependencies that don't satisfy the new specs", a
|
||||
await addDependenciesToPackage(manifest, ['react-datetime@1.3.0'], await testDefaults({ save: true }))
|
||||
|
||||
t.equal(
|
||||
project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/react-datetime/1.3.0/node_modules/react-onclickoutside/package.json`).version,
|
||||
project.requireModule(`.pnpm/localhost+${REGISTRY_MOCK_PORT}/react-datetime@1.3.0/node_modules/react-onclickoutside/package.json`).version,
|
||||
'0.3.4',
|
||||
'react-datetime@1.3.0 has react-onclickoutside@0.3.4 in its node_modules')
|
||||
|
||||
@@ -335,8 +335,8 @@ test(`respects ${WANTED_LOCKFILE} for top dependencies`, async (t: tape.Test) =>
|
||||
t.equal((await readPackageJsonFromDir(path.resolve('node_modules', 'foo'))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve('node_modules', 'bar'))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve('node_modules', 'qar'))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar/100.0.0/node_modules/foo`))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar/100.0.0/node_modules/bar`))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar@100.0.0/node_modules/foo`))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar@100.0.0/node_modules/bar`))).version, '100.0.0')
|
||||
|
||||
await Promise.all(pkgs.map((pkgName) => addDistTag(pkgName, '100.1.0', 'latest')))
|
||||
|
||||
@@ -361,8 +361,8 @@ test(`respects ${WANTED_LOCKFILE} for top dependencies`, async (t: tape.Test) =>
|
||||
t.equal((await readPackageJsonFromDir(path.resolve('node_modules', 'foo'))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve('node_modules', 'bar'))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve('node_modules', 'qar'))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar/100.0.0/node_modules/foo`))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar/100.0.0/node_modules/bar`))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar@100.0.0/node_modules/foo`))).version, '100.0.0')
|
||||
t.equal((await readPackageJsonFromDir(path.resolve(`node_modules/.pnpm/localhost+${REGISTRY_MOCK_PORT}/foobar@100.0.0/node_modules/bar`))).version, '100.0.0')
|
||||
})
|
||||
|
||||
test(`subdeps are updated on repeat install if outer ${WANTED_LOCKFILE} does not match the inner one`, async (t: tape.Test) => {
|
||||
|
||||
34
pnpm-lock.yaml
generated
34
pnpm-lock.yaml
generated
@@ -604,7 +604,7 @@ importers:
|
||||
'@pnpm/modules-cleaner': 'link:../modules-cleaner'
|
||||
'@pnpm/modules-yaml': 'link:../modules-yaml'
|
||||
'@pnpm/package-requester': 'link:../package-requester'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/read-package-json': 'link:../read-package-json'
|
||||
'@pnpm/read-project-manifest': 'link:../read-project-manifest'
|
||||
'@pnpm/store-controller-types': 'link:../store-controller-types'
|
||||
@@ -664,7 +664,7 @@ importers:
|
||||
'@pnpm/modules-yaml': 'workspace:6.0.2'
|
||||
'@pnpm/package-requester': 'workspace:12.0.0-alpha.2'
|
||||
'@pnpm/package-store': 'workspace:*'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/read-package-json': 'workspace:3.1.0'
|
||||
'@pnpm/read-project-manifest': 'workspace:1.0.5'
|
||||
'@pnpm/read-projects-context': 'workspace:*'
|
||||
@@ -703,7 +703,7 @@ importers:
|
||||
'@pnpm/lockfile-types': 'link:../lockfile-types'
|
||||
'@pnpm/lockfile-utils': 'link:../lockfile-utils'
|
||||
'@pnpm/lockfile-walker': 'link:../lockfile-walker'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/symlink-dependency': 'link:../symlink-dependency'
|
||||
'@pnpm/types': 'link:../types'
|
||||
dependency-path: 'link:../dependency-path'
|
||||
@@ -718,7 +718,7 @@ importers:
|
||||
'@pnpm/lockfile-utils': 'workspace:2.0.11'
|
||||
'@pnpm/lockfile-walker': 'workspace:2.0.2'
|
||||
'@pnpm/logger': 3.2.2
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/symlink-dependency': 'workspace:3.0.4'
|
||||
'@pnpm/types': 'workspace:5.0.0'
|
||||
'@types/ramda': ^0.27.4
|
||||
@@ -991,6 +991,7 @@ importers:
|
||||
'@pnpm/lockfile-types': 'link:../lockfile-types'
|
||||
'@pnpm/lockfile-utils': 'link:../lockfile-utils'
|
||||
'@pnpm/package-bins': 'link:../package-bins'
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/read-modules-dir': 'link:../read-modules-dir'
|
||||
'@pnpm/read-package-json': 'link:../read-package-json'
|
||||
'@pnpm/store-controller-types': 'link:../store-controller-types'
|
||||
@@ -1013,6 +1014,7 @@ importers:
|
||||
'@pnpm/logger': 3.2.2
|
||||
'@pnpm/modules-cleaner': 'link:'
|
||||
'@pnpm/package-bins': 'workspace:4.0.3'
|
||||
'@pnpm/pkgid-to-filename': ^3.0.0-0
|
||||
'@pnpm/read-modules-dir': 'workspace:2.0.1'
|
||||
'@pnpm/read-package-json': 'workspace:3.1.0'
|
||||
'@pnpm/store-controller-types': 'workspace:8.0.0-alpha.2'
|
||||
@@ -1219,7 +1221,7 @@ importers:
|
||||
'@pnpm/cafs': 'link:../cafs'
|
||||
'@pnpm/core-loggers': 'link:../core-loggers'
|
||||
'@pnpm/fetcher-base': 'link:../fetcher-base'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/read-package-json': 'link:../read-package-json'
|
||||
'@pnpm/resolver-base': 'link:../resolver-base'
|
||||
'@pnpm/store-controller-types': 'link:../store-controller-types'
|
||||
@@ -1261,7 +1263,7 @@ importers:
|
||||
'@pnpm/logger': 3.2.2
|
||||
'@pnpm/npm-resolver': 'workspace:*'
|
||||
'@pnpm/package-requester': 'link:'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/read-package-json': 'workspace:3.1.0'
|
||||
'@pnpm/resolver-base': 'workspace:7.0.0'
|
||||
'@pnpm/store-controller-types': 'workspace:8.0.0-alpha.2'
|
||||
@@ -1297,7 +1299,7 @@ importers:
|
||||
'@pnpm/fetcher-base': 'link:../fetcher-base'
|
||||
'@pnpm/fs-locker': 3.0.1
|
||||
'@pnpm/package-requester': 'link:../package-requester'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/resolver-base': 'link:../resolver-base'
|
||||
'@pnpm/store-controller-types': 'link:../store-controller-types'
|
||||
'@pnpm/types': 'link:../types'
|
||||
@@ -1333,7 +1335,7 @@ importers:
|
||||
'@pnpm/npm-resolver': 'workspace:*'
|
||||
'@pnpm/package-requester': 'workspace:12.0.0-alpha.2'
|
||||
'@pnpm/package-store': 'link:'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/resolver-base': 'workspace:7.0.0'
|
||||
'@pnpm/store-controller-types': 'workspace:8.0.0-alpha.2'
|
||||
'@pnpm/tarball-fetcher': 'workspace:*'
|
||||
@@ -1807,7 +1809,7 @@ importers:
|
||||
'@pnpm/lockfile-walker': 'link:../lockfile-walker'
|
||||
'@pnpm/modules-yaml': 'link:../modules-yaml'
|
||||
'@pnpm/normalize-registries': 'link:../normalize-registries'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/sort-packages': 'link:../sort-packages'
|
||||
'@pnpm/store-connection-manager': 'link:../store-connection-manager'
|
||||
'@pnpm/store-controller-types': 'link:../store-controller-types'
|
||||
@@ -1855,7 +1857,7 @@ importers:
|
||||
'@pnpm/logger': ^3.2.2
|
||||
'@pnpm/modules-yaml': 'workspace:6.0.2'
|
||||
'@pnpm/normalize-registries': 'workspace:1.0.0'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/plugin-commands-rebuild': 'link:'
|
||||
'@pnpm/prepare': 'workspace:0.0.1'
|
||||
'@pnpm/sort-packages': 'workspace:1.0.9'
|
||||
@@ -2004,6 +2006,7 @@ importers:
|
||||
'@pnpm/normalize-registries': 'link:../normalize-registries'
|
||||
'@pnpm/parse-wanted-dependency': 'link:../parse-wanted-dependency'
|
||||
'@pnpm/pick-registry-for-package': 'link:../pick-registry-for-package'
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/store-connection-manager': 'link:../store-connection-manager'
|
||||
'@pnpm/store-controller-types': 'link:../store-controller-types'
|
||||
'@pnpm/store-path': 4.0.0-0
|
||||
@@ -2047,6 +2050,7 @@ importers:
|
||||
'@pnpm/normalize-registries': 'workspace:1.0.0'
|
||||
'@pnpm/parse-wanted-dependency': 'workspace:1.0.0'
|
||||
'@pnpm/pick-registry-for-package': 'workspace:1.0.0'
|
||||
'@pnpm/pkgid-to-filename': ^3.0.0-0
|
||||
'@pnpm/plugin-commands-store': 'link:'
|
||||
'@pnpm/prepare': 'workspace:0.0.1'
|
||||
'@pnpm/store-connection-manager': 'workspace:0.3.0-alpha.2'
|
||||
@@ -2566,7 +2570,7 @@ importers:
|
||||
'@pnpm/normalize-registries': 'link:../normalize-registries'
|
||||
'@pnpm/package-requester': 'link:../package-requester'
|
||||
'@pnpm/parse-wanted-dependency': 'link:../parse-wanted-dependency'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/prune-lockfile': 'link:../prune-lockfile'
|
||||
'@pnpm/read-modules-dir': 'link:../read-modules-dir'
|
||||
'@pnpm/read-package-json': 'link:../read-package-json'
|
||||
@@ -2671,7 +2675,7 @@ importers:
|
||||
'@pnpm/package-requester': 'workspace:12.0.0-alpha.2'
|
||||
'@pnpm/package-store': 'workspace:*'
|
||||
'@pnpm/parse-wanted-dependency': 'workspace:1.0.0'
|
||||
'@pnpm/pkgid-to-filename': 2.0.0
|
||||
'@pnpm/pkgid-to-filename': 3.0.0-0
|
||||
'@pnpm/prepare': 'workspace:0.0.1'
|
||||
'@pnpm/prune-lockfile': 'workspace:2.0.7'
|
||||
'@pnpm/read-modules-dir': 'workspace:2.0.1'
|
||||
@@ -3430,14 +3434,14 @@ packages:
|
||||
node: '>=10'
|
||||
resolution:
|
||||
integrity: sha512-/hQK/HSxnqPavF/Wc1YanCtcrYnpLVEqv3fcHJ5SQmKbcaoIVHeUnBsI2Ep6JZiTTYxCfkzRw9c6mr9sn3Uk3w==
|
||||
/@pnpm/pkgid-to-filename/2.0.0:
|
||||
/@pnpm/pkgid-to-filename/3.0.0-0:
|
||||
dependencies:
|
||||
normalize-path: 3.0.0
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=6'
|
||||
node: '>=10.13'
|
||||
resolution:
|
||||
integrity: sha512-5cf9ik7ntSpPYLXFPs8eoCNgXuDVqa58/9P0Hrb6KmsVpchKi72Xh5TRd6dctqH4mJtfK0eVRaSt4+VDyGxDkQ==
|
||||
integrity: sha512-DojhkQRsAUqo39xnHqVUwMh3zIMRbMoSzv2AwT/+XOlpVPQbFCq7pOmQYs+sf78cDt06gTKJMaaO/gkMY6GsxQ==
|
||||
/@pnpm/registry-mock/2.0.1:
|
||||
dependencies:
|
||||
anonymous-npm-registry-client: 0.1.2
|
||||
|
||||
Reference in New Issue
Block a user