Skip to content

Commit

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

import type { JsonObject } from '@flex-development/tutils'
import type TestSubject from '../scripts'

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

it('should be json object', () => {
expectTypeOf<TestSubject>().toMatchTypeOf<JsonObject>()
})

it('should only have string values', () => {
expectTypeOf<TestSubject[string]>().toBeString()
})
})
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
export type { default as DependencyMap } from './dependency-map'
export type { default as Directories } from './directories'
export type { default as PublishConfig } from './publish-config'
export type { default as Scripts } from './scripts'
51 changes: 51 additions & 0 deletions src/interfaces/scripts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @file Interfaces - Scripts
* @module pkg-types/interfaces/Scripts
*/

import type { JsonObject } from '@flex-development/tutils'

/**
* Package lifecycle scripts.
*
* @see https://docs.npmjs.com/cli/using-npm/scripts
* @see https://yarnpkg.com/advanced/lifecycle-scripts
* @see https://classic.yarnpkg.com/en/docs/package-json#toc-scripts
*
* @extends {JsonObject}
*/
interface Scripts extends JsonObject {
[script: string]: string

install?: string
postinstall?: string
postpack?: string
postpublish?: string
postrestart?: string
poststart?: string
poststop?: string
posttest?: string
postuninstall?: string
postversion?: string
preinstall?: string
prepack?: string
prepare?: string
prepublish?: string
prepublishOnly?: string
prerestart?: string
prestart?: string
prestop?: string
pretest?: string
preuninstall?: string
preversion?: string
publish?: string
restart?: string
start?: string
stop?: string
test?: string
typecheck?: string
uninstall?: string
version?: string
}

export type { Scripts as default }

0 comments on commit b9db53b

Please sign in to comment.