UNPKG

3.37 kBTypeScriptView Raw
1import * as yaml from 'yaml';
2import Command from '../base';
3import { Container, InitParams, InitPaths, Question } from '../types';
4export default class Init extends Command {
5 static description: string;
6 static flags: {
7 help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
8 };
9 questions: object[];
10 srcDir: string;
11 destDir: string;
12 initPrompts: Container<Question>;
13 determineTemplate: (prompts: Container<Question<Record<string, any>>>) => Promise<{
14 prompts: Container<Question<Record<string, any>>>;
15 templates: ("command" | "workflow" | "glue_code")[] | undefined;
16 }>;
17 determineQuestions: ({ prompts, templates, }: {
18 prompts: Container<Question<Record<string, any>>>;
19 templates: ("command" | "workflow" | "glue_code")[];
20 }) => {
21 questions: Question<Record<string, any>>[];
22 templates: ("command" | "workflow" | "glue_code")[];
23 };
24 askQuestions: ({ questions, templates, }: {
25 questions: Question<Record<string, any>>[];
26 templates: ("command" | "workflow" | "glue_code")[];
27 }) => Promise<{
28 answers: Partial<InitParams>;
29 templates: ("command" | "workflow" | "glue_code")[];
30 }>;
31 determineInitPaths: ({ answers, templates, }: {
32 answers: Partial<InitParams>;
33 templates: ("command" | "workflow" | "glue_code")[];
34 }) => {
35 initPaths: {
36 sharedDir: string;
37 destDir: string;
38 };
39 initParams: {
40 templates: ("command" | "workflow" | "glue_code")[];
41 commandName?: string | undefined;
42 commandDescription?: string | undefined;
43 workflowName?: string | undefined;
44 workflowDescription?: string | undefined;
45 help?: void | undefined;
46 };
47 };
48 copyTemplateFiles: ({ initPaths, initParams, }: {
49 initPaths: InitPaths;
50 initParams: InitParams;
51 }) => Promise<{
52 initPaths: InitPaths;
53 initParams: InitParams;
54 }>;
55 customizePackageJson: ({ initPaths, initParams, }: {
56 initPaths: InitPaths;
57 initParams: InitParams;
58 }) => Promise<{
59 initPaths: InitPaths;
60 initParams: InitParams;
61 }>;
62 customizeYaml: ({ initPaths, initParams, }: {
63 initPaths: InitPaths;
64 initParams: InitParams;
65 }) => Promise<{
66 initPaths: InitPaths;
67 initParams: InitParams;
68 }>;
69 addHelpCommentsFor: (key: string, yamlDoc: yaml.ast.Document) => void;
70 customizeOpsYaml: (initParams: InitParams, yamlDoc: yaml.ast.Document) => Promise<void>;
71 customizeWorkflowYaml: (initParams: InitParams, yamlDoc: yaml.ast.Document) => Promise<void>;
72 logMessages: ({ initPaths, initParams, }: {
73 initPaths: InitPaths;
74 initParams: InitParams;
75 }) => Promise<{
76 initPaths: InitPaths;
77 initParams: InitParams;
78 }>;
79 logCommandMessage: (initParams: InitParams) => void;
80 logWorkflowMessage: (initParams: InitParams) => void;
81 logSuccessMessage: (templates: ("command" | "workflow" | "glue_code")[]) => void;
82 sendAnalytics: ({ initPaths, initParams, }: {
83 initPaths: InitPaths;
84 initParams: InitParams;
85 }) => Promise<void>;
86 private getNameAndDescription;
87 private _validateName;
88 private _validateDescription;
89 run(): Promise<void>;
90}