@shopify/cli-kit 3.0.10 → 3.0.13

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/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Listr, ListrTaskWrapper, ListrDefaultRenderer, ListrTask } from 'listr2';
2
2
  import { AbortSignal, AbortController } from 'abort-controller';
3
- import * as execa from 'execa';
4
3
  import { Writable } from 'node:stream';
5
4
  import { camelCase, paramCase, snakeCase, constantCase } from 'change-case';
6
5
  import * as pathe from 'pathe';
@@ -69,6 +68,280 @@ declare namespace ui {
69
68
  };
70
69
  }
71
70
 
71
+ declare const dependencyManager: readonly ["yarn", "npm", "pnpm"];
72
+ declare type DependencyManager = typeof dependencyManager[number];
73
+ declare const PackageJsonNotFoundError: (directory: string) => Abort;
74
+ /**
75
+ * Returns the dependency manager used to run the create workflow.
76
+ * @param env {Object} The environment variables of the process in which the CLI runs.
77
+ * @returns The dependency manager
78
+ */
79
+ declare function dependencyManagerUsedForCreating(env?: NodeJS.ProcessEnv): DependencyManager;
80
+ interface InstallNPMDependenciesRecursivelyOptions {
81
+ /**
82
+ * The dependency manager to use to install the dependencies.
83
+ */
84
+ dependencyManager: DependencyManager;
85
+ /**
86
+ * The directory from where we'll find package.json's recursively
87
+ */
88
+ directory: string;
89
+ /**
90
+ * Specifies the maximum depth of the glob search.
91
+ */
92
+ deep?: number;
93
+ }
94
+ /**
95
+ * This function traverses down a directory tree to find directories containing a package.json
96
+ * and installs the dependencies if needed. To know if it's needed, it uses the "check" command
97
+ * provided by dependency managers.
98
+ * @param options {InstallNPMDependenciesRecursivelyOptions} Options to install dependencies recursively.
99
+ */
100
+ declare function installNPMDependenciesRecursively(options: InstallNPMDependenciesRecursivelyOptions): Promise<void>;
101
+ /**
102
+ * Installs the dependencies in the given directory.
103
+ * @param directory {string} The directory that contains the package.json
104
+ * @param dependencyManager {DependencyManager} The dependency manager to use to install the dependencies.
105
+ * @param stdout {Writable} Standard output stream.
106
+ * @param stderr {Writable} Standard error stream.
107
+ * @param signal {AbortSignal} Abort signal.
108
+ * @returns stderr {Writable} Standard error stream.
109
+ */
110
+ declare function install(directory: string, dependencyManager: DependencyManager, stdout?: Writable, stderr?: Writable, signal?: AbortSignal): Promise<void>;
111
+ /**
112
+ * Returns the name of the package configured in its package.json
113
+ * @param packageJsonPath {string} Path to the package.json file
114
+ * @returns A promise that resolves with the name.
115
+ */
116
+ declare function getPackageName(packageJsonPath: string): Promise<string>;
117
+ /**
118
+ * Returns the list of production and dev dependencies of a package.json
119
+ * @param packageJsonPath {string} Path to the package.json file
120
+ * @returns A promise that resolves with the list of dependencies.
121
+ */
122
+ declare function getDependencies(packageJsonPath: string): Promise<{
123
+ [key: string]: string;
124
+ }>;
125
+ declare function checkForNewVersion(dependency: string, currentVersion: string): Promise<string | undefined>;
126
+ declare function getOutputUpdateCLIReminder(dependencyManager: DependencyManager, packages?: string[]): string;
127
+ declare type DependencyType = 'dev' | 'prod' | 'peer';
128
+ interface AddNPMDependenciesIfNeededOptions {
129
+ /** How dependencies should be added */
130
+ type: DependencyType;
131
+ /** The dependency manager to use to add dependencies */
132
+ dependencyManager: DependencyManager;
133
+ /** The directory that contains the package.json where dependencies will be added */
134
+ directory: string;
135
+ /** Standard output coming from the underlying installation process */
136
+ stdout?: Writable;
137
+ /** Standard error coming from the underlying installation process */
138
+ stderr?: Writable;
139
+ /** Abort signal to stop the process */
140
+ signal?: AbortSignal;
141
+ }
142
+ /**
143
+ * Adds dependencies to a Node project (i.e. a project that has a package.json)
144
+ * @param dependencies {string[]} List of dependencies to be added.
145
+ * @param options {AddNPMDependenciesIfNeededOptions} Options for adding dependencies.
146
+ */
147
+ declare function addNPMDependenciesIfNeeded(dependencies: string[], options: AddNPMDependenciesIfNeededOptions): Promise<void>;
148
+
149
+ declare const dependency_dependencyManager: typeof dependencyManager;
150
+ type dependency_DependencyManager = DependencyManager;
151
+ declare const dependency_PackageJsonNotFoundError: typeof PackageJsonNotFoundError;
152
+ declare const dependency_dependencyManagerUsedForCreating: typeof dependencyManagerUsedForCreating;
153
+ declare const dependency_installNPMDependenciesRecursively: typeof installNPMDependenciesRecursively;
154
+ declare const dependency_install: typeof install;
155
+ declare const dependency_getPackageName: typeof getPackageName;
156
+ declare const dependency_getDependencies: typeof getDependencies;
157
+ declare const dependency_checkForNewVersion: typeof checkForNewVersion;
158
+ declare const dependency_getOutputUpdateCLIReminder: typeof getOutputUpdateCLIReminder;
159
+ declare const dependency_addNPMDependenciesIfNeeded: typeof addNPMDependenciesIfNeeded;
160
+ declare namespace dependency {
161
+ export {
162
+ dependency_dependencyManager as dependencyManager,
163
+ dependency_DependencyManager as DependencyManager,
164
+ dependency_PackageJsonNotFoundError as PackageJsonNotFoundError,
165
+ dependency_dependencyManagerUsedForCreating as dependencyManagerUsedForCreating,
166
+ dependency_installNPMDependenciesRecursively as installNPMDependenciesRecursively,
167
+ dependency_install as install,
168
+ dependency_getPackageName as getPackageName,
169
+ dependency_getDependencies as getDependencies,
170
+ dependency_checkForNewVersion as checkForNewVersion,
171
+ dependency_getOutputUpdateCLIReminder as getOutputUpdateCLIReminder,
172
+ dependency_addNPMDependenciesIfNeeded as addNPMDependenciesIfNeeded,
173
+ };
174
+ }
175
+
176
+ declare enum ContentTokenType {
177
+ Raw = 0,
178
+ Command = 1,
179
+ Json = 2,
180
+ Path = 3,
181
+ Link = 4,
182
+ Heading = 5,
183
+ SubHeading = 6,
184
+ Italic = 7,
185
+ ErrorText = 8,
186
+ Yellow = 9,
187
+ Cyan = 10,
188
+ Magenta = 11,
189
+ Green = 12
190
+ }
191
+ interface ContentMetadata {
192
+ link?: string;
193
+ }
194
+ declare class ContentToken {
195
+ type: ContentTokenType;
196
+ value: Message;
197
+ metadata: ContentMetadata;
198
+ constructor(value: Message, metadata: ContentMetadata | undefined, type: ContentTokenType);
199
+ }
200
+ declare const token: {
201
+ raw: (value: Message) => ContentToken;
202
+ genericShellCommand: (value: Message) => ContentToken;
203
+ json: (value: any) => ContentToken;
204
+ path: (value: Message) => ContentToken;
205
+ link: (value: Message, link: string) => ContentToken;
206
+ heading: (value: Message) => ContentToken;
207
+ subheading: (value: Message) => ContentToken;
208
+ italic: (value: Message) => ContentToken;
209
+ errorText: (value: Message) => ContentToken;
210
+ cyan: (value: Message) => ContentToken;
211
+ yellow: (value: Message) => ContentToken;
212
+ magenta: (value: Message) => ContentToken;
213
+ green: (value: Message) => ContentToken;
214
+ packagejsonScript: (dependencyManager: DependencyManager, scriptName: string, ...scriptArgs: string[]) => ContentToken;
215
+ successIcon: () => ContentToken;
216
+ failIcon: () => ContentToken;
217
+ };
218
+ declare class TokenizedString {
219
+ value: string;
220
+ constructor(value: string);
221
+ }
222
+ declare type Message = string | TokenizedString;
223
+ declare function content(strings: TemplateStringsArray, ...keys: (ContentToken | string)[]): TokenizedString;
224
+ /** Log levels */
225
+ declare type LogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent';
226
+ /**
227
+ *
228
+ * @returns {LogLevel} It returns the log level set by the user.
229
+ */
230
+ declare const currentLogLevel: () => LogLevel;
231
+ declare const shouldOutput: (logLevel: LogLevel) => boolean;
232
+ /**
233
+ * Ouputs information to the user. This is akin to "console.log"
234
+ * Info messages don't get additional formatting.
235
+ * Note: Info messages are sent through the standard output.
236
+ * @param content {string} The content to be output to the user.
237
+ */
238
+ declare const info: (content: Message) => void;
239
+ /**
240
+ * Outputs a success message to the user.
241
+ * Success message receive a special formatting to make them stand out in the console.
242
+ * Note: Success messages are sent through the standard output.
243
+ * @param content {string} The content to be output to the user.
244
+ */
245
+ declare const success: (content: Message) => void;
246
+ /**
247
+ * Outputs a completed message to the user.
248
+ * Completed message receive a special formatting to make them stand out in the console.
249
+ * Note: Completed messages are sent through the standard output.
250
+ * @param content {string} The content to be output to the user.
251
+ */
252
+ declare const completed: (content: Message) => void;
253
+ /**
254
+ * Ouputs debug information to the user. By default these output is hidden unless the user calls the CLI with --verbose.
255
+ * Debug messages don't get additional formatting.
256
+ * Note: Debug messages are sent through the standard output.
257
+ * @param content {string} The content to be output to the user.
258
+ */
259
+ declare const debug: (content: Message) => void;
260
+ /**
261
+ * Outputs a warning message to the user.
262
+ * Warning messages receive a special formatting to make them stand out in the console.
263
+ * Note: Warning messages are sent through the standard output.
264
+ * @param content {string} The content to be output to the user.
265
+ */
266
+ declare const warn: (content: Message) => void;
267
+ /**
268
+ * Prints a new line in the terminal.
269
+ */
270
+ declare const newline: () => void;
271
+ /**
272
+ * Formats and outputs a fatal error.
273
+ * Note: This API is not intended to be used internally. If you want to
274
+ * abort the execution due to an error, raise a fatal error and let the
275
+ * error handler handle and format it.
276
+ * @param content {Fatal} The fatal error to be output.
277
+ */
278
+ declare const error$1: (content: Fatal) => Promise<void>;
279
+ declare function stringifyMessage(message: Message): string;
280
+ interface OutputProcess {
281
+ /** The prefix to include in the logs
282
+ * [vite] Output coming from Vite
283
+ */
284
+ prefix: string;
285
+ /**
286
+ * A callback to invoke the process. stdout and stderr should be used
287
+ * to send standard output and error data that gets formatted with the
288
+ * right prefix.
289
+ */
290
+ action: (stdout: Writable, stderr: Writable, signal: AbortSignal) => Promise<void>;
291
+ }
292
+ /**
293
+ * Use this function when you have multiple concurrent processes that send data events
294
+ * and we need to output them ensuring that they can visually differenciated by the user.
295
+ *
296
+ * @param processes {OutputProcess[]} A list of processes to run concurrently.
297
+ */
298
+ declare function concurrent(processes: OutputProcess[], callback?: ((signal: AbortSignal) => void) | undefined): Promise<void>;
299
+ declare function unstyled(message: string): string;
300
+ declare function shouldDisplayColors(): boolean;
301
+
302
+ declare const output_token: typeof token;
303
+ type output_TokenizedString = TokenizedString;
304
+ declare const output_TokenizedString: typeof TokenizedString;
305
+ type output_Message = Message;
306
+ declare const output_content: typeof content;
307
+ type output_LogLevel = LogLevel;
308
+ declare const output_currentLogLevel: typeof currentLogLevel;
309
+ declare const output_shouldOutput: typeof shouldOutput;
310
+ declare const output_info: typeof info;
311
+ declare const output_success: typeof success;
312
+ declare const output_completed: typeof completed;
313
+ declare const output_debug: typeof debug;
314
+ declare const output_warn: typeof warn;
315
+ declare const output_newline: typeof newline;
316
+ declare const output_stringifyMessage: typeof stringifyMessage;
317
+ type output_OutputProcess = OutputProcess;
318
+ declare const output_concurrent: typeof concurrent;
319
+ declare const output_unstyled: typeof unstyled;
320
+ declare const output_shouldDisplayColors: typeof shouldDisplayColors;
321
+ declare namespace output {
322
+ export {
323
+ output_token as token,
324
+ output_TokenizedString as TokenizedString,
325
+ output_Message as Message,
326
+ output_content as content,
327
+ output_LogLevel as LogLevel,
328
+ output_currentLogLevel as currentLogLevel,
329
+ output_shouldOutput as shouldOutput,
330
+ output_info as info,
331
+ output_success as success,
332
+ output_completed as completed,
333
+ output_debug as debug,
334
+ output_warn as warn,
335
+ output_newline as newline,
336
+ error$1 as error,
337
+ output_stringifyMessage as stringifyMessage,
338
+ output_OutputProcess as OutputProcess,
339
+ output_concurrent as concurrent,
340
+ output_unstyled as unstyled,
341
+ output_shouldDisplayColors as shouldDisplayColors,
342
+ };
343
+ }
344
+
72
345
  declare enum FatalErrorType {
73
346
  Abort = 0,
74
347
  AbortSilent = 1,
@@ -81,14 +354,14 @@ declare enum FatalErrorType {
81
354
  declare abstract class Fatal extends Error {
82
355
  tryMessage: string | null;
83
356
  type: FatalErrorType;
84
- constructor(message: string, type: FatalErrorType, tryMessage?: string | null);
357
+ constructor(message: Message, type: FatalErrorType, tryMessage?: Message | null);
85
358
  }
86
359
  /**
87
360
  * An abort error is a fatal error that shouldn't be reported as a bug.
88
361
  * Those usually represent unexpected scenarios that we can't handle and that usually require some action from the developer
89
362
  */
90
363
  declare class Abort extends Fatal {
91
- constructor(message: string, tryMessage?: string | null);
364
+ constructor(message: Message, tryMessage?: Message | null);
92
365
  }
93
366
  declare class AbortSilent extends Fatal {
94
367
  constructor();
@@ -97,7 +370,7 @@ declare class AbortSilent extends Fatal {
97
370
  * A bug error is an error that represents a bug and therefore should be reported.
98
371
  */
99
372
  declare class Bug extends Fatal {
100
- constructor(message: string, tryMessage?: string | null);
373
+ constructor(message: Message, tryMessage?: string | null);
101
374
  }
102
375
  /**
103
376
  * A function that handles errors that blow up in the CLI.
@@ -109,30 +382,30 @@ declare function mapper(error: Error): Promise<Error>;
109
382
  declare function isFatal(error: Error): boolean;
110
383
  declare function shouldReport(error: Error): boolean;
111
384
 
112
- type error$1_Fatal = Fatal;
113
- declare const error$1_Fatal: typeof Fatal;
114
- type error$1_Abort = Abort;
115
- declare const error$1_Abort: typeof Abort;
116
- type error$1_AbortSilent = AbortSilent;
117
- declare const error$1_AbortSilent: typeof AbortSilent;
118
- type error$1_Bug = Bug;
119
- declare const error$1_Bug: typeof Bug;
120
- declare const error$1_handler: typeof handler;
121
- declare const error$1_mapper: typeof mapper;
122
- declare const error$1_isFatal: typeof isFatal;
123
- declare const error$1_shouldReport: typeof shouldReport;
124
- declare const error$1_AbortSignal: typeof AbortSignal;
125
- declare namespace error$1 {
385
+ type error_Fatal = Fatal;
386
+ declare const error_Fatal: typeof Fatal;
387
+ type error_Abort = Abort;
388
+ declare const error_Abort: typeof Abort;
389
+ type error_AbortSilent = AbortSilent;
390
+ declare const error_AbortSilent: typeof AbortSilent;
391
+ type error_Bug = Bug;
392
+ declare const error_Bug: typeof Bug;
393
+ declare const error_handler: typeof handler;
394
+ declare const error_mapper: typeof mapper;
395
+ declare const error_isFatal: typeof isFatal;
396
+ declare const error_shouldReport: typeof shouldReport;
397
+ declare const error_AbortSignal: typeof AbortSignal;
398
+ declare namespace error {
126
399
  export {
127
- error$1_Fatal as Fatal,
128
- error$1_Abort as Abort,
129
- error$1_AbortSilent as AbortSilent,
130
- error$1_Bug as Bug,
131
- error$1_handler as handler,
132
- error$1_mapper as mapper,
133
- error$1_isFatal as isFatal,
134
- error$1_shouldReport as shouldReport,
135
- error$1_AbortSignal as AbortSignal,
400
+ error_Fatal as Fatal,
401
+ error_Abort as Abort,
402
+ error_AbortSilent as AbortSilent,
403
+ error_Bug as Bug,
404
+ error_handler as handler,
405
+ error_mapper as mapper,
406
+ error_isFatal as isFatal,
407
+ error_shouldReport as shouldReport,
408
+ error_AbortSignal as AbortSignal,
136
409
  };
137
410
  }
138
411
 
@@ -153,8 +426,8 @@ declare const open: (url: string) => Promise<void>;
153
426
  * @param args {string[]} Arguments to pass to the command.
154
427
  * @returns A promise that resolves with the aggregatted stdout of the command.
155
428
  */
156
- declare const captureOutput: (command: string, args: string[]) => Promise<string>;
157
- declare const exec: (command: string, args: string[], options?: ExecOptions) => Promise<execa.ExecaReturnValue<string>>;
429
+ declare const captureOutput: (command: string, args: string[], options?: ExecOptions) => Promise<string>;
430
+ declare const exec: (command: string, args: string[], options?: ExecOptions) => Promise<void>;
158
431
  interface ConcurrentExecCommand {
159
432
  prefix: string;
160
433
  executable: string;
@@ -282,6 +555,7 @@ declare function read$1(path: string): Promise<string>;
282
555
  * @param to {string} Destination path.
283
556
  */
284
557
  declare function copy(from: string, to: string): Promise<void>;
558
+ declare function touch(path: string): Promise<void>;
285
559
  declare function write$1(path: string, data: string): Promise<void>;
286
560
  declare function append(path: string, data: string): Promise<void>;
287
561
  declare function mkdir(path: string): Promise<void>;
@@ -317,10 +591,17 @@ declare function hasExecutablePermissions(path: string): Promise<boolean>;
317
591
  * @returns {boolean} True if it exists.
318
592
  */
319
593
  declare function exists(path: string): Promise<boolean>;
594
+ /**
595
+ * Format a string using prettier. Return the formatted content.
596
+ */
597
+ declare function format(content: string, options: {
598
+ path: string;
599
+ }): Promise<string>;
320
600
 
321
601
  declare const file_stripUp: typeof stripUp;
322
602
  declare const file_inTemporaryDirectory: typeof inTemporaryDirectory;
323
603
  declare const file_copy: typeof copy;
604
+ declare const file_touch: typeof touch;
324
605
  declare const file_append: typeof append;
325
606
  declare const file_mkdir: typeof mkdir;
326
607
  declare const file_remove: typeof remove;
@@ -331,12 +612,14 @@ declare const file_move: typeof move;
331
612
  declare const file_chmod: typeof chmod;
332
613
  declare const file_hasExecutablePermissions: typeof hasExecutablePermissions;
333
614
  declare const file_exists: typeof exists;
615
+ declare const file_format: typeof format;
334
616
  declare namespace file {
335
617
  export {
336
618
  file_stripUp as stripUp,
337
619
  file_inTemporaryDirectory as inTemporaryDirectory,
338
620
  read$1 as read,
339
621
  file_copy as copy,
622
+ file_touch as touch,
340
623
  write$1 as write,
341
624
  file_append as append,
342
625
  file_mkdir as mkdir,
@@ -348,20 +631,24 @@ declare namespace file {
348
631
  file_chmod as chmod,
349
632
  file_hasExecutablePermissions as hasExecutablePermissions,
350
633
  file_exists as exists,
634
+ file_format as format,
351
635
  };
352
636
  }
353
637
 
354
638
  declare const factory: simple_git.SimpleGitFactory;
639
+ declare function initializeRepository(directory: string): Promise<void>;
355
640
  declare function downloadRepository({ repoUrl, destination }: {
356
641
  repoUrl: string;
357
642
  destination: string;
358
643
  }): Promise<void>;
359
644
 
360
645
  declare const git_factory: typeof factory;
646
+ declare const git_initializeRepository: typeof initializeRepository;
361
647
  declare const git_downloadRepository: typeof downloadRepository;
362
648
  declare namespace git {
363
649
  export {
364
650
  git_factory as factory,
651
+ git_initializeRepository as initializeRepository,
365
652
  git_downloadRepository as downloadRepository,
366
653
  };
367
654
  }
@@ -403,274 +690,12 @@ declare namespace github {
403
690
  };
404
691
  }
405
692
 
406
- declare const dependencyManager: readonly ["yarn", "npm", "pnpm"];
407
- declare type DependencyManager = typeof dependencyManager[number];
408
- declare const PackageJsonNotFoundError: (directory: string) => Abort;
409
- /**
410
- * Returns the dependency manager used to run the create workflow.
411
- * @param env {Object} The environment variables of the process in which the CLI runs.
412
- * @returns The dependency manager
413
- */
414
- declare function dependencyManagerUsedForCreating(env?: NodeJS.ProcessEnv): DependencyManager;
415
- interface InstallNPMDependenciesRecursivelyOptions {
416
- /**
417
- * The dependency manager to use to install the dependencies.
418
- */
419
- dependencyManager: DependencyManager;
420
- /**
421
- * The directory from where we'll find package.json's recursively
422
- */
423
- directory: string;
424
- /**
425
- * Specifies the maximum depth of the glob search.
426
- */
427
- deep?: number;
428
- }
429
- /**
430
- * This function traverses down a directory tree to find directories containing a package.json
431
- * and installs the dependencies if needed. To know if it's needed, it uses the "check" command
432
- * provided by dependency managers.
433
- * @param options {InstallNPMDependenciesRecursivelyOptions} Options to install dependencies recursively.
434
- */
435
- declare function installNPMDependenciesRecursively(options: InstallNPMDependenciesRecursivelyOptions): Promise<void>;
436
- /**
437
- * Installs the dependencies in the given directory.
438
- * @param directory {string} The directory that contains the package.json
439
- * @param dependencyManager {DependencyManager} The dependency manager to use to install the dependencies.
440
- * @param stdout {Writable} Standard output stream.
441
- * @param stderr {Writable} Standard error stream.
442
- * @param signal {AbortSignal} Abort signal.
443
- * @returns stderr {Writable} Standard error stream.
444
- */
445
- declare function install(directory: string, dependencyManager: DependencyManager, stdout?: Writable, stderr?: Writable, signal?: AbortSignal): Promise<void>;
446
- /**
447
- * Returns the name of the package configured in its package.json
448
- * @param packageJsonPath {string} Path to the package.json file
449
- * @returns A promise that resolves with the name.
450
- */
451
- declare function getPackageName(packageJsonPath: string): Promise<string>;
452
- /**
453
- * Returns the list of production and dev dependencies of a package.json
454
- * @param packageJsonPath {string} Path to the package.json file
455
- * @returns A promise that resolves with the list of dependencies.
456
- */
457
- declare function getDependencies(packageJsonPath: string): Promise<{
458
- [key: string]: string;
459
- }>;
460
- declare type DependencyType = 'dev' | 'prod' | 'peer';
461
- interface AddNPMDependenciesIfNeededOptions {
462
- /** How dependencies should be added */
463
- type: DependencyType;
464
- /** The dependency manager to use to add dependencies */
465
- dependencyManager: DependencyManager;
466
- /** The directory that contains the package.json where dependencies will be added */
467
- directory: string;
468
- /** Standard output coming from the underlying installation process */
469
- stdout?: Writable;
470
- /** Standard error coming from the underlying installation process */
471
- stderr?: Writable;
472
- /** Abort signal to stop the process */
473
- signal?: AbortSignal;
474
- }
475
- /**
476
- * Adds dependencies to a Node project (i.e. a project that has a package.json)
477
- * @param dependencies {string[]} List of dependencies to be added.
478
- * @param options {AddNPMDependenciesIfNeededOptions} Options for adding dependencies.
479
- */
480
- declare function addNPMDependenciesIfNeeded(dependencies: string[], options: AddNPMDependenciesIfNeededOptions): Promise<void>;
481
-
482
- declare const dependency_dependencyManager: typeof dependencyManager;
483
- type dependency_DependencyManager = DependencyManager;
484
- declare const dependency_PackageJsonNotFoundError: typeof PackageJsonNotFoundError;
485
- declare const dependency_dependencyManagerUsedForCreating: typeof dependencyManagerUsedForCreating;
486
- declare const dependency_installNPMDependenciesRecursively: typeof installNPMDependenciesRecursively;
487
- declare const dependency_install: typeof install;
488
- declare const dependency_getPackageName: typeof getPackageName;
489
- declare const dependency_getDependencies: typeof getDependencies;
490
- declare const dependency_addNPMDependenciesIfNeeded: typeof addNPMDependenciesIfNeeded;
491
- declare namespace dependency {
492
- export {
493
- dependency_dependencyManager as dependencyManager,
494
- dependency_DependencyManager as DependencyManager,
495
- dependency_PackageJsonNotFoundError as PackageJsonNotFoundError,
496
- dependency_dependencyManagerUsedForCreating as dependencyManagerUsedForCreating,
497
- dependency_installNPMDependenciesRecursively as installNPMDependenciesRecursively,
498
- dependency_install as install,
499
- dependency_getPackageName as getPackageName,
500
- dependency_getDependencies as getDependencies,
501
- dependency_addNPMDependenciesIfNeeded as addNPMDependenciesIfNeeded,
502
- };
503
- }
504
-
505
- declare enum ContentTokenType {
506
- Command = 0,
507
- Path = 1,
508
- Link = 2,
509
- Heading = 3,
510
- SubHeading = 4,
511
- Italic = 5,
512
- ErrorText = 6,
513
- Yellow = 7,
514
- Cyan = 8,
515
- Magenta = 9,
516
- Green = 10
517
- }
518
- interface ContentMetadata {
519
- link?: string;
520
- }
521
- declare class ContentToken {
522
- type: ContentTokenType;
523
- value: string;
524
- metadata: ContentMetadata;
525
- constructor(value: string, metadata: ContentMetadata | undefined, type: ContentTokenType);
526
- }
527
- declare const token: {
528
- genericShellCommand: (value: string) => ContentToken;
529
- path: (value: string) => ContentToken;
530
- link: (value: string, link: string) => ContentToken;
531
- heading: (value: string) => ContentToken;
532
- subheading: (value: string) => ContentToken;
533
- italic: (value: string) => ContentToken;
534
- errorText: (value: string) => ContentToken;
535
- cyan: (value: string) => ContentToken;
536
- yellow: (value: string) => ContentToken;
537
- magenta: (value: string) => ContentToken;
538
- green: (value: string) => ContentToken;
539
- command: (dependencyManager: DependencyManager, scriptName: string, ...scriptArgs: string[]) => ContentToken;
540
- };
541
- declare class TokenizedString {
542
- value: string;
543
- constructor(value: string);
544
- }
545
- declare type Message = string | TokenizedString;
546
- declare function content(strings: TemplateStringsArray, ...keys: (ContentToken | string)[]): TokenizedString;
547
- /** Log levels */
548
- declare type LogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent';
549
- /**
550
- *
551
- * @returns {LogLevel} It returns the log level set by the user.
552
- */
553
- declare const currentLogLevel: () => LogLevel;
554
- declare const shouldOutput: (logLevel: LogLevel) => boolean;
555
- /**
556
- * Ouputs information to the user. This is akin to "console.log"
557
- * Info messages don't get additional formatting.
558
- * Note: Info messages are sent through the standard output.
559
- * @param content {string} The content to be output to the user.
560
- */
561
- declare const info: (content: Message) => void;
562
- /**
563
- * Outputs a success message to the user.
564
- * Success message receive a special formatting to make them stand out in the console.
565
- * Note: Success messages are sent through the standard output.
566
- * @param content {string} The content to be output to the user.
567
- */
568
- declare const success: (content: Message) => void;
569
- /**
570
- * Outputs a completed message to the user.
571
- * Completed message receive a special formatting to make them stand out in the console.
572
- * Note: Completed messages are sent through the standard output.
573
- * @param content {string} The content to be output to the user.
574
- */
575
- declare const completed: (content: Message) => void;
576
- /**
577
- * Ouputs debug information to the user. By default these output is hidden unless the user calls the CLI with --verbose.
578
- * Debug messages don't get additional formatting.
579
- * Note: Debug messages are sent through the standard output.
580
- * @param content {string} The content to be output to the user.
581
- */
582
- declare const debug: (content: Message) => void;
583
- /**
584
- * Outputs a warning message to the user.
585
- * Warning messages receive a special formatting to make them stand out in the console.
586
- * Note: Warning messages are sent through the standard output.
587
- * @param content {string} The content to be output to the user.
588
- */
589
- declare const warn: (content: Message) => void;
590
- /**
591
- * Prints a new line in the terminal.
592
- */
593
- declare const newline: () => void;
594
- /**
595
- * Turns the given object into a colorized JSON.
596
- * @param json {any} Object to turn into a JSON and colorize
597
- * @returns {string} Colorized JSON representation of the given object.
598
- */
599
- declare const colorJson: (json: any) => string;
600
- /**
601
- * Formats and outputs a fatal error.
602
- * Note: This API is not intended to be used internally. If you want to
603
- * abort the execution due to an error, raise a fatal error and let the
604
- * error handler handle and format it.
605
- * @param content {Fatal} The fatal error to be output.
606
- */
607
- declare const error: (content: Fatal) => Promise<void>;
608
- declare function stringifyMessage(message: Message): string;
609
- interface OutputProcess {
610
- /** The prefix to include in the logs
611
- * [vite] Output coming from Vite
612
- */
613
- prefix: string;
614
- /**
615
- * A callback to invoke the process. stdout and stderr should be used
616
- * to send standard output and error data that gets formatted with the
617
- * right prefix.
618
- */
619
- action: (stdout: Writable, stderr: Writable, signal: AbortSignal) => Promise<void>;
620
- }
621
- /**
622
- * Use this function when you have multiple concurrent processes that send data events
623
- * and we need to output them ensuring that they can visually differenciated by the user.
624
- *
625
- * @param processes {OutputProcess[]} A list of processes to run concurrently.
626
- */
627
- declare function concurrent(processes: OutputProcess[]): Promise<void>;
628
- declare function unstyled(message: string): string;
629
- declare function shouldDisplayColors(): boolean;
693
+ declare function generate(suffix: string): string;
630
694
 
631
- declare const output_token: typeof token;
632
- type output_TokenizedString = TokenizedString;
633
- declare const output_TokenizedString: typeof TokenizedString;
634
- type output_Message = Message;
635
- declare const output_content: typeof content;
636
- type output_LogLevel = LogLevel;
637
- declare const output_currentLogLevel: typeof currentLogLevel;
638
- declare const output_shouldOutput: typeof shouldOutput;
639
- declare const output_info: typeof info;
640
- declare const output_success: typeof success;
641
- declare const output_completed: typeof completed;
642
- declare const output_debug: typeof debug;
643
- declare const output_warn: typeof warn;
644
- declare const output_newline: typeof newline;
645
- declare const output_colorJson: typeof colorJson;
646
- declare const output_error: typeof error;
647
- declare const output_stringifyMessage: typeof stringifyMessage;
648
- type output_OutputProcess = OutputProcess;
649
- declare const output_concurrent: typeof concurrent;
650
- declare const output_unstyled: typeof unstyled;
651
- declare const output_shouldDisplayColors: typeof shouldDisplayColors;
652
- declare namespace output {
695
+ declare const haiku_generate: typeof generate;
696
+ declare namespace haiku {
653
697
  export {
654
- output_token as token,
655
- output_TokenizedString as TokenizedString,
656
- output_Message as Message,
657
- output_content as content,
658
- output_LogLevel as LogLevel,
659
- output_currentLogLevel as currentLogLevel,
660
- output_shouldOutput as shouldOutput,
661
- output_info as info,
662
- output_success as success,
663
- output_completed as completed,
664
- output_debug as debug,
665
- output_warn as warn,
666
- output_newline as newline,
667
- output_colorJson as colorJson,
668
- output_error as error,
669
- output_stringifyMessage as stringifyMessage,
670
- output_OutputProcess as OutputProcess,
671
- output_concurrent as concurrent,
672
- output_unstyled as unstyled,
673
- output_shouldDisplayColors as shouldDisplayColors,
698
+ haiku_generate as generate,
674
699
  };
675
700
  }
676
701
 
@@ -681,10 +706,10 @@ declare namespace output {
681
706
  */
682
707
  declare function latestNpmPackageVersion(name: string): Promise<string>;
683
708
 
684
- declare const version_latestNpmPackageVersion: typeof latestNpmPackageVersion;
685
- declare namespace version {
709
+ declare const version$1_latestNpmPackageVersion: typeof latestNpmPackageVersion;
710
+ declare namespace version$1 {
686
711
  export {
687
- version_latestNpmPackageVersion as latestNpmPackageVersion,
712
+ version$1_latestNpmPackageVersion as latestNpmPackageVersion,
688
713
  };
689
714
  }
690
715
 
@@ -718,6 +743,12 @@ declare function homeDirectory(): string;
718
743
  * @returns true if SHOPIFY_CONFIG is debug
719
744
  */
720
745
  declare function isDebug(env?: NodeJS.ProcessEnv): boolean;
746
+ /**
747
+ * Returns true if the CLI is running in verbose mode.
748
+ * @param env The environment variables from the environment of the current process.
749
+ * @returns true if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed
750
+ */
751
+ declare function isVerbose(env?: NodeJS.ProcessEnv): boolean;
721
752
  /**
722
753
  * Returns true if the environment in which the CLI is running is either
723
754
  * a local environment (where dev is present) or a cloud environment (spin).
@@ -732,17 +763,27 @@ declare function isShopify(env?: NodeJS.ProcessEnv): Promise<boolean>;
732
763
  * @returns True if the SHOPIFY_UNIT_TEST environment variable is truthy.
733
764
  */
734
765
  declare function isUnitTest(env?: NodeJS.ProcessEnv): boolean;
766
+ /**
767
+ * Returns true if reporting analytics is enabled.
768
+ * @param env The environment variables from the environment of the current process.
769
+ * @returns true unless SHOPIFY_CLI_NO_ANALYTICS is truthy.
770
+ */
771
+ declare function analyticsDisabled(env?: NodeJS.ProcessEnv): boolean;
735
772
 
736
773
  declare const local_homeDirectory: typeof homeDirectory;
737
774
  declare const local_isDebug: typeof isDebug;
775
+ declare const local_isVerbose: typeof isVerbose;
738
776
  declare const local_isShopify: typeof isShopify;
739
777
  declare const local_isUnitTest: typeof isUnitTest;
778
+ declare const local_analyticsDisabled: typeof analyticsDisabled;
740
779
  declare namespace local {
741
780
  export {
742
781
  local_homeDirectory as homeDirectory,
743
782
  local_isDebug as isDebug,
783
+ local_isVerbose as isVerbose,
744
784
  local_isShopify as isShopify,
745
785
  local_isUnitTest as isUnitTest,
786
+ local_analyticsDisabled as analyticsDisabled,
746
787
  };
747
788
  }
748
789
 
@@ -1189,15 +1230,16 @@ interface GenerateSignedUploadUrlSchema {
1189
1230
  }
1190
1231
 
1191
1232
  declare const CreateDeployment: string;
1233
+ interface ExtensionSettings {
1234
+ uuid: string;
1235
+ config: string;
1236
+ context: string;
1237
+ }
1192
1238
  interface CreateDeploymentVariables {
1193
1239
  apiKey: string;
1194
1240
  uuid: string;
1195
1241
  bundleUrl: string;
1196
- extensions: {
1197
- uuid: string;
1198
- config: string;
1199
- context: string;
1200
- }[];
1242
+ extensions: ExtensionSettings[];
1201
1243
  }
1202
1244
  interface CreateDeploymentSchema {
1203
1245
  deploymentCreate: {
@@ -1418,6 +1460,7 @@ declare const index_GenerateSignedUploadUrl: typeof GenerateSignedUploadUrl;
1418
1460
  type index_GenerateSignedUploadUrlVariables = GenerateSignedUploadUrlVariables;
1419
1461
  type index_GenerateSignedUploadUrlSchema = GenerateSignedUploadUrlSchema;
1420
1462
  declare const index_CreateDeployment: typeof CreateDeployment;
1463
+ type index_ExtensionSettings = ExtensionSettings;
1421
1464
  type index_CreateDeploymentVariables = CreateDeploymentVariables;
1422
1465
  type index_CreateDeploymentSchema = CreateDeploymentSchema;
1423
1466
  declare const index_AllStoresByOrganizationQuery: typeof AllStoresByOrganizationQuery;
@@ -1466,6 +1509,7 @@ declare namespace index {
1466
1509
  index_GenerateSignedUploadUrlVariables as GenerateSignedUploadUrlVariables,
1467
1510
  index_GenerateSignedUploadUrlSchema as GenerateSignedUploadUrlSchema,
1468
1511
  index_CreateDeployment as CreateDeployment,
1512
+ index_ExtensionSettings as ExtensionSettings,
1469
1513
  index_CreateDeploymentVariables as CreateDeploymentVariables,
1470
1514
  index_CreateDeploymentSchema as CreateDeploymentSchema,
1471
1515
  index_AllStoresByOrganizationQuery as AllStoresByOrganizationQuery,
@@ -1579,13 +1623,16 @@ interface ExecThemeCheckCLIOptions {
1579
1623
  stderr: Writable;
1580
1624
  }
1581
1625
  declare function execThemeCheckCLI({ directories, args, stdout, stderr, }: ExecThemeCheckCLIOptions): Promise<void[]>;
1626
+ declare function version(): Promise<string | undefined>;
1582
1627
 
1583
1628
  declare const ruby_execCLI: typeof execCLI;
1584
1629
  declare const ruby_execThemeCheckCLI: typeof execThemeCheckCLI;
1630
+ declare const ruby_version: typeof version;
1585
1631
  declare namespace ruby {
1586
1632
  export {
1587
1633
  ruby_execCLI as execCLI,
1588
1634
  ruby_execThemeCheckCLI as execThemeCheckCLI,
1635
+ ruby_version as version,
1589
1636
  };
1590
1637
  }
1591
1638
 
@@ -1757,6 +1804,8 @@ declare const constants: {
1757
1804
  spinNamespace: string;
1758
1805
  spinHost: string;
1759
1806
  partnersToken: string;
1807
+ verbose: string;
1808
+ noAnalytics: string;
1760
1809
  };
1761
1810
  paths: {
1762
1811
  executables: {
@@ -1801,5 +1850,23 @@ declare namespace plugins {
1801
1850
  };
1802
1851
  }
1803
1852
 
1804
- export { abort, api, archiver, checksum, cli, constants, dependency, dotEnv as dotenv, environment, error$1 as error, file, git, github, http, id, npm, os, output, path, plugins, port, ruby, schema, semver, session, store, string, system, template, temporary, toml, ui, version, yaml };
1853
+ /**
1854
+ * Check if user editor is VS Code
1855
+ */
1856
+ declare const isVSCode: (root?: string) => Promise<boolean>;
1857
+ /**
1858
+ * Add VSCode extension recommendations
1859
+ */
1860
+ declare function addRecommendedExtensions(directory: string, recommendations: string[]): Promise<void>;
1861
+
1862
+ declare const vscode_isVSCode: typeof isVSCode;
1863
+ declare const vscode_addRecommendedExtensions: typeof addRecommendedExtensions;
1864
+ declare namespace vscode {
1865
+ export {
1866
+ vscode_isVSCode as isVSCode,
1867
+ vscode_addRecommendedExtensions as addRecommendedExtensions,
1868
+ };
1869
+ }
1870
+
1871
+ export { abort, api, archiver, checksum, cli, constants, dependency, dotEnv as dotenv, environment, error, file, git, github, haiku, http, id, npm, os, output, path, plugins, port, ruby, schema, semver, session, store, string, system, template, temporary, toml, ui, version$1 as version, vscode, yaml };
1805
1872
  //# sourceMappingURL=index.d.ts.map