mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
refactor(core): export MutateModulesOptions
This commit is contained in:
5
.changeset/dull-wolves-pull.md
Normal file
5
.changeset/dull-wolves-pull.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/core": patch
|
||||
---
|
||||
|
||||
Export `MutateModulesOptions`.
|
||||
@@ -37,6 +37,7 @@ export interface StrictInstallOptions {
|
||||
storeDir: string
|
||||
reporter: ReporterFunction
|
||||
force: boolean
|
||||
forcePublicHoistPattern: boolean
|
||||
update: boolean
|
||||
updateMatching?: (pkgName: string) => boolean
|
||||
updatePackageManifest?: boolean
|
||||
|
||||
@@ -145,11 +145,13 @@ interface ProjectToBeInstalled {
|
||||
|
||||
export type MutatedProject = ProjectOptions & DependenciesMutation
|
||||
|
||||
export type MutateModulesOptions = InstallOptions & {
|
||||
preferredVersions?: PreferredVersions
|
||||
}
|
||||
|
||||
export async function mutateModules (
|
||||
projects: MutatedProject[],
|
||||
maybeOpts: InstallOptions & {
|
||||
preferredVersions?: PreferredVersions
|
||||
}
|
||||
maybeOpts: MutateModulesOptions
|
||||
): Promise<UpdatedProject[]> {
|
||||
const reporter = maybeOpts?.reporter
|
||||
if ((reporter != null) && typeof reporter === 'function') {
|
||||
|
||||
@@ -13,6 +13,7 @@ import { IncludedDependencies, Project } from '@pnpm/types'
|
||||
import {
|
||||
install,
|
||||
mutateModules,
|
||||
MutateModulesOptions,
|
||||
MutatedProject,
|
||||
WorkspacePackages,
|
||||
} from '@pnpm/core'
|
||||
@@ -174,7 +175,7 @@ when running add/update with the --workspace option')
|
||||
}
|
||||
|
||||
const store = await createOrConnectStoreController(opts)
|
||||
const installOpts = {
|
||||
const installOpts: MutateModulesOptions = {
|
||||
...opts,
|
||||
...getOptionsFromRootManifest(manifest),
|
||||
forceHoistPattern,
|
||||
@@ -223,14 +224,14 @@ when running add/update with the --workspace option')
|
||||
if (params?.length) {
|
||||
const mutatedProject: MutatedProject = {
|
||||
allowNew: opts.allowNew,
|
||||
binsDir: installOpts.bin,
|
||||
binsDir: opts.bin,
|
||||
dependencySelectors: params,
|
||||
manifest,
|
||||
mutation: 'installSome',
|
||||
peer: opts.savePeer,
|
||||
pinnedVersion: getPinnedVersion(opts),
|
||||
rootDir: installOpts.dir,
|
||||
targetDependenciesField: getSaveType(installOpts),
|
||||
rootDir: opts.dir,
|
||||
targetDependenciesField: getSaveType(opts),
|
||||
}
|
||||
let [updatedImporter] = await mutateModules([mutatedProject], installOpts)
|
||||
if (opts.save !== false) {
|
||||
|
||||
Reference in New Issue
Block a user