mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-11 02:29:48 -04:00
fix: use fs.mkdir instead of make-dir
This commit is contained in:
6
.changeset/quick-starfishes-fold.md
Normal file
6
.changeset/quick-starfishes-fold.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/package-requester": patch
|
||||
"@pnpm/tarball-fetcher": patch
|
||||
---
|
||||
|
||||
Use `fs.mkdir` instead of the `make-dir` package.
|
||||
@@ -44,7 +44,6 @@
|
||||
"@pnpm/store-controller-types": "workspace:8.0.0-alpha.0",
|
||||
"@pnpm/types": "workspace:5.0.0",
|
||||
"load-json-file": "6.2.0",
|
||||
"make-dir": "^3.1.0",
|
||||
"mz": "2.7.0",
|
||||
"p-limit": "2.3.0",
|
||||
"p-queue": "6.3.0",
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
"@types/sinon": "^9.0.0",
|
||||
"@types/table": "^5.0.0",
|
||||
"load-json-file": "6.2.0",
|
||||
"make-dir": "^3.1.0",
|
||||
"proxyquire": "2.1.3",
|
||||
"read-yaml-file": "2.0.0",
|
||||
"sinon": "9.0.2",
|
||||
|
||||
@@ -3,7 +3,6 @@ import { readProjects } from '@pnpm/filter-workspace-packages'
|
||||
import { Lockfile } from '@pnpm/lockfile-types'
|
||||
import { add, install, remove, update } from '@pnpm/plugin-commands-installation'
|
||||
import { preparePackages } from '@pnpm/prepare'
|
||||
import makeDir = require('make-dir')
|
||||
import fs = require('mz/fs')
|
||||
import path = require('path')
|
||||
import readYamlFile from 'read-yaml-file'
|
||||
@@ -265,7 +264,7 @@ test('running `pnpm recursive` only for packages in subdirectories of cwd', asyn
|
||||
},
|
||||
])
|
||||
|
||||
await makeDir('node_modules')
|
||||
await fs.mkdir('node_modules')
|
||||
process.chdir('packages')
|
||||
|
||||
await install.handler({
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
"@types/ramda": "^0.27.4",
|
||||
"@types/table": "^5.0.0",
|
||||
"@types/wrap-ansi": "3.0.0",
|
||||
"make-dir": "^3.1.0",
|
||||
"mz": "2.7.0",
|
||||
"strip-ansi": "6.0.0"
|
||||
},
|
||||
|
||||
@@ -5,15 +5,12 @@ import { outdated } from '@pnpm/plugin-commands-outdated'
|
||||
import prepare, { tempDir } from '@pnpm/prepare'
|
||||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||
import { stripIndent } from 'common-tags'
|
||||
import fs = require('fs')
|
||||
import makeDir = require('make-dir')
|
||||
import fs = require('mz/fs')
|
||||
import path = require('path')
|
||||
import stripAnsi = require('strip-ansi')
|
||||
import test = require('tape')
|
||||
import { promisify } from 'util'
|
||||
import './recursive'
|
||||
|
||||
const copyFile = promisify(fs.copyFile)
|
||||
const fixtures = path.join(__dirname, '../../../fixtures')
|
||||
const hasOutdatedDepsFixture = path.join(fixtures, 'has-outdated-deps')
|
||||
const hasOutdatedDepsFixtureAndExternalLockfile = path.join(fixtures, 'has-outdated-deps-and-external-shrinkwrap', 'pkg')
|
||||
@@ -43,9 +40,9 @@ const OUTDATED_OPTIONS = {
|
||||
test('pnpm outdated: show details', async (t) => {
|
||||
tempDir(t)
|
||||
|
||||
await makeDir(path.resolve('node_modules/.pnpm'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
await fs.mkdir(path.resolve('node_modules/.pnpm'), { recursive: true })
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
|
||||
const output = await outdated.handler({
|
||||
...OUTDATED_OPTIONS,
|
||||
@@ -73,9 +70,9 @@ test('pnpm outdated: show details', async (t) => {
|
||||
test('pnpm outdated: showing only prod or dev dependencies', async (t) => {
|
||||
tempDir(t)
|
||||
|
||||
await makeDir(path.resolve('node_modules/.pnpm'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
await fs.mkdir(path.resolve('node_modules/.pnpm'), { recursive: true })
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
|
||||
{
|
||||
const output = await outdated.handler({
|
||||
@@ -117,9 +114,9 @@ test('pnpm outdated: showing only prod or dev dependencies', async (t) => {
|
||||
test('pnpm outdated: no table', async (t) => {
|
||||
tempDir(t)
|
||||
|
||||
await makeDir(path.resolve('node_modules/.pnpm'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
await fs.mkdir(path.resolve('node_modules/.pnpm'), { recursive: true })
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
|
||||
{
|
||||
const output = await outdated.handler({
|
||||
@@ -171,9 +168,9 @@ test('pnpm outdated: no table', async (t) => {
|
||||
test('pnpm outdated: only current lockfile is available', async (t) => {
|
||||
tempDir(t)
|
||||
|
||||
await makeDir(path.resolve('node_modules/.pnpm'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
await fs.mkdir(path.resolve('node_modules/.pnpm'), { recursive: true })
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'node_modules/.pnpm/lock.yaml'), path.resolve('node_modules/.pnpm/lock.yaml'))
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
|
||||
const output = await outdated.handler({
|
||||
...OUTDATED_OPTIONS,
|
||||
@@ -197,8 +194,8 @@ test('pnpm outdated: only current lockfile is available', async (t) => {
|
||||
test('pnpm outdated: only wanted lockfile is available', async (t) => {
|
||||
tempDir(t)
|
||||
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'pnpm-lock.yaml'), path.resolve('pnpm-lock.yaml'))
|
||||
await copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'pnpm-lock.yaml'), path.resolve('pnpm-lock.yaml'))
|
||||
await fs.copyFile(path.join(hasOutdatedDepsFixture, 'package.json'), path.resolve('package.json'))
|
||||
|
||||
const output = await outdated.handler({
|
||||
...OUTDATED_OPTIONS,
|
||||
|
||||
@@ -94,7 +94,6 @@
|
||||
"exists-link": "2.0.0",
|
||||
"is-windows": "1.0.2",
|
||||
"load-json-file": "6.2.0",
|
||||
"make-dir": "^3.1.0",
|
||||
"mz": "2.7.0",
|
||||
"ncp": "2.0.0",
|
||||
"normalize-newline": "3.0.0",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import prepare from '@pnpm/prepare'
|
||||
import rimraf = require('@zkochan/rimraf')
|
||||
import execa = require('execa')
|
||||
import makeDir = require('make-dir')
|
||||
import fs = require('mz/fs')
|
||||
import tape = require('tape')
|
||||
import promisifyTape from 'tape-promise'
|
||||
@@ -25,7 +24,7 @@ test('some commands pass through to npm', t => {
|
||||
test('installs in the folder where the package.json file is', async function (t) {
|
||||
const project = prepare(t)
|
||||
|
||||
await makeDir('subdir')
|
||||
await fs.mkdir('subdir')
|
||||
process.chdir('subdir')
|
||||
|
||||
await execPnpm(['install', 'rimraf@2.5.1'])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import prepare from '@pnpm/prepare'
|
||||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||
import rimraf = require('@zkochan/rimraf')
|
||||
import makeDir = require('make-dir')
|
||||
import fs = require('mz/fs')
|
||||
import ncpCB = require('ncp')
|
||||
import path = require('path')
|
||||
import tape = require('tape')
|
||||
@@ -18,7 +18,7 @@ test('corrupted tarball should be redownloaded to the store', async (t: tape.Tes
|
||||
await execPnpm(['store', 'add', 'is-positive@1.0.0', 'is-positive@2.0.0'])
|
||||
|
||||
await rimraf(path.resolve(`../store/v3/localhost+${REGISTRY_MOCK_PORT}/is-positive/2.0.0`))
|
||||
await makeDir(path.resolve(`../store/v3/localhost+${REGISTRY_MOCK_PORT}/is-positive/2.0.0`))
|
||||
await fs.mkdir(path.resolve(`../store/v3/localhost+${REGISTRY_MOCK_PORT}/is-positive/2.0.0`), { recursive: true })
|
||||
await ncp(
|
||||
path.resolve(`../store/v3/localhost+${REGISTRY_MOCK_PORT}/is-positive/1.0.0/packed.tgz`),
|
||||
path.resolve(`../store/v3/localhost+${REGISTRY_MOCK_PORT}/is-positive/2.0.0/packed.tgz`),
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
"credentials-by-uri": "2.0.0",
|
||||
"fetch-from-npm-registry": "workspace:4.0.2",
|
||||
"graceful-fs": "4.2.1",
|
||||
"make-dir": "^3.1.0",
|
||||
"mem": "^6.1.0",
|
||||
"mz": "2.7.0",
|
||||
"path-temp": "2.0.0",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import PnpmError from '@pnpm/error'
|
||||
import { Cafs, FetchResult, FilesIndex } from '@pnpm/fetcher-base'
|
||||
import createFetcher from 'fetch-from-npm-registry'
|
||||
import fs = require('graceful-fs')
|
||||
import { IncomingMessage } from 'http'
|
||||
import makeDir = require('make-dir')
|
||||
import fs = require('mz/fs')
|
||||
import path = require('path')
|
||||
import pathTemp = require('path-temp')
|
||||
import retry = require('retry')
|
||||
@@ -114,7 +113,7 @@ export default (
|
||||
integrity?: string,
|
||||
}): Promise<FetchResult> {
|
||||
const saveToDir = path.dirname(saveto)
|
||||
await makeDir(saveToDir)
|
||||
await fs.mkdir(saveToDir, { recursive: true })
|
||||
|
||||
// If a tarball is hosted on a different place than the manifest, only send
|
||||
// credentials on `alwaysAuth`
|
||||
@@ -185,7 +184,7 @@ export default (
|
||||
if (integrityCheckResult !== true) {
|
||||
throw integrityCheckResult
|
||||
}
|
||||
fs.rename(tempTarballLocation, saveto, () => {
|
||||
fs.rename(tempTarballLocation, saveto).catch(() => {
|
||||
// ignore errors
|
||||
})
|
||||
resolve({ filesIndex: filesIndex as FilesIndex })
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -1215,7 +1215,6 @@ importers:
|
||||
'@pnpm/store-controller-types': 'link:../store-controller-types'
|
||||
'@pnpm/types': 'link:../types'
|
||||
load-json-file: 6.2.0
|
||||
make-dir: 3.1.0
|
||||
mz: 2.7.0
|
||||
p-limit: 2.3.0
|
||||
p-queue: 6.3.0
|
||||
@@ -1265,7 +1264,6 @@ importers:
|
||||
'@types/ssri': ^6.0.2
|
||||
delay: 4.3.0
|
||||
load-json-file: 6.2.0
|
||||
make-dir: ^3.1.0
|
||||
mz: 2.7.0
|
||||
ncp: 2.0.0
|
||||
nock: 12.0.3
|
||||
@@ -1516,7 +1514,6 @@ importers:
|
||||
'@types/sinon': 9.0.0
|
||||
'@types/table': 5.0.0
|
||||
load-json-file: 6.2.0
|
||||
make-dir: 3.1.0
|
||||
proxyquire: 2.1.3
|
||||
read-yaml-file: 2.0.0
|
||||
sinon: 9.0.2
|
||||
@@ -1564,7 +1561,6 @@ importers:
|
||||
is-ci: 2.0.0
|
||||
is-subdir: 1.1.1
|
||||
load-json-file: 6.2.0
|
||||
make-dir: ^3.1.0
|
||||
mem: ^6.1.0
|
||||
mz: 2.7.0
|
||||
p-filter: 2.1.0
|
||||
@@ -1665,7 +1661,6 @@ importers:
|
||||
'@types/ramda': 0.27.4
|
||||
'@types/table': 5.0.0
|
||||
'@types/wrap-ansi': 3.0.0
|
||||
make-dir: 3.1.0
|
||||
mz: 2.7.0
|
||||
strip-ansi: 6.0.0
|
||||
specifiers:
|
||||
@@ -1697,7 +1692,6 @@ importers:
|
||||
chalk: 4.0.0
|
||||
common-tags: 1.8.0
|
||||
lru-cache: 5.1.1
|
||||
make-dir: ^3.1.0
|
||||
mz: 2.7.0
|
||||
ramda: 0.27.0
|
||||
render-help: 1.0.0
|
||||
@@ -2138,7 +2132,6 @@ importers:
|
||||
exists-link: 2.0.0
|
||||
is-windows: 1.0.2
|
||||
load-json-file: 6.2.0
|
||||
make-dir: 3.1.0
|
||||
mz: 2.7.0
|
||||
ncp: 2.0.0
|
||||
normalize-newline: 3.0.0
|
||||
@@ -2224,7 +2217,6 @@ importers:
|
||||
is-windows: 1.0.2
|
||||
load-json-file: 6.2.0
|
||||
loud-rejection: 2.2.0
|
||||
make-dir: ^3.1.0
|
||||
mz: 2.7.0
|
||||
ncp: 2.0.0
|
||||
nopt: 4.0.3
|
||||
@@ -2757,7 +2749,6 @@ importers:
|
||||
credentials-by-uri: 2.0.0
|
||||
fetch-from-npm-registry: 'link:../fetch-from-npm-registry'
|
||||
graceful-fs: 4.2.1
|
||||
make-dir: 3.1.0
|
||||
mem: 6.1.0
|
||||
mz: 2.7.0
|
||||
path-temp: 2.0.0
|
||||
@@ -2793,7 +2784,6 @@ importers:
|
||||
credentials-by-uri: 2.0.0
|
||||
fetch-from-npm-registry: 'workspace:4.0.2'
|
||||
graceful-fs: 4.2.1
|
||||
make-dir: ^3.1.0
|
||||
mem: ^6.1.0
|
||||
mz: 2.7.0
|
||||
nock: 12.0.3
|
||||
@@ -2877,7 +2867,6 @@ importers:
|
||||
'@pnpm/assert-project': 'link:../assert-project'
|
||||
'@pnpm/types': 'link:../../packages/types'
|
||||
'@types/mkdirp': 1.0.0
|
||||
make-dir: 3.1.0
|
||||
tempy: 0.5.0
|
||||
write-json5-file: 3.0.0
|
||||
write-pkg: 4.0.0
|
||||
@@ -2891,7 +2880,6 @@ importers:
|
||||
'@pnpm/types': 'workspace:*'
|
||||
'@types/mkdirp': 1.0.0
|
||||
'@types/node': ^12.12.37
|
||||
make-dir: ^3.1.0
|
||||
tempy: 0.5.0
|
||||
tslint-config-standard: 9.0.0
|
||||
tslint-eslint-rules: 5.4.0
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
"@pnpm/assert-project": "workspace:*",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"@types/mkdirp": "1.0.0",
|
||||
"make-dir": "^3.1.0",
|
||||
"tempy": "0.5.0",
|
||||
"write-json5-file": "^3.0.0",
|
||||
"write-pkg": "4.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import assertProject, { Modules, Project } from '@pnpm/assert-project'
|
||||
import { ProjectManifest } from '@pnpm/types'
|
||||
import makeDir = require('make-dir')
|
||||
import fs = require('fs')
|
||||
import path = require('path')
|
||||
import { Test } from 'tape'
|
||||
import tempy = require('tempy')
|
||||
@@ -20,7 +20,7 @@ export function tempDir (t: Test) {
|
||||
dirNumber++
|
||||
const dirname = dirNumber.toString()
|
||||
const tmpDir = path.join(tmpPath, dirname)
|
||||
makeDir.sync(tmpDir)
|
||||
fs.mkdirSync(tmpDir, { recursive: true })
|
||||
|
||||
t.pass(`create testing dir ${path.join(tmpDir)}`)
|
||||
|
||||
@@ -69,7 +69,7 @@ export default function prepare (
|
||||
) {
|
||||
const dir = opts?.tempDir ?? path.join(tempDir(test), 'project')
|
||||
|
||||
makeDir.sync(dir)
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
switch (opts?.manifestFormat ?? 'JSON') {
|
||||
case 'JSON':
|
||||
writePkg.sync(dir, { name: 'project', version: '0.0.0', ...manifest } as any) // tslint:disable-line
|
||||
@@ -89,7 +89,7 @@ export default function prepare (
|
||||
export function prepareEmpty (t: Test) {
|
||||
const pkgTmpPath = path.join(tempDir(t), 'project')
|
||||
|
||||
makeDir.sync(pkgTmpPath)
|
||||
fs.mkdirSync(pkgTmpPath, { recursive: true })
|
||||
process.chdir(pkgTmpPath)
|
||||
|
||||
return assertProject(t, pkgTmpPath)
|
||||
|
||||
Reference in New Issue
Block a user