Skip to content

Commit

Permalink
feat(interfaces): InstallConfig
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Dec 1, 2022
1 parent 154c209 commit ef89d52
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/interfaces/__tests__/install-config.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @file Unit Tests - InstallConfig
* @module pkg-types/interfaces/tests/InstallConfig
*/

import type TestSubject from '../install-config'

describe('unit:interfaces/InstallConfig', () => {
it('should allow empty object', () => {
assertType<TestSubject>({})
})

it('should allow object that only has property "hoistingLimits"', () => {
assertType<TestSubject>({ hoistingLimits: 'workspaces' })
})

it('should allow object that only has property "selfReferences"', () => {
assertType<TestSubject>({ selfReferences: true })
})

it('should allow object with all properties', () => {
assertType<Required<TestSubject>>({
hoistingLimits: 'none',
selfReferences: true
})
})
})
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

export type { default as BugsObject } from './bugs-object'
export type { default as DependencyMeta } from './dependency-meta'
export type { default as InstallConfig } from './install-config'
export type { default as PeerDependencyMeta } from './peer-dependency-meta'
export type { default as WorkspacesConfig } from './workspaces-config'
34 changes: 34 additions & 0 deletions src/interfaces/install-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @file Interfaces - InstallConfig
* @module pkg-types/interfaces/InstallConfig
*/

import type { HoistingLimits } from '#src/types'

/**
* Yarn workspace install configuration.
*
* @see https://yarnpkg.com/configuration/manifest#installConfig
*/
interface InstallConfig {
/**
* Highest point where packages can be hoisted.
*
* [1]: https://yarnpkg.com/configuration/yarnrc#nmHoistingLimits
*
* **Note**: Overrides [`nmHoistingLimits`][1].
*/
hoistingLimits?: HoistingLimits

/**
* Indicates if workspace is allowed to require itself. Results in creation of
* self-referencing symlinks.
*
* [1]: https://yarnpkg.com/configuration/yarnrc#nmSelfReferences
*
* **Note**: Overrides [`nmSelfReferences`][1].
*/
selfReferences?: boolean
}

export type { InstallConfig as default }

0 comments on commit ef89d52

Please sign in to comment.