appwrite-utils-cli 0.10.86 → 1.0.1
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/.appwrite/.yaml_schemas/appwrite-config.schema.json +380 -0
- package/.appwrite/.yaml_schemas/collection.schema.json +255 -0
- package/.appwrite/collections/Categories.yaml +182 -0
- package/.appwrite/collections/ExampleCollection.yaml +36 -0
- package/.appwrite/collections/Posts.yaml +227 -0
- package/.appwrite/collections/Users.yaml +149 -0
- package/.appwrite/config.yaml +109 -0
- package/.appwrite/import/README.md +148 -0
- package/.appwrite/import/categories-import.yaml +129 -0
- package/.appwrite/import/posts-import.yaml +208 -0
- package/.appwrite/import/users-import.yaml +130 -0
- package/.appwrite/importData/categories.json +194 -0
- package/.appwrite/importData/posts.json +270 -0
- package/.appwrite/importData/users.json +220 -0
- package/.appwrite/schemas/categories.json +128 -0
- package/.appwrite/schemas/exampleCollection.json +52 -0
- package/.appwrite/schemas/posts.json +173 -0
- package/.appwrite/schemas/users.json +125 -0
- package/README.md +260 -33
- package/dist/collections/attributes.js +3 -2
- package/dist/collections/methods.js +56 -38
- package/dist/config/yamlConfig.d.ts +501 -0
- package/dist/config/yamlConfig.js +452 -0
- package/dist/databases/setup.d.ts +6 -0
- package/dist/databases/setup.js +119 -0
- package/dist/functions/methods.d.ts +1 -1
- package/dist/functions/methods.js +5 -2
- package/dist/functions/openapi.d.ts +4 -0
- package/dist/functions/openapi.js +60 -0
- package/dist/interactiveCLI.d.ts +5 -0
- package/dist/interactiveCLI.js +194 -49
- package/dist/main.js +91 -30
- package/dist/migrations/afterImportActions.js +2 -2
- package/dist/migrations/appwriteToX.d.ts +10 -0
- package/dist/migrations/appwriteToX.js +15 -4
- package/dist/migrations/backup.d.ts +16 -16
- package/dist/migrations/dataLoader.d.ts +83 -1
- package/dist/migrations/dataLoader.js +4 -4
- package/dist/migrations/importController.js +25 -18
- package/dist/migrations/importDataActions.js +2 -2
- package/dist/migrations/logging.d.ts +9 -1
- package/dist/migrations/logging.js +41 -22
- package/dist/migrations/migrationHelper.d.ts +4 -4
- package/dist/migrations/relationships.js +1 -1
- package/dist/migrations/services/DataTransformationService.d.ts +55 -0
- package/dist/migrations/services/DataTransformationService.js +158 -0
- package/dist/migrations/services/FileHandlerService.d.ts +75 -0
- package/dist/migrations/services/FileHandlerService.js +236 -0
- package/dist/migrations/services/ImportOrchestrator.d.ts +97 -0
- package/dist/migrations/services/ImportOrchestrator.js +488 -0
- package/dist/migrations/services/RateLimitManager.d.ts +138 -0
- package/dist/migrations/services/RateLimitManager.js +279 -0
- package/dist/migrations/services/RelationshipResolver.d.ts +120 -0
- package/dist/migrations/services/RelationshipResolver.js +332 -0
- package/dist/migrations/services/UserMappingService.d.ts +109 -0
- package/dist/migrations/services/UserMappingService.js +277 -0
- package/dist/migrations/services/ValidationService.d.ts +74 -0
- package/dist/migrations/services/ValidationService.js +260 -0
- package/dist/migrations/transfer.d.ts +0 -6
- package/dist/migrations/transfer.js +16 -132
- package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +384 -0
- package/dist/migrations/yaml/YamlImportConfigLoader.js +375 -0
- package/dist/migrations/yaml/YamlImportIntegration.d.ts +87 -0
- package/dist/migrations/yaml/YamlImportIntegration.js +330 -0
- package/dist/migrations/yaml/generateImportSchemas.d.ts +17 -0
- package/dist/migrations/yaml/generateImportSchemas.js +575 -0
- package/dist/schemas/authUser.d.ts +9 -9
- package/dist/shared/attributeManager.d.ts +17 -0
- package/dist/shared/attributeManager.js +273 -0
- package/dist/shared/confirmationDialogs.d.ts +75 -0
- package/dist/shared/confirmationDialogs.js +236 -0
- package/dist/shared/functionManager.d.ts +48 -0
- package/dist/shared/functionManager.js +322 -0
- package/dist/shared/indexManager.d.ts +24 -0
- package/dist/shared/indexManager.js +150 -0
- package/dist/shared/jsonSchemaGenerator.d.ts +51 -0
- package/dist/shared/jsonSchemaGenerator.js +313 -0
- package/dist/shared/logging.d.ts +10 -0
- package/dist/shared/logging.js +46 -0
- package/dist/shared/messageFormatter.d.ts +37 -0
- package/dist/shared/messageFormatter.js +152 -0
- package/dist/shared/migrationHelpers.d.ts +173 -0
- package/dist/shared/migrationHelpers.js +142 -0
- package/dist/shared/operationLogger.d.ts +3 -0
- package/dist/shared/operationLogger.js +25 -0
- package/dist/shared/operationQueue.d.ts +13 -0
- package/dist/shared/operationQueue.js +79 -0
- package/dist/shared/progressManager.d.ts +62 -0
- package/dist/shared/progressManager.js +215 -0
- package/dist/shared/schemaGenerator.d.ts +18 -0
- package/dist/shared/schemaGenerator.js +523 -0
- package/dist/storage/methods.d.ts +3 -1
- package/dist/storage/methods.js +144 -55
- package/dist/storage/schemas.d.ts +56 -16
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/users/methods.d.ts +16 -0
- package/dist/users/methods.js +276 -0
- package/dist/utils/configMigration.d.ts +1 -0
- package/dist/utils/configMigration.js +156 -0
- package/dist/utils/dataConverters.d.ts +46 -0
- package/dist/utils/dataConverters.js +139 -0
- package/dist/utils/loadConfigs.d.ts +15 -4
- package/dist/utils/loadConfigs.js +377 -51
- package/dist/utils/schemaStrings.js +2 -1
- package/dist/utils/setupFiles.d.ts +2 -1
- package/dist/utils/setupFiles.js +723 -28
- package/dist/utils/validationRules.d.ts +43 -0
- package/dist/utils/validationRules.js +42 -0
- package/dist/utils/yamlConverter.d.ts +48 -0
- package/dist/utils/yamlConverter.js +98 -0
- package/dist/utilsController.js +65 -43
- package/package.json +19 -15
- package/src/collections/attributes.ts +3 -2
- package/src/collections/methods.ts +85 -51
- package/src/config/yamlConfig.ts +488 -0
- package/src/{migrations/setupDatabase.ts → databases/setup.ts} +11 -5
- package/src/functions/methods.ts +8 -4
- package/src/functions/templates/count-docs-in-collection/package.json +25 -0
- package/src/functions/templates/count-docs-in-collection/tsconfig.json +28 -0
- package/src/functions/templates/typescript-node/package.json +24 -0
- package/src/functions/templates/typescript-node/tsconfig.json +28 -0
- package/src/functions/templates/uv/README.md +31 -0
- package/src/functions/templates/uv/pyproject.toml +29 -0
- package/src/interactiveCLI.ts +226 -61
- package/src/main.ts +111 -37
- package/src/migrations/afterImportActions.ts +2 -2
- package/src/migrations/appwriteToX.ts +17 -4
- package/src/migrations/dataLoader.ts +4 -4
- package/src/migrations/importController.ts +30 -22
- package/src/migrations/importDataActions.ts +2 -2
- package/src/migrations/relationships.ts +1 -1
- package/src/migrations/services/DataTransformationService.ts +196 -0
- package/src/migrations/services/FileHandlerService.ts +311 -0
- package/src/migrations/services/ImportOrchestrator.ts +669 -0
- package/src/migrations/services/RateLimitManager.ts +363 -0
- package/src/migrations/services/RelationshipResolver.ts +461 -0
- package/src/migrations/services/UserMappingService.ts +345 -0
- package/src/migrations/services/ValidationService.ts +349 -0
- package/src/migrations/transfer.ts +22 -228
- package/src/migrations/yaml/YamlImportConfigLoader.ts +427 -0
- package/src/migrations/yaml/YamlImportIntegration.ts +419 -0
- package/src/migrations/yaml/generateImportSchemas.ts +589 -0
- package/src/shared/attributeManager.ts +429 -0
- package/src/shared/confirmationDialogs.ts +327 -0
- package/src/shared/functionManager.ts +515 -0
- package/src/shared/indexManager.ts +253 -0
- package/src/shared/jsonSchemaGenerator.ts +403 -0
- package/src/shared/logging.ts +74 -0
- package/src/shared/messageFormatter.ts +195 -0
- package/src/{migrations/migrationHelper.ts → shared/migrationHelpers.ts} +22 -4
- package/src/{migrations/helper.ts → shared/operationLogger.ts} +7 -2
- package/src/{migrations/queue.ts → shared/operationQueue.ts} +1 -1
- package/src/shared/progressManager.ts +278 -0
- package/src/{migrations/schemaStrings.ts → shared/schemaGenerator.ts} +71 -17
- package/src/storage/methods.ts +199 -78
- package/src/types.ts +2 -2
- package/src/{migrations/users.ts → users/methods.ts} +2 -2
- package/src/utils/configMigration.ts +212 -0
- package/src/utils/loadConfigs.ts +414 -52
- package/src/utils/schemaStrings.ts +2 -1
- package/src/utils/setupFiles.ts +742 -40
- package/src/{migrations → utils}/validationRules.ts +1 -1
- package/src/utils/yamlConverter.ts +131 -0
- package/src/utilsController.ts +75 -54
- package/src/functions/templates/poetry/README.md +0 -30
- package/src/functions/templates/poetry/pyproject.toml +0 -16
- package/src/migrations/attributes.ts +0 -561
- package/src/migrations/backup.ts +0 -205
- package/src/migrations/databases.ts +0 -39
- package/src/migrations/dbHelpers.ts +0 -92
- package/src/migrations/indexes.ts +0 -40
- package/src/migrations/logging.ts +0 -29
- package/src/migrations/storage.ts +0 -538
- /package/src/{migrations → functions}/openapi.ts +0 -0
- /package/src/functions/templates/{poetry → uv}/src/__init__.py +0 -0
- /package/src/functions/templates/{poetry → uv}/src/index.py +0 -0
- /package/src/{migrations/converters.ts → utils/dataConverters.ts} +0 -0
@@ -0,0 +1,327 @@
|
|
1
|
+
import inquirer from "inquirer";
|
2
|
+
import chalk from "chalk";
|
3
|
+
import { MessageFormatter } from "./messageFormatter.js";
|
4
|
+
|
5
|
+
export interface DestructiveOperationOptions {
|
6
|
+
operation: string;
|
7
|
+
targets: string[];
|
8
|
+
consequences?: string[];
|
9
|
+
requireExplicitConfirmation?: boolean;
|
10
|
+
confirmationText?: string;
|
11
|
+
skipConfirmation?: boolean;
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface BackupPromptOptions {
|
15
|
+
operation: string;
|
16
|
+
targets: string[];
|
17
|
+
recommendBackup?: boolean;
|
18
|
+
backupMessage?: string;
|
19
|
+
}
|
20
|
+
|
21
|
+
export class ConfirmationDialogs {
|
22
|
+
/**
|
23
|
+
* Shows a confirmation dialog for destructive operations
|
24
|
+
*/
|
25
|
+
static async confirmDestructiveOperation(options: DestructiveOperationOptions): Promise<boolean> {
|
26
|
+
if (options.skipConfirmation) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
|
30
|
+
MessageFormatter.warning(`You are about to perform a destructive operation:`);
|
31
|
+
console.log(chalk.red.bold(` Operation: ${options.operation}`));
|
32
|
+
console.log(chalk.yellow(` Targets: ${options.targets.join(", ")}`));
|
33
|
+
|
34
|
+
if (options.consequences && options.consequences.length > 0) {
|
35
|
+
console.log(chalk.red("\n This will:"));
|
36
|
+
options.consequences.forEach(consequence => {
|
37
|
+
console.log(chalk.red(` • ${consequence}`));
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
console.log(chalk.red("\n ⚠️ THIS ACTION CANNOT BE UNDONE!"));
|
42
|
+
|
43
|
+
if (options.requireExplicitConfirmation && options.confirmationText) {
|
44
|
+
const { confirmation } = await inquirer.prompt([{
|
45
|
+
type: 'input',
|
46
|
+
name: 'confirmation',
|
47
|
+
message: chalk.red(`Type "${options.confirmationText}" to confirm:`),
|
48
|
+
validate: (input: string) => {
|
49
|
+
return input === options.confirmationText ||
|
50
|
+
chalk.red(`Please type exactly: ${options.confirmationText}`);
|
51
|
+
}
|
52
|
+
}]);
|
53
|
+
|
54
|
+
return confirmation === options.confirmationText;
|
55
|
+
} else {
|
56
|
+
const { confirmed } = await inquirer.prompt([{
|
57
|
+
type: 'confirm',
|
58
|
+
name: 'confirmed',
|
59
|
+
message: chalk.red('Are you absolutely sure you want to continue?'),
|
60
|
+
default: false
|
61
|
+
}]);
|
62
|
+
|
63
|
+
return confirmed;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Prompts user about creating a backup before a destructive operation
|
69
|
+
*/
|
70
|
+
static async promptForBackup(options: BackupPromptOptions): Promise<'yes' | 'no' | 'skip'> {
|
71
|
+
const message = options.backupMessage ||
|
72
|
+
`Create a backup before performing ${options.operation} on: ${options.targets.join(", ")}?`;
|
73
|
+
|
74
|
+
console.log(chalk.blue("\n🛡️ Backup Recommendation"));
|
75
|
+
if (options.recommendBackup !== false) {
|
76
|
+
console.log(chalk.yellow(" It's strongly recommended to create a backup before proceeding."));
|
77
|
+
}
|
78
|
+
|
79
|
+
const { choice } = await inquirer.prompt([{
|
80
|
+
type: 'list',
|
81
|
+
name: 'choice',
|
82
|
+
message,
|
83
|
+
choices: [
|
84
|
+
{ name: '🛡️ Yes, create backup first', value: 'yes' },
|
85
|
+
{ name: '⚠️ No, proceed without backup', value: 'no' },
|
86
|
+
{ name: '❌ Cancel operation', value: 'skip' }
|
87
|
+
],
|
88
|
+
default: 'yes'
|
89
|
+
}]);
|
90
|
+
|
91
|
+
return choice;
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Shows a final confirmation before proceeding with an operation
|
96
|
+
*/
|
97
|
+
static async finalConfirmation(operation: string, details?: string[]): Promise<boolean> {
|
98
|
+
console.log(chalk.green(`\n✅ Ready to perform: ${chalk.bold(operation)}`));
|
99
|
+
|
100
|
+
if (details && details.length > 0) {
|
101
|
+
console.log(chalk.gray(" Details:"));
|
102
|
+
details.forEach(detail => {
|
103
|
+
console.log(chalk.gray(` • ${detail}`));
|
104
|
+
});
|
105
|
+
}
|
106
|
+
|
107
|
+
const { proceed } = await inquirer.prompt([{
|
108
|
+
type: 'confirm',
|
109
|
+
name: 'proceed',
|
110
|
+
message: 'Proceed with this operation?',
|
111
|
+
default: true
|
112
|
+
}]);
|
113
|
+
|
114
|
+
return proceed;
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Specialized confirmation for database wiping
|
119
|
+
*/
|
120
|
+
static async confirmDatabaseWipe(databaseNames: string[], options: {
|
121
|
+
includeStorage?: boolean;
|
122
|
+
includeUsers?: boolean;
|
123
|
+
skipConfirmation?: boolean;
|
124
|
+
} = {}): Promise<boolean> {
|
125
|
+
const consequences = [
|
126
|
+
"Delete all documents in the specified databases",
|
127
|
+
"Remove all collections and their data",
|
128
|
+
];
|
129
|
+
|
130
|
+
if (options.includeStorage) {
|
131
|
+
consequences.push("Delete all files in associated storage buckets");
|
132
|
+
}
|
133
|
+
|
134
|
+
if (options.includeUsers) {
|
135
|
+
consequences.push("Delete all user accounts");
|
136
|
+
}
|
137
|
+
|
138
|
+
return this.confirmDestructiveOperation({
|
139
|
+
operation: "Database Wipe",
|
140
|
+
targets: databaseNames,
|
141
|
+
consequences,
|
142
|
+
requireExplicitConfirmation: true,
|
143
|
+
confirmationText: "DELETE ALL DATA",
|
144
|
+
skipConfirmation: options.skipConfirmation,
|
145
|
+
});
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Specialized confirmation for collection wiping
|
150
|
+
*/
|
151
|
+
static async confirmCollectionWipe(
|
152
|
+
databaseName: string,
|
153
|
+
collectionNames: string[],
|
154
|
+
options: { skipConfirmation?: boolean } = {}
|
155
|
+
): Promise<boolean> {
|
156
|
+
return this.confirmDestructiveOperation({
|
157
|
+
operation: "Collection Wipe",
|
158
|
+
targets: collectionNames.map(name => `${databaseName}.${name}`),
|
159
|
+
consequences: [
|
160
|
+
"Delete all documents in the specified collections",
|
161
|
+
"Keep the collection structure intact",
|
162
|
+
],
|
163
|
+
requireExplicitConfirmation: collectionNames.length > 5,
|
164
|
+
confirmationText: "DELETE DOCUMENTS",
|
165
|
+
skipConfirmation: options.skipConfirmation,
|
166
|
+
});
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Specialized confirmation for function deployment
|
171
|
+
*/
|
172
|
+
static async confirmFunctionDeployment(
|
173
|
+
functionNames: string[],
|
174
|
+
options: {
|
175
|
+
isProduction?: boolean;
|
176
|
+
hasBreakingChanges?: boolean;
|
177
|
+
skipConfirmation?: boolean;
|
178
|
+
} = {}
|
179
|
+
): Promise<boolean> {
|
180
|
+
if (options.skipConfirmation) {
|
181
|
+
return true;
|
182
|
+
}
|
183
|
+
|
184
|
+
const consequences = ["Replace existing function code"];
|
185
|
+
|
186
|
+
if (options.isProduction) {
|
187
|
+
consequences.push("Affect production environment");
|
188
|
+
}
|
189
|
+
|
190
|
+
if (options.hasBreakingChanges) {
|
191
|
+
consequences.push("Potentially break existing integrations");
|
192
|
+
}
|
193
|
+
|
194
|
+
return this.confirmDestructiveOperation({
|
195
|
+
operation: "Function Deployment",
|
196
|
+
targets: functionNames,
|
197
|
+
consequences: consequences.length > 1 ? consequences : undefined,
|
198
|
+
requireExplicitConfirmation: options.isProduction || options.hasBreakingChanges,
|
199
|
+
confirmationText: options.isProduction ? "DEPLOY TO PRODUCTION" : "DEPLOY",
|
200
|
+
});
|
201
|
+
}
|
202
|
+
|
203
|
+
/**
|
204
|
+
* Shows operation summary and asks for final confirmation
|
205
|
+
*/
|
206
|
+
static async showOperationSummary(
|
207
|
+
title: string,
|
208
|
+
summary: Record<string, string | number | string[]>,
|
209
|
+
options: {
|
210
|
+
confirmationRequired?: boolean;
|
211
|
+
warningMessage?: string;
|
212
|
+
} = {}
|
213
|
+
): Promise<boolean> {
|
214
|
+
MessageFormatter.section(`${title} Summary`);
|
215
|
+
|
216
|
+
Object.entries(summary).forEach(([key, value]) => {
|
217
|
+
const formattedKey = key.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());
|
218
|
+
|
219
|
+
if (Array.isArray(value)) {
|
220
|
+
console.log(`${chalk.gray("●")} ${formattedKey}:`);
|
221
|
+
value.forEach(item => {
|
222
|
+
console.log(` ${chalk.gray("•")} ${item}`);
|
223
|
+
});
|
224
|
+
} else {
|
225
|
+
console.log(`${chalk.gray("●")} ${formattedKey}: ${chalk.cyan(String(value))}`);
|
226
|
+
}
|
227
|
+
});
|
228
|
+
|
229
|
+
if (options.warningMessage) {
|
230
|
+
console.log(chalk.yellow(`\n⚠️ ${options.warningMessage}`));
|
231
|
+
}
|
232
|
+
|
233
|
+
if (options.confirmationRequired !== false) {
|
234
|
+
const { confirmed } = await inquirer.prompt([{
|
235
|
+
type: 'confirm',
|
236
|
+
name: 'confirmed',
|
237
|
+
message: 'Continue with this operation?',
|
238
|
+
default: true
|
239
|
+
}]);
|
240
|
+
|
241
|
+
return confirmed;
|
242
|
+
}
|
243
|
+
|
244
|
+
return true;
|
245
|
+
}
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Interactive selection with confirmation
|
249
|
+
*/
|
250
|
+
static async selectWithConfirmation<T>(
|
251
|
+
items: T[],
|
252
|
+
options: {
|
253
|
+
message: string;
|
254
|
+
displayProperty?: keyof T;
|
255
|
+
multiSelect?: boolean;
|
256
|
+
confirmMessage?: string;
|
257
|
+
validator?: (selection: T[]) => string | true;
|
258
|
+
}
|
259
|
+
): Promise<T[]> {
|
260
|
+
const choices = items.map((item, index) => ({
|
261
|
+
name: options.displayProperty ? String(item[options.displayProperty]) : String(item),
|
262
|
+
value: item,
|
263
|
+
}));
|
264
|
+
|
265
|
+
const prompt = options.multiSelect ? 'checkbox' : 'list';
|
266
|
+
const { selection } = await inquirer.prompt([{
|
267
|
+
type: prompt,
|
268
|
+
name: 'selection',
|
269
|
+
message: options.message,
|
270
|
+
choices,
|
271
|
+
validate: options.validator ? (input: T[]) => {
|
272
|
+
const result = options.validator!(Array.isArray(input) ? input : [input]);
|
273
|
+
return result;
|
274
|
+
} : undefined,
|
275
|
+
}]);
|
276
|
+
|
277
|
+
const selectedItems = Array.isArray(selection) ? selection : [selection];
|
278
|
+
|
279
|
+
if (options.confirmMessage) {
|
280
|
+
const confirmMessage = options.confirmMessage.replace(
|
281
|
+
'{count}',
|
282
|
+
selectedItems.length.toString()
|
283
|
+
);
|
284
|
+
|
285
|
+
const { confirmed } = await inquirer.prompt([{
|
286
|
+
type: 'confirm',
|
287
|
+
name: 'confirmed',
|
288
|
+
message: confirmMessage,
|
289
|
+
default: true
|
290
|
+
}]);
|
291
|
+
|
292
|
+
if (!confirmed) {
|
293
|
+
return [];
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
return selectedItems;
|
298
|
+
}
|
299
|
+
|
300
|
+
/**
|
301
|
+
* Confirms overwriting an existing file or directory
|
302
|
+
*/
|
303
|
+
static async confirmOverwrite(target: string): Promise<boolean> {
|
304
|
+
const { confirmed } = await inquirer.prompt([{
|
305
|
+
type: 'confirm',
|
306
|
+
name: 'confirmed',
|
307
|
+
message: chalk.yellow(`${target} already exists. Overwrite?`),
|
308
|
+
default: false
|
309
|
+
}]);
|
310
|
+
|
311
|
+
return confirmed;
|
312
|
+
}
|
313
|
+
|
314
|
+
/**
|
315
|
+
* Confirms removal of a file
|
316
|
+
*/
|
317
|
+
static async confirmRemoval(target: string): Promise<boolean> {
|
318
|
+
const { confirmed } = await inquirer.prompt([{
|
319
|
+
type: 'confirm',
|
320
|
+
name: 'confirmed',
|
321
|
+
message: chalk.red(target),
|
322
|
+
default: false
|
323
|
+
}]);
|
324
|
+
|
325
|
+
return confirmed;
|
326
|
+
}
|
327
|
+
}
|