@turbo/gen 2.8.17 → 2.8.18-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -1,2 +1,155 @@
1
- import * as PlopTypes from "node-plop";
2
- export { type PlopTypes };
1
+ //#region src/types.d.ts
2
+ declare namespace PlopTypes {
3
+ export interface Answers {
4
+ [key: string]: any;
5
+ }
6
+ export interface IncludeDefinitionConfig {
7
+ generators?: boolean;
8
+ helpers?: boolean;
9
+ partials?: boolean;
10
+ actionTypes?: boolean;
11
+ }
12
+ export type IncludeDefinition = boolean | string[] | IncludeDefinitionConfig;
13
+ export interface PlopCfg {
14
+ force: boolean;
15
+ destBasePath: string | undefined;
16
+ }
17
+ export interface ActionConfig {
18
+ type: string;
19
+ force?: boolean;
20
+ data?: object;
21
+ abortOnFail?: boolean;
22
+ skip?: (...args: any[]) => any;
23
+ }
24
+ interface Template {
25
+ template: string;
26
+ templateFile?: never;
27
+ }
28
+ interface TemplateFile {
29
+ template?: never;
30
+ templateFile: string;
31
+ }
32
+ type TemplateStrOrFile = Template | TemplateFile;
33
+ type TransformFn<T> = (template: string, data: any, cfg: T) => string | Promise<string>;
34
+ interface AddActionConfigBase extends ActionConfig {
35
+ type: "add";
36
+ path: string;
37
+ skipIfExists?: boolean;
38
+ transform?: TransformFn<AddActionConfig>;
39
+ }
40
+ export type AddActionConfig = AddActionConfigBase & TemplateStrOrFile;
41
+ export interface AddManyActionConfig extends Pick<AddActionConfig, Exclude<keyof AddActionConfig, "type" | "templateFile" | "template" | "transform">> {
42
+ type: "addMany";
43
+ destination: string;
44
+ base: string;
45
+ templateFiles: string | string[];
46
+ stripExtensions?: string[];
47
+ globOptions: Record<string, unknown>;
48
+ verbose?: boolean;
49
+ transform?: TransformFn<AddManyActionConfig>;
50
+ }
51
+ interface ModifyActionConfigBase extends ActionConfig {
52
+ type: "modify";
53
+ path: string;
54
+ pattern: string | RegExp;
55
+ transform?: TransformFn<ModifyActionConfig>;
56
+ }
57
+ export type ModifyActionConfig = ModifyActionConfigBase & TemplateStrOrFile;
58
+ interface AppendActionConfigBase extends ActionConfig {
59
+ type: "append";
60
+ path: string;
61
+ pattern: string | RegExp;
62
+ unique: boolean;
63
+ separator: string;
64
+ }
65
+ export type AppendActionConfig = AppendActionConfigBase & TemplateStrOrFile;
66
+ export interface CustomActionConfig<TypeString extends string> extends Omit<ActionConfig, "type"> {
67
+ type: TypeString extends "addMany" | "modify" | "append" ? never : TypeString;
68
+ [key: string]: any;
69
+ }
70
+ export type CustomActionFunction = (answers: Answers, config: CustomActionConfig<string>, plopfileApi: NodePlopAPI) => Promise<string> | string;
71
+ export type ActionType = string | ActionConfig | AddActionConfig | AddManyActionConfig | ModifyActionConfig | AppendActionConfig | CustomActionFunction;
72
+ export interface PromptQuestion {
73
+ type?: string;
74
+ name?: string;
75
+ message?: string | ((...args: any[]) => string);
76
+ default?: any;
77
+ choices?: Array<any> | ((...args: any[]) => any);
78
+ validate?: (...args: any[]) => boolean | string | Promise<boolean | string>;
79
+ filter?: (...args: any[]) => any;
80
+ transformer?: (...args: any[]) => any;
81
+ when?: boolean | ((...args: any[]) => boolean | Promise<boolean>);
82
+ prefix?: string;
83
+ suffix?: string;
84
+ [key: string]: any;
85
+ }
86
+ export type DynamicPromptsFunction = (inquirer: unknown) => Promise<Answers>;
87
+ export type DynamicActionsFunction = (data?: Answers) => ActionType[];
88
+ export type Prompts = DynamicPromptsFunction | PromptQuestion[];
89
+ export type Actions = DynamicActionsFunction | ActionType[];
90
+ interface PlopActionHooksFailures {
91
+ type: string;
92
+ path: string;
93
+ error: string;
94
+ message: string;
95
+ }
96
+ interface PlopActionHooksChanges {
97
+ type: string;
98
+ path: string;
99
+ }
100
+ interface PlopActionHooks {
101
+ onComment?: (msg: string) => void;
102
+ onSuccess?: (change: PlopActionHooksChanges) => void;
103
+ onFailure?: (failure: PlopActionHooksFailures) => void;
104
+ }
105
+ export interface PlopGeneratorConfig {
106
+ description: string;
107
+ prompts: Prompts;
108
+ actions: Actions;
109
+ }
110
+ export interface PlopGenerator extends PlopGeneratorConfig {
111
+ runPrompts: (bypassArr?: string[]) => Promise<any>;
112
+ runActions: (answers: Answers, hooks?: PlopActionHooks) => Promise<{
113
+ changes: PlopActionHooksChanges[];
114
+ failures: PlopActionHooksFailures[];
115
+ }>;
116
+ }
117
+ export interface NodePlopAPI {
118
+ setGenerator(name: string, config: Partial<PlopGeneratorConfig>): PlopGenerator;
119
+ setPrompt(name: string, prompt: unknown): void;
120
+ setWelcomeMessage(message: string): void;
121
+ getWelcomeMessage(): string;
122
+ getGenerator(name: string): PlopGenerator;
123
+ getGeneratorList(): {
124
+ name: string;
125
+ description: string;
126
+ }[];
127
+ setPartial(name: string, str: string): void;
128
+ getPartial(name: string): string;
129
+ getPartialList(): string[];
130
+ setHelper(name: string, fn: (...args: any[]) => any): void;
131
+ getHelper(name: string): (...args: any[]) => any;
132
+ getHelperList(): string[];
133
+ setActionType(name: string, fn: CustomActionFunction): void;
134
+ getActionType(name: string): ActionType;
135
+ getActionTypeList(): string[];
136
+ setPlopfilePath(filePath: string): void;
137
+ getPlopfilePath(): string;
138
+ getDestBasePath(): string;
139
+ load(target: string[] | string, loadCfg?: Partial<PlopCfg> | null, includeOverride?: IncludeDefinition): Promise<void>;
140
+ setDefaultInclude(inc: object): void;
141
+ getDefaultInclude(): object;
142
+ renderString(template: string, data: any): string;
143
+ /** @deprecated Use "setPrompt" instead. */
144
+ addPrompt(name: string, prompt: unknown): void;
145
+ /** @deprecated Use "setPartial" instead. */
146
+ addPartial(name: string, str: string): void;
147
+ /** @deprecated Use "setHelper" instead. */
148
+ addHelper(name: string, fn: (...args: any[]) => any): void;
149
+ }
150
+ export {};
151
+ }
152
+ //# sourceMappingURL=types.d.ts.map
153
+ //#endregion
154
+ export { PlopTypes };
155
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"s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o/gen",
3
- "version": "2.8.17",
3
+ "version": "2.8.18-canary.2",
4
4
  "description": "Extend a Turborepo",
5
5
  "homepage": "https://turborepo.dev",
6
6
  "bugs": {
@@ -42,10 +42,10 @@
42
42
  "typescript": "5.5.4",
43
43
  "update-check": "1.5.4",
44
44
  "validate-npm-package-name": "5.0.0",
45
- "@turbo/test-utils": "0.0.0",
46
- "@turbo/tsconfig": "0.0.0",
47
45
  "@turbo/utils": "0.0.0",
48
- "@turbo/workspaces": "2.8.17"
46
+ "@turbo/workspaces": "2.8.18-canary.2",
47
+ "@turbo/tsconfig": "0.0.0",
48
+ "@turbo/test-utils": "0.0.0"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsdown",