1 | import type {
|
2 | BaseGenerator,
|
3 | ComposeOptions as EnvironmentComposeOptions,
|
4 | GeneratorFeatures as FeaturesApi,
|
5 | GeneratorOptions as OptionsApi,
|
6 | ProgressOptions,
|
7 | } from '@yeoman/types';
|
8 | import type { JSONSchema7Type } from 'json-schema';
|
9 | import type { PipelineOptions } from 'mem-fs';
|
10 | import type { MemFsEditorFile } from 'mem-fs-editor';
|
11 | import type Storage from './util/storage.js';
|
12 | import type Generator from './index.js';
|
13 |
|
14 | export type StorageValue = JSONSchema7Type;
|
15 | export type StorageRecord = Record<string, StorageValue>;
|
16 | export type GeneratorPipelineOptions = PipelineOptions<MemFsEditorFile> & ProgressOptions & { pendingFiles?: boolean };
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | type QueueOptions = {
|
22 |
|
23 | queueName?: string;
|
24 |
|
25 |
|
26 | once?: boolean;
|
27 |
|
28 |
|
29 | run?: boolean;
|
30 |
|
31 |
|
32 | edit?: boolean;
|
33 |
|
34 |
|
35 | skip?: boolean;
|
36 |
|
37 |
|
38 | args?: any[] | ((generator: Generator) => any[]);
|
39 | };
|
40 |
|
41 | /**
|
42 | * Task options.
|
43 | */
|
44 | export type TaskOptions = QueueOptions & {
|
45 | /** Reject callback. */
|
46 | reject?: (error: unknown) => void;
|
47 |
|
48 | taskPrefix?: string;
|
49 |
|
50 | auto?: boolean;
|
51 |
|
52 | taskOrigin?: any;
|
53 |
|
54 | cancellable?: boolean;
|
55 | };
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | export type Priority = QueueOptions & {
|
61 |
|
62 | priorityName: string;
|
63 |
|
64 | before?: string;
|
65 | };
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | export type Task<TaskContext = any> = TaskOptions & {
|
71 |
|
72 |
|
73 | method: (this: TaskContext, ...args: any[]) => unknown | Promise<unknown>;
|
74 |
|
75 |
|
76 | taskName: string;
|
77 | };
|
78 |
|
79 | export type BaseFeatures = FeaturesApi & {
|
80 |
|
81 | uniqueBy?: string;
|
82 |
|
83 |
|
84 | unique?: true | 'argument' | 'namespace';
|
85 |
|
86 |
|
87 | tasksMatchingPriority?: boolean;
|
88 |
|
89 |
|
90 | taskPrefix?: string;
|
91 |
|
92 |
|
93 | customInstallTask?: boolean | ((...args: any[]) => void | Promise<void>);
|
94 |
|
95 | /** Provides a custom commit task. */
|
96 | customCommitTask?: boolean | ((...args: any[]) => void | Promise<void>);
|
97 |
|
98 | /** Disable args/options parsing. Whenever options/arguments are provided parsed like using commander based parsing. */
|
99 | skipParseOptions?: boolean;
|
100 |
|
101 | /** Custom priorities for more fine tuned workflows. */
|
102 | customPriorities?: Priority[];
|
103 |
|
104 | /** Inherit tasks from parent prototypes, implies tasksMatchingPriority */
|
105 | inheritTasks?: boolean;
|
106 | };
|
107 |
|
108 | export type BaseOptions = OptionsApi & {
|
109 | destinationRoot?: string;
|
110 |
|
111 | skipInstall?: boolean;
|
112 |
|
113 | skipCheckEnv?: boolean;
|
114 |
|
115 | ignoreVersionCheck?: boolean;
|
116 |
|
117 | askAnswered?: boolean;
|
118 |
|
119 | localConfigOnly?: boolean;
|
120 |
|
121 | skipCache?: boolean;
|
122 |
|
123 | skipLocalCache?: boolean;
|
124 |
|
125 | description?: string;
|
126 |
|
127 | /** @deprecated moved to features */
|
128 | skipParseOptions?: boolean;
|
129 |
|
130 | /** @deprecated moved to features */
|
131 | customPriorities?: Priority[];
|
132 | };
|
133 |
|
134 | export type ArgumentSpec = {
|
135 | name: string;
|
136 |
|
137 | /** Description for the argument. */
|
138 | description?: string;
|
139 |
|
140 | /** A value indicating whether the argument is required. */
|
141 | required?: boolean;
|
142 |
|
143 | /** A value indicating whether the argument is optional. */
|
144 | optional?: boolean;
|
145 |
|
146 | /** The type of the argument. */
|
147 | type: typeof String | typeof Number | typeof Array | typeof Object;
|
148 |
|
149 | /** The default value of the argument. */
|
150 | default?: any;
|
151 | };
|
152 |
|
153 | export type CliOptionSpec = {
|
154 | name: string;
|
155 |
|
156 | /** The type of the option. */
|
157 | type: typeof Boolean | typeof String | typeof Number | ((opt: string) => any);
|
158 |
|
159 | required?: boolean;
|
160 |
|
161 | /** The option name alias (example `-h` and --help`). */
|
162 | alias?: string;
|
163 |
|
164 | /** The default value. */
|
165 | default?: any;
|
166 |
|
167 | /** The description for the option. */
|
168 | description?: string;
|
169 |
|
170 | /** A value indicating whether the option should be hidden from the help output. */
|
171 | hide?: boolean;
|
172 |
|
173 | /** The storage to persist the option */
|
174 | storage?: string | Storage;
|
175 | };
|
176 |
|
177 | export type ComposeOptions<G extends BaseGenerator = BaseGenerator> = EnvironmentComposeOptions<G> & {
|
178 | destinationRoot?: string;
|
179 | skipEnvRegister?: boolean;
|
180 | forceResolve?: boolean;
|
181 | forwardOptions?: boolean;
|
182 | };
|
183 |
|
\ | No newline at end of file |