-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
38 lines (31 loc) · 1.21 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { ConfigurationKeys } from './configuration'
export type Template<T> = { [key: string]: T | ((option?: Option) => T) }
type Dependencies = { [key: string]: string }
export type PackageJson = {
name: string
author?: string | { name: string }
localDependencies?: Dependencies
configuration?: { [key: string]: string | object | string[] }
}
export type File = { name: string; contents: string; commitFile?: boolean; folder?: boolean }
export type Configuration = {
name: ConfigurationKeys
alias?: ConfigurationKeys
configuration: {
templates?: Template<string | object | string[]>
// biome-ignore lint/suspicious/noExplicitAny: Will be specified in file explicitly.
createFile: (value?: any) => File | (File | undefined)[] | undefined
extension?: (path: string) => object
}
}
export type Option = string | { extends?: string; folder?: string } | true
export type Options = Option | Option[]
export interface State {
options: { [Key in ConfigurationKeys]?: Options }
// Where does the configuration come from package.json => configuration: json
extension: 'ts' | 'js' | 'json' | 'cjs' | 'mjs'
packageJson: PackageJson
directory: string
root: boolean
pendingIgnores: string[]
}