mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-11 02:29:48 -04:00
5
.changeset/rich-experts-whisper.md
Normal file
5
.changeset/rich-experts-whisper.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/package-requester": patch
|
||||
---
|
||||
|
||||
The temporary file name to which the package index is written should not be longer than the target file name.
|
||||
@@ -48,12 +48,12 @@
|
||||
"p-defer": "^3.0.0",
|
||||
"p-limit": "2.3.0",
|
||||
"p-queue": "^6.4.0",
|
||||
"path-temp": "^2.0.0",
|
||||
"promise-share": "1.0.0",
|
||||
"ramda": "0.27.0",
|
||||
"rename-overwrite": "^3.0.0",
|
||||
"ssri": "6.0.1",
|
||||
"symlink-dir": "^4.0.3",
|
||||
"write-json-file": "4.0.0"
|
||||
"symlink-dir": "^4.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pnpm/local-resolver": "workspace:*",
|
||||
|
||||
@@ -38,10 +38,11 @@ import * as fs from 'mz/fs'
|
||||
import pDefer = require('p-defer')
|
||||
import PQueue from 'p-queue'
|
||||
import path = require('path')
|
||||
import pathTemp = require('path-temp')
|
||||
import pShare = require('promise-share')
|
||||
import R = require('ramda')
|
||||
import renameOverwrite = require('rename-overwrite')
|
||||
import ssri = require('ssri')
|
||||
import writeJsonFile = require('write-json-file')
|
||||
import safeDeferredPromise from './safeDeferredPromise'
|
||||
|
||||
const TARBALL_INTEGRITY_FILENAME = 'tarball-integrity'
|
||||
@@ -471,7 +472,7 @@ function fetchToStore (
|
||||
}
|
||||
})
|
||||
)
|
||||
await writeJsonFile(filesIndexFile, { files: integrity }, { indent: undefined })
|
||||
await writeJsonFile(filesIndexFile, { files: integrity })
|
||||
finishing.resolve(undefined)
|
||||
|
||||
if (isLocalTarballDep && opts.resolution['integrity']) { // tslint:disable-line:no-string-literal
|
||||
@@ -492,6 +493,17 @@ function fetchToStore (
|
||||
}
|
||||
}
|
||||
|
||||
async function writeJsonFile (filePath: string, data: Object) {
|
||||
const targetDir = path.dirname(filePath)
|
||||
// TODO: use the API of @pnpm/cafs to write this file
|
||||
// There is actually no need to create the directory in 99% of cases.
|
||||
// So by using cafs API, we'll improve performance.
|
||||
await fs.mkdir(targetDir, { recursive: true })
|
||||
const temp = pathTemp(targetDir)
|
||||
await fs.writeFile(temp, JSON.stringify(data))
|
||||
await renameOverwrite(temp, filePath)
|
||||
}
|
||||
|
||||
async function readBundledManifest (pkgJsonPath: string): Promise<BundledManifest> {
|
||||
return pickBundledManifest(await readPackage(pkgJsonPath) as DependencyManifest)
|
||||
}
|
||||
|
||||
4
pnpm-lock.yaml
generated
4
pnpm-lock.yaml
generated
@@ -1233,12 +1233,12 @@ importers:
|
||||
p-defer: 3.0.0
|
||||
p-limit: 2.3.0
|
||||
p-queue: 6.4.0
|
||||
path-temp: 2.0.0
|
||||
promise-share: 1.0.0
|
||||
ramda: 0.27.0
|
||||
rename-overwrite: 3.0.0
|
||||
ssri: 6.0.1
|
||||
symlink-dir: 4.0.3
|
||||
write-json-file: 4.0.0
|
||||
devDependencies:
|
||||
'@pnpm/local-resolver': 'link:../local-resolver'
|
||||
'@pnpm/logger': 3.2.2
|
||||
@@ -1286,6 +1286,7 @@ importers:
|
||||
p-defer: ^3.0.0
|
||||
p-limit: 2.3.0
|
||||
p-queue: ^6.4.0
|
||||
path-temp: ^2.0.0
|
||||
promise-share: 1.0.0
|
||||
ramda: 0.27.0
|
||||
rename-overwrite: ^3.0.0
|
||||
@@ -1293,7 +1294,6 @@ importers:
|
||||
ssri: 6.0.1
|
||||
symlink-dir: ^4.0.3
|
||||
tempy: 0.5.0
|
||||
write-json-file: 4.0.0
|
||||
packages/package-store:
|
||||
dependencies:
|
||||
'@pnpm/cafs': 'link:../cafs'
|
||||
|
||||
Reference in New Issue
Block a user