@sanity/runtime-cli 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  @sanity/runtime-cli
2
- =================
2
+ ===================
3
3
 
4
- A new CLI generated with oclif
4
+ Sanity's Runtime CLI for Blueprints and Functions
5
5
 
6
6
 
7
7
  [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
@@ -20,7 +20,7 @@ $ npm install -g @sanity/runtime-cli
20
20
  $ sanity-run COMMAND
21
21
  running command...
22
22
  $ sanity-run (--version)
23
- @sanity/runtime-cli/1.8.0 linux-x64 node-v22.14.0
23
+ @sanity/runtime-cli/1.8.2 linux-x64 node-v22.14.0
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -42,16 +42,6 @@ USAGE
42
42
  * [`sanity-run functions logs NAME`](#sanity-run-functions-logs-name)
43
43
  * [`sanity-run functions test NAME`](#sanity-run-functions-test-name)
44
44
  * [`sanity-run help [COMMAND]`](#sanity-run-help-command)
45
- * [`sanity-run plugins`](#sanity-run-plugins)
46
- * [`sanity-run plugins add PLUGIN`](#sanity-run-plugins-add-plugin)
47
- * [`sanity-run plugins:inspect PLUGIN...`](#sanity-run-pluginsinspect-plugin)
48
- * [`sanity-run plugins install PLUGIN`](#sanity-run-plugins-install-plugin)
49
- * [`sanity-run plugins link PATH`](#sanity-run-plugins-link-path)
50
- * [`sanity-run plugins remove [PLUGIN]`](#sanity-run-plugins-remove-plugin)
51
- * [`sanity-run plugins reset`](#sanity-run-plugins-reset)
52
- * [`sanity-run plugins uninstall [PLUGIN]`](#sanity-run-plugins-uninstall-plugin)
53
- * [`sanity-run plugins unlink [PLUGIN]`](#sanity-run-plugins-unlink-plugin)
54
- * [`sanity-run plugins update`](#sanity-run-plugins-update)
55
45
 
56
46
  ## `sanity-run blueprints add TYPE`
57
47
 
@@ -71,7 +61,7 @@ EXAMPLES
71
61
  $ sanity-run blueprints add function
72
62
  ```
73
63
 
74
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/add.ts)_
64
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/add.ts)_
75
65
 
76
66
  ## `sanity-run blueprints config`
77
67
 
@@ -93,7 +83,7 @@ EXAMPLES
93
83
  $ sanity-run blueprints config --edit
94
84
  ```
95
85
 
96
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/config.ts)_
86
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/config.ts)_
97
87
 
98
88
  ## `sanity-run blueprints deploy`
99
89
 
@@ -110,7 +100,7 @@ EXAMPLES
110
100
  $ sanity-run blueprints deploy
111
101
  ```
112
102
 
113
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/deploy.ts)_
103
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/deploy.ts)_
114
104
 
115
105
  ## `sanity-run blueprints info`
116
106
 
@@ -132,7 +122,7 @@ EXAMPLES
132
122
  $ sanity-run blueprints info --id abc123
133
123
  ```
134
124
 
135
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/info.ts)_
125
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/info.ts)_
136
126
 
137
127
  ## `sanity-run blueprints init`
138
128
 
@@ -149,7 +139,7 @@ EXAMPLES
149
139
  $ sanity-run blueprints init
150
140
  ```
151
141
 
152
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/init.ts)_
142
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/init.ts)_
153
143
 
154
144
  ## `sanity-run blueprints logs`
155
145
 
@@ -171,7 +161,7 @@ EXAMPLES
171
161
  $ sanity-run blueprints logs --watch
172
162
  ```
173
163
 
174
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/logs.ts)_
164
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/logs.ts)_
175
165
 
176
166
  ## `sanity-run blueprints plan`
177
167
 
@@ -188,7 +178,7 @@ EXAMPLES
188
178
  $ sanity-run blueprints plan
189
179
  ```
190
180
 
191
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/plan.ts)_
181
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/plan.ts)_
192
182
 
193
183
  ## `sanity-run blueprints stacks`
194
184
 
@@ -205,7 +195,7 @@ EXAMPLES
205
195
  $ sanity-run blueprints stacks
206
196
  ```
207
197
 
208
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/blueprints/stacks.ts)_
198
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/blueprints/stacks.ts)_
209
199
 
210
200
  ## `sanity-run functions dev`
211
201
 
@@ -225,7 +215,7 @@ EXAMPLES
225
215
  $ sanity-run functions dev --port 8974
226
216
  ```
227
217
 
228
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/functions/dev.ts)_
218
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/functions/dev.ts)_
229
219
 
230
220
  ## `sanity-run functions invoke NAME`
231
221
 
@@ -251,7 +241,7 @@ EXAMPLES
251
241
  $ sanity-run functions invoke <ID> --file 'payload.json'
252
242
  ```
253
243
 
254
- _See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/functions/invoke.ts)_
244
+ _See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/functions/invoke.ts)_
255
245
 
256
246
  ## `sanity-run functions logs NAME`
257
247
 
@@ -271,7 +261,7 @@ EXAMPLES
271
261
  $ sanity-run functions logs <ID>
272
262
  ```
273
263
 
274
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/functions/logs.ts)_
264
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/functions/logs.ts)_
275
265
 
276
266
  ## `sanity-run functions test NAME`
277
267
 
@@ -300,7 +290,7 @@ EXAMPLES
300
290
  $ sanity-run functions test echo-fn --data '{ "id": 1 }' --timeout 60
301
291
  ```
302
292
 
303
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.0/src/commands/functions/test.ts)_
293
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v1.8.2/src/commands/functions/test.ts)_
304
294
 
305
295
  ## `sanity-run help [COMMAND]`
306
296
 
@@ -320,391 +310,5 @@ DESCRIPTION
320
310
  Display help for sanity-run.
321
311
  ```
322
312
 
323
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.26/src/commands/help.ts)_
324
-
325
- ## `sanity-run plugins`
326
-
327
- List installed plugins.
328
-
329
- ```
330
- USAGE
331
- $ sanity-run plugins [--json] [--core]
332
-
333
- FLAGS
334
- --core Show core plugins.
335
-
336
- GLOBAL FLAGS
337
- --json Format output as json.
338
-
339
- DESCRIPTION
340
- List installed plugins.
341
-
342
- EXAMPLES
343
- $ sanity-run plugins
344
- ```
345
-
346
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/index.ts)_
347
-
348
- ## `sanity-run plugins add PLUGIN`
349
-
350
- Installs a plugin into sanity-run.
351
-
352
- ```
353
- USAGE
354
- $ sanity-run plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
355
-
356
- ARGUMENTS
357
- PLUGIN... Plugin to install.
358
-
359
- FLAGS
360
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
361
- -h, --help Show CLI help.
362
- -s, --silent Silences npm output.
363
- -v, --verbose Show verbose npm output.
364
-
365
- GLOBAL FLAGS
366
- --json Format output as json.
367
-
368
- DESCRIPTION
369
- Installs a plugin into sanity-run.
370
-
371
- Uses npm to install plugins.
372
-
373
- Installation of a user-installed plugin will override a core plugin.
374
-
375
- Use the SANITY_RUN_NPM_LOG_LEVEL environment variable to set the npm loglevel.
376
- Use the SANITY_RUN_NPM_REGISTRY environment variable to set the npm registry.
377
-
378
- ALIASES
379
- $ sanity-run plugins add
380
-
381
- EXAMPLES
382
- Install a plugin from npm registry.
383
-
384
- $ sanity-run plugins add myplugin
385
-
386
- Install a plugin from a github url.
387
-
388
- $ sanity-run plugins add https://github.com/someuser/someplugin
389
-
390
- Install a plugin from a github slug.
391
-
392
- $ sanity-run plugins add someuser/someplugin
393
- ```
394
-
395
- ## `sanity-run plugins:inspect PLUGIN...`
396
-
397
- Displays installation properties of a plugin.
398
-
399
- ```
400
- USAGE
401
- $ sanity-run plugins inspect PLUGIN...
402
-
403
- ARGUMENTS
404
- PLUGIN... [default: .] Plugin to inspect.
405
-
406
- FLAGS
407
- -h, --help Show CLI help.
408
- -v, --verbose
409
-
410
- GLOBAL FLAGS
411
- --json Format output as json.
412
-
413
- DESCRIPTION
414
- Displays installation properties of a plugin.
415
-
416
- EXAMPLES
417
- $ sanity-run plugins inspect myplugin
418
- ```
419
-
420
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/inspect.ts)_
421
-
422
- ## `sanity-run plugins install PLUGIN`
423
-
424
- Installs a plugin into sanity-run.
425
-
426
- ```
427
- USAGE
428
- $ sanity-run plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
429
-
430
- ARGUMENTS
431
- PLUGIN... Plugin to install.
432
-
433
- FLAGS
434
- -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
435
- -h, --help Show CLI help.
436
- -s, --silent Silences npm output.
437
- -v, --verbose Show verbose npm output.
438
-
439
- GLOBAL FLAGS
440
- --json Format output as json.
441
-
442
- DESCRIPTION
443
- Installs a plugin into sanity-run.
444
-
445
- Uses npm to install plugins.
446
-
447
- Installation of a user-installed plugin will override a core plugin.
448
-
449
- Use the SANITY_RUN_NPM_LOG_LEVEL environment variable to set the npm loglevel.
450
- Use the SANITY_RUN_NPM_REGISTRY environment variable to set the npm registry.
451
-
452
- ALIASES
453
- $ sanity-run plugins add
454
-
455
- EXAMPLES
456
- Install a plugin from npm registry.
457
-
458
- $ sanity-run plugins install myplugin
459
-
460
- Install a plugin from a github url.
461
-
462
- $ sanity-run plugins install https://github.com/someuser/someplugin
463
-
464
- Install a plugin from a github slug.
465
-
466
- $ sanity-run plugins install someuser/someplugin
467
- ```
468
-
469
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/install.ts)_
470
-
471
- ## `sanity-run plugins link PATH`
472
-
473
- Links a plugin into the CLI for development.
474
-
475
- ```
476
- USAGE
477
- $ sanity-run plugins link PATH [-h] [--install] [-v]
478
-
479
- ARGUMENTS
480
- PATH [default: .] path to plugin
481
-
482
- FLAGS
483
- -h, --help Show CLI help.
484
- -v, --verbose
485
- --[no-]install Install dependencies after linking the plugin.
486
-
487
- DESCRIPTION
488
- Links a plugin into the CLI for development.
489
-
490
- Installation of a linked plugin will override a user-installed or core plugin.
491
-
492
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
493
- command will override the user-installed or core plugin implementation. This is useful for development work.
494
-
495
-
496
- EXAMPLES
497
- $ sanity-run plugins link myplugin
498
- ```
499
-
500
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/link.ts)_
501
-
502
- ## `sanity-run plugins remove [PLUGIN]`
503
-
504
- Removes a plugin from the CLI.
505
-
506
- ```
507
- USAGE
508
- $ sanity-run plugins remove [PLUGIN...] [-h] [-v]
509
-
510
- ARGUMENTS
511
- PLUGIN... plugin to uninstall
512
-
513
- FLAGS
514
- -h, --help Show CLI help.
515
- -v, --verbose
516
-
517
- DESCRIPTION
518
- Removes a plugin from the CLI.
519
-
520
- ALIASES
521
- $ sanity-run plugins unlink
522
- $ sanity-run plugins remove
523
-
524
- EXAMPLES
525
- $ sanity-run plugins remove myplugin
526
- ```
527
-
528
- ## `sanity-run plugins reset`
529
-
530
- Remove all user-installed and linked plugins.
531
-
532
- ```
533
- USAGE
534
- $ sanity-run plugins reset [--hard] [--reinstall]
535
-
536
- FLAGS
537
- --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
538
- --reinstall Reinstall all plugins after uninstalling.
539
- ```
540
-
541
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/reset.ts)_
542
-
543
- ## `sanity-run plugins uninstall [PLUGIN]`
544
-
545
- Removes a plugin from the CLI.
546
-
547
- ```
548
- USAGE
549
- $ sanity-run plugins uninstall [PLUGIN...] [-h] [-v]
550
-
551
- ARGUMENTS
552
- PLUGIN... plugin to uninstall
553
-
554
- FLAGS
555
- -h, --help Show CLI help.
556
- -v, --verbose
557
-
558
- DESCRIPTION
559
- Removes a plugin from the CLI.
560
-
561
- ALIASES
562
- $ sanity-run plugins unlink
563
- $ sanity-run plugins remove
564
-
565
- EXAMPLES
566
- $ sanity-run plugins uninstall myplugin
567
- ```
568
-
569
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/uninstall.ts)_
570
-
571
- ## `sanity-run plugins unlink [PLUGIN]`
572
-
573
- Removes a plugin from the CLI.
574
-
575
- ```
576
- USAGE
577
- $ sanity-run plugins unlink [PLUGIN...] [-h] [-v]
578
-
579
- ARGUMENTS
580
- PLUGIN... plugin to uninstall
581
-
582
- FLAGS
583
- -h, --help Show CLI help.
584
- -v, --verbose
585
-
586
- DESCRIPTION
587
- Removes a plugin from the CLI.
588
-
589
- ALIASES
590
- $ sanity-run plugins unlink
591
- $ sanity-run plugins remove
592
-
593
- EXAMPLES
594
- $ sanity-run plugins unlink myplugin
595
- ```
596
-
597
- ## `sanity-run plugins update`
598
-
599
- Update installed plugins.
600
-
601
- ```
602
- USAGE
603
- $ sanity-run plugins update [-h] [-v]
604
-
605
- FLAGS
606
- -h, --help Show CLI help.
607
- -v, --verbose
608
-
609
- DESCRIPTION
610
- Update installed plugins.
611
- ```
612
-
613
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/update.ts)_
313
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.27/src/commands/help.ts)_
614
314
  <!-- commandsstop -->
615
- * [`sanity functions dev`](#sanity-functions-dev)
616
- * [`sanity functions invoke`](#sanity-functions-invoke)
617
- * [`sanity functions logs`](#sanity-functions-logs)
618
- * [`sanity functions test`](#sanity-functions-test)
619
-
620
- ## `sanity functions dev`
621
-
622
- Start the Sanity Function emulator
623
-
624
- ```
625
- USAGE
626
- $ sanity functions dev [-p <value>]
627
-
628
- FLAGS
629
- -p, --port=<value> Port to start emulator on
630
-
631
- DESCRIPTION
632
- Start the Sanity Function emulator
633
-
634
- EXAMPLES
635
- $ sanity functions dev --port 8974
636
- ```
637
-
638
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli-demos/blob/v0.0.0/src/commands/functions/dev.ts)_
639
-
640
- ## `sanity functions invoke`
641
-
642
- Invoke a remote Sanity Function
643
-
644
- ```
645
- USAGE
646
- $ sanity functions invoke ID [-d <value>] [-f <value>]
647
-
648
- ARGUMENTS
649
- ID The ID of the function to invoke
650
-
651
- FLAGS
652
- -d, --data=<value> Data to send to the function
653
- -f, --file=<value> Read data from file and send to the function
654
-
655
- DESCRIPTION
656
- Invoke a remote Sanity Function
657
-
658
- EXAMPLES
659
- $ sanity functions invoke <ID> --data '{ "id": 1 }'
660
-
661
- $ sanity functions invoke <ID> --file 'payload.json'
662
- ```
663
-
664
- _See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli-demos/blob/v0.0.0/src/commands/functions/invoke.ts)_
665
-
666
- ## `sanity functions logs`
667
-
668
- Retrieve logs for a Sanity Function
669
-
670
- ```
671
- USAGE
672
- $ sanity functions logs ID
673
-
674
- ARGUMENTS
675
- ID The ID of the function to retrieve logs for
676
-
677
- DESCRIPTION
678
- Retrieve logs for a Sanity Function
679
-
680
- EXAMPLES
681
- $ sanity functions logs <ID>
682
- ```
683
-
684
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli-demos/blob/v0.0.0/src/commands/functions/logs.ts)_
685
-
686
- ## `sanity functions test`
687
-
688
- Invoke a local Sanity Function
689
-
690
- ```
691
- USAGE
692
- $ sanity functions test PATH [-d <value>] [-f <value>]
693
-
694
- ARGUMENTS
695
- PATH The path to the function source code
696
-
697
- FLAGS
698
- -d, --data=<value> Data to send to the function
699
- -f, --file=<value> Read data from file and send to the function
700
-
701
- DESCRIPTION
702
- Invoke a local Sanity Function
703
-
704
- EXAMPLES
705
- $ sanity functions test ./test.ts --data '{ "id": 1 }'
706
-
707
- $ sanity functions test ./test.js --file 'payload.json'
708
- ```
709
-
710
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli-demos/blob/v0.0.0/src/commands/functions/test.ts)_
package/bin/dev.cmd CHANGED
@@ -1,3 +1,3 @@
1
1
  @echo off
2
2
 
3
- node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
3
+ node --import tsx --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
1
+ #!/usr/bin/env -S node --import tsx --disable-warning=ExperimentalWarning
2
2
 
3
3
  import {execute} from '@oclif/core'
4
4
 
@@ -15,7 +15,7 @@ export function createFunctionResource(options) {
15
15
  }
16
16
  // Create function file with default template
17
17
  const functionPath = join(functionsDir, `${name}.js`);
18
- const functionContent = `export const handler = function (event) {
18
+ const functionContent = `export async function handler (event) {
19
19
  console.log(event)
20
20
  return {event}
21
21
  }`;
@@ -1,6 +1,6 @@
1
1
  import { Args, Command } from '@oclif/core';
2
+ import highlight from 'color-json';
2
3
  import inquirer from 'inquirer';
3
- import { highlight } from 'tinyhighlight/picocolors';
4
4
  import { findBlueprintFile } from '../../actions/blueprints/blueprint.js';
5
5
  import { createFunctionResource } from '../../actions/blueprints/resources.js';
6
6
  export default class Add extends Command {
@@ -1,6 +1,6 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
+ import highlight from 'color-json';
2
3
  import inquirer from 'inquirer';
3
- import { highlight } from 'tinyhighlight/picocolors';
4
4
  import { readConfigFile, writeConfigFile } from '../../actions/blueprints/blueprint.js';
5
5
  import { listProjects } from '../../actions/blueprints/projects.js';
6
6
  import { listStacks } from '../../actions/blueprints/stacks.js';
@@ -1,6 +1,6 @@
1
1
  import { Command } from '@oclif/core';
2
2
  import inquirer from 'inquirer';
3
- import { Spinner } from 'picospinner';
3
+ import Spinner from 'yocto-spinner';
4
4
  import { readBlueprintOnDisk, writeConfigFile } from '../../actions/blueprints/blueprint.js';
5
5
  import { createStack, updateStack } from '../../actions/blueprints/stacks.js';
6
6
  import { stashAsset } from '../../actions/blueprints/stash-asset.js';
@@ -51,17 +51,16 @@ export default class Deploy extends Command {
51
51
  // First stash all function assets
52
52
  if (functionResources.length > 0) {
53
53
  for (const resource of functionResources) {
54
- const fnSpinner = new Spinner(`Processing ${resource.name}...`);
55
- fnSpinner.start();
54
+ const fnSpinner = Spinner({ text: `Processing ${resource.name}...` }).start();
56
55
  const result = await stashAsset({ resource, projectId });
57
56
  if (result.success) {
58
57
  const src = resource.src;
59
58
  resource.src = result.assetId; // TODO: properly reference asset - for now, the API expects the assetId
60
- fnSpinner.succeed(`${resource.name} <${yellow(result.assetId)}>`);
59
+ fnSpinner.success(`${resource.name} <${yellow(result.assetId)}>`);
61
60
  this.log(` Source: ${src}`);
62
61
  }
63
62
  else {
64
- fnSpinner.fail(`Failed to process ${resource.name}`);
63
+ fnSpinner.error(`Failed to process ${resource.name}`);
65
64
  this.log(` Error: ${result.error}`);
66
65
  return;
67
66
  }
@@ -73,14 +72,13 @@ export default class Deploy extends Command {
73
72
  document: { resources: validResources },
74
73
  };
75
74
  this.debug('BLUEPRINT DOCUMENT:', blueprint);
76
- const spinner = new Spinner('Deploying stack...');
77
- spinner.start();
75
+ const spinner = Spinner({ text: 'Deploying stack...' }).start();
78
76
  const { ok: deployOk, stack, error: deployError, } = deployedStack
79
77
  ? await updateStack({ stackId: deployedStack.id, blueprint, projectId })
80
78
  : await createStack({ blueprint, projectId });
81
79
  this.debug('STACK RESPONSE:', stack);
82
80
  if (deployOk) {
83
- spinner.succeed(`${green('Success!')} Stack "${bold(stack.name)}" ${deployedStack ? 'updated' : 'created'} <${yellow(stack.id)}>`);
81
+ spinner.success(`${green('Success!')} Stack "${bold(stack.name)}" ${deployedStack ? 'updated' : 'created'} <${yellow(stack.id)}>`);
84
82
  writeConfigFile({
85
83
  projectId,
86
84
  stackId: stack.id,
@@ -89,7 +87,7 @@ export default class Deploy extends Command {
89
87
  }
90
88
  else {
91
89
  this.debug('STACK ERROR RESPONSE:', stack);
92
- spinner.fail(`${red('Failed')} to ${deployedStack ? 'update' : 'create'} stack`);
90
+ spinner.error(`${red('Failed')} to ${deployedStack ? 'update' : 'create'} stack`);
93
91
  this.log(`Error: ${deployError || JSON.stringify(stack, null, 2) || 'Unknown error'}`);
94
92
  }
95
93
  }
@@ -1,9 +1,7 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
2
  import { readBlueprintOnDisk } from '../../actions/blueprints/blueprint.js';
3
3
  import { getStack } from '../../actions/blueprints/stacks.js';
4
- import { formatResourceTree } from '../../utils/display/blueprints-formatting.js';
5
- import { bold, green, red, yellow } from '../../utils/display/colors.js';
6
- import { formatDate, formatDuration } from '../../utils/display/dates.js';
4
+ import { formatResourceTree, formatStackInfo } from '../../utils/display/blueprints-formatting.js';
7
5
  export default class Info extends Command {
8
6
  static description = 'Show information about a Blueprint';
9
7
  static examples = [
@@ -21,7 +19,7 @@ export default class Info extends Command {
21
19
  const { errors, deployedStack, projectId } = await readBlueprintOnDisk({ getStack: true });
22
20
  if (errors.length > 0) {
23
21
  // printErrors(errors)
24
- this.log('Blueprint parse errors:');
22
+ this.warn('Blueprint parse errors:');
25
23
  console.dir(errors, { depth: null });
26
24
  return;
27
25
  }
@@ -39,42 +37,10 @@ export default class Info extends Command {
39
37
  }
40
38
  if (!stack)
41
39
  this.error('Stack not found. Is it deployed?');
42
- try {
43
- this.log(`Stack name: ${bold(stack.name)}`);
44
- this.log(`Stack ID: ${yellow(stack.id)}`);
45
- if (stack.createdAt) {
46
- this.log(`Created: ${formatDate(stack.createdAt)}`);
47
- }
48
- if (stack.updatedAt) {
49
- this.log(`Updated: ${formatDate(stack.updatedAt)}`);
50
- }
51
- if (stack.recentOperation) {
52
- const operation = stack.recentOperation;
53
- if (operation.id) {
54
- this.log(`Recent Operation <${yellow(operation.id)}>:`);
55
- }
56
- if (operation.status) {
57
- const operationColor = operation.status === 'COMPLETED' ? green : red;
58
- const status = operation.status || 'UNKNOWN';
59
- this.log(` Status: ${operationColor(status)}`);
60
- }
61
- if (operation.createdAt) {
62
- this.log(` Started: ${formatDate(operation.createdAt)}`);
63
- }
64
- if (operation.status === 'COMPLETED' && operation.completedAt && operation.createdAt) {
65
- this.log(` Completed: ${formatDate(operation.completedAt)}`);
66
- this.log(` Duration: ${yellow(formatDuration(operation.createdAt, operation.completedAt))}`);
67
- }
68
- }
40
+ this.log(formatStackInfo(stack, true));
41
+ if (stack.resources) {
69
42
  this.log('');
70
- if (stack.resources) {
71
- formatResourceTree(stack.resources, this.log.bind(this));
72
- }
73
- }
74
- catch (err) {
75
- if (err instanceof Error) {
76
- this.log(`Error: ${err.message}`);
77
- }
43
+ this.log(formatResourceTree(stack.resources));
78
44
  }
79
45
  }
80
46
  }