mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 02:51:59 -04:00
* feat: this is a best attempt at flattening the dependency tree, similar to what npm does * test: shamefullyFlatten option * feat: when uninstalling, if shamefully-flatten is true, we need to re-flatten * fix: use new shrinkwrap, not the old one * fix: changes suggested in PR * test: remove test.only * fix: various bugs in uninstall and general install, added tests * test: fix test * test: use project.has and project.hasNot correctly * test: remove test.only * test: added tsconfig.json, added lint-test script, lint fixes * test: use correct message * fix: check should work on windows too
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import storePath from '@pnpm/store-path'
|
|
import {InstallOptions} from 'supi'
|
|
import path = require('path')
|
|
import createStore from 'package-store'
|
|
import createFetcher from '@pnpm/default-fetcher'
|
|
import createResolver from '@pnpm/default-resolver'
|
|
|
|
const registry = 'http://localhost:4873/'
|
|
|
|
const retryOpts = {
|
|
fetchRetries: 2,
|
|
fetchRetryFactor: 10,
|
|
fetchRetryMintimeout: 10_000,
|
|
fetchRetryMaxtimeout: 60_000,
|
|
}
|
|
|
|
export default async function testDefaults (
|
|
opts?: any, // tslint:disable-line
|
|
resolveOpts?: any, // tslint:disable-line
|
|
fetchOpts?: any, // tslint:disable-line
|
|
storeOpts?: any, // tslint:disable-line
|
|
): Promise<InstallOptions> {
|
|
let store = opts && opts.store || path.resolve('..', '.store')
|
|
store = await storePath(opts && opts.prefix || process.cwd(), store)
|
|
const rawNpmConfig = {registry}
|
|
const storeController = await createStore(
|
|
createResolver({
|
|
metaCache: new Map(),
|
|
rawNpmConfig,
|
|
store,
|
|
strictSsl: true,
|
|
...retryOpts,
|
|
...resolveOpts,
|
|
}),
|
|
createFetcher({
|
|
alwaysAuth: true,
|
|
registry,
|
|
rawNpmConfig,
|
|
...retryOpts,
|
|
...fetchOpts,
|
|
}) as {},
|
|
{
|
|
store,
|
|
locks: path.join(store, '_locks'),
|
|
...storeOpts,
|
|
}
|
|
)
|
|
return {
|
|
store,
|
|
storeController,
|
|
registry,
|
|
...opts,
|
|
}
|
|
}
|