refactor: move option type to @pnpm/types

This commit is contained in:
Zoltan Kochan
2017-12-04 21:39:47 +02:00
parent bf945814e4
commit 8f030ed109
17 changed files with 50 additions and 181 deletions

View File

@@ -19,7 +19,7 @@
"@pnpm/logger": "^1.0.0"
},
"dependencies": {
"@pnpm/types": "^1.1.0",
"@pnpm/types": "^1.2.1",
"@types/byline": "^4.2.31",
"@types/common-tags": "^1.2.5",
"@types/load-json-file": "^2.0.5",

View File

@@ -1,5 +1,5 @@
dependencies:
'@pnpm/types': 1.1.0
'@pnpm/types': 1.2.1
'@types/byline': 4.2.31
'@types/common-tags': 1.4.0
'@types/load-json-file': 2.0.7
@@ -188,7 +188,7 @@ packages:
integrity: sha512-ZNaOAOvl9J45nhrnMcRxT9wd2G6hPzC444nRmo8Wk/GmY6dd8FVN/XG/nEdHPjcYPyyrW2UA3McNi+klB9oBHw==
/@pnpm/git-resolver/0.1.0:
dependencies:
'@types/node': 8.0.53
'@types/node': 8.0.54
graceful-git: 1.0.1
hosted-git-info: 2.5.0
normalize-ssh: 1.0.0
@@ -201,8 +201,8 @@ packages:
integrity: sha512-wGo7xkIcjk1eqRpO0QIGG4+3l7ReoAkGNHdynOofAOtqgN6GxHuOYaWOKOckUi1zegqAn/eGWc+awbrr1CmuEA==
/@pnpm/local-resolver/0.1.0:
dependencies:
'@pnpm/types': 1.1.0
'@types/node': 8.0.53
'@pnpm/types': 1.2.1
'@types/node': 8.0.54
normalize-path: 2.1.1
osenv: 0.1.4
read-package-json: 2.0.12
@@ -224,9 +224,9 @@ packages:
integrity: sha512-VRqE5/SiuR7ZrwBmS+Af89BTXli5xBbiqu7WPq56gEtWT8dKf9rFLoimmmMBVeRq5LmVZIXlOxs29F9I+vgSvQ==
/@pnpm/npm-resolver/0.1.0:
dependencies:
'@pnpm/types': 1.1.0
'@pnpm/types': 1.2.1
'@types/load-json-file': 2.0.7
'@types/node': 8.0.53
'@types/node': 8.0.54
'@types/semver': 5.4.0
'@types/write-json-file': 2.2.1
encode-registry: 1.1.0
@@ -250,14 +250,10 @@ packages:
node: '>=4'
resolution:
integrity: sha512-Ieeu9Gg5qZkUdgnsHkjFlqr1Gp2z0LegDnCKe7l4l2klnH5Yp2fjqegfkebpM7Qut9YYe+aFsXFWxSCUk13Z8g==
/@pnpm/types/1.0.0:
/@pnpm/types/1.2.1:
dev: false
resolution:
integrity: sha512-2BQ/X7qS3bCWOFR+HMQ3ZR1qU1KZNGGjfF6fvMPbYq3kZBGr5i57je4XTHADuiVRv0t6wJ4Ev+X4bw6GktbFYQ==
/@pnpm/types/1.1.0:
dev: false
resolution:
integrity: sha512-KB3/erhXOVDj7D7mCWvaSKhGT9FBSZqhOCfyNXiy3/TI9ziUCcXxvEiF7hv6SpaU5aNRrMsxmH3+jrLJFrRWrw==
integrity: sha512-gvOa3EP2z7O+IFiYsRBB+SBdnyE+SHTVFM5bPr2WGHhPhrScMUJ2jqgzlC79FgRP9c7uoe8Wbp3LYClEDh/U6A==
/@types/byline/4.2.31:
dependencies:
'@types/node': 8.0.53
@@ -268,6 +264,9 @@ packages:
dev: false
resolution:
integrity: sha512-HI1tSO87vmd1sPS3DOVSK4gvVKROvCBFvAnXlLiQtAus/+1xXMQcNyu9TX2ChwRXFeQZeB9+f+nMo99xLd5DdA==
/@types/events/1.1.0:
resolution:
integrity: sha512-y3bR98mzYOo0pAZuiLari+cQyiKk3UXRuT45h1RjhfeCzqkjaVsfZJNaxdgtk7/3tzOm1ozLTqEqMP3VbI48jw==
/@types/fs-extra/4.0.5:
dependencies:
'@types/node': 8.0.53
@@ -301,12 +300,12 @@ packages:
integrity: sha512-XA4vNO6GCBz8Smq0hqSRo4yRWMqr4FPQrWjhJt6nKskzly4/p87SfuJMFYGRyYb6jo2WNIQU2FDBsY5r1BibUA==
/@types/mz/0.0.31:
dependencies:
'@types/node': 8.0.53
'@types/node': 8.0.54
resolution:
integrity: sha1-pNgMCC/v5x5Ap8DwfR5lVbu8e1I=
/@types/mz/0.0.32:
dependencies:
'@types/node': 8.0.53
'@types/node': 8.0.54
resolution:
integrity: sha512-cy3yebKhrHuOcrJGkfwNHhpTXQLgmXSv1BX+4p32j+VUQ6aP2eJ5cL7OvGcAQx75fCTFaAIIAKewvqL+iwSd4g==
/@types/node/7.0.48:
@@ -316,6 +315,11 @@ packages:
/@types/node/8.0.53:
resolution:
integrity: sha512-54Dm6NwYeiSQmRB1BLXKr5GELi0wFapR1npi8bnZhEcu84d/yQKqnwwXQ56hZ0RUbTG6L5nqDZaN3dgByQXQRQ==
/@types/node/8.0.54:
dependencies:
'@types/events': 1.1.0
resolution:
integrity: sha512-qetMdTv3Ytz9u9ESLdcYs45LPI0mczYZIbC184n7kY0jczOqPNQsabBfVCh+na3B2shAfvC459JqHV771A8Rxg==
/@types/nopt/3.0.29:
dev: false
resolution:
@@ -448,14 +452,14 @@ packages:
node: '>= 0.6'
resolution:
integrity: sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=
/ajv/5.5.0:
/ajv/5.5.1:
dependencies:
co: 4.6.0
fast-deep-equal: 1.0.0
fast-json-stable-stringify: 2.0.0
json-schema-traverse: 0.3.1
resolution:
integrity: sha1-6yhAdG6dxIvV4GOjbj/UAMXqtak=
integrity: sha1-s4u4h22ehr7plJVqBOch6IskjrI=
/align-text/0.1.4:
dependencies:
kind-of: 3.2.2
@@ -1487,6 +1491,11 @@ packages:
'0': node >=0.6.0
resolution:
integrity: sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=
/extsprintf/1.4.0:
engines:
'0': node >=0.6.0
resolution:
integrity: sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
/fast-deep-equal/1.0.0:
resolution:
integrity: sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=
@@ -1792,7 +1801,7 @@ packages:
integrity: sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=
/har-validator/5.0.3:
dependencies:
ajv: 5.5.0
ajv: 5.5.1
har-schema: 2.0.0
engines:
node: '>=4'
@@ -3003,9 +3012,9 @@ packages:
'@pnpm/local-resolver': 0.1.0
'@pnpm/npm-resolver': 0.1.0
'@pnpm/tarball-resolver': 0.1.0
'@pnpm/types': 1.0.0
'@pnpm/types': 1.2.1
'@types/load-json-file': 2.0.7
'@types/node': 8.0.53
'@types/node': 8.0.54
'@types/ramda': 0.25.6
'@types/retry': 0.10.2
credentials-by-uri: 1.0.0
@@ -3978,7 +3987,7 @@ packages:
/symlink-dir/1.1.0:
dependencies:
'@types/mz': 0.0.31
'@types/node': 8.0.53
'@types/node': 8.0.54
graceful-fs: 4.1.11
is-windows: 1.0.1
mkdirp-promise: 5.0.1
@@ -4242,7 +4251,7 @@ packages:
integrity: sha1-HAgkFQSBvHoB1J6Y8exmjYJBLzs=
/unpack-stream/2.2.0:
dependencies:
'@types/node': 8.0.53
'@types/node': 8.0.54
decompress-maybe: 1.0.0
ssri: 5.0.0
tar-fs: 1.16.0
@@ -4368,7 +4377,7 @@ packages:
dependencies:
assert-plus: 1.0.0
core-util-is: 1.0.2
extsprintf: 1.3.0
extsprintf: 1.4.0
engines:
'0': node >=0.6.0
resolution:
@@ -4511,7 +4520,7 @@ specifiers:
'@commitlint/config-angular': ^4.2.0
'@commitlint/prompt-cli': ^4.2.0
'@pnpm/logger': ^1.0.0
'@pnpm/types': ^1.1.0
'@pnpm/types': ^1.2.1
'@types/byline': ^4.2.31
'@types/common-tags': ^1.2.5
'@types/load-json-file': ^2.0.5

View File

@@ -1,4 +1,4 @@
import {StrictPnpmOptions, PnpmOptions} from '../types'
import {StrictPnpmOptions, PnpmOptions} from '@pnpm/types'
import path = require('path')
import logger from '@pnpm/logger'
import pnpmPkgJson from '../pnpmPkgJson'
@@ -82,5 +82,6 @@ export default async (opts?: PnpmOptions): Promise<StrictPnpmOptions> => {
const subfolder = LAYOUT_VERSION.toString() + (extendedOpts.independentLeaves ? '_independent_leaves' : '')
extendedOpts.prefix = path.join(extendedOpts.prefix, subfolder)
}
extendedOpts.rawNpmConfig['registry'] = extendedOpts.registry
return extendedOpts
}

View File

@@ -6,7 +6,7 @@ import {
Store,
read as readStore,
} from 'package-store'
import {StrictPnpmOptions} from '../types'
import {StrictPnpmOptions} from '@pnpm/types'
import {
readWanted as readWantedShrinkwrap,
readCurrent as readCurrentShrinkwrap,

View File

@@ -1,6 +1,8 @@
import {
Dependencies,
PackageJson,
PnpmOptions,
StrictPnpmOptions,
} from '@pnpm/types'
import path = require('path')
import RegClient = require('npm-registry-client')
@@ -20,8 +22,6 @@ import R = require('ramda')
import safeIsInnerLink from '../safeIsInnerLink'
import {fromDir as safeReadPkgFromDir} from '../fs/safeReadPkg'
import {
PnpmOptions,
StrictPnpmOptions,
WantedDependency,
} from '../types'
import getContext, {PnpmContext} from './getContext'
@@ -356,7 +356,7 @@ async function installInContext (
offline: opts.offline,
rawNpmConfig: opts.rawNpmConfig,
nodeModules: nodeModulesPath,
metaCache: opts.metaCache,
metaCache: opts.metaCache as Map<string, PackageMeta>,
verifyStoreInegrity: opts.verifyStoreIntegrity,
engineStrict: opts.engineStrict,
nodeVersion: opts.nodeVersion,

View File

@@ -5,7 +5,7 @@ import logger, {streamParser} from '@pnpm/logger'
import {install} from './install'
import pathAbsolute = require('path-absolute')
import {linkPkgBins} from '../link/linkBins'
import {PnpmOptions} from '../types'
import {PnpmOptions} from '@pnpm/types'
import extendOptions from './extendOptions'
const linkLogger = logger('link')

View File

@@ -2,7 +2,7 @@ import {PackageJson} from '@pnpm/types'
import path = require('path')
import R = require('ramda')
import getContext from './getContext'
import {PnpmOptions} from '../types'
import {PnpmOptions} from '@pnpm/types'
import extendOptions from './extendOptions'
import getPkgDirs from '../fs/getPkgDirs'
import {fromDir as readPkgFromDir} from '../fs/readPkg'

View File

@@ -1,4 +1,4 @@
import {PnpmOptions, StrictPnpmOptions} from '../types'
import {PnpmOptions, StrictPnpmOptions} from '@pnpm/types'
import extendOptions from './extendOptions'
import getContext from './getContext'
import logger, {streamParser} from '@pnpm/logger'

View File

@@ -1,5 +1,5 @@
import path = require('path')
import {PnpmOptions} from '../types'
import {PnpmOptions} from '@pnpm/types'
import extendOptions from './extendOptions'
import getContext from './getContext'
import logger, {streamParser} from '@pnpm/logger'

View File

@@ -1,6 +1,6 @@
import path = require('path')
import pFilter = require('p-filter')
import {PnpmOptions} from '../types'
import {PnpmOptions} from '@pnpm/types'
import extendOptions from './extendOptions'
import getContext from './getContext'
import {pkgIsUntouched as untouched} from 'package-store'

View File

@@ -4,7 +4,7 @@ import getContext, {PnpmContext} from './getContext'
import getSaveType from '../getSaveType'
import removeDeps from '../removeDeps'
import extendOptions from './extendOptions'
import {PnpmOptions, StrictPnpmOptions} from '../types'
import {PnpmOptions, StrictPnpmOptions} from '@pnpm/types'
import lock from './lock'
import {
Shrinkwrap,

View File

@@ -1,5 +1,5 @@
import path = require('path')
import {PnpmOptions, StrictPnpmOptions} from '../types'
import {PnpmOptions, StrictPnpmOptions} from '@pnpm/types'
import extendOptions from './extendOptions'
import isInnerLink = require('is-inner-link')
import logger, {streamParser} from '@pnpm/logger'

View File

@@ -1,4 +1,4 @@
import {PnpmOptions} from './types'
import {PnpmOptions} from '@pnpm/types'
export type DependenciesType = 'dependencies' | 'devDependencies' | 'optionalDependencies'
export const dependenciesTypes: DependenciesType[] = ['dependencies', 'devDependencies', 'optionalDependencies']

View File

@@ -1,9 +1,8 @@
// Patch the global fs module here at the app level
import './fs/gracefulify'
export {PackageManifest} from '@pnpm/types'
export {PackageManifest, PnpmOptions} from '@pnpm/types'
export * from './api'
export {PnpmOptions} from './types'
export {PnpmError, PnpmErrorCode} from './errorTypes'
export {
PackageJsonLog,

View File

@@ -15,10 +15,10 @@ import {
} from 'package-store'
import {InstallContext, InstalledPackages} from '../api/install'
import {
ReadPackageHook,
WantedDependency,
} from '../types'
import {
ReadPackageHook,
Dependencies,
PackageManifest,
} from '@pnpm/types'

View File

@@ -3,148 +3,8 @@ import {
PackageBin,
PackageManifest,
} from '@pnpm/types'
import {PackageMeta} from 'package-store'
import {LogBase} from '@pnpm/logger'
export type PnpmOptions = {
rawNpmConfig?: Object,
global?: boolean,
prefix?: string,
bin?: string,
ignoreScripts?: boolean
save?: boolean,
saveProd?: boolean,
saveDev?: boolean,
saveOptional?: boolean,
production?: boolean,
development?: boolean,
fetchRetries?: number,
fetchRetryFactor?: number,
fetchRetryMintimeout?: number,
fetchRetryMaxtimeout?: number,
saveExact?: boolean,
savePrefix?: string,
force?: boolean,
depth?: number,
engineStrict?: boolean,
nodeVersion?: string,
offline?: boolean,
registry?: string,
optional?: boolean,
// proxy
proxy?: string,
httpsProxy?: string,
localAddress?: string,
// ssl
cert?: string,
key?: string,
ca?: string,
strictSsl?: boolean,
userAgent?: string,
tag?: string,
metaCache?: Map<string, PackageMeta>,
alwaysAuth?: boolean,
// pnpm specific configs
storePath?: string, // DEPRECATED! store should be used
store?: string,
verifyStoreIntegrity?: boolean,
networkConcurrency?: number,
fetchingConcurrency?: number,
lockStaleDuration?: number,
lock?: boolean,
childConcurrency?: number,
repeatInstallDepth?: number,
independentLeaves?: boolean,
// cannot be specified via configs
update?: boolean,
reporter?: (logObj: LogBase) => void,
packageManager?: {
name: string,
version: string,
},
hooks?: {
readPackage?: ReadPackageHook,
},
ignoreFile?: (filename: string) => boolean,
}
export type ReadPackageHook = (pkg: PackageManifest) => PackageManifest
export type StrictPnpmOptions = PnpmOptions & {
rawNpmConfig: Object,
global: boolean,
prefix: string,
bin: string,
ignoreScripts: boolean
save: boolean,
saveProd: boolean,
saveDev: boolean,
saveOptional: boolean,
production: boolean,
development: boolean,
fetchRetries: number,
fetchRetryFactor: number,
fetchRetryMintimeout: number,
fetchRetryMaxtimeout: number,
saveExact: boolean,
savePrefix: string,
force: boolean,
depth: number,
engineStrict: boolean,
nodeVersion: string,
offline: boolean,
registry: string,
optional: boolean,
// proxy
proxy?: string,
httpsProxy?: string,
localAddress?: string,
// ssl
cert?: string,
key?: string,
ca?: string,
strictSsl: boolean,
userAgent: string,
tag: string,
metaCache: Map<string, PackageMeta>,
alwaysAuth: boolean,
// pnpm specific configs
store: string,
verifyStoreIntegrity: boolean,
networkConcurrency: number,
fetchingConcurrency: number,
lockStaleDuration: number,
lock: boolean,
childConcurrency: number,
repeatInstallDepth: number,
independentLeaves: boolean,
locks: string,
// cannot be specified via configs
update: boolean,
packageManager: {
name: string,
version: string,
},
hooks: {
readPackage?: ReadPackageHook,
},
}
export type WantedDependency = {
alias?: string,
pref: string, // package reference

View File

@@ -25,7 +25,7 @@ test('should fail to update when requests are cached', async function (t) {
await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0')
})
test('should not cache when cache is not used', async function (t) {
test('should not cache when cache is not used', async (t: tape.Test) => {
const project = prepare(t)
await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest')