mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-18 13:51:38 -04:00
refactor: rename constants that contain the work SHRINKWRAP
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import path = require('path')
|
||||
|
||||
export const WANTED_SHRINKWRAP_FILENAME = 'pnpm-lock.yaml'
|
||||
export const CURRENT_SHRINKWRAP_FILENAME = path.join('node_modules', '.pnpm-lock.yaml')
|
||||
export const WANTED_LOCKFILE = 'pnpm-lock.yaml'
|
||||
export const CURRENT_LOCKFILE = path.join('node_modules', '.pnpm-lock.yaml')
|
||||
export const SHRINKWRAP_VERSION = 5
|
||||
|
||||
export const ENGINE_NAME = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import dh, { forPackages as dhForPackages, PackageNode } from 'dependencies-hierarchy'
|
||||
import path = require('path')
|
||||
import test = require('tape')
|
||||
@@ -382,7 +382,7 @@ test('unsaved dependencies are listed and filtered', async t => {
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1549
|
||||
test(`do not fail on importers that are not in current ${WANTED_SHRINKWRAP_FILENAME}`, async t => {
|
||||
test(`do not fail on importers that are not in current ${WANTED_LOCKFILE}`, async t => {
|
||||
t.deepEqual(await dh(fixtureMonorepo), [])
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
PackageSnapshots,
|
||||
Shrinkwrap,
|
||||
@@ -83,7 +83,7 @@ function pkgAllDeps (
|
||||
if (pickedPackages[relDepPath] || opts.skipped.has(relDepPath)) continue
|
||||
const pkgSnapshot = pkgSnapshots[relDepPath]
|
||||
if (!pkgSnapshot && !relDepPath.startsWith('link:')) {
|
||||
const message = `No entry for "${relDepPath}" in ${WANTED_SHRINKWRAP_FILENAME}`
|
||||
const message = `No entry for "${relDepPath}" in ${WANTED_LOCKFILE}`
|
||||
if (opts.failOnMissingDependencies) {
|
||||
const err = new Error(message)
|
||||
err['code'] = 'ERR_PNPM_SHRINKWRAP_MISSING_DEPENDENCY' // tslint:disable-line:no-string-literal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
PackageSnapshots,
|
||||
Shrinkwrap,
|
||||
@@ -121,7 +121,7 @@ function pkgAllDeps (
|
||||
if (ctx.pickedPackages[relDepPath]) continue
|
||||
const pkgSnapshot = ctx.pkgSnapshots[relDepPath]
|
||||
if (!pkgSnapshot && !relDepPath.startsWith('link:')) {
|
||||
const message = `No entry for "${relDepPath}" in ${WANTED_SHRINKWRAP_FILENAME}`
|
||||
const message = `No entry for "${relDepPath}" in ${WANTED_LOCKFILE}`
|
||||
if (opts.failOnMissingDependencies) {
|
||||
const err = new Error(message)
|
||||
err['code'] = 'ERR_PNPM_SHRINKWRAP_MISSING_DEPENDENCY' // tslint:disable-line:no-string-literal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { filterByImporters } from '@pnpm/filter-lockfile'
|
||||
import test = require('tape')
|
||||
|
||||
@@ -164,7 +164,7 @@ test('filterByImporters(): fail on missing packages when failOnMissingDependenci
|
||||
err = _
|
||||
}
|
||||
t.ok(err)
|
||||
t.equal(err.message, `No entry for "/prod-dep-dep/1.0.0" in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(err.message, `No entry for "/prod-dep-dep/1.0.0" in ${WANTED_LOCKFILE}`)
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
ENGINE_NAME,
|
||||
LAYOUT_VERSION,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import {
|
||||
packageJsonLogger,
|
||||
@@ -111,7 +111,7 @@ export default async (opts: HeadlessOptions) => {
|
||||
const wantedShrinkwrap = opts.wantedShrinkwrap || await readWanted(lockfileDirectory, { ignoreIncompatible: false })
|
||||
|
||||
if (!wantedShrinkwrap) {
|
||||
throw new Error(`Headless installation requires a ${WANTED_SHRINKWRAP_FILENAME} file`)
|
||||
throw new Error(`Headless installation requires a ${WANTED_LOCKFILE} file`)
|
||||
}
|
||||
|
||||
const currentShrinkwrap = opts.currentShrinkwrap || await readCurrent(lockfileDirectory, { ignoreIncompatible: false })
|
||||
@@ -119,7 +119,7 @@ export default async (opts: HeadlessOptions) => {
|
||||
|
||||
for (const importer of opts.importers) {
|
||||
if (!satisfiesPackageJson(wantedShrinkwrap, importer.pkg, importer.id)) {
|
||||
const err = new Error(`Cannot install with "frozen-lockfile" because ${WANTED_SHRINKWRAP_FILENAME} is not up-to-date with ` +
|
||||
const err = new Error(`Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up-to-date with ` +
|
||||
path.relative(opts.lockfileDirectory, path.join(importer.prefix, 'package.json')))
|
||||
err['code'] = 'ERR_PNPM_OUTDATED_SHRINKWRAP' // tslint:disable-line
|
||||
throw err
|
||||
@@ -565,7 +565,7 @@ async function getChildrenPaths (
|
||||
} else if (allDeps[alias].indexOf('file:') === 0) {
|
||||
children[alias] = path.resolve(ctx.prefix, allDeps[alias].substr(5))
|
||||
} else if (!ctx.skipped.has(childRelDepPath)) {
|
||||
throw new Error(`${childRelDepPath} not found in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
throw new Error(`${childRelDepPath} not found in ${WANTED_LOCKFILE}`)
|
||||
}
|
||||
}
|
||||
return children
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///<reference path="../typings/index.d.ts" />
|
||||
import assertProject from '@pnpm/assert-project'
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
PackageJsonLog,
|
||||
RootLog,
|
||||
@@ -149,7 +149,7 @@ test('installing non-prod deps then all deps', async (t) => {
|
||||
|
||||
{
|
||||
const currentShrinkwrap = await project.loadCurrentShrinkwrap()
|
||||
t.notOk(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep only not added to current ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.notOk(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep only not added to current ${WANTED_LOCKFILE}`)
|
||||
}
|
||||
|
||||
const reporter = sinon.spy()
|
||||
@@ -188,7 +188,7 @@ test('installing non-prod deps then all deps', async (t) => {
|
||||
|
||||
{
|
||||
const currentShrinkwrap = await project.loadCurrentShrinkwrap()
|
||||
t.ok(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep added to current ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep added to current ${WANTED_LOCKFILE}`)
|
||||
}
|
||||
|
||||
t.end()
|
||||
@@ -297,19 +297,19 @@ test('orphan packages are removed', async (t) => {
|
||||
t.comment(projectDir)
|
||||
|
||||
const destPackageJsonPath = path.join(projectDir, 'package.json')
|
||||
const destShrinkwrapYamlPath = path.join(projectDir, WANTED_SHRINKWRAP_FILENAME)
|
||||
const destShrinkwrapYamlPath = path.join(projectDir, WANTED_LOCKFILE)
|
||||
|
||||
const simpleWithMoreDepsDir = path.join(fixtures, 'simple-with-more-deps')
|
||||
const simpleDir = path.join(fixtures, 'simple')
|
||||
fse.copySync(path.join(simpleWithMoreDepsDir, 'package.json'), destPackageJsonPath)
|
||||
fse.copySync(path.join(simpleWithMoreDepsDir, WANTED_SHRINKWRAP_FILENAME), destShrinkwrapYamlPath)
|
||||
fse.copySync(path.join(simpleWithMoreDepsDir, WANTED_LOCKFILE), destShrinkwrapYamlPath)
|
||||
|
||||
await headless(await testDefaults({
|
||||
lockfileDirectory: projectDir,
|
||||
}))
|
||||
|
||||
fse.copySync(path.join(simpleDir, 'package.json'), destPackageJsonPath)
|
||||
fse.copySync(path.join(simpleDir, WANTED_SHRINKWRAP_FILENAME), destShrinkwrapYamlPath)
|
||||
fse.copySync(path.join(simpleDir, WANTED_LOCKFILE), destShrinkwrapYamlPath)
|
||||
|
||||
const reporter = sinon.spy()
|
||||
await headless(await testDefaults({
|
||||
@@ -338,17 +338,17 @@ test('available packages are used when node_modules is not clean', async (t) =>
|
||||
t.comment(projectDir)
|
||||
|
||||
const destPackageJsonPath = path.join(projectDir, 'package.json')
|
||||
const destShrinkwrapYamlPath = path.join(projectDir, WANTED_SHRINKWRAP_FILENAME)
|
||||
const destShrinkwrapYamlPath = path.join(projectDir, WANTED_LOCKFILE)
|
||||
|
||||
const hasGlobDir = path.join(fixtures, 'has-glob')
|
||||
const hasGlobAndRimrafDir = path.join(fixtures, 'has-glob-and-rimraf')
|
||||
fse.copySync(path.join(hasGlobDir, 'package.json'), destPackageJsonPath)
|
||||
fse.copySync(path.join(hasGlobDir, WANTED_SHRINKWRAP_FILENAME), destShrinkwrapYamlPath)
|
||||
fse.copySync(path.join(hasGlobDir, WANTED_LOCKFILE), destShrinkwrapYamlPath)
|
||||
|
||||
await headless(await testDefaults({ lockfileDirectory: projectDir }))
|
||||
|
||||
fse.copySync(path.join(hasGlobAndRimrafDir, 'package.json'), destPackageJsonPath)
|
||||
fse.copySync(path.join(hasGlobAndRimrafDir, WANTED_SHRINKWRAP_FILENAME), destShrinkwrapYamlPath)
|
||||
fse.copySync(path.join(hasGlobAndRimrafDir, WANTED_LOCKFILE), destShrinkwrapYamlPath)
|
||||
|
||||
const reporter = sinon.spy()
|
||||
await headless(await testDefaults({ lockfileDirectory: projectDir, reporter }))
|
||||
@@ -378,17 +378,17 @@ test('available packages are relinked during forced install', async (t) => {
|
||||
t.comment(projectDir)
|
||||
|
||||
const destPackageJsonPath = path.join(projectDir, 'package.json')
|
||||
const destShrinkwrapYamlPath = path.join(projectDir, WANTED_SHRINKWRAP_FILENAME)
|
||||
const destShrinkwrapYamlPath = path.join(projectDir, WANTED_LOCKFILE)
|
||||
|
||||
const hasGlobDir = path.join(fixtures, 'has-glob')
|
||||
const hasGlobAndRimrafDir = path.join(fixtures, 'has-glob-and-rimraf')
|
||||
fse.copySync(path.join(hasGlobDir, 'package.json'), destPackageJsonPath)
|
||||
fse.copySync(path.join(hasGlobDir, WANTED_SHRINKWRAP_FILENAME), destShrinkwrapYamlPath)
|
||||
fse.copySync(path.join(hasGlobDir, WANTED_LOCKFILE), destShrinkwrapYamlPath)
|
||||
|
||||
await headless(await testDefaults({ lockfileDirectory: projectDir }))
|
||||
|
||||
fse.copySync(path.join(hasGlobAndRimrafDir, 'package.json'), destPackageJsonPath)
|
||||
fse.copySync(path.join(hasGlobAndRimrafDir, WANTED_SHRINKWRAP_FILENAME), destShrinkwrapYamlPath)
|
||||
fse.copySync(path.join(hasGlobAndRimrafDir, WANTED_LOCKFILE), destShrinkwrapYamlPath)
|
||||
|
||||
const reporter = sinon.spy()
|
||||
await headless(await testDefaults({ lockfileDirectory: projectDir, reporter, force: true }))
|
||||
@@ -413,7 +413,7 @@ test('available packages are relinked during forced install', async (t) => {
|
||||
t.end()
|
||||
})
|
||||
|
||||
test(`fail when ${WANTED_SHRINKWRAP_FILENAME} is not up-to-date with package.json`, async (t) => {
|
||||
test(`fail when ${WANTED_LOCKFILE} is not up-to-date with package.json`, async (t) => {
|
||||
const projectDir = tempy.directory()
|
||||
t.comment(projectDir)
|
||||
|
||||
@@ -421,13 +421,13 @@ test(`fail when ${WANTED_SHRINKWRAP_FILENAME} is not up-to-date with package.jso
|
||||
fse.copySync(path.join(simpleDir, 'package.json'), path.join(projectDir, 'package.json'))
|
||||
|
||||
const simpleWithMoreDepsDir = path.join(fixtures, 'simple-with-more-deps')
|
||||
fse.copySync(path.join(simpleWithMoreDepsDir, WANTED_SHRINKWRAP_FILENAME), path.join(projectDir, WANTED_SHRINKWRAP_FILENAME))
|
||||
fse.copySync(path.join(simpleWithMoreDepsDir, WANTED_LOCKFILE), path.join(projectDir, WANTED_LOCKFILE))
|
||||
|
||||
try {
|
||||
await headless(await testDefaults({ lockfileDirectory: projectDir }))
|
||||
t.fail()
|
||||
} catch (err) {
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_SHRINKWRAP_FILENAME} is not up-to-date with package.json`)
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up-to-date with package.json`)
|
||||
}
|
||||
|
||||
t.end()
|
||||
@@ -463,7 +463,7 @@ test('installing using passed in shrinkwrap files', async (t) => {
|
||||
|
||||
const simplePkgPath = path.join(fixtures, 'simple')
|
||||
fse.copySync(path.join(simplePkgPath, 'package.json'), path.join(prefix, 'package.json'))
|
||||
fse.copySync(path.join(simplePkgPath, WANTED_SHRINKWRAP_FILENAME), path.join(prefix, WANTED_SHRINKWRAP_FILENAME))
|
||||
fse.copySync(path.join(simplePkgPath, WANTED_LOCKFILE), path.join(prefix, WANTED_LOCKFILE))
|
||||
|
||||
const wantedShr = await readWanted(simplePkgPath, { ignoreIncompatible: false })
|
||||
|
||||
@@ -701,7 +701,7 @@ test('installing in a workspace', async (t) => {
|
||||
t.deepEqual(Object.keys(shr.packages), [
|
||||
'/is-negative/1.0.0',
|
||||
'/is-positive/1.0.0',
|
||||
], `packages of importer that was not selected by last installation are not removed from current ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
], `packages of importer that was not selected by last installation are not removed from current ${WANTED_LOCKFILE}`)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import fs = require('fs')
|
||||
import path = require('path')
|
||||
|
||||
export default (pkgPath: string) => new Promise((resolve, reject) => {
|
||||
fs.access(path.join(pkgPath, WANTED_SHRINKWRAP_FILENAME), (err) => {
|
||||
fs.access(path.join(pkgPath, WANTED_LOCKFILE), (err) => {
|
||||
if (!err) {
|
||||
resolve(true)
|
||||
return
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
import {
|
||||
CURRENT_SHRINKWRAP_FILENAME,
|
||||
CURRENT_LOCKFILE,
|
||||
SHRINKWRAP_VERSION,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-types'
|
||||
import { DEPENDENCIES_FIELDS } from '@pnpm/types'
|
||||
@@ -20,7 +20,7 @@ export async function readCurrent (
|
||||
ignoreIncompatible: boolean,
|
||||
},
|
||||
): Promise<Shrinkwrap | null> {
|
||||
const shrinkwrapPath = path.join(pkgPath, CURRENT_SHRINKWRAP_FILENAME)
|
||||
const shrinkwrapPath = path.join(pkgPath, CURRENT_LOCKFILE)
|
||||
return _read(shrinkwrapPath, pkgPath, opts)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function readWanted (
|
||||
ignoreIncompatible: boolean,
|
||||
},
|
||||
): Promise<Shrinkwrap | null> {
|
||||
const shrinkwrapPath = path.join(pkgPath, WANTED_SHRINKWRAP_FILENAME)
|
||||
const shrinkwrapPath = path.join(pkgPath, WANTED_LOCKFILE)
|
||||
return _read(shrinkwrapPath, pkgPath, opts)
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ async function _read (
|
||||
if (typeof opts.wantedVersion !== 'number' || Math.floor(shrinkwrap.lockfileVersion) === Math.floor(opts.wantedVersion)) {
|
||||
if (typeof opts.wantedVersion === 'number' && shrinkwrap.lockfileVersion > opts.wantedVersion) {
|
||||
logger.warn({
|
||||
message: `Your ${WANTED_SHRINKWRAP_FILENAME} was generated by a newer version of pnpm. ` +
|
||||
message: `Your ${WANTED_LOCKFILE} was generated by a newer version of pnpm. ` +
|
||||
`It is a compatible version but it might get downgraded to version ${opts.wantedVersion}`,
|
||||
prefix,
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
CURRENT_SHRINKWRAP_FILENAME,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
CURRENT_LOCKFILE,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-types'
|
||||
import { DEPENDENCIES_FIELDS } from '@pnpm/types'
|
||||
@@ -29,7 +29,7 @@ export function writeWantedOnly (
|
||||
forceSharedFormat?: boolean,
|
||||
},
|
||||
) {
|
||||
return writeShrinkwrap(WANTED_SHRINKWRAP_FILENAME, pkgPath, wantedShrinkwrap, opts)
|
||||
return writeShrinkwrap(WANTED_LOCKFILE, pkgPath, wantedShrinkwrap, opts)
|
||||
}
|
||||
|
||||
export async function writeCurrentOnly (
|
||||
@@ -40,7 +40,7 @@ export async function writeCurrentOnly (
|
||||
},
|
||||
) {
|
||||
await mkdirp(path.join(pkgPath, 'node_modules'))
|
||||
return writeShrinkwrap(CURRENT_SHRINKWRAP_FILENAME, pkgPath, currentShrinkwrap, opts)
|
||||
return writeShrinkwrap(CURRENT_LOCKFILE, pkgPath, currentShrinkwrap, opts)
|
||||
}
|
||||
|
||||
function writeShrinkwrap (
|
||||
@@ -115,8 +115,8 @@ export default function write (
|
||||
forceSharedFormat?: boolean,
|
||||
},
|
||||
) {
|
||||
const wantedShrinkwrapPath = path.join(pkgPath, WANTED_SHRINKWRAP_FILENAME)
|
||||
const currentShrinkwrapPath = path.join(pkgPath, CURRENT_SHRINKWRAP_FILENAME)
|
||||
const wantedShrinkwrapPath = path.join(pkgPath, WANTED_LOCKFILE)
|
||||
const currentShrinkwrapPath = path.join(pkgPath, CURRENT_LOCKFILE)
|
||||
|
||||
// empty shrinkwrap is not saved
|
||||
if (isEmptyShrinkwrap(wantedShrinkwrap)) {
|
||||
@@ -143,7 +143,7 @@ export default function write (
|
||||
}
|
||||
|
||||
logger.debug({
|
||||
message: `\`${WANTED_SHRINKWRAP_FILENAME}\` differs from \`${CURRENT_SHRINKWRAP_FILENAME}\``,
|
||||
message: `\`${WANTED_LOCKFILE}\` differs from \`${CURRENT_LOCKFILE}\``,
|
||||
prefix: pkgPath,
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
existsWanted,
|
||||
read,
|
||||
@@ -295,7 +295,7 @@ test('write does not use yaml anchors/aliases', async t => {
|
||||
}
|
||||
await write(projectPath, wantedShrinkwrap, wantedShrinkwrap)
|
||||
|
||||
const shrContent = fs.readFileSync(path.join(projectPath, WANTED_SHRINKWRAP_FILENAME), 'utf8')
|
||||
const shrContent = fs.readFileSync(path.join(projectPath, WANTED_LOCKFILE), 'utf8')
|
||||
t.ok(shrContent.indexOf('&') === -1, 'shrinkwrap contains no anchors')
|
||||
t.ok(shrContent.indexOf('*') === -1, 'shrinkwrap contains no aliases')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
getImporterId,
|
||||
readCurrent as readCurrentShrinkwrap,
|
||||
@@ -154,7 +154,7 @@ async function _outdated (
|
||||
const pkgSnapshot = wantedShrinkwrap.packages && wantedShrinkwrap.packages[relativeDepPath]
|
||||
|
||||
if (!pkgSnapshot) {
|
||||
throw new Error(`Invalid ${WANTED_SHRINKWRAP_FILENAME} file. ${relativeDepPath} not found in packages field`)
|
||||
throw new Error(`Invalid ${WANTED_LOCKFILE} file. ${relativeDepPath} not found in packages field`)
|
||||
}
|
||||
|
||||
const currentRef = currentShrinkwrap.importers[importerId][depType][packageName]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import outdated, { forPackages as outdatedForPackages } from '@pnpm/outdated'
|
||||
import path = require('path')
|
||||
import test = require('tape')
|
||||
@@ -23,7 +23,7 @@ const outdatedOpts = {
|
||||
userAgent: 'pnpm',
|
||||
}
|
||||
|
||||
test(`fail when there is no ${WANTED_SHRINKWRAP_FILENAME} file in the root of the project`, async (t) => {
|
||||
test(`fail when there is no ${WANTED_LOCKFILE} file in the root of the project`, async (t) => {
|
||||
try {
|
||||
await outdated('no-shrinkwrap', outdatedOpts)
|
||||
t.fail('the call should have failed')
|
||||
@@ -33,7 +33,7 @@ test(`fail when there is no ${WANTED_SHRINKWRAP_FILENAME} file in the root of th
|
||||
}
|
||||
})
|
||||
|
||||
test(`dont fail when there is no ${WANTED_SHRINKWRAP_FILENAME} file but no dependencies in package.json`, async (t) => {
|
||||
test(`dont fail when there is no ${WANTED_LOCKFILE} file but no dependencies in package.json`, async (t) => {
|
||||
t.deepEqual(await outdated('no-deps', outdatedOpts), [])
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { stripIndent } from 'common-tags'
|
||||
import getCommandFullName from '../getCommandFullName'
|
||||
|
||||
@@ -48,12 +48,12 @@ function getHelpText (command: string) {
|
||||
--[no-]lock
|
||||
--strict-peer-dependencies fail on missing or invalid peer dependencies.
|
||||
|
||||
--no-lockfile don't read or generate a \`${WANTED_SHRINKWRAP_FILENAME}\` file
|
||||
--lockfile-only dependencies are not downloaded only \`${WANTED_SHRINKWRAP_FILENAME}\` is updated
|
||||
--no-lockfile don't read or generate a \`${WANTED_LOCKFILE}\` file
|
||||
--lockfile-only dependencies are not downloaded only \`${WANTED_LOCKFILE}\` is updated
|
||||
--frozen-lockfile don't generate a lockfile and fail if an update is needed
|
||||
--prefer-frozen-lockfile if the available \`${WANTED_SHRINKWRAP_FILENAME}\` satisfies the \`package.json\`
|
||||
--prefer-frozen-lockfile if the available \`${WANTED_LOCKFILE}\` satisfies the \`package.json\`
|
||||
then perform a headless installation.
|
||||
--lockfile-directory <path> the directory in which the ${WANTED_SHRINKWRAP_FILENAME} of the package will be created.
|
||||
--lockfile-directory <path> the directory in which the ${WANTED_LOCKFILE} of the package will be created.
|
||||
Several projects may share a single lockfile.
|
||||
|
||||
--use-store-server starts a store server in the background.
|
||||
@@ -108,7 +108,7 @@ function getHelpText (command: string) {
|
||||
return stripIndent`
|
||||
pnpm import
|
||||
|
||||
Generates ${WANTED_SHRINKWRAP_FILENAME} from an npm package-lock.json (or npm-shrinkwrap.json) file.
|
||||
Generates ${WANTED_LOCKFILE} from an npm package-lock.json (or npm-shrinkwrap.json) file.
|
||||
`
|
||||
|
||||
case 'uninstall':
|
||||
@@ -369,7 +369,7 @@ function getHelpText (command: string) {
|
||||
Sort packages topologically (dependencies before dependents). Pass --no-sort to disable.
|
||||
|
||||
--shared-workspace-lockfile
|
||||
Creates a single ${WANTED_SHRINKWRAP_FILENAME} file in the root of the workspace.
|
||||
Creates a single ${WANTED_LOCKFILE} file in the root of the workspace.
|
||||
A shared lockfile also means that all dependencies of all workspace packages will be in a single node_modules.
|
||||
`
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import loadJsonFile from 'load-json-file'
|
||||
import path = require('path')
|
||||
import rimraf = require('rimraf-then')
|
||||
@@ -12,7 +12,7 @@ export default async function installCmd (
|
||||
) {
|
||||
// Removing existing pnpm lockfile
|
||||
// it should not influence the new one
|
||||
await rimraf(path.join(opts.prefix, WANTED_SHRINKWRAP_FILENAME))
|
||||
await rimraf(path.join(opts.prefix, WANTED_LOCKFILE))
|
||||
const npmPackageLock = await readNpmLockfile(opts.prefix)
|
||||
const versionsByPackageNames = {}
|
||||
getAllVersionsByPackageNames(npmPackageLock, versionsByPackageNames)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-types'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import { fromDir as readPackageJsonFromDir } from '@pnpm/read-package-json'
|
||||
@@ -71,7 +71,7 @@ test('install --no-lockfile', async (t: tape.Test) => {
|
||||
|
||||
await project.has('is-positive')
|
||||
|
||||
t.notOk(await project.loadShrinkwrap(), `${WANTED_SHRINKWRAP_FILENAME} not created`)
|
||||
t.notOk(await project.loadShrinkwrap(), `${WANTED_LOCKFILE} not created`)
|
||||
})
|
||||
|
||||
test('install --no-package-lock', async (t: tape.Test) => {
|
||||
@@ -81,7 +81,7 @@ test('install --no-package-lock', async (t: tape.Test) => {
|
||||
|
||||
await project.has('is-positive')
|
||||
|
||||
t.notOk(await project.loadShrinkwrap(), `${WANTED_SHRINKWRAP_FILENAME} not created`)
|
||||
t.notOk(await project.loadShrinkwrap(), `${WANTED_LOCKFILE} not created`)
|
||||
})
|
||||
|
||||
test('install from any location via the --prefix flag', async (t: tape.Test) => {
|
||||
@@ -106,7 +106,7 @@ test('install with external lockfile directory', async (t: tape.Test) => {
|
||||
|
||||
await project.has('is-positive')
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
|
||||
t.deepEqual(Object.keys(shr.importers), ['project'], 'lockfile created in correct location')
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import rimraf = require('rimraf-then')
|
||||
import tape = require('tape')
|
||||
@@ -19,7 +19,7 @@ test('when prefer offline is used, meta from store is used, where latest might b
|
||||
await execPnpm('install', 'foo')
|
||||
|
||||
await rimraf('node_modules')
|
||||
await rimraf(WANTED_SHRINKWRAP_FILENAME)
|
||||
await rimraf(WANTED_LOCKFILE)
|
||||
|
||||
await addDistTag('foo', '100.1.0', 'latest')
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import assertProject, { isExecutable } from '@pnpm/assert-project'
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import isWindows = require('is-windows')
|
||||
import fs = require('mz/fs')
|
||||
@@ -87,7 +87,7 @@ test('relative link', async (t: tape.Test) => {
|
||||
|
||||
const wantedShrinkwrap = await project.loadShrinkwrap()
|
||||
t.equal(wantedShrinkwrap.dependencies['hello-world-js-bin'], 'link:../hello-world-js-bin', 'link added to wanted shrinkwrap')
|
||||
t.equal(wantedShrinkwrap.specifiers['hello-world-js-bin'], '*', `specifier of linked dependency added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(wantedShrinkwrap.specifiers['hello-world-js-bin'], '*', `specifier of linked dependency added to ${WANTED_LOCKFILE}`)
|
||||
|
||||
const currentShrinkwrap = await project.loadCurrentShrinkwrap()
|
||||
t.equal(currentShrinkwrap.dependencies['hello-world-js-bin'], 'link:../hello-world-js-bin', 'link added to wanted shrinkwrap')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare, { preparePackages, tempDir } from '@pnpm/prepare'
|
||||
import { stripIndent } from 'common-tags'
|
||||
import isWindows = require('is-windows')
|
||||
@@ -130,7 +130,7 @@ test('listing packages', async (t: tape.Test) => {
|
||||
}
|
||||
})
|
||||
|
||||
test(`listing packages of a project that has an external ${WANTED_SHRINKWRAP_FILENAME}`, async (t: tape.Test) => {
|
||||
test(`listing packages of a project that has an external ${WANTED_LOCKFILE}`, async (t: tape.Test) => {
|
||||
preparePackages(t, [
|
||||
{
|
||||
name: 'pkg',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-types'
|
||||
import prepare, { preparePackages } from '@pnpm/prepare'
|
||||
import { fromDir as readPackageJsonFromDir } from '@pnpm/read-package-json'
|
||||
@@ -361,7 +361,7 @@ test('shared-workspace-lockfile: installation with --link-workspace-packages lin
|
||||
await execPnpm('recursive', 'install')
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
t.equal(shr!.importers!.project!.dependencies!['is-positive'], '2.0.0')
|
||||
t.equal(shr!.importers!.project!.dependencies!['negative'], '/is-negative/1.0.0')
|
||||
}
|
||||
@@ -379,7 +379,7 @@ test('shared-workspace-lockfile: installation with --link-workspace-packages lin
|
||||
await execPnpm('recursive', 'install')
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
t.equal(shr.importers!.project!.dependencies!['is-positive'], 'link:../is-positive')
|
||||
t.equal(shr.importers!.project!.dependencies!['negative'], 'link:../is-negative')
|
||||
}
|
||||
@@ -437,7 +437,7 @@ test('recursive install with link-workspace-packages and shared-workspace-lockfi
|
||||
t.ok(projects['is-positive'].requireModule('concat-stream'), 'dependencies flattened in is-positive')
|
||||
t.notOk(projects['project-1'].requireModule('is-positive/package.json').author, 'local package is linked')
|
||||
|
||||
const sharedShr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const sharedShr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
t.equal(sharedShr.importers['project-1']!.devDependencies!['is-positive'], 'link:../is-positive')
|
||||
|
||||
const outputs = await import(path.resolve('output.json')) as string[]
|
||||
@@ -622,7 +622,7 @@ test('recursive installation with shared-workspace-lockfile and a readPackage ho
|
||||
|
||||
await execPnpm('recursive', 'install', '--shared-workspace-lockfile', '--store', 'store')
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(`./${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
const shr = await readYamlFile<Shrinkwrap>(`./${WANTED_LOCKFILE}`)
|
||||
t.ok(shr.packages!['/dep-of-pkg-with-1-dep/100.1.0'], 'new dependency added by hook')
|
||||
|
||||
await execPnpm('recursive', 'install', '--shared-workspace-lockfile', '--store', 'store', '--', 'project-1')
|
||||
@@ -671,10 +671,10 @@ test('shared-workspace-lockfile: create shared lockfile format when installation
|
||||
|
||||
await execPnpm('install', '--store', 'store')
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
|
||||
t.ok(shr['importers'] && shr['importers']['.'], `correct ${WANTED_SHRINKWRAP_FILENAME} format`)
|
||||
t.equal(shr['lockfileVersion'], 5, `correct ${WANTED_SHRINKWRAP_FILENAME} version`)
|
||||
t.ok(shr['importers'] && shr['importers']['.'], `correct ${WANTED_LOCKFILE} format`)
|
||||
t.equal(shr['lockfileVersion'], 5, `correct ${WANTED_LOCKFILE} version`)
|
||||
})
|
||||
|
||||
// covers https://github.com/pnpm/pnpm/issues/1451
|
||||
@@ -716,7 +716,7 @@ test("shared-workspace-lockfile: don't install dependencies in projects that are
|
||||
|
||||
await execPnpm('install', '--store', 'store', '--shared-workspace-lockfile', '--link-workspace-packages')
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
|
||||
t.deepEqual(shr, {
|
||||
importers: {
|
||||
@@ -743,7 +743,7 @@ test("shared-workspace-lockfile: don't install dependencies in projects that are
|
||||
},
|
||||
},
|
||||
},
|
||||
}, `correct ${WANTED_SHRINKWRAP_FILENAME} created`)
|
||||
}, `correct ${WANTED_LOCKFILE} created`)
|
||||
})
|
||||
|
||||
test('shared-workspace-lockfile: entries of removed projects should be removed from shared lockfile', async (t) => {
|
||||
@@ -771,7 +771,7 @@ test('shared-workspace-lockfile: entries of removed projects should be removed f
|
||||
await execPnpm('recursive', 'install', '--store', 'store', '--shared-workspace-lockfile', '--link-workspace-packages')
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
t.deepEqual(Object.keys(shr.importers), ['package-1', 'package-2'])
|
||||
}
|
||||
|
||||
@@ -780,7 +780,7 @@ test('shared-workspace-lockfile: entries of removed projects should be removed f
|
||||
await execPnpm('recursive', 'install', '--store', 'store', '--shared-workspace-lockfile', '--link-workspace-packages')
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
t.deepEqual(Object.keys(shr.importers), ['package-1'])
|
||||
}
|
||||
})
|
||||
@@ -845,9 +845,9 @@ test('shared-workspace-lockfile: uninstalling a package recursively', async (t:
|
||||
t.deepEqual(pkg.dependencies, { 'is-negative': '1.0.0' }, 'is-positive removed from project2')
|
||||
}
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
|
||||
t.deepEqual(Object.keys(shr.packages || {}), ['/is-negative/1.0.0'], `is-positive removed from ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.deepEqual(Object.keys(shr.packages || {}), ['/is-negative/1.0.0'], `is-positive removed from ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1506
|
||||
@@ -875,7 +875,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
await execPnpm('install', 'ajv@4.10.4', 'ajv-keywords@1.5.0')
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr.importers['foo'], {
|
||||
dependencies: {
|
||||
'ajv': '4.10.4',
|
||||
@@ -893,7 +893,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
await execPnpm('uninstall', 'ajv')
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr.importers['foo'], {
|
||||
dependencies: {
|
||||
'ajv-keywords': '1.5.0',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { preparePackages } from '@pnpm/prepare'
|
||||
import exists = require('path-exists')
|
||||
import tape = require('tape')
|
||||
@@ -44,13 +44,13 @@ test('recursive linking/unlinking', async (t: tape.Test) => {
|
||||
|
||||
{
|
||||
const project1Shr = await projects['project-1'].loadShrinkwrap()
|
||||
t.equal(project1Shr.lockfileVersion, 5, `project-1 has correct lockfileVersion specified in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(project1Shr.lockfileVersion, 5, `project-1 has correct lockfileVersion specified in ${WANTED_LOCKFILE}`)
|
||||
t.equal(project1Shr.devDependencies['is-positive'], '1.0.0')
|
||||
t.ok(project1Shr.packages['/is-positive/1.0.0'])
|
||||
}
|
||||
|
||||
const isPositiveShr = await projects['is-positive'].loadShrinkwrap()
|
||||
t.equal(isPositiveShr.lockfileVersion, 5, `is-positive has correct lockfileVersion specified in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(isPositiveShr.lockfileVersion, 5, `is-positive has correct lockfileVersion specified in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('recursive unlink specific package', async (t: tape.Test) => {
|
||||
@@ -90,11 +90,11 @@ test('recursive unlink specific package', async (t: tape.Test) => {
|
||||
|
||||
{
|
||||
const project1Shr = await projects['project-1'].loadShrinkwrap()
|
||||
t.equal(project1Shr.lockfileVersion, 5, `project-1 has correct lockfileVersion specified in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(project1Shr.lockfileVersion, 5, `project-1 has correct lockfileVersion specified in ${WANTED_LOCKFILE}`)
|
||||
t.equal(project1Shr.devDependencies['is-positive'], '1.0.0')
|
||||
t.ok(project1Shr.packages['/is-positive/1.0.0'])
|
||||
}
|
||||
|
||||
const isPositiveShr = await projects['is-positive'].loadShrinkwrap()
|
||||
t.equal(isPositiveShr.lockfileVersion, 5, `is-positive has correct lockfileVersion specified in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(isPositiveShr.lockfileVersion, 5, `is-positive has correct lockfileVersion specified in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///<reference path="../typings/local.d.ts"/>
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
prune,
|
||||
pruneSharedShrinkwrap,
|
||||
@@ -889,7 +889,7 @@ test('remove dependencies that are not in the package', t => {
|
||||
t.end()
|
||||
})
|
||||
|
||||
test(`ignore dependencies that are in package.json but are not in ${WANTED_SHRINKWRAP_FILENAME}`, t => {
|
||||
test(`ignore dependencies that are in package.json but are not in ${WANTED_LOCKFILE}`, t => {
|
||||
t.deepEqual(prune({
|
||||
importers: {
|
||||
'.': {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
nameVerFromPkgSnapshot,
|
||||
packageIsIndependent,
|
||||
@@ -75,7 +75,7 @@ async function getDependencies (
|
||||
|
||||
// It might make sense to fail if the depPath is not in the skipped list from .modules.yaml
|
||||
// However, the skipped list currently contains package IDs, not dep paths.
|
||||
logger.debug({ message: `No entry for "${depRelPath}" in ${WANTED_SHRINKWRAP_FILENAME}` })
|
||||
logger.debug({ message: `No entry for "${depRelPath}" in ${WANTED_LOCKFILE}` })
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
SHRINKWRAP_VERSION,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import {
|
||||
create as createShrinkwrap,
|
||||
@@ -48,7 +48,7 @@ export default async function (
|
||||
opts.shrinkwrap && readWantedShrinkwrap(opts.lockfileDirectory, shrOpts)
|
||||
|| await existsWantedShrinkwrap(opts.lockfileDirectory) &&
|
||||
logger.warn({
|
||||
message: `A ${WANTED_SHRINKWRAP_FILENAME} file exists. The current configuration prohibits to read or write a shrinkwrap file`,
|
||||
message: `A ${WANTED_LOCKFILE} file exists. The current configuration prohibits to read or write a shrinkwrap file`,
|
||||
prefix: opts.lockfileDirectory,
|
||||
}),
|
||||
readCurrentShrinkwrap(opts.lockfileDirectory, shrOpts),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-file'
|
||||
import { IncludedDependencies } from '@pnpm/modules-yaml'
|
||||
import { LocalPackages } from '@pnpm/resolver-base'
|
||||
@@ -181,7 +181,7 @@ export default async (
|
||||
store: defaultOpts.store,
|
||||
}
|
||||
if (!extendedOpts.shrinkwrap && extendedOpts.shrinkwrapOnly) {
|
||||
throw new Error(`Cannot generate a ${WANTED_SHRINKWRAP_FILENAME} because shrinkwrap is set to false`)
|
||||
throw new Error(`Cannot generate a ${WANTED_LOCKFILE} because shrinkwrap is set to false`)
|
||||
}
|
||||
if (extendedOpts.userAgent.startsWith('npm/')) {
|
||||
extendedOpts.userAgent = `${extendedOpts.packageManager.name}/${extendedOpts.packageManager.version} ${extendedOpts.userAgent}`
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
ENGINE_NAME,
|
||||
LAYOUT_VERSION,
|
||||
SHRINKWRAP_VERSION,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import {
|
||||
packageJsonLogger,
|
||||
@@ -188,7 +188,7 @@ export async function mutateModules (
|
||||
) {
|
||||
if (!ctx.existsWantedShrinkwrap) {
|
||||
if (ctx.importers.some((importer) => pkgHasDependencies(importer.pkg))) {
|
||||
throw new Error(`Headless installation requires a ${WANTED_SHRINKWRAP_FILENAME} file`)
|
||||
throw new Error(`Headless installation requires a ${WANTED_LOCKFILE} file`)
|
||||
}
|
||||
} else {
|
||||
logger.info({ message: 'Performing headless installation', prefix: opts.lockfileDirectory })
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
SHRINKWRAP_VERSION,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import {
|
||||
rootLogger,
|
||||
@@ -241,7 +241,7 @@ export default async function linkPackages (
|
||||
const depNode = depGraph[pendingRequiresBuild.absoluteDepPath]
|
||||
if (!depNode.fetchingRawManifest) {
|
||||
// This should never ever happen
|
||||
throw new Error(`Cannot create ${WANTED_SHRINKWRAP_FILENAME} because raw manifest (aka package.json) wasn't fetched for "${pendingRequiresBuild.absoluteDepPath}"`)
|
||||
throw new Error(`Cannot create ${WANTED_LOCKFILE} because raw manifest (aka package.json) wasn't fetched for "${pendingRequiresBuild.absoluteDepPath}"`)
|
||||
}
|
||||
const filesResponse = await depNode.fetchingFiles
|
||||
// The npm team suggests to always read the package.json for deciding whether the package has lifecycle scripts
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
ENGINE_NAME,
|
||||
LAYOUT_VERSION,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import { skippedOptionalDependencyLogger } from '@pnpm/core-loggers'
|
||||
import {
|
||||
@@ -43,8 +43,8 @@ function findPackages (
|
||||
const pkgInfo = nameVerFromPkgSnapshot(relativeDepPath, pkgShr)
|
||||
if (!pkgInfo.name) {
|
||||
logger.warn({
|
||||
message: `Skipping ${relativeDepPath} because cannot get the package name from ${WANTED_SHRINKWRAP_FILENAME}.
|
||||
Try to run run \`pnpm update --depth 100\` to create a new ${WANTED_SHRINKWRAP_FILENAME} with all the necessary info.`,
|
||||
message: `Skipping ${relativeDepPath} because cannot get the package name from ${WANTED_LOCKFILE}.
|
||||
Try to run run \`pnpm update --depth 100\` to create a new ${WANTED_LOCKFILE} with all the necessary info.`,
|
||||
prefix: opts.prefix,
|
||||
})
|
||||
return false
|
||||
@@ -212,7 +212,7 @@ function getSubgraphToBuild (
|
||||
|
||||
// It might make sense to fail if the depPath is not in the skipped list from .modules.yaml
|
||||
// However, the skipped list currently contains package IDs, not dep paths.
|
||||
logger.debug({ message: `No entry for "${depPath}" in ${WANTED_SHRINKWRAP_FILENAME}` })
|
||||
logger.debug({ message: `No entry for "${depPath}" in ${WANTED_LOCKFILE}` })
|
||||
continue
|
||||
}
|
||||
const nextEntryNodes = R.toPairs({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import isCI = require('is-ci')
|
||||
import mkdirp = require('mkdirp-promise')
|
||||
@@ -70,14 +70,14 @@ async function saveModulesYaml (pnpmVersion: string, storePath: string) {
|
||||
await fs.writeFile('node_modules/.modules.yaml', `packageManager: pnpm@${pnpmVersion}\nstore: ${storePath}\nindependentLeaves: false`)
|
||||
}
|
||||
|
||||
test(`fail on non-compatible ${WANTED_SHRINKWRAP_FILENAME}`, async (t: tape.Test) => {
|
||||
test(`fail on non-compatible ${WANTED_LOCKFILE}`, async (t: tape.Test) => {
|
||||
if (isCI) {
|
||||
t.skip('this test will always fail on CI servers')
|
||||
return
|
||||
}
|
||||
|
||||
const project = prepare(t)
|
||||
await fs.writeFile(WANTED_SHRINKWRAP_FILENAME, '')
|
||||
await fs.writeFile(WANTED_LOCKFILE, '')
|
||||
|
||||
try {
|
||||
await addDependenciesToPackage(['is-negative'], await testDefaults())
|
||||
@@ -87,9 +87,9 @@ test(`fail on non-compatible ${WANTED_SHRINKWRAP_FILENAME}`, async (t: tape.Test
|
||||
}
|
||||
})
|
||||
|
||||
test(`don't fail on non-compatible ${WANTED_SHRINKWRAP_FILENAME} when forced`, async (t: tape.Test) => {
|
||||
test(`don't fail on non-compatible ${WANTED_LOCKFILE} when forced`, async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
await fs.writeFile(WANTED_SHRINKWRAP_FILENAME, '')
|
||||
await fs.writeFile(WANTED_LOCKFILE, '')
|
||||
|
||||
await addDependenciesToPackage(['is-negative'], await testDefaults({ force: true }))
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import { getIntegrity } from 'pnpm-registry-mock'
|
||||
import { addDependenciesToPackage } from 'supi'
|
||||
@@ -50,7 +50,7 @@ test('installing aliased dependency', async (t: tape.Test) => {
|
||||
negative: 'npm:is-negative@1.0.0',
|
||||
positive: 'npm:is-positive@^3.1.0',
|
||||
},
|
||||
}, `correct ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
}, `correct ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('aliased dependency w/o version spec, with custom tag config', async (t) => {
|
||||
@@ -98,5 +98,5 @@ test('a dependency has an aliased subdependency', async (t: tape.Test) => {
|
||||
specifiers: {
|
||||
'pkg-with-1-aliased-dep': '^100.0.0',
|
||||
},
|
||||
}, `correct ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
}, `correct ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { RootLog } from '@pnpm/core-loggers'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import isCI = require('is-ci')
|
||||
@@ -57,7 +57,7 @@ test('from a github repo with different name via named installation', async (t:
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.deepEqual(shr.dependencies, {
|
||||
'say-hi': 'github.com/zkochan/hi/4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd',
|
||||
}, `the aliased name added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
}, `the aliased name added to ${WANTED_LOCKFILE}`)
|
||||
|
||||
await project.isExecutable('.bin/hi')
|
||||
await project.isExecutable('.bin/szia')
|
||||
@@ -96,7 +96,7 @@ test('from a github repo with different name', async (t: tape.Test) => {
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.deepEqual(shr.dependencies, {
|
||||
'say-hi': 'github.com/zkochan/hi/4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd',
|
||||
}, `the aliased name added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
}, `the aliased name added to ${WANTED_LOCKFILE}`)
|
||||
|
||||
await project.isExecutable('.bin/hi')
|
||||
await project.isExecutable('.bin/szia')
|
||||
@@ -115,7 +115,7 @@ test('a subdependency is from a github repo with different name', async (t: tape
|
||||
t.deepEqual(shr.packages['/has-aliased-git-dependency/1.0.0'].dependencies, {
|
||||
'has-say-hi-peer': '1.0.0_say-hi@1.0.0',
|
||||
'say-hi': 'github.com/zkochan/hi/4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd',
|
||||
}, `the aliased name added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
}, `the aliased name added to ${WANTED_LOCKFILE}`)
|
||||
|
||||
await project.isExecutable('has-aliased-git-dependency/node_modules/.bin/hi')
|
||||
await project.isExecutable('has-aliased-git-dependency/node_modules/.bin/szia')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare, { preparePackages } from '@pnpm/prepare'
|
||||
import path = require('path')
|
||||
import sinon = require('sinon')
|
||||
@@ -15,7 +15,7 @@ import { testDefaults } from '../utils'
|
||||
const test = promisifyTape(tape)
|
||||
const testOnly = promisifyTape(tape.only)
|
||||
|
||||
test(`frozen-lockfile: installation fails if specs in package.json don't match the ones in ${WANTED_SHRINKWRAP_FILENAME}`, async (t) => {
|
||||
test(`frozen-lockfile: installation fails if specs in package.json don't match the ones in ${WANTED_LOCKFILE}`, async (t) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': '^3.0.0',
|
||||
@@ -34,11 +34,11 @@ test(`frozen-lockfile: installation fails if specs in package.json don't match t
|
||||
await install(await testDefaults({ frozenShrinkwrap: true }))
|
||||
t.fail()
|
||||
} catch (err) {
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_SHRINKWRAP_FILENAME} is not up-to-date with package.json`)
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up-to-date with package.json`)
|
||||
}
|
||||
})
|
||||
|
||||
test(`frozen-lockfile+shamefully-flatten: installation fails if specs in package.json don't match the ones in ${WANTED_SHRINKWRAP_FILENAME}`, async (t) => {
|
||||
test(`frozen-lockfile+shamefully-flatten: installation fails if specs in package.json don't match the ones in ${WANTED_LOCKFILE}`, async (t) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': '^3.0.0',
|
||||
@@ -57,11 +57,11 @@ test(`frozen-lockfile+shamefully-flatten: installation fails if specs in package
|
||||
await install(await testDefaults({ frozenShrinkwrap: true, shamefullyFlatten: true }))
|
||||
t.fail()
|
||||
} catch (err) {
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_SHRINKWRAP_FILENAME} is not up-to-date with package.json`)
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up-to-date with package.json`)
|
||||
}
|
||||
})
|
||||
|
||||
test(`frozen-lockfile: fail on a shared ${WANTED_SHRINKWRAP_FILENAME} that does not satisfy one of the package.json files`, async (t) => {
|
||||
test(`frozen-lockfile: fail on a shared ${WANTED_LOCKFILE} that does not satisfy one of the package.json files`, async (t) => {
|
||||
const project = preparePackages(t, [
|
||||
{
|
||||
name: 'p1',
|
||||
@@ -103,11 +103,11 @@ test(`frozen-lockfile: fail on a shared ${WANTED_SHRINKWRAP_FILENAME} that does
|
||||
await mutateModules(importers, await testDefaults({ frozenShrinkwrap: true }))
|
||||
t.fail()
|
||||
} catch (err) {
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_SHRINKWRAP_FILENAME} is not up-to-date with p1${path.sep}package.json`)
|
||||
t.equal(err.message, `Cannot install with "frozen-lockfile" because ${WANTED_LOCKFILE} is not up-to-date with p1${path.sep}package.json`)
|
||||
}
|
||||
})
|
||||
|
||||
test(`frozen-shrinkwrap: should successfully install when ${WANTED_SHRINKWRAP_FILENAME} is available`, async (t) => {
|
||||
test(`frozen-shrinkwrap: should successfully install when ${WANTED_LOCKFILE} is available`, async (t) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': '^3.0.0',
|
||||
@@ -123,7 +123,7 @@ test(`frozen-shrinkwrap: should successfully install when ${WANTED_SHRINKWRAP_FI
|
||||
await project.has('is-positive')
|
||||
})
|
||||
|
||||
test(`frozen-shrinkwrap: should fail if no ${WANTED_SHRINKWRAP_FILENAME} is present`, async (t) => {
|
||||
test(`frozen-shrinkwrap: should fail if no ${WANTED_LOCKFILE} is present`, async (t) => {
|
||||
prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': '^3.0.0',
|
||||
@@ -134,11 +134,11 @@ test(`frozen-shrinkwrap: should fail if no ${WANTED_SHRINKWRAP_FILENAME} is pres
|
||||
await install(await testDefaults({ frozenShrinkwrap: true }))
|
||||
t.fail()
|
||||
} catch (err) {
|
||||
t.equals(err.message, `Headless installation requires a ${WANTED_SHRINKWRAP_FILENAME} file`)
|
||||
t.equals(err.message, `Headless installation requires a ${WANTED_LOCKFILE} file`)
|
||||
}
|
||||
})
|
||||
|
||||
test(`prefer-frozen-shrinkwrap: should prefer headless installation when ${WANTED_SHRINKWRAP_FILENAME} satisfies package.json`, async (t) => {
|
||||
test(`prefer-frozen-shrinkwrap: should prefer headless installation when ${WANTED_LOCKFILE} satisfies package.json`, async (t) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': '^3.0.0',
|
||||
@@ -161,7 +161,7 @@ test(`prefer-frozen-shrinkwrap: should prefer headless installation when ${WANTE
|
||||
await project.has('is-positive')
|
||||
})
|
||||
|
||||
test(`prefer-frozen-shrinkwrap: should not prefer headless installation when ${WANTED_SHRINKWRAP_FILENAME} does not satisfy package.json`, async (t) => {
|
||||
test(`prefer-frozen-shrinkwrap: should not prefer headless installation when ${WANTED_LOCKFILE} does not satisfy package.json`, async (t) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': '^3.0.0',
|
||||
@@ -190,19 +190,19 @@ test(`prefer-frozen-shrinkwrap: should not prefer headless installation when ${W
|
||||
await project.has('is-negative')
|
||||
})
|
||||
|
||||
test(`prefer-frozen-shrinkwrap: should not fail if no ${WANTED_SHRINKWRAP_FILENAME} is present and project has no deps`, async (t) => {
|
||||
test(`prefer-frozen-shrinkwrap: should not fail if no ${WANTED_LOCKFILE} is present and project has no deps`, async (t) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await install(await testDefaults({ preferFrozenShrinkwrap: true }))
|
||||
})
|
||||
|
||||
test(`frozen-shrinkwrap: should not fail if no ${WANTED_SHRINKWRAP_FILENAME} is present and project has no deps`, async (t) => {
|
||||
test(`frozen-shrinkwrap: should not fail if no ${WANTED_LOCKFILE} is present and project has no deps`, async (t) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await install(await testDefaults({ frozenShrinkwrap: true }))
|
||||
})
|
||||
|
||||
test(`prefer-frozen-shrinkwrap+shamefully-flatten: should prefer headless installation when ${WANTED_SHRINKWRAP_FILENAME} satisfies package.json`, async (t) => {
|
||||
test(`prefer-frozen-shrinkwrap+shamefully-flatten: should prefer headless installation when ${WANTED_LOCKFILE} satisfies package.json`, async (t) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'pkg-with-1-dep': '100.0.0',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import { addDependenciesToPackage } from 'supi'
|
||||
import tape = require('tape')
|
||||
@@ -33,7 +33,7 @@ test('do not fail if installed package does not support the current engine and e
|
||||
await project.storeHas('not-compatible-with-any-os', '1.0.0')
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.deepEqual(shr.packages['/not-compatible-with-any-os/1.0.0'].os, ['this-os-does-not-exist'], `os field added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.deepEqual(shr.packages['/not-compatible-with-any-os/1.0.0'].os, ['this-os-does-not-exist'], `os field added to ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('do not fail if installed package requires the node version that was passed in and engine-strict = true', async (t: tape.Test) => {
|
||||
@@ -48,10 +48,10 @@ test('do not fail if installed package requires the node version that was passed
|
||||
await project.storeHas('for-legacy-node', '1.0.0')
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.deepEqual(shr.packages['/for-legacy-node/1.0.0'].engines, { node: '0.10' }, `engines field added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.deepEqual(shr.packages['/for-legacy-node/1.0.0'].engines, { node: '0.10' }, `engines field added to ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test(`save cpu field to ${WANTED_SHRINKWRAP_FILENAME}`, async (t: tape.Test) => {
|
||||
test(`save cpu field to ${WANTED_LOCKFILE}`, async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await addDependenciesToPackage(['has-cpu-specified'], await testDefaults())
|
||||
@@ -61,11 +61,11 @@ test(`save cpu field to ${WANTED_SHRINKWRAP_FILENAME}`, async (t: tape.Test) =>
|
||||
t.deepEqual(
|
||||
shr.packages['/has-cpu-specified/1.0.0'].cpu,
|
||||
['x64', 'ia32'],
|
||||
`cpu field added to ${WANTED_SHRINKWRAP_FILENAME}`,
|
||||
`cpu field added to ${WANTED_LOCKFILE}`,
|
||||
)
|
||||
})
|
||||
|
||||
test(`engines field is not added to ${WANTED_SHRINKWRAP_FILENAME} when "node": "*" is in "engines" field`, async (t: tape.Test) => {
|
||||
test(`engines field is not added to ${WANTED_LOCKFILE} when "node": "*" is in "engines" field`, async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await addDependenciesToPackage(['jsonify@0.0.0'], await testDefaults())
|
||||
@@ -74,6 +74,6 @@ test(`engines field is not added to ${WANTED_SHRINKWRAP_FILENAME} when "node": "
|
||||
|
||||
t.notOk(
|
||||
shr.packages['/jsonify/0.0.0'].engines,
|
||||
`engines field is not added to ${WANTED_SHRINKWRAP_FILENAME}`,
|
||||
`engines field is not added to ${WANTED_LOCKFILE}`,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { LifecycleLog } from '@pnpm/core-loggers'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import loadJsonFile from 'load-json-file'
|
||||
@@ -274,5 +274,5 @@ test('run prepare script for git-hosted dependencies', async (t: tape.Test) => {
|
||||
t.equal(scripts[3], 'prepare')
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.ok(shr.packages['github.com/zkochan/install-scripts-example/2de638b8b572cd1e87b74f4540754145fb2c0ebb'].prepare === true, `prepare field added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(shr.packages['github.com/zkochan/install-scripts-example/2de638b8b572cd1e87b74f4540754145fb2c0ebb'].prepare === true, `prepare field added to ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import { copy } from 'fs-extra'
|
||||
import fs = require('mz/fs')
|
||||
@@ -140,7 +140,7 @@ test('tarball local package', async (t: tape.Test) => {
|
||||
tarball: `file:${normalizePath(path.relative(process.cwd(), pathToLocalPkg('tar-pkg/tar-pkg-1.0.0.tgz')))}`,
|
||||
},
|
||||
version: '1.0.0',
|
||||
}, `a snapshot of the local dep tarball added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
}, `a snapshot of the local dep tarball added to ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('tarball local package from project directory', async (t: tape.Test) => {
|
||||
@@ -172,7 +172,7 @@ test('tarball local package from project directory', async (t: tape.Test) => {
|
||||
tarball: pkgSpec,
|
||||
},
|
||||
version: '1.0.0',
|
||||
}, `a snapshot of the local dep tarball added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
}, `a snapshot of the local dep tarball added to ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('update tarball local package when its integrity changes', async (t) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-file'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import ncpCB = require('ncp')
|
||||
@@ -23,7 +23,7 @@ testSkip('subsequent installation uses same shrinkwrap directory by default', as
|
||||
|
||||
await addDependenciesToPackage(['is-negative@1.0.0'], await testDefaults())
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
|
||||
t.deepEqual(Object.keys(shr['packages'] || {}), ['/is-negative/1.0.0', '/is-positive/1.0.0']) // tslint:disable-line:no-string-literal
|
||||
})
|
||||
@@ -45,7 +45,7 @@ testSkip('subsequent installation fails if a different shrinkwrap directory is s
|
||||
t.equal(err.code, 'ERR_PNPM_SHRINKWRAP_DIRECTORY_MISMATCH', 'failed with correct error code')
|
||||
})
|
||||
|
||||
test(`tarball location is correctly saved to ${WANTED_SHRINKWRAP_FILENAME} when a shared ${WANTED_SHRINKWRAP_FILENAME} is used`, async (t: tape.Test) => {
|
||||
test(`tarball location is correctly saved to ${WANTED_LOCKFILE} when a shared ${WANTED_LOCKFILE} is used`, async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await ncp(path.join(pathToLocalPkg('tar-pkg-with-dep-2'), 'tar-pkg-with-dep-1.0.0.tgz'), 'pkg.tgz')
|
||||
@@ -63,7 +63,7 @@ test(`tarball location is correctly saved to ${WANTED_SHRINKWRAP_FILENAME} when
|
||||
await testDefaults({ lockfileDirectory }),
|
||||
)
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.ok(shr.packages!['file:project/pkg.tgz'])
|
||||
t.equal(shr.packages!['file:project/pkg.tgz'].resolution['tarball'], 'file:project/pkg.tgz')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import { fromDir as readPackageJsonFromDir } from '@pnpm/read-package-json'
|
||||
import fs = require('mz/fs')
|
||||
@@ -36,7 +36,7 @@ test('install with shrinkwrapOnly = true', async (t: tape.Test) => {
|
||||
const currentShr = await project.loadCurrentShrinkwrap()
|
||||
t.notOk(currentShr, 'current shrinkwrap not created')
|
||||
|
||||
t.comment(`doing repeat install when ${WANTED_SHRINKWRAP_FILENAME} is available already`)
|
||||
t.comment(`doing repeat install when ${WANTED_LOCKFILE} is available already`)
|
||||
await install(opts)
|
||||
|
||||
t.deepEqual(await fs.readdir(path.join(opts.store, 'localhost+4873', 'pkg-with-1-dep')), ['100.0.0', 'index.json'])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
PackageJsonLog,
|
||||
ProgressLog,
|
||||
@@ -54,7 +54,7 @@ test('small with dependencies (rimraf)', async (t: tape.Test) => {
|
||||
await project.isExecutable('.bin/rimraf')
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.ok(shr.packages['/rimraf/2.5.1'].hasBin, `package marked with "hasBin: true" in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(shr.packages['/rimraf/2.5.1'].hasBin, `package marked with "hasBin: true" in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('spec not specified in package.json.dependencies', async (t: tape.Test) => {
|
||||
@@ -67,7 +67,7 @@ test('spec not specified in package.json.dependencies', async (t: tape.Test) =>
|
||||
await install(await testDefaults())
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.ok(shr.specifiers['is-positive'] === '', `spec saved properly in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(shr.specifiers['is-positive'] === '', `spec saved properly in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('ignoring some files in the dependency', async (t: tape.Test) => {
|
||||
@@ -518,7 +518,7 @@ test('bundledDependencies (pkg-with-bundled-dependencies@1.0.0)', async (t: tape
|
||||
t.deepEqual(
|
||||
shr.packages['/pkg-with-bundled-dependencies/1.0.0'].bundledDependencies,
|
||||
['hello-world-js-bin'],
|
||||
`bundledDependencies added to ${WANTED_SHRINKWRAP_FILENAME}`,
|
||||
`bundledDependencies added to ${WANTED_LOCKFILE}`,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -533,7 +533,7 @@ test('bundleDependencies (pkg-with-bundle-dependencies@1.0.0)', async (t: tape.T
|
||||
t.deepEqual(
|
||||
shr.packages['/pkg-with-bundle-dependencies/1.0.0'].bundledDependencies,
|
||||
['hello-world-js-bin'],
|
||||
`bundledDependencies added to ${WANTED_SHRINKWRAP_FILENAME}`,
|
||||
`bundledDependencies added to ${WANTED_LOCKFILE}`,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -820,7 +820,7 @@ test('shrinkwrap locks npm dependencies', async (t: tape.Test) => {
|
||||
|
||||
const m = project.requireModule('.localhost+4873/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_SHRINKWRAP_FILENAME} is installed`)
|
||||
t.equal(m.version, '100.0.0', `dependency specified in ${WANTED_LOCKFILE} is installed`)
|
||||
})
|
||||
|
||||
test('self-require should work', async (t) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import assertProject from '@pnpm/assert-project'
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { readCurrent } from '@pnpm/lockfile-file'
|
||||
import { preparePackages } from '@pnpm/prepare'
|
||||
import path = require('path')
|
||||
@@ -111,7 +111,7 @@ test('dependencies of other importers are not pruned when installing for a subse
|
||||
t.deepEqual(Object.keys(shr.packages), [
|
||||
'/is-negative/1.0.0',
|
||||
'/is-positive/2.0.0',
|
||||
], `packages of importer that was not selected by last installation are not removed from current ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
], `packages of importer that was not selected by last installation are not removed from current ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('dependencies of other importers are not pruned when (headless) installing for a subset of importers', async (t) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import fs = require('mz/fs')
|
||||
import path = require('path')
|
||||
@@ -72,7 +72,7 @@ test('install dev dependencies only', async (t: tape.Test) => {
|
||||
|
||||
{
|
||||
const currentShrinkwrap = await project.loadCurrentShrinkwrap()
|
||||
t.notOk(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep only not added to current ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.notOk(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep only not added to current ${WANTED_LOCKFILE}`)
|
||||
}
|
||||
|
||||
// Repeat normal installation adds missing deps to node_modules
|
||||
@@ -82,7 +82,7 @@ test('install dev dependencies only', async (t: tape.Test) => {
|
||||
|
||||
{
|
||||
const currentShrinkwrap = await project.loadCurrentShrinkwrap()
|
||||
t.ok(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep added to current ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(currentShrinkwrap.packages['/is-positive/1.0.0'], `prod dep added to current ${WANTED_LOCKFILE}`)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare, { preparePackages } from '@pnpm/prepare'
|
||||
import deepRequireCwd = require('deep-require-cwd')
|
||||
import path = require('path')
|
||||
@@ -56,7 +56,7 @@ test('skip non-existing optional dependency', async (t: tape.Test) => {
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
|
||||
t.deepEqual(shr.specifiers, { 'is-positive': '*' }, `skipped optional dep not added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.deepEqual(shr.specifiers, { 'is-positive': '*' }, `skipped optional dep not added to ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('skip optional dependency that does not support the current OS', async (t: tape.Test) => {
|
||||
@@ -342,7 +342,7 @@ test('only skip optional dependencies', async (t: tape.Test) => {
|
||||
t.ok(await exists(path.resolve('node_modules', '.localhost+4873', 'got', '3.3.1', 'node_modules', 'duplexify')), 'duplexify is linked into node_modules of got')
|
||||
})
|
||||
|
||||
test(`rebuild should not fail on incomplete ${WANTED_SHRINKWRAP_FILENAME}`, async (t: tape.Test) => {
|
||||
test(`rebuild should not fail on incomplete ${WANTED_LOCKFILE}`, async (t: tape.Test) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'pre-and-postinstall-scripts-example': '1.0.0',
|
||||
@@ -363,7 +363,7 @@ test(`rebuild should not fail on incomplete ${WANTED_SHRINKWRAP_FILENAME}`, asyn
|
||||
|
||||
t.ok(reporter.calledWithMatch({
|
||||
level: 'debug',
|
||||
message: `No entry for "/not-compatible-with-any-os/1.0.0" in ${WANTED_SHRINKWRAP_FILENAME}`,
|
||||
message: `No entry for "/not-compatible-with-any-os/1.0.0" in ${WANTED_LOCKFILE}`,
|
||||
name: 'pnpm',
|
||||
}), 'missing package reported')
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-file'
|
||||
import prepare, { preparePackages } from '@pnpm/prepare'
|
||||
import deepRequireCwd = require('deep-require-cwd')
|
||||
@@ -56,7 +56,7 @@ test('peer dependency is grouped with dependency when peer is resolved not from
|
||||
t.equal(
|
||||
shr.packages['/using-ajv/1.0.0'].dependencies['ajv-keywords'],
|
||||
'1.5.0_ajv@4.10.4',
|
||||
`${WANTED_SHRINKWRAP_FILENAME}: correct reference is created to ajv-keywords from using-ajv`,
|
||||
`${WANTED_LOCKFILE}: correct reference is created to ajv-keywords from using-ajv`,
|
||||
)
|
||||
// covers https://github.com/pnpm/pnpm/issues/1150
|
||||
t.ok(shr.packages['/ajv-keywords/1.5.0_ajv@4.10.4'])
|
||||
@@ -300,7 +300,7 @@ test['skip']('peer dependencies are linked', async (t: tape.Test) => {
|
||||
t.equal(deepRequireCwd(['abc-grand-parent-with-c', 'abc-parent-with-ab', 'abc', 'peer-c', './package.json']).version, '1.0.0')
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.ok(shr.packages['/abc-parent-with-ab/1.0.0/peer-a@1.0.0+peer-b@1.0.0'].dev, `the dev resolution set is marked as dev in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(shr.packages['/abc-parent-with-ab/1.0.0/peer-a@1.0.0+peer-b@1.0.0'].dev, `the dev resolution set is marked as dev in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('scoped peer dependency is linked', async (t: tape.Test) => {
|
||||
@@ -389,7 +389,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
|
||||
t.ok(await exists(path.join('..', NM, '.localhost+4873', 'ajv-keywords', '1.5.0_ajv@4.10.4', NM, 'ajv-keywords')))
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.join('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.join('..', WANTED_LOCKFILE))
|
||||
|
||||
t.deepEqual(shr['importers']['project'], { // tslint:disable-line
|
||||
dependencies: {
|
||||
@@ -400,7 +400,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
'ajv': '4.10.4',
|
||||
'ajv-keywords': '1.5.0',
|
||||
},
|
||||
}, `correct ${WANTED_SHRINKWRAP_FILENAME} created`)
|
||||
}, `correct ${WANTED_LOCKFILE} created`)
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1483
|
||||
@@ -429,7 +429,7 @@ 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({ lockfileDirectory }))
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr['importers']['_'], {
|
||||
dependencies: {
|
||||
'ajv': '4.10.4',
|
||||
@@ -445,7 +445,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
await install(await testDefaults({ lockfileDirectory }))
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr['importers']['_'], {
|
||||
dependencies: {
|
||||
'ajv': '4.10.4',
|
||||
@@ -473,7 +473,7 @@ test('peer dependency is grouped with dependent when the peer is a top dependenc
|
||||
)
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr['importers']['_'], {
|
||||
dependencies: {
|
||||
'ajv-keywords': '1.5.0',
|
||||
@@ -494,7 +494,7 @@ test('external shrinkwrap: peer dependency is grouped with dependent even after
|
||||
await addDependenciesToPackage(['ajv@4.10.4', 'ajv-keywords@1.4.0'], await testDefaults({ lockfileDirectory }))
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr['importers']['_'], {
|
||||
dependencies: {
|
||||
'ajv': '4.10.4',
|
||||
@@ -510,7 +510,7 @@ test('external shrinkwrap: peer dependency is grouped with dependent even after
|
||||
await addDependenciesToPackage(['ajv-keywords@1.5.0'], await testDefaults({ lockfileDirectory }))
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr['importers']['_'], {
|
||||
dependencies: {
|
||||
'ajv': '4.10.4',
|
||||
@@ -533,7 +533,7 @@ test('external shrinkwrap: peer dependency is grouped with dependent even after
|
||||
await addDependenciesToPackage(['peer-c@1.0.0', 'abc-parent-with-ab@1.0.0'], await testDefaults({ lockfileDirectory }))
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr['importers']['_'], {
|
||||
dependencies: {
|
||||
'abc-parent-with-ab': '1.0.0_peer-c@1.0.0',
|
||||
@@ -549,7 +549,7 @@ test('external shrinkwrap: peer dependency is grouped with dependent even after
|
||||
await addDependenciesToPackage(['peer-c@2.0.0'], await testDefaults({ lockfileDirectory }))
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
t.deepEqual(shr['importers']['_'], {
|
||||
dependencies: {
|
||||
'abc-parent-with-ab': '1.0.0_peer-c@2.0.0',
|
||||
@@ -594,7 +594,7 @@ test('peer dependency is resolved from parent package', async (t) => {
|
||||
},
|
||||
], await testDefaults())
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
t.deepEqual(Object.keys(shr.packages || {}), [
|
||||
'/has-tango-as-peer-dep/1.0.0_tango@1.0.0',
|
||||
'/tango/1.0.0_tango@1.0.0',
|
||||
@@ -615,7 +615,7 @@ test('peer dependency is resolved from parent package via its alias', async (t)
|
||||
},
|
||||
], await testDefaults())
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
t.deepEqual(Object.keys(shr.packages || {}), [
|
||||
'/has-tango-as-peer-dep/1.0.0_tango@1.0.0',
|
||||
'/tango-tango/1.0.0_tango@1.0.0',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { DeprecationLog } from '@pnpm/core-loggers'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import sinon = require('sinon')
|
||||
@@ -32,7 +32,7 @@ test('reports warning when installing deprecated packages', async (t: tape.Test)
|
||||
t.equal(
|
||||
shr.packages['/express/0.14.1'].deprecated,
|
||||
'express 0.x series is deprecated',
|
||||
`deprecated field added to ${WANTED_SHRINKWRAP_FILENAME}`,
|
||||
`deprecated field added to ${WANTED_LOCKFILE}`,
|
||||
)
|
||||
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-file'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import path = require('path')
|
||||
@@ -83,7 +83,7 @@ test('update dependency when external shrinkwrap directory is used', async (t: t
|
||||
|
||||
await install(await testDefaults({ update: true, depth: 0, lockfileDirectory }))
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.join('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.join('..', WANTED_LOCKFILE))
|
||||
|
||||
t.ok(shr.packages && shr.packages['/foo/100.1.0']) // tslint:disable-line:no-string-literal
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import readPkg = require('read-pkg')
|
||||
import {
|
||||
@@ -90,11 +90,11 @@ test('dependency should not be added to package.json if it is already there', as
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
|
||||
t.equal(shr.devDependencies.foo, '100.0.0', `\`foo\` is in the devDependencies property of ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(shr.packages['/foo/100.0.0'].dev, `the \`foo\` package is marked as dev in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(shr.devDependencies.foo, '100.0.0', `\`foo\` is in the devDependencies property of ${WANTED_LOCKFILE}`)
|
||||
t.ok(shr.packages['/foo/100.0.0'].dev, `the \`foo\` package is marked as dev in ${WANTED_LOCKFILE}`)
|
||||
|
||||
t.equal(shr.optionalDependencies.bar, '100.0.0', `\`bar\` is in the optionalDependencies property of ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(shr.packages['/bar/100.0.0'].optional, `the \`bar\` package is marked as optional in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(shr.optionalDependencies.bar, '100.0.0', `\`bar\` is in the optionalDependencies property of ${WANTED_LOCKFILE}`)
|
||||
t.ok(shr.packages['/bar/100.0.0'].optional, `the \`bar\` package is marked as optional in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('dependencies should be updated in the fields where they already are', async (t: tape.Test) => {
|
||||
@@ -173,7 +173,7 @@ test('dependency should be removed from the old field when installing it as a di
|
||||
},
|
||||
name: 'project',
|
||||
version: '0.0.0',
|
||||
}, `dependencies moved around correctly when installed with node_modules and ${WANTED_SHRINKWRAP_FILENAME} present`)
|
||||
}, `dependencies moved around correctly when installed with node_modules and ${WANTED_LOCKFILE} present`)
|
||||
const shr = await project.loadCurrentShrinkwrap()
|
||||
t.deepEqual(Object.keys(shr.dependencies), ['bar', 'foo', 'qar'], 'shrinkwrap updated')
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { isExecutable } from '@pnpm/assert-project'
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { RootLog } from '@pnpm/core-loggers'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-file'
|
||||
import prepare from '@pnpm/prepare'
|
||||
@@ -48,7 +48,7 @@ test('relative link', async (t: tape.Test) => {
|
||||
|
||||
const wantedShrinkwrap = await project.loadShrinkwrap()
|
||||
t.equal(wantedShrinkwrap.dependencies['hello-world-js-bin'], 'link:../hello-world-js-bin', 'link added to wanted shrinkwrap')
|
||||
t.equal(wantedShrinkwrap.specifiers['hello-world-js-bin'], '*', `specifier of linked dependency added to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(wantedShrinkwrap.specifiers['hello-world-js-bin'], '*', `specifier of linked dependency added to ${WANTED_LOCKFILE}`)
|
||||
|
||||
const currentShrinkwrap = await project.loadCurrentShrinkwrap()
|
||||
t.equal(currentShrinkwrap.dependencies['hello-world-js-bin'], 'link:../hello-world-js-bin', 'link added to wanted shrinkwrap')
|
||||
@@ -259,7 +259,7 @@ test['skip']('relative link when an external shrinkwrap is used', async (t: tape
|
||||
const opts = await testDefaults({ lockfileDirectory: path.join('..') })
|
||||
await link([process.cwd()], path.resolve(process.cwd(), 'node_modules'), opts)
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.resolve('..', WANTED_LOCKFILE))
|
||||
|
||||
t.deepEqual(shr && shr['importers'], {
|
||||
project: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
CURRENT_SHRINKWRAP_FILENAME,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
CURRENT_LOCKFILE,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import { RootLog } from '@pnpm/core-loggers'
|
||||
import { Shrinkwrap } from '@pnpm/lockfile-file'
|
||||
@@ -35,7 +35,7 @@ test['skip'] = promisifyTape(tape.skip) // tslint:disable-line:no-string-literal
|
||||
|
||||
const SHRINKWRAP_WARN_LOG = {
|
||||
level: 'warn',
|
||||
message: `A ${WANTED_SHRINKWRAP_FILENAME} file exists. The current configuration prohibits to read or write a shrinkwrap file`,
|
||||
message: `A ${WANTED_LOCKFILE} file exists. The current configuration prohibits to read or write a shrinkwrap file`,
|
||||
name: 'pnpm',
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ test('shrinkwrap with scoped package', async (t: tape.Test) => {
|
||||
},
|
||||
})
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, {
|
||||
await writeYamlFile(WANTED_LOCKFILE, {
|
||||
dependencies: {
|
||||
'@types/semver': '5.3.31',
|
||||
},
|
||||
@@ -130,7 +130,7 @@ test('fail when shasum from shrinkwrap does not match with the actual one', asyn
|
||||
},
|
||||
})
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, {
|
||||
await writeYamlFile(WANTED_LOCKFILE, {
|
||||
dependencies: {
|
||||
'is-negative': '2.1.0',
|
||||
},
|
||||
@@ -187,7 +187,7 @@ test('shrinkwrap not created when no deps in package.json', async (t: tape.Test)
|
||||
test('shrinkwrap removed when no deps in package.json', async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, {
|
||||
await writeYamlFile(WANTED_LOCKFILE, {
|
||||
dependencies: {
|
||||
'is-negative': '2.1.0',
|
||||
},
|
||||
@@ -219,7 +219,7 @@ test('shrinkwrap is fixed when it does not match package.json', async (t: tape.T
|
||||
},
|
||||
})
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, {
|
||||
await writeYamlFile(WANTED_LOCKFILE, {
|
||||
dependencies: {
|
||||
'@types/semver': '5.3.31',
|
||||
'is-negative': '2.1.0',
|
||||
@@ -261,13 +261,13 @@ test('shrinkwrap is fixed when it does not match package.json', async (t: tape.T
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
|
||||
t.equal(shr.devDependencies['is-negative'], '2.1.0', `is-negative moved to devDependencies in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(shr.optionalDependencies['is-positive'], '3.1.0', `is-positive moved to optionalDependencies in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(shr.devDependencies['is-negative'], '2.1.0', `is-negative moved to devDependencies in ${WANTED_LOCKFILE}`)
|
||||
t.equal(shr.optionalDependencies['is-positive'], '3.1.0', `is-positive moved to optionalDependencies in ${WANTED_LOCKFILE}`)
|
||||
t.notOk(shr.dependencies, 'empty dependencies property removed')
|
||||
t.notOk(shr.packages['/@types/semver/5.3.31'], 'package not referenced in package.json removed')
|
||||
})
|
||||
|
||||
test(`doing named installation when ${WANTED_SHRINKWRAP_FILENAME} exists already`, async (t: tape.Test) => {
|
||||
test(`doing named installation when ${WANTED_LOCKFILE} exists already`, async (t: tape.Test) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'@types/semver': '5.3.31',
|
||||
@@ -276,7 +276,7 @@ test(`doing named installation when ${WANTED_SHRINKWRAP_FILENAME} exists already
|
||||
},
|
||||
})
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, {
|
||||
await writeYamlFile(WANTED_LOCKFILE, {
|
||||
dependencies: {
|
||||
'@types/semver': '5.3.31',
|
||||
'is-negative': '2.1.0',
|
||||
@@ -312,12 +312,12 @@ test(`doing named installation when ${WANTED_SHRINKWRAP_FILENAME} exists already
|
||||
await addDependenciesToPackage(['is-positive'], await testDefaults({ reporter }))
|
||||
await install(await testDefaults({ reporter }))
|
||||
|
||||
t.notOk(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `no warning about ignoring ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.notOk(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `no warning about ignoring ${WANTED_LOCKFILE}`)
|
||||
|
||||
await project.has('is-negative')
|
||||
})
|
||||
|
||||
test(`respects ${WANTED_SHRINKWRAP_FILENAME} for top dependencies`, async (t: tape.Test) => {
|
||||
test(`respects ${WANTED_LOCKFILE} for top dependencies`, async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
const reporter = sinon.spy()
|
||||
// const fooProgress = sinon.match({
|
||||
@@ -370,7 +370,7 @@ test(`respects ${WANTED_SHRINKWRAP_FILENAME} for top dependencies`, async (t: ta
|
||||
t.equal((await readPackageJsonFromDir(path.resolve('node_modules', '.localhost+4873', 'foobar', '100.0.0', 'node_modules', 'bar'))).version, '100.0.0')
|
||||
})
|
||||
|
||||
test(`subdeps are updated on repeat install if outer ${WANTED_SHRINKWRAP_FILENAME} does not match the inner one`, async (t: tape.Test) => {
|
||||
test(`subdeps are updated on repeat install if outer ${WANTED_LOCKFILE} does not match the inner one`, async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest')
|
||||
@@ -393,7 +393,7 @@ test(`subdeps are updated on repeat install if outer ${WANTED_SHRINKWRAP_FILENAM
|
||||
|
||||
shr.packages['/pkg-with-1-dep/100.0.0'].dependencies['dep-of-pkg-with-1-dep'] = '100.1.0'
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, shr)
|
||||
await writeYamlFile(WANTED_LOCKFILE, shr)
|
||||
|
||||
await install(await testDefaults())
|
||||
|
||||
@@ -440,7 +440,7 @@ test('repeat install with shrinkwrap should not mutate shrinkwrap when dependenc
|
||||
|
||||
const shr1 = await project.loadShrinkwrap()
|
||||
|
||||
t.equal(shr1.dependencies['highmaps-release'], '5.0.11', `dependency added correctly to ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.equal(shr1.dependencies['highmaps-release'], '5.0.11', `dependency added correctly to ${WANTED_LOCKFILE}`)
|
||||
|
||||
await rimraf('node_modules')
|
||||
|
||||
@@ -558,7 +558,7 @@ test('repeat install with no inner shrinkwrap should not rewrite packages in nod
|
||||
|
||||
await addDependenciesToPackage(['is-negative@1.0.0'], await testDefaults())
|
||||
|
||||
await rimraf(CURRENT_SHRINKWRAP_FILENAME)
|
||||
await rimraf(CURRENT_LOCKFILE)
|
||||
|
||||
await install(await testDefaults())
|
||||
|
||||
@@ -698,7 +698,7 @@ test('dev properties are correctly updated on named install', async (t: tape.Tes
|
||||
await addDependenciesToPackage(['foo@npm:inflight@1.0.6'], await testDefaults({}))
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.deepEqual(R.values(shr.packages).filter((dep) => typeof dep.dev !== 'undefined'), [], `there are 0 packages with dev property in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.deepEqual(R.values(shr.packages).filter((dep) => typeof dep.dev !== 'undefined'), [], `there are 0 packages with dev property in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('optional properties are correctly updated on named install', async (t: tape.Test) => {
|
||||
@@ -708,7 +708,7 @@ test('optional properties are correctly updated on named install', async (t: tap
|
||||
await addDependenciesToPackage(['foo@npm:inflight@1.0.6'], await testDefaults({}))
|
||||
|
||||
const shr = await project.loadShrinkwrap()
|
||||
t.deepEqual(R.values(shr.packages).filter((dep) => typeof dep.optional !== 'undefined'), [], `there are 0 packages with optional property in ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.deepEqual(R.values(shr.packages).filter((dep) => typeof dep.optional !== 'undefined'), [], `there are 0 packages with optional property in ${WANTED_LOCKFILE}`)
|
||||
})
|
||||
|
||||
test('dev property is correctly set for package that is duplicated to both the dependencies and devDependencies group', async (t: tape.Test) => {
|
||||
@@ -727,11 +727,11 @@ test('no shrinkwrap', async (t: tape.Test) => {
|
||||
|
||||
await addDependenciesToPackage(['is-positive'], await testDefaults({ shrinkwrap: false, reporter }))
|
||||
|
||||
t.notOk(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `no warning about ignoring ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.notOk(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `no warning about ignoring ${WANTED_LOCKFILE}`)
|
||||
|
||||
await project.has('is-positive')
|
||||
|
||||
t.notOk(await project.loadShrinkwrap(), `${WANTED_SHRINKWRAP_FILENAME} not created`)
|
||||
t.notOk(await project.loadShrinkwrap(), `${WANTED_LOCKFILE} not created`)
|
||||
})
|
||||
|
||||
test('shrinkwrap is ignored when shrinkwrap = false', async (t: tape.Test) => {
|
||||
@@ -741,7 +741,7 @@ test('shrinkwrap is ignored when shrinkwrap = false', async (t: tape.Test) => {
|
||||
},
|
||||
})
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, {
|
||||
await writeYamlFile(WANTED_LOCKFILE, {
|
||||
dependencies: {
|
||||
'is-negative': '2.1.0',
|
||||
},
|
||||
@@ -763,14 +763,14 @@ test('shrinkwrap is ignored when shrinkwrap = false', async (t: tape.Test) => {
|
||||
|
||||
await install(await testDefaults({ shrinkwrap: false, reporter }))
|
||||
|
||||
t.ok(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `warning about ignoring ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `warning about ignoring ${WANTED_LOCKFILE}`)
|
||||
|
||||
await project.has('is-negative')
|
||||
|
||||
t.ok(await project.loadShrinkwrap(), `existing ${WANTED_SHRINKWRAP_FILENAME} not removed`)
|
||||
t.ok(await project.loadShrinkwrap(), `existing ${WANTED_LOCKFILE} not removed`)
|
||||
})
|
||||
|
||||
test(`don't update ${WANTED_SHRINKWRAP_FILENAME} during uninstall when shrinkwrap: false`, async (t: tape.Test) => {
|
||||
test(`don't update ${WANTED_LOCKFILE} during uninstall when shrinkwrap: false`, async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
|
||||
{
|
||||
@@ -778,7 +778,7 @@ test(`don't update ${WANTED_SHRINKWRAP_FILENAME} during uninstall when shrinkwra
|
||||
|
||||
await addDependenciesToPackage(['is-positive'], await testDefaults({ reporter }))
|
||||
|
||||
t.notOk(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `no warning about ignoring ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.notOk(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `no warning about ignoring ${WANTED_LOCKFILE}`)
|
||||
}
|
||||
|
||||
{
|
||||
@@ -786,12 +786,12 @@ test(`don't update ${WANTED_SHRINKWRAP_FILENAME} during uninstall when shrinkwra
|
||||
|
||||
await uninstall(['is-positive'], await testDefaults({ shrinkwrap: false, reporter }))
|
||||
|
||||
t.ok(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `warning about ignoring ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(reporter.calledWithMatch(SHRINKWRAP_WARN_LOG), `warning about ignoring ${WANTED_LOCKFILE}`)
|
||||
}
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
|
||||
t.ok(await project.loadShrinkwrap(), `${WANTED_SHRINKWRAP_FILENAME} not removed during uninstall`)
|
||||
t.ok(await project.loadShrinkwrap(), `${WANTED_LOCKFILE} not removed during uninstall`)
|
||||
})
|
||||
|
||||
test('fail when installing with shrinkwrap: false and shrinkwrapOnly: true', async (t: tape.Test) => {
|
||||
@@ -801,7 +801,7 @@ test('fail when installing with shrinkwrap: false and shrinkwrapOnly: true', asy
|
||||
await install(await testDefaults({ shrinkwrap: false, shrinkwrapOnly: true }))
|
||||
t.fail('installation should have failed')
|
||||
} catch (err) {
|
||||
t.equal(err.message, `Cannot generate a ${WANTED_SHRINKWRAP_FILENAME} because shrinkwrap is set to false`)
|
||||
t.equal(err.message, `Cannot generate a ${WANTED_LOCKFILE} because shrinkwrap is set to false`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -891,7 +891,7 @@ test('shrinkwrap file has correct format when shrinkwrap directory does not equa
|
||||
t.equal(modules['pendingBuilds'].length, 0) // tslint:disable-line:no-string-literal
|
||||
|
||||
{
|
||||
const shr = await readYamlFile(WANTED_SHRINKWRAP_FILENAME) as Shrinkwrap
|
||||
const shr = await readYamlFile(WANTED_LOCKFILE) as Shrinkwrap
|
||||
const id = '/pkg-with-1-dep/100.0.0'
|
||||
|
||||
t.equal(shr.lockfileVersion, 5, 'correct shrinkwrap version')
|
||||
@@ -924,7 +924,7 @@ test('shrinkwrap file has correct format when shrinkwrap directory does not equa
|
||||
await addDependenciesToPackage(['is-positive'], await testDefaults({ save: true, lockfileDirectory: path.resolve('..'), store }))
|
||||
|
||||
{
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.join('..', WANTED_SHRINKWRAP_FILENAME))
|
||||
const shr = await readYamlFile<Shrinkwrap>(path.join('..', WANTED_LOCKFILE))
|
||||
|
||||
t.ok(shr.importers)
|
||||
t.ok(shr.importers['project-2'])
|
||||
@@ -954,7 +954,7 @@ test('shrinkwrap file has correct format when shrinkwrap directory does not equa
|
||||
}
|
||||
})
|
||||
|
||||
test(`doing named installation when shared ${WANTED_SHRINKWRAP_FILENAME} exists already`, async (t: tape.Test) => {
|
||||
test(`doing named installation when shared ${WANTED_LOCKFILE} exists already`, async (t: tape.Test) => {
|
||||
const projects = preparePackages(t, [
|
||||
{
|
||||
name: 'pkg1',
|
||||
@@ -974,7 +974,7 @@ test(`doing named installation when shared ${WANTED_SHRINKWRAP_FILENAME} exists
|
||||
},
|
||||
])
|
||||
|
||||
await writeYamlFile(WANTED_SHRINKWRAP_FILENAME, {
|
||||
await writeYamlFile(WANTED_LOCKFILE, {
|
||||
importers: {
|
||||
pkg1: {
|
||||
dependencies: {
|
||||
@@ -1016,7 +1016,7 @@ test(`doing named installation when shared ${WANTED_SHRINKWRAP_FILENAME} exists
|
||||
}),
|
||||
)
|
||||
|
||||
const currentShr = await readYamlFile<Shrinkwrap>(path.resolve(CURRENT_SHRINKWRAP_FILENAME))
|
||||
const currentShr = await readYamlFile<Shrinkwrap>(path.resolve(CURRENT_LOCKFILE))
|
||||
|
||||
t.deepEqual(R.keys(currentShr['importers']), ['pkg2'], 'only pkg2 added to importers of current shrinkwrap')
|
||||
|
||||
@@ -1041,12 +1041,12 @@ test(`doing named installation when shared ${WANTED_SHRINKWRAP_FILENAME} exists
|
||||
})
|
||||
|
||||
// Covers https://github.com/pnpm/pnpm/issues/1200
|
||||
test(`use current ${WANTED_SHRINKWRAP_FILENAME} as initial wanted one, when wanted was removed`, async (t) => {
|
||||
test(`use current ${WANTED_LOCKFILE} as initial wanted one, when wanted was removed`, async (t) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await addDependenciesToPackage(['lodash@4.17.11', 'underscore@1.9.0'], await testDefaults())
|
||||
|
||||
await rimraf(WANTED_SHRINKWRAP_FILENAME)
|
||||
await rimraf(WANTED_LOCKFILE)
|
||||
|
||||
await addDependenciesToPackage(['underscore@1.9.1'], await testDefaults())
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import {
|
||||
PackageJsonLog,
|
||||
RootLog,
|
||||
@@ -271,7 +271,7 @@ test('uninstalling a dependency from package that uses shared shrinkwrap', async
|
||||
await projects['project-1'].hasNot('is-positive')
|
||||
await projects['project-2'].has('is-negative')
|
||||
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_SHRINKWRAP_FILENAME)
|
||||
const shr = await readYamlFile<Shrinkwrap>(WANTED_LOCKFILE)
|
||||
|
||||
t.deepEqual(shr, {
|
||||
importers: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import prepare from '@pnpm/prepare'
|
||||
import { fromDir as readPackageJsonFromDir } from '@pnpm/read-package-json'
|
||||
import isInnerLink = require('is-inner-link')
|
||||
@@ -104,7 +104,7 @@ test("don't update package when unlinking", async (t: tape.Test) => {
|
||||
t.equal(project.requireModule('foo/package.json').version, '100.0.0', 'foo not updated after unlink')
|
||||
})
|
||||
|
||||
test(`don't update package when unlinking. Initial link is done on a package w/o ${WANTED_SHRINKWRAP_FILENAME}`, async (t: tape.Test) => {
|
||||
test(`don't update package when unlinking. Initial link is done on a package w/o ${WANTED_LOCKFILE}`, async (t: tape.Test) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
foo: '^100.0.0',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assertStore from '@pnpm/assert-store'
|
||||
import {
|
||||
CURRENT_SHRINKWRAP_FILENAME,
|
||||
WANTED_SHRINKWRAP_FILENAME,
|
||||
CURRENT_LOCKFILE,
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import { read as readModules } from '@pnpm/modules-yaml'
|
||||
import path = require('path')
|
||||
@@ -77,7 +77,7 @@ export default (t: Test, projectPath: string, encodedRegistryName?: string) => {
|
||||
},
|
||||
async loadCurrentShrinkwrap () {
|
||||
try {
|
||||
return await readYamlFile<any>(path.join(modules, '..', CURRENT_SHRINKWRAP_FILENAME)) // tslint:disable-line
|
||||
return await readYamlFile<any>(path.join(modules, '..', CURRENT_LOCKFILE)) // tslint:disable-line
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') return null
|
||||
throw err
|
||||
@@ -86,7 +86,7 @@ export default (t: Test, projectPath: string, encodedRegistryName?: string) => {
|
||||
loadModules: () => readModules(modules),
|
||||
async loadShrinkwrap () {
|
||||
try {
|
||||
return await readYamlFile<any>(path.join(projectPath, WANTED_SHRINKWRAP_FILENAME)) // tslint:disable-line
|
||||
return await readYamlFile<any>(path.join(projectPath, WANTED_LOCKFILE)) // tslint:disable-line
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') return null
|
||||
throw err
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WANTED_SHRINKWRAP_FILENAME } from '@pnpm/constants'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import test = require('tape')
|
||||
import assertProject from '@pnpm/assert-project'
|
||||
import path = require('path')
|
||||
@@ -21,8 +21,8 @@ test('assertProject() store functions', async (t) => {
|
||||
await project.storeHas('is-positive', '3.1.0')
|
||||
t.equal(typeof await project.resolve('is-positive', '3.1.0'), 'string')
|
||||
await project.storeHasNot('is-positive', '3.100.0')
|
||||
t.ok(await project.loadShrinkwrap(), `loads wanted ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(await project.loadCurrentShrinkwrap(), `loads current ${WANTED_SHRINKWRAP_FILENAME}`)
|
||||
t.ok(await project.loadShrinkwrap(), `loads wanted ${WANTED_LOCKFILE}`)
|
||||
t.ok(await project.loadCurrentShrinkwrap(), `loads current ${WANTED_LOCKFILE}`)
|
||||
t.ok(await project.loadModules(), 'loads .modules.yaml')
|
||||
|
||||
t.end()
|
||||
|
||||
Reference in New Issue
Block a user