@sanity/runtime-cli 1.8.1 → 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.1 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.1/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.1/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.1/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.1/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.1/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.1/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.1/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.1/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.1/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.1/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.1/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.1/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
 
@@ -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
  }
@@ -26,9 +26,8 @@ export default class Init extends Command {
26
26
  },
27
27
  ]);
28
28
  const { ok, projects, error } = await listProjects();
29
- if (!ok) {
29
+ if (!ok)
30
30
  this.error(error);
31
- }
32
31
  if (projects.length === 0) {
33
32
  this.error('No projects found. Please create a project in Sanity.io first.');
34
33
  }
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { Spinner } from 'picospinner';
2
+ import Spinner from 'yocto-spinner';
3
3
  import { readBlueprintOnDisk } from '../../actions/blueprints/blueprint.js';
4
4
  import { findNewestLogTimestamp, getLogs, getRecentLogs, isNewerLog, streamLogs, } from '../../actions/blueprints/logs.js';
5
5
  import config from '../../config.js';
@@ -33,17 +33,16 @@ export default class Logs extends Command {
33
33
  if (!deployedStack)
34
34
  this.error('Stack not found'); // returns
35
35
  const { id: stackId, projectId, name } = deployedStack;
36
- const spinner = new Spinner(`Fetching logs for stack ${yellow(`<${stackId}>`)}`);
37
- spinner.start();
36
+ const spinner = Spinner({ text: `Fetching logs for stack ${yellow(`<${stackId}>`)}` }).start();
38
37
  if (watchMode) {
39
38
  const { ok, logs, error } = await getLogs(stackId, projectId, config.token);
40
39
  if (!ok) {
41
- spinner.fail(`${red('Failed')} to retrieve logs`);
40
+ spinner.error(`${red('Failed')} to retrieve logs`);
42
41
  this.log(`Error: ${error || 'Unknown error'}`);
43
42
  return;
44
43
  }
45
- spinner.stop(); // stop and remove the spinner
46
- this.log(`${formatTitle('Blueprint', name)} ${bold('Live')} Logs`);
44
+ spinner.stop().clear(); // stop and remove the spinner
45
+ this.log(`${formatTitle('Blueprint', name)} <${yellow(stackId)}> logs`);
47
46
  if (logs.length > 0) {
48
47
  this.log('\nMost recent logs:');
49
48
  const recentLogs = getRecentLogs(logs);
@@ -52,18 +51,22 @@ export default class Logs extends Command {
52
51
  }
53
52
  }
54
53
  else {
55
- this.log(`No recent logs found for stack ${yellow(stackId)}`);
54
+ this.log(`No recent logs found for stack <${yellow(stackId)}>`);
55
+ }
56
+ const watchSpinner = Spinner();
57
+ function onOpen() {
58
+ if (watchSpinner.isSpinning)
59
+ watchSpinner.stop().clear();
60
+ watchSpinner.text = `Watching for new logs... ${bold('ctrl+c')} to stop`;
61
+ watchSpinner.start();
56
62
  }
57
- const onOpen = () => {
58
- this.log(`Watching for new logs... ${bold('ctrl+c')} to stop`);
59
- };
60
63
  let newestTimestamp = findNewestLogTimestamp(logs);
61
64
  const renderLog = (log) => {
62
- if (!isNewerLog(log, newestTimestamp)) {
65
+ if (!isNewerLog(log, newestTimestamp))
63
66
  return;
64
- }
65
67
  newestTimestamp = new Date(log.timestamp).getTime();
66
68
  this.log(formatLogEntry(log, true));
69
+ onOpen();
67
70
  };
68
71
  this.debug(`${yellow('Debug:')} Connecting to streaming endpoint for stack ${stackId}...`);
69
72
  streamLogs(stackId, projectId, config.token, renderLog, onOpen, (error) => this.log(`${red('Error:')} ${error}`));
@@ -73,7 +76,7 @@ export default class Logs extends Command {
73
76
  }
74
77
  const { ok, logs, error } = await getLogs(stackId, projectId, config.token);
75
78
  if (!ok) {
76
- spinner.fail(`${red('Failed')} to retrieve logs`);
79
+ spinner.error(`${red('Failed')} to retrieve logs`);
77
80
  this.log(`Error: ${error || 'Unknown error'}`);
78
81
  return;
79
82
  }
@@ -81,7 +84,7 @@ export default class Logs extends Command {
81
84
  spinner.info(`No logs found for stack ${stackId}`);
82
85
  return;
83
86
  }
84
- spinner.succeed(`${formatTitle('Blueprint', name)} Logs`);
87
+ spinner.success(`${formatTitle('Blueprint', name)} Logs`);
85
88
  this.log(`Found ${bold(logs.length.toString())} log entries for stack ${yellow(stackId)}\n`);
86
89
  // Organize and format logs by day
87
90
  const logsByDay = organizeLogsByDay(logs);
@@ -89,9 +92,8 @@ export default class Logs extends Command {
89
92
  }
90
93
  catch (err) {
91
94
  this.warn('Failed to retrieve logs');
92
- if (err instanceof Error) {
95
+ if (err instanceof Error)
93
96
  this.error(`Error: ${err.message}`);
94
- }
95
97
  }
96
98
  }
97
99
  }
@@ -18,9 +18,7 @@ export default class Plan extends Command {
18
18
  this.log(`${formatTitle('Blueprint', name)} Plan\n`);
19
19
  this.log(`Blueprint document: (${fileInfo.fileName})`);
20
20
  this.log('');
21
- formatResourceTree(resources, this.log.bind(this));
22
- if (resources.length > 0) {
23
- this.log('\nRun `sanity blueprints deploy` to deploy these changes');
24
- }
21
+ this.log(formatResourceTree(resources));
22
+ this.log('\nRun `sanity blueprints deploy` to deploy these changes');
25
23
  }
26
24
  }
@@ -19,10 +19,10 @@ export default class Stacks extends Command {
19
19
  if (!ok)
20
20
  this.error(error || 'Failed to list stacks');
21
21
  if (!stacks || stacks.length === 0) {
22
- this.log('No stacks found');
22
+ this.warn('No stacks found');
23
23
  return;
24
24
  }
25
- this.log(`${bold('Project')} <${yellow(projectId)}> ${bold('Stacks')} :\n`);
25
+ this.log(`${bold('Project')} <${yellow(projectId)}> ${bold('Stacks')}:\n`);
26
26
  this.log(formatStacksListing(stacks, stackId));
27
27
  }
28
28
  }
@@ -1,5 +1,5 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { Spinner } from 'picospinner';
2
+ import Spinner from 'yocto-spinner';
3
3
  import { readBlueprintOnDisk } from '../../actions/blueprints/blueprint.js';
4
4
  import { invoke } from '../../actions/functions/invoke.js';
5
5
  import config from '../../config.js';
@@ -24,20 +24,19 @@ export default class Invoke extends Command {
24
24
  };
25
25
  async run() {
26
26
  const { args, flags } = await this.parse(Invoke);
27
- const spinner = new Spinner(`Invoking function "${args.name}"`);
27
+ const spinner = Spinner({ text: `Invoking function "${args.name}"` }).start();
28
28
  const { deployedStack } = await readBlueprintOnDisk({ getStack: true });
29
29
  if (!deployedStack)
30
30
  this.error('Stack not found'); // returns
31
31
  const { projectId } = deployedStack;
32
- spinner.start();
33
32
  const { externalId } = findFunctionByName(deployedStack, args.name);
34
33
  const result = await invoke(externalId, { data: flags.data, file: flags.file }, { token: config.token, projectId });
35
34
  if (result.ok) {
36
- spinner.succeed(`Invocation of ${args.name} succeeded`);
35
+ spinner.success(`Invocation of ${args.name} succeeded`);
37
36
  this.log(JSON.stringify(result.json, null, 2));
38
37
  }
39
38
  else {
40
- spinner.fail(`${red('Failed')} to invoke function`);
39
+ spinner.error(`${red('Failed')} to invoke function`);
41
40
  this.log(`Error: ${result.error || 'Unknown error'}`);
42
41
  }
43
42
  }
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { Spinner } from 'picospinner';
2
+ import Spinner from 'yocto-spinner';
3
3
  import { readBlueprintOnDisk } from '../../actions/blueprints/blueprint.js';
4
4
  import { logs } from '../../actions/functions/logs.js';
5
5
  import config from '../../config.js';
@@ -13,16 +13,15 @@ export default class Logs extends Command {
13
13
  static examples = ['<%= config.bin %> <%= command.id %> <ID>'];
14
14
  async run() {
15
15
  const { args } = await this.parse(Logs);
16
- const spinner = new Spinner(`Finding logs for function "${args.name}"`);
16
+ const spinner = Spinner({ text: `Finding logs for function "${args.name}"` }).start();
17
17
  const { deployedStack } = await readBlueprintOnDisk({ getStack: true });
18
18
  if (!deployedStack)
19
19
  this.error('Stack not found'); // returns
20
20
  const { name, projectId } = deployedStack;
21
- spinner.start();
22
21
  const { externalId } = findFunctionByName(deployedStack, args.name);
23
22
  const result = await logs(externalId, { token: config.token, projectId });
24
23
  if (result.ok) {
25
- spinner.succeed(`Found logs ${args.name} for blueprint "${name}"`);
24
+ spinner.success(`Found logs ${args.name} for blueprint "${name}"`);
26
25
  for (const logGroup of result.logs) {
27
26
  for (const log of logGroup.events) {
28
27
  const { message, timestamp } = log;
@@ -41,7 +40,7 @@ export default class Logs extends Command {
41
40
  }
42
41
  }
43
42
  else {
44
- spinner.fail(`${red('Failed')} to retrieve logs`);
43
+ spinner.error(`${red('Failed')} to retrieve logs`);
45
44
  this.log(`Error: ${result.error || 'Unknown error'}`);
46
45
  }
47
46
  }
@@ -1,6 +1,5 @@
1
1
  import type { BlueprintResource, BlueprintStack } from '../types.js';
2
2
  export declare function formatTitle(title: string, name: string): string;
3
- export declare function formatStacksList(stacks: string[]): string;
4
- export declare function formatResourceTree(resources: BlueprintResource[], logger: (msg: string) => void): void;
3
+ export declare function formatResourceTree(resources: BlueprintResource[]): string;
5
4
  export declare function formatStackInfo(stack: BlueprintStack, isCurrentStack?: boolean): string;
6
5
  export declare function formatStacksListing(stacks: BlueprintStack[], currentStackId?: string): string;
@@ -1,67 +1,78 @@
1
- import { blue, bold, boldnblue, green, yellow } from './colors.js';
2
- import { formatDate } from './dates.js';
1
+ import { treeify } from 'array-treeify';
2
+ import { blue, bold, boldnblue, green, red, yellow } from './colors.js';
3
+ import { formatDate, formatDuration } from './dates.js';
3
4
  export function formatTitle(title, name) {
4
5
  return `${boldnblue(title)} ${bold(`"${name}"`)}`;
5
6
  }
6
- export function formatStacksList(stacks) {
7
- if (!stacks || stacks.length === 0) {
8
- return 'No stacks found';
9
- }
10
- let result = '\nFound Stacks:\n';
11
- for (const name of stacks) {
12
- result += ` ${name}\n`;
13
- }
14
- return result;
15
- }
16
- export function formatResourceTree(resources, logger) {
7
+ export function formatResourceTree(resources) {
17
8
  if (!resources || resources.length === 0) {
18
- logger(' No resources in this stack');
19
- return;
9
+ return ' No resources in this stack';
20
10
  }
21
- logger(`${blue('Stack Resources')} [${resources.length}]`);
11
+ const output = [];
12
+ output.push(`${blue('Stack Resources')} [${resources.length}]`);
22
13
  const functionResources = resources.filter((r) => r.type?.startsWith('sanity.function.'));
23
14
  const otherResources = resources.filter((r) => !r.type?.startsWith('sanity.function.'));
24
15
  const hasOtherResources = otherResources.length > 0;
25
16
  if (functionResources.length > 0) {
26
- logger(` ${hasOtherResources ? '├─' : '└─'} ${bold('Functions')} [${functionResources.length}]`);
27
- for (const [i, fn] of functionResources.entries()) {
28
- const isLast = i === functionResources.length - 1;
29
- const prefix = hasOtherResources ? '│' : ' ';
30
- const connector = isLast ? '└─' : '├─';
17
+ const functionsOutput = [];
18
+ functionsOutput.push(`${bold('Functions')} [${functionResources.length}]`);
19
+ const functionResourcesOutput = functionResources.map((fn) => {
31
20
  const name = green(fn.displayName || fn.name);
32
21
  const externalId = fn.externalId ? `Fn<${yellow(fn.externalId)}>` : '';
33
- logger(` ${prefix} ${connector} "${name}" ${externalId}`);
34
- }
22
+ return `"${name}" ${externalId}`;
23
+ });
24
+ functionsOutput.push(functionResourcesOutput);
25
+ output.push(functionsOutput);
35
26
  }
36
27
  if (hasOtherResources) {
37
- logger(` └─ ${bold('Other Resources')} [${otherResources.length}]`);
38
- for (const [i, other] of otherResources.entries()) {
39
- const isLast = i === otherResources.length - 1;
40
- logger(` ${isLast ? '└─' : '├─'} "${yellow(other.displayName || other.name || other.src)}"`);
41
- }
28
+ const otherOutput = [];
29
+ otherOutput.push(`${bold('Other Resources')} [${otherResources.length}]`);
30
+ const otherResourcesOutput = otherResources.map((other) => {
31
+ return `"${yellow(other.displayName || other.name || other.src)}"`;
32
+ });
33
+ otherOutput.push(otherResourcesOutput);
34
+ output.push(otherOutput);
42
35
  }
36
+ return treeify(output);
43
37
  }
44
38
  export function formatStackInfo(stack, isCurrentStack = false) {
45
- let result = '';
39
+ const output = [];
46
40
  const stackName = isCurrentStack ? boldnblue(stack.name) : bold(stack.name);
47
- result += `${stackName} <${yellow(stack.id)}>${isCurrentStack ? ' (current)' : ''}\n`;
48
- if (stack.createdAt) {
49
- result += ` Created: ${formatDate(stack.createdAt)}\n`;
50
- }
51
- if (stack.updatedAt) {
52
- result += ` Updated: ${formatDate(stack.updatedAt)}\n`;
41
+ output.push(`"${stackName}" <${yellow(stack.id)}>${isCurrentStack ? ' (current)' : ''}`);
42
+ const infoOutput = [];
43
+ infoOutput.push(`${stack.resources.length} resource${stack.resources.length === 1 ? '' : 's'}`);
44
+ if (stack.createdAt)
45
+ infoOutput.push(`Created: ${formatDate(stack.createdAt)}`);
46
+ if (stack.updatedAt)
47
+ infoOutput.push(`Updated: ${formatDate(stack.updatedAt)}`);
48
+ if (stack.recentOperation) {
49
+ const operation = stack.recentOperation;
50
+ const operationOutput = [];
51
+ if (operation.id)
52
+ operationOutput.push(`Recent Operation <${yellow(operation.id)}>:`);
53
+ if (operation.status) {
54
+ const operationColor = operation.status === 'COMPLETED' ? green : red;
55
+ const status = operation.status || 'UNKNOWN';
56
+ operationOutput.push(`Status: ${operationColor(status)}`);
57
+ }
58
+ if (operation.createdAt)
59
+ operationOutput.push(`Started: ${formatDate(operation.createdAt)}`);
60
+ if (operation.status === 'COMPLETED' && operation.completedAt && operation.createdAt) {
61
+ operationOutput.push(`Completed: ${formatDate(operation.completedAt)}`);
62
+ operationOutput.push(`Duration: ${yellow(formatDuration(operation.createdAt, operation.completedAt))}`);
63
+ }
64
+ infoOutput.push(operationOutput);
53
65
  }
54
- result += ` ${stack.resources.length} resource${stack.resources.length === 1 ? '' : 's'}\n\n`;
55
- return result;
66
+ output.push(infoOutput);
67
+ return treeify(output, { plain: true });
56
68
  }
57
69
  export function formatStacksListing(stacks, currentStackId) {
58
- if (!stacks || stacks.length === 0) {
70
+ if (!stacks || stacks.length === 0)
59
71
  return 'No stacks found';
60
- }
61
- let result = '';
72
+ const output = [];
62
73
  for (const stack of stacks) {
63
74
  const isCurrentStack = currentStackId === stack.id;
64
- result += formatStackInfo(stack, isCurrentStack);
75
+ output.push(formatStackInfo(stack, isCurrentStack));
65
76
  }
66
- return result;
77
+ return output.join('\n');
67
78
  }
@@ -1,4 +1,5 @@
1
1
  export declare function bold(str: string): string;
2
+ export declare function dim(str: string): string;
2
3
  export declare function blue(str: string): string;
3
4
  export declare function green(str: string): string;
4
5
  export declare function red(str: string): string;
@@ -1,6 +1,9 @@
1
1
  export function bold(str) {
2
2
  return `\x1b[1m${str}\x1b[0m`;
3
3
  }
4
+ export function dim(str) {
5
+ return `\x1b[2m${str}\x1b[0m`;
6
+ }
4
7
  export function blue(str) {
5
8
  return `\x1b[34m${str}\x1b[0m`;
6
9
  }
@@ -1,20 +1,16 @@
1
1
  export function formatDate(dateString) {
2
- const date = new Date(dateString);
3
- return date.toLocaleString();
2
+ return new Date(dateString).toLocaleString();
4
3
  }
5
4
  export function formatDuration(startDate, endDate) {
6
5
  const start = new Date(startDate).getTime();
7
6
  const end = new Date(endDate).getTime();
8
- if (start > end) {
7
+ if (start > end)
9
8
  return 'Invalid duration';
10
- }
11
9
  const durationMs = end - start;
12
- if (durationMs < 1000) {
10
+ if (durationMs < 1000)
13
11
  return `${durationMs}ms`;
14
- }
15
- if (durationMs < 60000) {
12
+ if (durationMs < 60000)
16
13
  return `${Math.round(durationMs / 1000)}s`;
17
- }
18
14
  if (durationMs < 3600000) {
19
15
  const minutes = Math.floor(durationMs / 60000);
20
16
  const seconds = Math.floor((durationMs % 60000) / 1000);
@@ -1,5 +1,5 @@
1
1
  import type { BlueprintLog } from '../types.js';
2
- export declare function formatLogEntry(log: BlueprintLog, isNewest?: boolean): string;
2
+ export declare function formatLogEntry(log: BlueprintLog, withDate?: boolean, isNewest?: boolean): string;
3
3
  export declare function formatRecentLogs(logs: BlueprintLog[]): string;
4
4
  export declare function organizeLogsByDay(logs: BlueprintLog[]): Map<string, BlueprintLog[]>;
5
5
  export declare function formatLogsByDay(logsByDay: Map<string, BlueprintLog[]>): string;
@@ -1,9 +1,10 @@
1
- import { blue, bold, green, yellow } from './colors.js';
2
- export function formatLogEntry(log, isNewest = false) {
1
+ import { treeify } from 'array-treeify';
2
+ import { blue, bold, dim, green } from './colors.js';
3
+ export function formatLogEntry(log, withDate = true, isNewest = false) {
3
4
  const date = new Date(log.timestamp);
4
5
  const time = date.toLocaleTimeString();
5
6
  const day = date.toLocaleDateString();
6
- return `${isNewest ? `${green('>')} ` : ''}${bold(day)} ${yellow(time)} ${log.message}`;
7
+ return `${isNewest ? `${green('>')} ` : ''}${withDate ? `${day} ` : ''}${dim(time)} ${log.message}`;
7
8
  }
8
9
  export function formatRecentLogs(logs) {
9
10
  if (logs.length === 0)
@@ -11,9 +12,8 @@ export function formatRecentLogs(logs) {
11
12
  const sortedLogs = [...logs].sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
12
13
  const recentLogs = sortedLogs.slice(-10);
13
14
  let result = '\nMost recent logs:\n';
14
- for (const log of recentLogs) {
15
+ for (const log of recentLogs)
15
16
  result += ` ${formatLogEntry(log)}\n`;
16
- }
17
17
  return result;
18
18
  }
19
19
  export function organizeLogsByDay(logs) {
@@ -21,30 +21,25 @@ export function organizeLogsByDay(logs) {
21
21
  for (const log of logs) {
22
22
  const date = new Date(log.timestamp);
23
23
  const day = date.toLocaleDateString();
24
- if (!logsByDay.has(day)) {
24
+ if (!logsByDay.has(day))
25
25
  logsByDay.set(day, []);
26
- }
27
26
  logsByDay.get(day)?.push(log);
28
27
  }
29
28
  return logsByDay;
30
29
  }
31
30
  export function formatLogsByDay(logsByDay) {
32
- let result = '';
31
+ const output = [];
33
32
  const sortedDays = Array.from(logsByDay.keys()).sort((a, b) => {
34
33
  return new Date(a).getTime() - new Date(b).getTime();
35
34
  });
36
35
  for (const day of sortedDays) {
37
- result += `${blue('Date:')} ${bold(day)}\n`;
36
+ output.push(`${blue('Date:')} ${bold(day)}`);
38
37
  const dayLogs = logsByDay.get(day) || [];
39
38
  dayLogs.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
40
- for (const [i, log] of dayLogs.entries()) {
41
- const date = new Date(log.timestamp);
42
- const time = date.toLocaleTimeString();
43
- const isLast = i === dayLogs.length - 1;
44
- result += ` ${isLast ? '└─' : '├─'} ${yellow(time)} ${log.message}\n`;
45
- }
46
- // new line between days
47
- result += '\n';
39
+ const dayLogsOutput = dayLogs.map((log) => formatLogEntry(log, false));
40
+ output.push(dayLogsOutput);
41
+ output.push('');
48
42
  }
49
- return result;
43
+ output.pop(); // remove last empty line
44
+ return treeify(output);
50
45
  }
@@ -404,5 +404,5 @@
404
404
  ]
405
405
  }
406
406
  },
407
- "version": "1.8.1"
407
+ "version": "1.8.2"
408
408
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
- "description": "A new CLI generated with oclif",
4
- "version": "1.8.1",
3
+ "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
+ "version": "1.8.2",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -25,32 +25,31 @@
25
25
  "sanity-run": "./bin/run.js"
26
26
  },
27
27
  "scripts": {
28
- "build": "rollup -c && npm run build:bin && npm run build:static",
29
- "build:bin": "shx rm -rf dist *.tsbuildinfo && tsc -b",
28
+ "build": "rollup -c && npm run build:ts && npm run build:static",
29
+ "postbuild": "oclif manifest && oclif readme",
30
+ "build:ts": "shx rm -rf dist *.tsbuildinfo && tsc -b",
30
31
  "build:static": "npm run copy:wrapper && npm run copy:server",
31
32
  "copy:server": "shx cp -r ./src/server/static ./dist/server",
32
33
  "copy:wrapper": "shx cp ./src/utils/child-process-wrapper.js ./dist/utils/child-process-wrapper.js",
33
34
  "lint": "biome ci",
34
35
  "lint:write": "biome check --write",
35
- "postpack": "shx rm -f oclif.manifest.json",
36
- "posttest": "npm run lint",
37
36
  "prepack": "oclif manifest && oclif readme",
37
+ "postpack": "shx rm -f oclif.manifest.json",
38
38
  "test": "vitest run",
39
- "test:watch": "vitest",
40
- "version": "oclif readme && git add README.md"
39
+ "posttest": "npm run lint",
40
+ "test:watch": "vitest"
41
41
  },
42
42
  "dependencies": {
43
- "@oclif/core": "^4",
44
- "@oclif/plugin-help": "^6",
45
- "@oclif/plugin-plugins": "^5",
46
- "eventsource": "^3.0.5",
43
+ "@oclif/core": "^4.2.10",
44
+ "@oclif/plugin-help": "^6.2.27",
45
+ "array-treeify": "^0.1.3",
46
+ "color-json": "^3.0.5",
47
+ "eventsource": "^3.0.6",
47
48
  "inquirer": "^12.5.0",
48
49
  "jszip": "^3.10.1",
49
- "mime-types": "^2.1.35",
50
- "picocolors": "^1.1.1",
51
- "picospinner": "^3.0.0",
52
- "tinyhighlight": "^0.3.2",
53
- "xdg-basedir": "^5.1.0"
50
+ "mime-types": "^3.0.1",
51
+ "xdg-basedir": "^5.1.0",
52
+ "yocto-spinner": "^0.2.1"
54
53
  },
55
54
  "devDependencies": {
56
55
  "@biomejs/biome": "1.9.4",
@@ -58,29 +57,28 @@
58
57
  "@codemirror/state": "^6.5.2",
59
58
  "@enhance/store": "^1.0.2",
60
59
  "@oclif/prettier-config": "^0.2.1",
61
- "@oclif/test": "^4",
60
+ "@oclif/test": "^4.1.12",
62
61
  "@rollup/plugin-node-resolve": "^16.0.1",
63
62
  "@types/mime-types": "^2.1.4",
64
63
  "@types/node": "20",
65
64
  "codemirror": "^6.0.1",
66
- "mentoss": "^0.8.0",
67
- "oclif": "^4",
65
+ "mentoss": "^0.9.1",
66
+ "oclif": "^4.17.41",
68
67
  "pretty-bytes": "^6.1.1",
69
68
  "pretty-ms": "^9.2.0",
70
- "rollup": "^4.36.0",
69
+ "rollup": "^4.38.0",
71
70
  "shx": "^0.4.0",
72
- "ts-node": "^10",
71
+ "ts-node": "^10.9.2",
73
72
  "tsx": "^4.19.3",
74
- "typescript": "^5",
75
- "vitest": "3.0.8"
73
+ "typescript": "^5.8.2",
74
+ "vitest": "3.0.9"
76
75
  },
77
76
  "oclif": {
78
77
  "bin": "sanity-run",
79
78
  "dirname": "sanity-run",
80
79
  "commands": "./dist/commands",
81
80
  "plugins": [
82
- "@oclif/plugin-help",
83
- "@oclif/plugin-plugins"
81
+ "@oclif/plugin-help"
84
82
  ],
85
83
  "state": "beta",
86
84
  "topicSeparator": " ",