Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use a worker for hard linking directories #7154

Merged
merged 9 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: fix
  • Loading branch information
zkochan committed Oct 1, 2023
commit a883f8a1abdd74748ec63c5d1fc6d29c0586dcd3
2 changes: 1 addition & 1 deletion exec/build-modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
"dependencies": {
"@pnpm/calc-dep-state": "workspace:*",
"@pnpm/core-loggers": "workspace:*",
"@pnpm/fs.hard-link-dir": "workspace:*",
"@pnpm/graph-sequencer": "1.1.1",
"@pnpm/lifecycle": "workspace:*",
"@pnpm/link-bins": "workspace:*",
"@pnpm/patching.apply-patch": "workspace:*",
"@pnpm/read-package-json": "workspace:*",
"@pnpm/store-controller-types": "workspace:*",
"@pnpm/types": "workspace:*",
"@pnpm/worker": "workspace:*",
"p-defer": "^3.0.0",
"ramda": "npm:@pnpm/ramda@0.28.1",
"run-groups": "^3.0.1"
Expand Down
2 changes: 1 addition & 1 deletion exec/build-modules/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { skippedOptionalDependencyLogger } from '@pnpm/core-loggers'
import { runPostinstallHooks } from '@pnpm/lifecycle'
import { linkBins, linkBinsOfPackages } from '@pnpm/link-bins'
import { logger } from '@pnpm/logger'
import { hardLinkDir } from '@pnpm/fs.hard-link-dir'
import { hardLinkDir } from '@pnpm/worker'
import { readPackageJsonFromDir, safeReadPackageJsonFromDir } from '@pnpm/read-package-json'
import { type StoreController } from '@pnpm/store-controller-types'
import { applyPatchToDir } from '@pnpm/patching.apply-patch'
Expand Down
6 changes: 3 additions & 3 deletions exec/build-modules/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"../../__typings__/**/*.d.ts"
],
"references": [
{
"path": "../../fs/hard-link-dir"
},
{
"path": "../../packages/calc-dep-state"
},
Expand All @@ -33,6 +30,9 @@
{
"path": "../../store/store-controller-types"
},
{
"path": "../../worker"
},
{
"path": "../lifecycle"
}
Expand Down
2 changes: 1 addition & 1 deletion exec/plugin-commands-rebuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"@pnpm/core-loggers": "workspace:*",
"@pnpm/dependency-path": "workspace:*",
"@pnpm/error": "workspace:*",
"@pnpm/fs.hard-link-dir": "workspace:*",
"@pnpm/get-context": "workspace:*",
"@pnpm/graph-sequencer": "1.1.1",
"@pnpm/lifecycle": "workspace:*",
Expand All @@ -69,6 +68,7 @@
"@pnpm/store-controller-types": "workspace:*",
"@pnpm/store.cafs": "workspace:*",
"@pnpm/types": "workspace:*",
"@pnpm/worker": "workspace:*",
"@pnpm/workspace.find-packages": "workspace:*",
"load-json-file": "^6.2.0",
"mem": "^8.1.1",
Expand Down
2 changes: 1 addition & 1 deletion exec/plugin-commands-rebuild/src/implementation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { writeModulesManifest } from '@pnpm/modules-yaml'
import { createOrConnectStoreController } from '@pnpm/store-connection-manager'
import { type ProjectManifest } from '@pnpm/types'
import * as dp from '@pnpm/dependency-path'
import { hardLinkDir } from '@pnpm/fs.hard-link-dir'
import { hardLinkDir } from '@pnpm/worker'
import loadJsonFile from 'load-json-file'
import runGroups from 'run-groups'
import graphSequencer from '@pnpm/graph-sequencer'
Expand Down
6 changes: 3 additions & 3 deletions exec/plugin-commands-rebuild/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
{
"path": "../../config/normalize-registries"
},
{
"path": "../../fs/hard-link-dir"
},
{
"path": "../../lockfile/lockfile-types"
},
Expand Down Expand Up @@ -78,6 +75,9 @@
{
"path": "../../store/store-controller-types"
},
{
"path": "../../worker"
},
{
"path": "../../workspace/filter-workspace-packages"
},
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
type AddDirToStoreMessage,
type LinkPkgMessage,
type SymlinkAllModulesMessage,
HardLinkDirMessage,
type HardLinkDirMessage,
} from './types'

let workerPool: WorkerPool | undefined
Expand Down Expand Up @@ -239,7 +239,7 @@ export async function hardLinkDir (src: string, destDirs: string[]): Promise<voi
localWorker.postMessage({
type: 'hardLinkDir',
src,
destDirs
destDirs,
} as HardLinkDirMessage)
})
}
3 changes: 1 addition & 2 deletions worker/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
type LinkPkgMessage,
type SymlinkAllModulesMessage,
type TarballExtractMessage,
HardLinkDirMessage,
type HardLinkDirMessage,
} from './types'

const INTEGRITY_REGEX: RegExp = /^([^-]+)-([A-Za-z0-9+/=]+)$/
Expand Down Expand Up @@ -242,4 +242,3 @@ function writeJsonFile (filePath: string, data: unknown) {
process.on('uncaughtException', (err) => {
console.error(err)
})

Loading