@sanity/runtime-cli 17.3.0 → 17.3.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
@@ -3,30 +3,17 @@
3
3
 
4
4
  Sanity's Runtime CLI for Blueprints and Functions
5
5
 
6
+ Typically, the `@sanity/runtime-cli` (`sanity-run`) CLI is not used directly by end-users. The main `@sanity/cli` (`sanity`) loads and uses this CLI internally.
7
+ All `sanity-run` commands can also be run as `sanity <command>` when `@sanity/cli` is available.
6
8
 
7
9
  [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
8
10
  [![Version](https://img.shields.io/npm/v/@sanity/runtime-cli.svg)](https://npmjs.org/package/@sanity/runtime-cli)
9
11
  [![Downloads/week](https://img.shields.io/npm/dw/@sanity/runtime-cli.svg)](https://npmjs.org/package/@sanity/runtime-cli)
10
12
 
11
-
12
13
  <!-- toc -->
13
- * [Usage](#usage)
14
14
  * [Commands](#commands)
15
15
  <!-- tocstop -->
16
- # Usage
17
- <!-- usage -->
18
- ```sh-session
19
- $ npm install -g @sanity/runtime-cli
20
- $ sanity-run COMMAND
21
- running command...
22
- $ sanity-run (--version)
23
- @sanity/runtime-cli/17.3.0 linux-x64 node-v24.18.0
24
- $ sanity-run --help [COMMAND]
25
- USAGE
26
- $ sanity-run COMMAND
27
- ...
28
- ```
29
- <!-- usagestop -->
16
+
30
17
  # Commands
31
18
  <!-- commands -->
32
19
  * [`sanity-run blueprints add TYPE`](#sanity-run-blueprints-add-type)
@@ -103,7 +90,7 @@ EXAMPLES
103
90
  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
104
91
  ```
105
92
 
106
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/add.ts)_
93
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/add.ts)_
107
94
 
108
95
  ## `sanity-run blueprints config`
109
96
 
@@ -140,7 +127,7 @@ EXAMPLES
140
127
  $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
141
128
  ```
142
129
 
143
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/config.ts)_
130
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/config.ts)_
144
131
 
145
132
  ## `sanity-run blueprints deploy`
146
133
 
@@ -194,7 +181,7 @@ EXAMPLES
194
181
  $ sanity-run blueprints deploy --new-stack-name <new-name>
195
182
  ```
196
183
 
197
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/deploy.ts)_
184
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/deploy.ts)_
198
185
 
199
186
  ## `sanity-run blueprints destroy`
200
187
 
@@ -232,7 +219,7 @@ EXAMPLES
232
219
  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
233
220
  ```
234
221
 
235
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/destroy.ts)_
222
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/destroy.ts)_
236
223
 
237
224
  ## `sanity-run blueprints doctor`
238
225
 
@@ -264,7 +251,7 @@ EXAMPLES
264
251
  $ sanity-run blueprints doctor --fix
265
252
  ```
266
253
 
267
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/doctor.ts)_
254
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/doctor.ts)_
268
255
 
269
256
  ## `sanity-run blueprints info`
270
257
 
@@ -301,7 +288,7 @@ EXAMPLES
301
288
  $ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
302
289
  ```
303
290
 
304
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/info.ts)_
291
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/info.ts)_
305
292
 
306
293
  ## `sanity-run blueprints init [DIR]`
307
294
 
@@ -365,7 +352,7 @@ EXAMPLES
365
352
  $ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
366
353
  ```
367
354
 
368
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/init.ts)_
355
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/init.ts)_
369
356
 
370
357
  ## `sanity-run blueprints logs`
371
358
 
@@ -411,7 +398,7 @@ EXAMPLES
411
398
  $ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
412
399
  ```
413
400
 
414
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/logs.ts)_
401
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/logs.ts)_
415
402
 
416
403
  ## `sanity-run blueprints mint-deploy-token`
417
404
 
@@ -456,7 +443,7 @@ EXAMPLES
456
443
  $ sanity-run blueprints mint-deploy-token --organization-id <orgId>
457
444
  ```
458
445
 
459
- _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/mint-deploy-token.ts)_
446
+ _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/mint-deploy-token.ts)_
460
447
 
461
448
  ## `sanity-run blueprints plan`
462
449
 
@@ -489,7 +476,7 @@ EXAMPLES
489
476
  $ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
490
477
  ```
491
478
 
492
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/plan.ts)_
479
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/plan.ts)_
493
480
 
494
481
  ## `sanity-run blueprints promote`
495
482
 
@@ -525,7 +512,7 @@ EXAMPLES
525
512
  $ sanity-run blueprints promote --new-stack-name <new-name>
526
513
  ```
527
514
 
528
- _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/promote.ts)_
515
+ _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/promote.ts)_
529
516
 
530
517
  ## `sanity-run blueprints stacks`
531
518
 
@@ -561,7 +548,7 @@ EXAMPLES
561
548
  $ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
562
549
  ```
563
550
 
564
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/blueprints/stacks.ts)_
551
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/blueprints/stacks.ts)_
565
552
 
566
553
  ## `sanity-run functions add`
567
554
 
@@ -613,7 +600,7 @@ EXAMPLES
613
600
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
614
601
  ```
615
602
 
616
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/functions/add.ts)_
603
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/functions/add.ts)_
617
604
 
618
605
  ## `sanity-run functions dev`
619
606
 
@@ -648,7 +635,7 @@ EXAMPLES
648
635
  $ sanity-run functions dev --timeout 60
649
636
  ```
650
637
 
651
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/functions/dev.ts)_
638
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/functions/dev.ts)_
652
639
 
653
640
  ## `sanity-run functions env add NAME KEY VALUE`
654
641
 
@@ -681,7 +668,7 @@ EXAMPLES
681
668
  $ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
682
669
  ```
683
670
 
684
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/functions/env/add.ts)_
671
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/functions/env/add.ts)_
685
672
 
686
673
  ## `sanity-run functions env list NAME`
687
674
 
@@ -711,7 +698,7 @@ EXAMPLES
711
698
  $ sanity-run functions env list --stack <name-or-id> MyFunction
712
699
  ```
713
700
 
714
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/functions/env/list.ts)_
701
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/functions/env/list.ts)_
715
702
 
716
703
  ## `sanity-run functions env remove NAME KEY`
717
704
 
@@ -743,7 +730,7 @@ EXAMPLES
743
730
  $ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
744
731
  ```
745
732
 
746
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/functions/env/remove.ts)_
733
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/functions/env/remove.ts)_
747
734
 
748
735
  ## `sanity-run functions logs [NAME]`
749
736
 
@@ -783,7 +770,7 @@ EXAMPLES
783
770
  $ sanity-run functions logs <name> --delete
784
771
  ```
785
772
 
786
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/functions/logs.ts)_
773
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/functions/logs.ts)_
787
774
 
788
775
  ## `sanity-run functions test [NAME]`
789
776
 
@@ -840,7 +827,7 @@ EXAMPLES
840
827
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
841
828
  ```
842
829
 
843
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.0/src/commands/functions/test.ts)_
830
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.3.2/src/commands/functions/test.ts)_
844
831
 
845
832
  ## `sanity-run help [COMMAND]`
846
833
 
@@ -860,5 +847,5 @@ DESCRIPTION
860
847
  Display help for sanity-run.
861
848
  ```
862
849
 
863
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.53/src/commands/help.ts)_
850
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.55/src/commands/help.ts)_
864
851
  <!-- commandsstop -->
package/dist/config.js CHANGED
@@ -30,7 +30,6 @@ const isTest = nodeEnv === 'test';
30
30
  const sanityEnv = env.SANITY_INTERNAL_ENV?.toLowerCase() ?? 'production';
31
31
  const sanityProd = sanityEnv === 'production';
32
32
  const isLive = sanityProd || sanityEnv === 'staging';
33
- const isPublishing = isTrueish(env?.PUBLISHING);
34
33
  // https://github.com/sanity-io/cli/blob/adf90ea6691ee6c36849e426de9729533706f47f/packages/%40sanity/cli-core/src/util/isCi.ts
35
34
  const isCi =
36
35
  // Travis CI, CircleCI, Gitlab CI, Appveyor, CodeShip, Travis CI, Jenkins, TeamCity
@@ -55,7 +54,7 @@ export function blueprintsUrl(path, version = BLUEPRINTS_API_VERSION) {
55
54
  let _token;
56
55
  function loadToken() {
57
56
  let token = null;
58
- if (isTest || isPublishing) {
57
+ if (isTest) {
59
58
  token = 'token';
60
59
  }
61
60
  else {
@@ -27598,25 +27598,21 @@ function prettyBytes(number, options) {
27598
27598
  }
27599
27599
 
27600
27600
  const localeOptions = buildLocaleOptions(options);
27601
- let result;
27602
27601
 
27603
- if (number < 1) {
27604
- const numberString = toLocaleString(number, options.locale, localeOptions);
27605
- result = prefix + numberString + separator + UNITS[0];
27606
- } else {
27607
- const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
27608
- number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
27602
+ let exponent = 0;
27603
+ if (number >= 1) {
27604
+ exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
27605
+ }
27609
27606
 
27610
- if (!localeOptions) {
27611
- const minPrecision = Math.max(3, Math.floor(number).toString().length);
27612
- number = number.toPrecision(minPrecision);
27613
- }
27607
+ number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
27614
27608
 
27615
- const numberString = toLocaleString(Number(number), options.locale, localeOptions);
27616
- const unit = UNITS[exponent];
27617
- result = prefix + numberString + separator + unit;
27609
+ if (!localeOptions) {
27610
+ const minPrecision = Math.max(3, Math.floor(number).toString().length);
27611
+ number = Number(number.toPrecision(minPrecision));
27618
27612
  }
27619
27613
 
27614
+ const numberString = toLocaleString(number, options.locale, localeOptions);
27615
+ const result = prefix + numberString + separator + UNITS[exponent];
27620
27616
  return applyFixedWidth(result, options.fixedWidth);
27621
27617
  }
27622
27618
 
@@ -15,7 +15,7 @@ function arrayifyEvent(event) {
15
15
  details.push(formatLabeledValue('expression', event.expression));
16
16
  }
17
17
  else {
18
- details.push(formatLabeledValue('expression', `${event.minute} ${event.hour} ${event.dayOfWeek} ${event.month} ${event.dayOfMonth}`));
18
+ details.push(formatLabeledValue('expression', `${event.minute} ${event.hour} ${event.dayOfMonth} ${event.month} ${event.dayOfWeek}`));
19
19
  }
20
20
  }
21
21
  else {
@@ -37,12 +37,16 @@ export function Logger(log, flags = {}) {
37
37
  if (flags.json)
38
38
  return createOraLineLoggingWrapper(opts, logger);
39
39
  if (level >= LogLevel.INFO)
40
- return withTerminalProgress(ora(opts));
40
+ return withTerminalProgress(ora(keepStdinInterruptible(opts)));
41
41
  return createOraLineLoggingWrapper(opts, logger);
42
42
  };
43
43
  logger.ora = oraWrapper;
44
44
  return logger;
45
45
  }
46
+ function keepStdinInterruptible(opts) {
47
+ const options = typeof opts === 'string' ? { text: opts } : opts;
48
+ return { discardStdin: false, ...options };
49
+ }
46
50
  function withTerminalProgress(spinner) {
47
51
  const wrap = (name, effect) => {
48
52
  if (typeof spinner[name] !== 'function')