mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-09 23:48:28 -05:00
6
.changeset/afraid-gifts-provide.md
Normal file
6
.changeset/afraid-gifts-provide.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-rebuild": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
`pnpm rebuild` should work in projects that use the hoister node linker [#5560](https://github.com/pnpm/pnpm/issues/5560).
|
||||
5
.changeset/rare-rocks-type.md
Normal file
5
.changeset/rare-rocks-type.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/fs.hard-link-dir": major
|
||||
---
|
||||
|
||||
Initial release.
|
||||
@@ -44,7 +44,7 @@
|
||||
"@pnpm/constants": "workspace:*",
|
||||
"@pnpm/lockfile-types": "workspace:*",
|
||||
"@pnpm/modules-yaml": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"is-windows": "^1.0.2",
|
||||
"isexe": "2.0.0",
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/cafs": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"path-exists": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -33,10 +33,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/pnpm/pnpm/blob/main/exec/plugin-commands-rebuild#readme",
|
||||
"devDependencies": {
|
||||
"@pnpm/assert-project": "workspace:*",
|
||||
"@pnpm/filter-workspace-packages": "workspace:*",
|
||||
"@pnpm/plugin-commands-rebuild": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@types/ramda": "0.28.20",
|
||||
"@types/semver": "7.3.13",
|
||||
@@ -52,7 +53,9 @@
|
||||
"@pnpm/config": "workspace:*",
|
||||
"@pnpm/constants": "workspace:*",
|
||||
"@pnpm/core-loggers": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"@pnpm/find-workspace-packages": "workspace:*",
|
||||
"@pnpm/fs.hard-link-dir": "workspace:*",
|
||||
"@pnpm/get-context": "workspace:*",
|
||||
"@pnpm/graph-sequencer": "1.0.0",
|
||||
"@pnpm/lifecycle": "workspace:*",
|
||||
@@ -66,7 +69,6 @@
|
||||
"@pnpm/store-connection-manager": "workspace:*",
|
||||
"@pnpm/store-controller-types": "workspace:*",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"load-json-file": "^6.2.0",
|
||||
"mem": "^8.1.1",
|
||||
"p-limit": "^3.1.0",
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
WANTED_LOCKFILE,
|
||||
} from '@pnpm/constants'
|
||||
import { skippedOptionalDependencyLogger } from '@pnpm/core-loggers'
|
||||
import { getContext } from '@pnpm/get-context'
|
||||
import { getContext, PnpmContext } from '@pnpm/get-context'
|
||||
import {
|
||||
runLifecycleHooksConcurrently,
|
||||
runPostinstallHooks,
|
||||
@@ -22,6 +22,7 @@ import { writeModulesManifest } from '@pnpm/modules-yaml'
|
||||
import { createOrConnectStoreController } from '@pnpm/store-connection-manager'
|
||||
import { ProjectManifest } from '@pnpm/types'
|
||||
import * as dp from '@pnpm/dependency-path'
|
||||
import { hardLinkDir } from '@pnpm/fs.hard-link-dir'
|
||||
import runGroups from 'run-groups'
|
||||
import graphSequencer from '@pnpm/graph-sequencer'
|
||||
import npa from '@pnpm/npm-package-arg'
|
||||
@@ -231,7 +232,7 @@ async function _rebuild (
|
||||
projects: Record<string, { id: string, rootDir: string }>
|
||||
extraBinPaths: string[]
|
||||
extraNodePaths: string[]
|
||||
},
|
||||
} & Pick<PnpmContext, 'modulesFile'>,
|
||||
opts: StrictRebuildOptions
|
||||
) {
|
||||
const pkgsThatWereRebuilt = new Set()
|
||||
@@ -272,14 +273,22 @@ async function _rebuild (
|
||||
async () => {
|
||||
const pkgSnapshot = pkgSnapshots[depPath]
|
||||
const pkgInfo = nameVerFromPkgSnapshot(depPath, pkgSnapshot)
|
||||
const pkgRoot = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath), 'node_modules', pkgInfo.name)
|
||||
const pkgRoots = opts.nodeLinker === 'hoisted'
|
||||
? (ctx.modulesFile?.hoistedLocations?.[depPath] ?? []).map((hoistedLocation) => path.join(opts.lockfileDir, hoistedLocation))
|
||||
: [path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath), 'node_modules', pkgInfo.name)]
|
||||
const pkgRoot = pkgRoots[0]
|
||||
try {
|
||||
const modules = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath), 'node_modules')
|
||||
const binPath = path.join(pkgRoot, 'node_modules', '.bin')
|
||||
await linkBins(modules, binPath, { extraNodePaths: ctx.extraNodePaths, warn })
|
||||
const extraBinPaths = ctx.extraBinPaths
|
||||
if (opts.nodeLinker !== 'hoisted') {
|
||||
const modules = path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath), 'node_modules')
|
||||
const binPath = path.join(pkgRoot, 'node_modules', '.bin')
|
||||
await linkBins(modules, binPath, { extraNodePaths: ctx.extraNodePaths, warn })
|
||||
} else {
|
||||
extraBinPaths.push(...binDirsInAllParentDirs(pkgRoot, opts.lockfileDir))
|
||||
}
|
||||
await runPostinstallHooks({
|
||||
depPath,
|
||||
extraBinPaths: ctx.extraBinPaths,
|
||||
extraBinPaths,
|
||||
extraEnv: opts.extraEnv,
|
||||
optional: pkgSnapshot.optional === true,
|
||||
pkgRoot,
|
||||
@@ -307,6 +316,9 @@ async function _rebuild (
|
||||
}
|
||||
throw err
|
||||
}
|
||||
if (pkgRoots.length > 1) {
|
||||
await hardLinkDir(pkgRoot, pkgRoots.slice(1))
|
||||
}
|
||||
}
|
||||
))
|
||||
|
||||
@@ -336,3 +348,16 @@ async function _rebuild (
|
||||
|
||||
return pkgsThatWereRebuilt
|
||||
}
|
||||
|
||||
function binDirsInAllParentDirs (pkgRoot: string, lockfileDir: string): string[] {
|
||||
const binDirs: string[] = []
|
||||
let dir = pkgRoot
|
||||
do {
|
||||
if (!path.dirname(dir).startsWith('@')) {
|
||||
binDirs.push(path.join(dir, 'node_modules/.bin'))
|
||||
}
|
||||
dir = path.dirname(dir)
|
||||
} while (path.relative(dir, lockfileDir) !== '')
|
||||
binDirs.push(path.join(lockfileDir, 'node_modules/.bin'))
|
||||
return binDirs
|
||||
}
|
||||
|
||||
@@ -76,6 +76,8 @@ export async function handler (
|
||||
| 'dir'
|
||||
| 'engineStrict'
|
||||
| 'hooks'
|
||||
| 'lockfileDir'
|
||||
| 'nodeLinker'
|
||||
| 'rawLocalConfig'
|
||||
| 'registries'
|
||||
| 'scriptShell'
|
||||
|
||||
@@ -22,6 +22,7 @@ type RecursiveRebuildOpts = CreateStoreControllerOptions & Pick<Config,
|
||||
| 'ignoreScripts'
|
||||
| 'lockfileDir'
|
||||
| 'lockfileOnly'
|
||||
| 'nodeLinker'
|
||||
| 'rawLocalConfig'
|
||||
| 'registries'
|
||||
| 'sharedWorkspaceLockfile'
|
||||
|
||||
@@ -23,7 +23,7 @@ test('rebuilds dependencies', async () => {
|
||||
pnpmBin,
|
||||
'add',
|
||||
'--save-dev',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0',
|
||||
'pnpm/test-git-fetch#299c6d89507571462b992b92407a8a07663e32ee',
|
||||
`--registry=${REGISTRY}`,
|
||||
`--store-dir=${storeDir}`,
|
||||
@@ -109,7 +109,7 @@ test('rebuilds specific dependencies', async () => {
|
||||
pnpmBin,
|
||||
'add',
|
||||
'--save-dev',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0',
|
||||
'pnpm-e2e/install-scripts-example#b6cfdb8af6f8d5ebc5e7de6831af9d38084d765b',
|
||||
`--registry=${REGISTRY}`,
|
||||
`--store-dir=${storeDir}`,
|
||||
@@ -144,7 +144,7 @@ test('rebuild with pending option', async () => {
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'add',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0',
|
||||
`--registry=${REGISTRY}`,
|
||||
`--store-dir=${storeDir}`,
|
||||
`--cache-dir=${cacheDir}`,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import path from 'path'
|
||||
import { assertProject } from '@pnpm/assert-project'
|
||||
import { readProjects } from '@pnpm/filter-workspace-packages'
|
||||
import { rebuild } from '@pnpm/plugin-commands-rebuild'
|
||||
import { preparePackages } from '@pnpm/prepare'
|
||||
@@ -63,6 +64,89 @@ test('pnpm recursive rebuild', async () => {
|
||||
await projects['project-2'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
})
|
||||
|
||||
test('pnpm recursive rebuild with hoisted node linker', async () => {
|
||||
const projects = preparePackages([
|
||||
{
|
||||
name: 'project-1',
|
||||
version: '1.0.0',
|
||||
|
||||
dependencies: {
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example': '1',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'project-2',
|
||||
version: '1.0.0',
|
||||
|
||||
dependencies: {
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example': '1',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'project-3',
|
||||
version: '1.0.0',
|
||||
|
||||
dependencies: {
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example': '2',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'project-4',
|
||||
version: '1.0.0',
|
||||
|
||||
dependencies: {
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example': '2',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
const { allProjects, selectedProjectsGraph } = await readProjects(process.cwd(), [])
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['*'] })
|
||||
await execa('node', [
|
||||
pnpmBin,
|
||||
'install',
|
||||
'-r',
|
||||
`--registry=${REGISTRY}`,
|
||||
`--store-dir=${path.resolve(DEFAULT_OPTS.storeDir)}`,
|
||||
`--cache-dir=${path.resolve(DEFAULT_OPTS.cacheDir)}`,
|
||||
'--ignore-scripts',
|
||||
'--reporter=append-only',
|
||||
'--config.node-linker=hoisted',
|
||||
], { stdout: 'inherit' })
|
||||
|
||||
const rootProject = assertProject(process.cwd())
|
||||
await rootProject.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await rootProject.hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-3'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-3'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-4'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-4'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
|
||||
const modulesManifest = await rootProject.readModulesManifest()
|
||||
await rebuild.handler({
|
||||
...DEFAULT_OPTS,
|
||||
allProjects,
|
||||
dir: process.cwd(),
|
||||
nodeLinker: 'hoisted',
|
||||
recursive: true,
|
||||
registries: modulesManifest!.registries!,
|
||||
selectedProjectsGraph,
|
||||
lockfileDir: process.cwd(),
|
||||
workspaceDir: process.cwd(),
|
||||
}, [])
|
||||
|
||||
await rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await rootProject.has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-1'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-2'].hasNot('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-3'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
await projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')
|
||||
await projects['project-4'].has('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-postinstall.js')
|
||||
})
|
||||
|
||||
// TODO: make this test pass
|
||||
test.skip('rebuild multiple packages in correct order', async () => {
|
||||
const pkgs = [
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
"../../__typings__/**/*.d.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../__utils__/assert-project"
|
||||
},
|
||||
{
|
||||
"path": "../../__utils__/prepare"
|
||||
},
|
||||
@@ -27,6 +30,9 @@
|
||||
{
|
||||
"path": "../../config/normalize-registries"
|
||||
},
|
||||
{
|
||||
"path": "../../fs/hard-link-dir"
|
||||
},
|
||||
{
|
||||
"path": "../../lockfile/lockfile-utils"
|
||||
},
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"@pnpm/filter-workspace-packages": "workspace:*",
|
||||
"@pnpm/plugin-commands-script-runners": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@types/is-windows": "^1.0.0",
|
||||
"@types/ramda": "0.28.20",
|
||||
"is-windows": "^1.0.2",
|
||||
|
||||
17
fs/hard-link-dir/README.md
Normal file
17
fs/hard-link-dir/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# @pnpm/fs.hard-link-dir
|
||||
|
||||
> Hard link all files from a directory to several target directories.
|
||||
|
||||
<!--@shields('npm')-->
|
||||
[](https://www.npmjs.com/package/@pnpm/fs.hard-link-dir)
|
||||
<!--/@-->
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
pnpm add @pnpm/fs.hard-link-dir
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Zoltan Kochan](https://www.kochan.io)
|
||||
1
fs/hard-link-dir/jest.config.js
Normal file
1
fs/hard-link-dir/jest.config.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('../../jest.config.js')
|
||||
42
fs/hard-link-dir/package.json
Normal file
42
fs/hard-link-dir/package.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@pnpm/fs.hard-link-dir",
|
||||
"version": "0.0.0",
|
||||
"description": "Hard link all files from a directory to several target directories.",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"!*.map"
|
||||
],
|
||||
"types": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"lint": "eslint src/**/*.ts test/**/*.ts",
|
||||
"_test": "jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
},
|
||||
"repository": "https://github.com/pnpm/pnpm/blob/main/fs/hard-link-dir",
|
||||
"keywords": [
|
||||
"pnpm7",
|
||||
"find",
|
||||
"package"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.6"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"homepage": "https://github.com/pnpm/pnpm/blob/main/fs/hard-link-dir#readme",
|
||||
"dependencies": {
|
||||
},
|
||||
"funding": "https://opencollective.com/pnpm",
|
||||
"devDependencies": {
|
||||
"@pnpm/fs.hard-link-dir": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/index.js"
|
||||
}
|
||||
}
|
||||
43
fs/hard-link-dir/src/index.ts
Normal file
43
fs/hard-link-dir/src/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import path from 'path'
|
||||
import { promises as fs } from 'fs'
|
||||
|
||||
export async function hardLinkDir (src: string, destDirs: string[]) {
|
||||
const files = await fs.readdir(src)
|
||||
await Promise.all(
|
||||
files.map(async (file) => {
|
||||
if (file === 'node_modules') return
|
||||
const srcFile = path.join(src, file)
|
||||
if ((await fs.lstat(srcFile)).isDirectory()) {
|
||||
await Promise.all(
|
||||
destDirs.map(async (destDir) => {
|
||||
const destFile = path.join(destDir, file)
|
||||
try {
|
||||
await fs.mkdir(destFile, { recursive: true })
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if (err.code !== 'EEXIST') throw err
|
||||
}
|
||||
return hardLinkDir(srcFile, [destFile])
|
||||
})
|
||||
)
|
||||
return
|
||||
}
|
||||
await Promise.all(
|
||||
destDirs.map(async (destDir) => {
|
||||
const destFile = path.join(destDir, file)
|
||||
try {
|
||||
await fs.link(srcFile, destFile)
|
||||
} catch (err: any) { // eslint-disable-line
|
||||
if (err.code === 'ENOENT') {
|
||||
await fs.mkdir(destDir, { recursive: true })
|
||||
await fs.link(srcFile, destFile)
|
||||
return
|
||||
}
|
||||
if (err.code !== 'EEXIST') {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
34
fs/hard-link-dir/test/index.ts
Normal file
34
fs/hard-link-dir/test/index.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { tempDir as createTempDir } from '@pnpm/prepare'
|
||||
import { hardLinkDir } from '@pnpm/fs.hard-link-dir'
|
||||
|
||||
test('hardLinkDirectory()', async () => {
|
||||
const tempDir = createTempDir()
|
||||
const srcDir = path.join(tempDir, 'source')
|
||||
const dest1Dir = path.join(tempDir, 'dest1')
|
||||
const dest2Dir = path.join(tempDir, 'dest2')
|
||||
|
||||
fs.mkdirSync(srcDir, { recursive: true })
|
||||
fs.mkdirSync(dest1Dir, { recursive: true })
|
||||
fs.mkdirSync(path.join(srcDir, 'node_modules'), { recursive: true })
|
||||
fs.mkdirSync(path.join(srcDir, 'subdir'), { recursive: true })
|
||||
|
||||
fs.writeFileSync(path.join(srcDir, 'file.txt'), 'Hello World')
|
||||
fs.writeFileSync(path.join(srcDir, 'subdir/file.txt'), 'Hello World')
|
||||
fs.writeFileSync(path.join(srcDir, 'node_modules/file.txt'), 'Hello World')
|
||||
|
||||
await hardLinkDir(srcDir, [dest1Dir, dest2Dir])
|
||||
|
||||
// It should link the files from the root
|
||||
expect(fs.readFileSync(path.join(dest1Dir, 'file.txt'), 'utf8')).toBe('Hello World')
|
||||
expect(fs.readFileSync(path.join(dest2Dir, 'file.txt'), 'utf8')).toBe('Hello World')
|
||||
|
||||
// It should link files from a subdirectory
|
||||
expect(fs.readFileSync(path.join(dest1Dir, 'subdir/file.txt'), 'utf8')).toBe('Hello World')
|
||||
expect(fs.readFileSync(path.join(dest2Dir, 'subdir/file.txt'), 'utf8')).toBe('Hello World')
|
||||
|
||||
// It should not link files from node_modules
|
||||
expect(fs.existsSync(path.join(dest1Dir, 'node_modules/file.txt'))).toBe(false)
|
||||
expect(fs.existsSync(path.join(dest2Dir, 'node_modules/file.txt'))).toBe(false)
|
||||
})
|
||||
16
fs/hard-link-dir/tsconfig.json
Normal file
16
fs/hard-link-dir/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "@pnpm/tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"../../__typings__/**/*.d.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../__utils__/prepare"
|
||||
}
|
||||
]
|
||||
}
|
||||
8
fs/hard-link-dir/tsconfig.lint.json
Normal file
8
fs/hard-link-dir/tsconfig.lint.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"test/**/*.ts",
|
||||
"../../__typings__/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -39,7 +39,7 @@
|
||||
"@commitlint/prompt-cli": "^17.3.0",
|
||||
"@pnpm/eslint-config": "workspace:*",
|
||||
"@pnpm/meta-updater": "0.2.2",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/tsconfig": "workspace:*",
|
||||
"@types/jest": "^29.2.3",
|
||||
"@types/node": "^14.18.33",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"devDependencies": {
|
||||
"@pnpm/plugin-commands-patching": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@types/ramda": "0.28.20"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"@pnpm/constants": "workspace:*",
|
||||
"@pnpm/core-loggers": "workspace:*",
|
||||
"@pnpm/crypto.base32-hash": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"@pnpm/error": "workspace:*",
|
||||
"@pnpm/filter-lockfile": "workspace:*",
|
||||
"@pnpm/get-context": "workspace:*",
|
||||
@@ -54,7 +55,6 @@
|
||||
"@pnpm/types": "workspace:*",
|
||||
"@pnpm/which-version-is-pinned": "workspace:*",
|
||||
"@zkochan/rimraf": "^2.1.2",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"is-inner-link": "^4.0.0",
|
||||
"load-json-file": "^6.2.0",
|
||||
"normalize-path": "^3.0.0",
|
||||
@@ -77,7 +77,7 @@
|
||||
"@pnpm/git-utils": "workspace:*",
|
||||
"@pnpm/package-store": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/store-path": "workspace:*",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
|
||||
@@ -20,7 +20,7 @@ const testOnNonWindows = isWindows() ? test.skip : test
|
||||
test('run pre/postinstall scripts', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({},
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example'],
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'],
|
||||
await testDefaults({ fastUnpack: false, targetDependenciesField: 'devDependencies' })
|
||||
)
|
||||
|
||||
@@ -57,7 +57,7 @@ test('run pre/postinstall scripts', async () => {
|
||||
test('run pre/postinstall scripts, when PnP is used and no symlinks', async () => {
|
||||
prepareEmpty()
|
||||
await addDependenciesToPackage({},
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example'],
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'],
|
||||
await testDefaults({
|
||||
fastUnpack: false,
|
||||
enablePnp: true,
|
||||
@@ -76,7 +76,7 @@ test('testing that the bins are linked when the package with the bins was alread
|
||||
const project = prepareEmpty()
|
||||
|
||||
const manifest = await addDependenciesToPackage({}, ['@pnpm.e2e/hello-world-js-bin'], await testDefaults({ fastUnpack: false }))
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/pre-and-postinstall-scripts-example'], await testDefaults({ fastUnpack: false, targetDependenciesField: 'devDependencies' }))
|
||||
await addDependenciesToPackage(manifest, ['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'], await testDefaults({ fastUnpack: false, targetDependenciesField: 'devDependencies' }))
|
||||
|
||||
const generatedByPreinstall = project.requireModule('@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall')
|
||||
expect(typeof generatedByPreinstall).toBe('function')
|
||||
@@ -333,7 +333,7 @@ test('bins are linked even if lifecycle scripts are ignored', async () => {
|
||||
[
|
||||
'@pnpm.e2e/pkg-with-peer-having-bin',
|
||||
'@pnpm.e2e/peer-with-bin',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example',
|
||||
'@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0',
|
||||
],
|
||||
await testDefaults({ fastUnpack: false, ignoreScripts: true })
|
||||
)
|
||||
@@ -402,7 +402,7 @@ test('selectively ignore scripts in some dependencies by neverBuiltDependencies'
|
||||
const project = prepareEmpty()
|
||||
const neverBuiltDependencies = ['@pnpm.e2e/pre-and-postinstall-scripts-example']
|
||||
const manifest = await addDependenciesToPackage({},
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example', '@pnpm.e2e/install-script-example'],
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', '@pnpm.e2e/install-script-example'],
|
||||
await testDefaults({ fastUnpack: false, neverBuiltDependencies })
|
||||
)
|
||||
|
||||
@@ -430,7 +430,7 @@ test('throw an exception when both neverBuiltDependencies and onlyBuiltDependenc
|
||||
await expect(
|
||||
addDependenciesToPackage(
|
||||
{},
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example'],
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0'],
|
||||
await testDefaults({ onlyBuiltDependencies: ['@pnpm.e2e/foo'], neverBuiltDependencies: ['@pnpm.e2e/bar'] })
|
||||
)
|
||||
).rejects.toThrow(/Cannot have both/)
|
||||
@@ -440,7 +440,7 @@ test('selectively allow scripts in some dependencies by onlyBuiltDependencies',
|
||||
const project = prepareEmpty()
|
||||
const onlyBuiltDependencies = ['@pnpm.e2e/install-script-example']
|
||||
const manifest = await addDependenciesToPackage({},
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example', '@pnpm.e2e/install-script-example'],
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', '@pnpm.e2e/install-script-example'],
|
||||
await testDefaults({ fastUnpack: false, onlyBuiltDependencies })
|
||||
)
|
||||
|
||||
@@ -465,7 +465,7 @@ test('selectively allow scripts in some dependencies by onlyBuiltDependencies',
|
||||
test('lockfile is updated if neverBuiltDependencies is changed', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({},
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example', '@pnpm.e2e/install-script-example'],
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', '@pnpm.e2e/install-script-example'],
|
||||
await testDefaults({ fastUnpack: false })
|
||||
)
|
||||
|
||||
@@ -494,7 +494,7 @@ test('lockfile is updated if neverBuiltDependencies is changed', async () => {
|
||||
test('lockfile is updated if onlyBuiltDependencies is changed', async () => {
|
||||
const project = prepareEmpty()
|
||||
const manifest = await addDependenciesToPackage({},
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example', '@pnpm.e2e/install-script-example'],
|
||||
['@pnpm.e2e/pre-and-postinstall-scripts-example@1.0.0', '@pnpm.e2e/install-script-example'],
|
||||
await testDefaults({ fastUnpack: false })
|
||||
)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"@pnpm/package-store": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/read-projects-context": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/store-path": "workspace:*",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
@@ -62,7 +62,7 @@
|
||||
"_test": "cross-env PNPM_REGISTRY_MOCK_PORT=7773 pnpm run test:e2e",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"runPrepareFixtures": "node ../pnpm/bin/pnpm.cjs i -r -C test/fixtures --no-shared-workspace-lockfile --no-link-workspace-packages --lockfile-only --registry http://localhost:4873/ --ignore-scripts --force --no-strict-peer-dependencies",
|
||||
"runPrepareFixtures": "node ../../pnpm/bin/pnpm.cjs i -r -C test/fixtures --no-shared-workspace-lockfile --no-link-workspace-packages --lockfile-only --registry http://localhost:4873/ --ignore-scripts --force --no-strict-peer-dependencies",
|
||||
"prepareFixtures": "registry-mock prepare && run-p -r registry-mock runPrepareFixtures",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
},
|
||||
@@ -71,6 +71,7 @@
|
||||
"@pnpm/calc-dep-state": "workspace:*",
|
||||
"@pnpm/constants": "workspace:*",
|
||||
"@pnpm/core-loggers": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"@pnpm/error": "workspace:*",
|
||||
"@pnpm/filter-lockfile": "workspace:*",
|
||||
"@pnpm/hoist": "workspace:*",
|
||||
@@ -91,7 +92,6 @@
|
||||
"@pnpm/symlink-dependency": "workspace:*",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"@zkochan/rimraf": "^2.1.2",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"p-limit": "^3.1.0",
|
||||
"path-absolute": "^1.0.1",
|
||||
"path-exists": "^4.0.0",
|
||||
|
||||
2
pkg-manager/headless/test/fixtures/deps-have-lifecycle-scripts/pnpm-lock.yaml
generated
vendored
2
pkg-manager/headless/test/fixtures/deps-have-lifecycle-scripts/pnpm-lock.yaml
generated
vendored
@@ -16,7 +16,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
/@pnpm.e2e/pre-and-postinstall-scripts-example/1.0.0:
|
||||
resolution: {integrity: sha512-RWys6ZQfGRl4enR2IZv+Ear9h5v0p1LjwY36bxkBgJCEAV9lP1DksvXa3hATKgG9r3/FrkESKSwlMwZ8vLNgAg==}
|
||||
resolution: {integrity: sha512-p2L5hqNZFiWX/4tQiuawjhh4xVy2QObs21HzZa6DdGZfWlgzdKiMN5MLuwh5ehI0GxuNWSrq0+/T+DEEr7kWVw==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@pnpm.e2e/hello-world-js-bin': 1.0.0
|
||||
|
||||
2
pkg-manager/headless/test/fixtures/side-effects/pnpm-lock.yaml
generated
vendored
2
pkg-manager/headless/test/fixtures/side-effects/pnpm-lock.yaml
generated
vendored
@@ -14,7 +14,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
/@pnpm.e2e/pre-and-postinstall-scripts-example/1.0.0:
|
||||
resolution: {integrity: sha512-RWys6ZQfGRl4enR2IZv+Ear9h5v0p1LjwY36bxkBgJCEAV9lP1DksvXa3hATKgG9r3/FrkESKSwlMwZ8vLNgAg==}
|
||||
resolution: {integrity: sha512-p2L5hqNZFiWX/4tQiuawjhh4xVy2QObs21HzZa6DdGZfWlgzdKiMN5MLuwh5ehI0GxuNWSrq0+/T+DEEr7kWVw==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@pnpm.e2e/hello-world-js-bin': 1.0.0
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"dependencies": {
|
||||
"@pnpm/cafs": "workspace:*",
|
||||
"@pnpm/core-loggers": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"@pnpm/error": "workspace:*",
|
||||
"@pnpm/fetcher-base": "workspace:*",
|
||||
"@pnpm/graceful-fs": "workspace:*",
|
||||
@@ -49,7 +50,6 @@
|
||||
"@pnpm/resolver-base": "workspace:*",
|
||||
"@pnpm/store-controller-types": "workspace:*",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"load-json-file": "^6.2.0",
|
||||
"p-defer": "^3.0.0",
|
||||
"p-limit": "^3.1.0",
|
||||
@@ -68,7 +68,7 @@
|
||||
"@pnpm/client": "workspace:*",
|
||||
"@pnpm/create-cafs-store": "workspace:*",
|
||||
"@pnpm/package-requester": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@types/normalize-path": "^3.0.0",
|
||||
"@types/ramda": "0.28.20",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@pnpm/modules-yaml": "workspace:*",
|
||||
"@pnpm/plugin-commands-installation": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@types/is-ci": "^3.0.0",
|
||||
"@types/proxyquire": "^1.3.28",
|
||||
|
||||
1056
pnpm-lock.yaml
generated
1056
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@
|
||||
"@pnpm/constants": "workspace:*",
|
||||
"@pnpm/core-loggers": "workspace:*",
|
||||
"@pnpm/default-reporter": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"@pnpm/filter-workspace-packages": "workspace:*",
|
||||
"@pnpm/find-workspace-dir": "workspace:*",
|
||||
"@pnpm/find-workspace-packages": "workspace:*",
|
||||
@@ -58,13 +59,13 @@
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/read-package-json": "workspace:*",
|
||||
"@pnpm/read-project-manifest": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/run-npm": "workspace:*",
|
||||
"@pnpm/tabtab": "^0.1.2",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"@pnpm/write-project-manifest": "workspace:*",
|
||||
"@pnpm/workspace.pkgs-graph": "workspace:*",
|
||||
"@pnpm/write-project-manifest": "workspace:*",
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/is-ci": "^3.0.0",
|
||||
"@types/is-windows": "^1.0.0",
|
||||
@@ -79,7 +80,6 @@
|
||||
"cross-var-no-babel": "^1.2.0",
|
||||
"deep-require-cwd": "1.0.0",
|
||||
"delay": "^5.0.0",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"dir-is-case-sensitive": "^2.0.0",
|
||||
"esbuild": "^0.15.16",
|
||||
"execa": "npm:safe-execa@^0.1.2",
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"@pnpm/lockfile-types": "workspace:*",
|
||||
"@pnpm/plugin-commands-deploy": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0"
|
||||
"@pnpm/registry-mock": "3.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/cli-utils": "workspace:*",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@pnpm/filter-workspace-packages": "workspace:*",
|
||||
"@pnpm/plugin-commands-publishing": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/is-ci": "^3.0.0",
|
||||
"@types/is-windows": "^1.0.0",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@pnpm/plugin-commands-installation": "workspace:*",
|
||||
"@pnpm/plugin-commands-licenses": "workspace:*",
|
||||
"@pnpm/read-package-json": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@types/ramda": "0.28.20",
|
||||
"@types/wrap-ansi": "^8.0.1",
|
||||
"@types/zkochan__table": "npm:@types/table@6.0.0",
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"@pnpm/plugin-commands-installation": "workspace:*",
|
||||
"@pnpm/plugin-commands-listing": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@types/ramda": "0.28.20",
|
||||
"execa": "npm:safe-execa@^0.1.2",
|
||||
"strip-ansi": "^6.0.1",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@pnpm/plugin-commands-installation": "workspace:*",
|
||||
"@pnpm/plugin-commands-outdated": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@pnpm/test-fixtures": "workspace:*",
|
||||
"@types/ramda": "0.28.20",
|
||||
"@types/wrap-ansi": "^8.0.1",
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"@pnpm/lockfile-file": "workspace:*",
|
||||
"@pnpm/plugin-commands-store": "workspace:*",
|
||||
"@pnpm/prepare": "workspace:*",
|
||||
"@pnpm/registry-mock": "3.1.0",
|
||||
"@pnpm/registry-mock": "3.2.0",
|
||||
"@types/archy": "0.0.32",
|
||||
"@types/ramda": "0.28.20",
|
||||
"@types/ssri": "^7.1.1",
|
||||
@@ -51,6 +51,7 @@
|
||||
"@pnpm/cafs": "workspace:*",
|
||||
"@pnpm/cli-utils": "workspace:*",
|
||||
"@pnpm/config": "workspace:*",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"@pnpm/error": "workspace:*",
|
||||
"@pnpm/get-context": "workspace:*",
|
||||
"@pnpm/lockfile-utils": "workspace:*",
|
||||
@@ -62,7 +63,6 @@
|
||||
"@pnpm/store-path": "workspace:*",
|
||||
"@pnpm/types": "workspace:*",
|
||||
"archy": "^1.0.0",
|
||||
"@pnpm/dependency-path": "workspace:*",
|
||||
"dint": "^5.1.0",
|
||||
"load-json-file": "^6.2.0",
|
||||
"p-filter": "^2.1.0",
|
||||
|
||||
Reference in New Issue
Block a user