mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
refactor: move Project and ProjectsGraph to @pnpm/types
This commit is contained in:
5
.changeset/honest-maps-explode.md
Normal file
5
.changeset/honest-maps-explode.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/config": major
|
||||
---
|
||||
|
||||
Move Project and ProjectsGraph to @pnpm/types.
|
||||
5
.changeset/tender-actors-repair.md
Normal file
5
.changeset/tender-actors-repair.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/types": minor
|
||||
---
|
||||
|
||||
Add Project and ProjectsGraph types.
|
||||
@@ -1,18 +1,11 @@
|
||||
import {
|
||||
ProjectManifest,
|
||||
Project,
|
||||
ProjectsGraph,
|
||||
Registries,
|
||||
} from '@pnpm/types'
|
||||
|
||||
export type UniversalOptions = Pick<Config, 'color' | 'dir' | 'rawConfig' | 'rawLocalConfig'>
|
||||
|
||||
export type Project = {
|
||||
dir: string,
|
||||
manifest: ProjectManifest,
|
||||
writeProjectManifest (manifest: ProjectManifest, force?: boolean | undefined): Promise<void>,
|
||||
}
|
||||
|
||||
export type ProjectsGraph = Record<string, { dependencies: string[], package: Project }>
|
||||
|
||||
export interface Config {
|
||||
allProjects?: Project[],
|
||||
selectedProjectsGraph?: ProjectsGraph,
|
||||
|
||||
@@ -9,14 +9,12 @@ import whichcb = require('which')
|
||||
import {
|
||||
Config,
|
||||
ConfigWithDeprecatedSettings,
|
||||
Project,
|
||||
ProjectsGraph,
|
||||
UniversalOptions,
|
||||
} from './Config'
|
||||
import findBestGlobalPrefixOnWindows from './findBestGlobalPrefixOnWindows'
|
||||
import getScopeRegistries, { normalizeRegistry } from './getScopeRegistries'
|
||||
|
||||
export { Config, UniversalOptions, Project, ProjectsGraph }
|
||||
export { Config, UniversalOptions }
|
||||
|
||||
const npmDefaults = loadNpmConf.defaults
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/cli-utils": "workspace:0.4.9",
|
||||
"@pnpm/config": "workspace:9.2.0",
|
||||
"@pnpm/constants": "workspace:4.0.0",
|
||||
"@pnpm/types": "workspace:6.1.0",
|
||||
"find-packages": "workspace:7.0.11",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { packageIsInstallable } from '@pnpm/cli-utils'
|
||||
import { Project } from '@pnpm/config'
|
||||
import { WORKSPACE_MANIFEST_FILENAME } from '@pnpm/constants'
|
||||
import { Project } from '@pnpm/types'
|
||||
import findPackages from 'find-packages'
|
||||
import path = require('path')
|
||||
import readYamlFile from 'read-yaml-file'
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
{
|
||||
"path": "../cli-utils"
|
||||
},
|
||||
{
|
||||
"path": "../config"
|
||||
},
|
||||
{
|
||||
"path": "../constants"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
RecursiveSummary,
|
||||
throwOnCommandFail,
|
||||
} from '@pnpm/cli-utils'
|
||||
import { Config, Project, ProjectsGraph } from '@pnpm/config'
|
||||
import { Config } from '@pnpm/config'
|
||||
import PnpmError from '@pnpm/error'
|
||||
import { arrayOfWorkspacePackagesToMap } from '@pnpm/find-workspace-packages'
|
||||
import logger from '@pnpm/logger'
|
||||
@@ -15,7 +15,9 @@ import { createOrConnectStoreController, CreateStoreControllerOptions } from '@p
|
||||
import {
|
||||
IncludedDependencies,
|
||||
PackageManifest,
|
||||
Project,
|
||||
ProjectManifest,
|
||||
ProjectsGraph,
|
||||
} from '@pnpm/types'
|
||||
import camelcaseKeys = require('camelcase-keys')
|
||||
import isSubdir = require('is-subdir')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Config, Project } from '@pnpm/config'
|
||||
import { Config } from '@pnpm/config'
|
||||
import logger from '@pnpm/logger'
|
||||
import { IncludedDependencies } from '@pnpm/types'
|
||||
import { IncludedDependencies, Project } from '@pnpm/types'
|
||||
import { render } from './list'
|
||||
|
||||
export default async (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Config, Project } from '@pnpm/config'
|
||||
import { Config } from '@pnpm/config'
|
||||
import createResolver from '@pnpm/npm-resolver'
|
||||
import pickRegistryForPackage from '@pnpm/pick-registry-for-package'
|
||||
import { ResolveFunction } from '@pnpm/resolver-base'
|
||||
|
||||
@@ -4,15 +4,13 @@ import {
|
||||
} from '@pnpm/cli-utils'
|
||||
import {
|
||||
Config,
|
||||
Project,
|
||||
ProjectsGraph,
|
||||
types as allTypes,
|
||||
} from '@pnpm/config'
|
||||
import { arrayOfWorkspacePackagesToMap } from '@pnpm/find-workspace-packages'
|
||||
import logger from '@pnpm/logger'
|
||||
import sortPackages from '@pnpm/sort-packages'
|
||||
import { createOrConnectStoreController, CreateStoreControllerOptions } from '@pnpm/store-connection-manager'
|
||||
import { PackageManifest, ProjectManifest } from '@pnpm/types'
|
||||
import { Project, ProjectManifest } from '@pnpm/types'
|
||||
import camelcaseKeys = require('camelcase-keys')
|
||||
import mem = require('mem')
|
||||
import pLimit = require('p-limit')
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { RecursiveSummary, throwOnCommandFail } from '@pnpm/cli-utils'
|
||||
import { Config, ProjectsGraph } from '@pnpm/config'
|
||||
import { Config } from '@pnpm/config'
|
||||
import PnpmError from '@pnpm/error'
|
||||
import runLifecycleHooks from '@pnpm/lifecycle'
|
||||
import logger from '@pnpm/logger'
|
||||
import sortPackages from '@pnpm/sort-packages'
|
||||
import { PackageManifest } from '@pnpm/types'
|
||||
import pLimit = require('p-limit')
|
||||
import path = require('path')
|
||||
import realpathMissing = require('realpath-missing')
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"@pnpm/sort-packages": "link:"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/config": "workspace:9.2.0",
|
||||
"@pnpm/types": "workspace:^6.1.0",
|
||||
"graph-sequencer": "2.0.0"
|
||||
},
|
||||
"funding": "https://opencollective.com/pnpm"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ProjectsGraph } from '@pnpm/config'
|
||||
import { ProjectsGraph } from '@pnpm/types'
|
||||
import graphSequencer = require('graph-sequencer')
|
||||
|
||||
export default function sortPackages (pkgGraph: ProjectsGraph): string[][] {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../config"
|
||||
"path": "../types"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './misc'
|
||||
export * from './options'
|
||||
export * from './package'
|
||||
export * from './project'
|
||||
|
||||
9
packages/types/src/project.ts
Normal file
9
packages/types/src/project.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ProjectManifest } from './package'
|
||||
|
||||
export type Project = {
|
||||
dir: string,
|
||||
manifest: ProjectManifest,
|
||||
writeProjectManifest (manifest: ProjectManifest, force?: boolean | undefined): Promise<void>,
|
||||
}
|
||||
|
||||
export type ProjectsGraph = Record<string, { dependencies: string[], package: Project }>
|
||||
6
pnpm-lock.yaml
generated
6
pnpm-lock.yaml
generated
@@ -503,7 +503,6 @@ importers:
|
||||
packages/find-workspace-packages:
|
||||
dependencies:
|
||||
'@pnpm/cli-utils': 'link:../cli-utils'
|
||||
'@pnpm/config': 'link:../config'
|
||||
'@pnpm/constants': 'link:../constants'
|
||||
'@pnpm/types': 'link:../types'
|
||||
find-packages: 'link:../find-packages'
|
||||
@@ -512,7 +511,6 @@ importers:
|
||||
'@pnpm/find-workspace-packages': 'link:'
|
||||
specifiers:
|
||||
'@pnpm/cli-utils': 'workspace:0.4.9'
|
||||
'@pnpm/config': 'workspace:9.2.0'
|
||||
'@pnpm/constants': 'workspace:4.0.0'
|
||||
'@pnpm/find-workspace-packages': 'link:'
|
||||
'@pnpm/types': 'workspace:6.1.0'
|
||||
@@ -2525,13 +2523,13 @@ importers:
|
||||
uuid: ^3.4.0
|
||||
packages/sort-packages:
|
||||
dependencies:
|
||||
'@pnpm/config': 'link:../config'
|
||||
'@pnpm/types': 'link:../types'
|
||||
graph-sequencer: 2.0.0
|
||||
devDependencies:
|
||||
'@pnpm/sort-packages': 'link:'
|
||||
specifiers:
|
||||
'@pnpm/config': 'workspace:9.2.0'
|
||||
'@pnpm/sort-packages': 'link:'
|
||||
'@pnpm/types': 'workspace:^6.1.0'
|
||||
graph-sequencer: 2.0.0
|
||||
packages/store-connection-manager:
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user