@shopify/cli-kit 3.0.9 → 3.0.12

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