@sanity/runtime-cli 17.0.0 → 17.1.0-next.gcfbd613
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 +24 -23
- package/dist/actions/blueprints/assets.d.ts +2 -1
- package/dist/actions/blueprints/assets.js +2 -2
- package/dist/actions/blueprints/blueprint.d.ts +1 -1
- package/dist/actions/blueprints/wait-for-operation.js +4 -0
- package/dist/actions/functions/test.js +1 -1
- package/dist/actions/sanity/examples.d.ts +4 -4
- package/dist/baseCommands.d.ts +4 -4
- package/dist/baseCommands.js +13 -2
- package/dist/commands/blueprints/add.d.ts +1 -1
- package/dist/commands/blueprints/config.d.ts +1 -1
- package/dist/commands/blueprints/deploy.d.ts +1 -1
- package/dist/commands/blueprints/destroy.d.ts +1 -1
- package/dist/commands/blueprints/doctor.d.ts +0 -1
- package/dist/commands/blueprints/doctor.js +3 -7
- package/dist/commands/blueprints/info.d.ts +1 -1
- package/dist/commands/blueprints/logs.d.ts +1 -1
- package/dist/commands/blueprints/mint-deploy-token.d.ts +1 -1
- package/dist/commands/blueprints/plan.d.ts +1 -1
- package/dist/commands/blueprints/promote.d.ts +1 -1
- package/dist/commands/blueprints/stacks.d.ts +1 -1
- package/dist/commands/functions/add.d.ts +1 -1
- package/dist/commands/functions/build.d.ts +1 -1
- package/dist/commands/functions/dev.d.ts +1 -1
- package/dist/commands/functions/env/add.d.ts +1 -1
- package/dist/commands/functions/env/list.d.ts +1 -1
- package/dist/commands/functions/env/remove.d.ts +1 -1
- package/dist/commands/functions/logs.d.ts +1 -1
- package/dist/commands/functions/test.d.ts +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +7 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/cores/blueprints/deploy.js +5 -4
- package/dist/cores/blueprints/doctor.js +15 -12
- package/dist/cores/functions/build.js +3 -2
- package/dist/cores/functions/test.js +48 -2
- package/dist/server/app.js +39 -5
- package/dist/server/handlers/invoke.d.ts +2 -2
- package/dist/server/handlers/invoke.js +7 -4
- package/dist/server/static/components/console-panel.js +59 -8
- package/dist/server/static/components/rule-panel.js +11 -8
- package/dist/server/static/components/shared-styles.js +24 -21
- package/dist/server/static/favicon-dark.svg +1 -0
- package/dist/server/static/favicon.svg +1 -0
- package/dist/server/static/index.html +2 -2
- package/dist/server/static/vendor/vendor.bundle.js +115 -61
- package/dist/server/static/web-socket.js +41 -0
- package/dist/utils/functions/child-process-wrapper.js +62 -7
- package/dist/utils/functions/find-entry-point.d.ts +1 -1
- package/dist/utils/functions/find-entry-point.js +10 -12
- package/dist/utils/functions/{invoke-local.d.ts → invoke/local.d.ts} +1 -1
- package/dist/utils/functions/invoke/local.js +306 -0
- package/dist/utils/functions/invoke/nested.d.ts +25 -0
- package/dist/utils/functions/invoke/nested.js +41 -0
- package/dist/utils/functions/invoke/prepare.d.ts +20 -0
- package/dist/utils/functions/invoke/prepare.js +101 -0
- package/dist/utils/functions/package-json.d.ts +1 -2
- package/dist/utils/functions/package-json.js +4 -6
- package/dist/utils/functions/prepare-asset.d.ts +2 -2
- package/dist/utils/functions/prepare-asset.js +18 -7
- package/dist/utils/functions/resolve-dependencies.d.ts +4 -1
- package/dist/utils/functions/resolve-dependencies.js +5 -6
- package/dist/utils/functions/resource-to-arc.d.ts +1 -1
- package/dist/utils/functions/resource-to-arc.js +4 -5
- package/dist/utils/functions/should-transpile.d.ts +7 -1
- package/dist/utils/functions/should-transpile.js +10 -10
- package/dist/utils/functions/transpile/function.d.ts +4 -1
- package/dist/utils/functions/transpile/function.js +9 -14
- package/dist/utils/functions/transpile/verify-handler.js +1 -1
- package/dist/utils/isTrueish.d.ts +6 -0
- package/dist/utils/isTrueish.js +9 -0
- package/dist/utils/logger.d.ts +7 -5
- package/dist/utils/logger.js +33 -1
- package/dist/utils/progress.d.ts +5 -0
- package/dist/utils/progress.js +40 -0
- package/dist/utils/types.d.ts +67 -5
- package/oclif.manifest.json +5 -4
- package/package.json +28 -23
- package/dist/server/static/hot-reload.js +0 -16
- package/dist/utils/functions/invoke-local.js +0 -185
package/README.md
CHANGED
|
@@ -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/17.0.
|
|
23
|
+
@sanity/runtime-cli/17.1.0-next.gcfbd613 linux-x64 node-v24.18.0
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -103,7 +103,7 @@ EXAMPLES
|
|
|
103
103
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
106
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/add.ts)_
|
|
107
107
|
|
|
108
108
|
## `sanity-run blueprints config`
|
|
109
109
|
|
|
@@ -140,7 +140,7 @@ EXAMPLES
|
|
|
140
140
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
143
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/config.ts)_
|
|
144
144
|
|
|
145
145
|
## `sanity-run blueprints deploy`
|
|
146
146
|
|
|
@@ -194,7 +194,7 @@ EXAMPLES
|
|
|
194
194
|
$ sanity-run blueprints deploy --new-stack-name <new-name>
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
197
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/deploy.ts)_
|
|
198
198
|
|
|
199
199
|
## `sanity-run blueprints destroy`
|
|
200
200
|
|
|
@@ -232,7 +232,7 @@ EXAMPLES
|
|
|
232
232
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
235
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/destroy.ts)_
|
|
236
236
|
|
|
237
237
|
## `sanity-run blueprints doctor`
|
|
238
238
|
|
|
@@ -240,13 +240,12 @@ Diagnose potential issues with local Blueprint and remote Stack configuration
|
|
|
240
240
|
|
|
241
241
|
```
|
|
242
242
|
USAGE
|
|
243
|
-
$ sanity-run blueprints doctor [--json] [-p <value>] [--
|
|
243
|
+
$ sanity-run blueprints doctor [--json] [-p <value>] [--fix]
|
|
244
244
|
|
|
245
245
|
FLAGS
|
|
246
246
|
-p, --path=<value> [env: SANITY_BLUEPRINT_PATH] Path to a Blueprint file or directory containing one
|
|
247
247
|
--fix Interactively fix configuration issues
|
|
248
248
|
--json Format output as json
|
|
249
|
-
--[no-]verbose Verbose output; defaults to true
|
|
250
249
|
|
|
251
250
|
DESCRIPTION
|
|
252
251
|
Diagnose potential issues with local Blueprint and remote Stack configuration
|
|
@@ -257,13 +256,15 @@ DESCRIPTION
|
|
|
257
256
|
Run this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected
|
|
258
257
|
issues.
|
|
259
258
|
|
|
259
|
+
Supports --json for programmatic consumption of diagnostic results.
|
|
260
|
+
|
|
260
261
|
EXAMPLES
|
|
261
262
|
$ sanity-run blueprints doctor
|
|
262
263
|
|
|
263
264
|
$ sanity-run blueprints doctor --fix
|
|
264
265
|
```
|
|
265
266
|
|
|
266
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
267
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/doctor.ts)_
|
|
267
268
|
|
|
268
269
|
## `sanity-run blueprints info`
|
|
269
270
|
|
|
@@ -300,7 +301,7 @@ EXAMPLES
|
|
|
300
301
|
$ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
|
|
301
302
|
```
|
|
302
303
|
|
|
303
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
304
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/info.ts)_
|
|
304
305
|
|
|
305
306
|
## `sanity-run blueprints init [DIR]`
|
|
306
307
|
|
|
@@ -364,7 +365,7 @@ EXAMPLES
|
|
|
364
365
|
$ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
|
|
365
366
|
```
|
|
366
367
|
|
|
367
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
368
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/init.ts)_
|
|
368
369
|
|
|
369
370
|
## `sanity-run blueprints logs`
|
|
370
371
|
|
|
@@ -410,7 +411,7 @@ EXAMPLES
|
|
|
410
411
|
$ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
|
|
411
412
|
```
|
|
412
413
|
|
|
413
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
414
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/logs.ts)_
|
|
414
415
|
|
|
415
416
|
## `sanity-run blueprints mint-deploy-token`
|
|
416
417
|
|
|
@@ -455,7 +456,7 @@ EXAMPLES
|
|
|
455
456
|
$ sanity-run blueprints mint-deploy-token --organization-id <orgId>
|
|
456
457
|
```
|
|
457
458
|
|
|
458
|
-
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
459
|
+
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/mint-deploy-token.ts)_
|
|
459
460
|
|
|
460
461
|
## `sanity-run blueprints plan`
|
|
461
462
|
|
|
@@ -488,7 +489,7 @@ EXAMPLES
|
|
|
488
489
|
$ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
|
|
489
490
|
```
|
|
490
491
|
|
|
491
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
492
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/plan.ts)_
|
|
492
493
|
|
|
493
494
|
## `sanity-run blueprints promote`
|
|
494
495
|
|
|
@@ -524,7 +525,7 @@ EXAMPLES
|
|
|
524
525
|
$ sanity-run blueprints promote --new-stack-name <new-name>
|
|
525
526
|
```
|
|
526
527
|
|
|
527
|
-
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
528
|
+
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/promote.ts)_
|
|
528
529
|
|
|
529
530
|
## `sanity-run blueprints stacks`
|
|
530
531
|
|
|
@@ -560,7 +561,7 @@ EXAMPLES
|
|
|
560
561
|
$ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
|
|
561
562
|
```
|
|
562
563
|
|
|
563
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
564
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/blueprints/stacks.ts)_
|
|
564
565
|
|
|
565
566
|
## `sanity-run functions add`
|
|
566
567
|
|
|
@@ -612,7 +613,7 @@ EXAMPLES
|
|
|
612
613
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
613
614
|
```
|
|
614
615
|
|
|
615
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
616
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/functions/add.ts)_
|
|
616
617
|
|
|
617
618
|
## `sanity-run functions dev`
|
|
618
619
|
|
|
@@ -647,7 +648,7 @@ EXAMPLES
|
|
|
647
648
|
$ sanity-run functions dev --timeout 60
|
|
648
649
|
```
|
|
649
650
|
|
|
650
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
651
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/functions/dev.ts)_
|
|
651
652
|
|
|
652
653
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
653
654
|
|
|
@@ -677,7 +678,7 @@ EXAMPLES
|
|
|
677
678
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
678
679
|
```
|
|
679
680
|
|
|
680
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
681
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/functions/env/add.ts)_
|
|
681
682
|
|
|
682
683
|
## `sanity-run functions env list NAME`
|
|
683
684
|
|
|
@@ -704,7 +705,7 @@ EXAMPLES
|
|
|
704
705
|
$ sanity-run functions env list MyFunction
|
|
705
706
|
```
|
|
706
707
|
|
|
707
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
708
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/functions/env/list.ts)_
|
|
708
709
|
|
|
709
710
|
## `sanity-run functions env remove NAME KEY`
|
|
710
711
|
|
|
@@ -733,7 +734,7 @@ EXAMPLES
|
|
|
733
734
|
$ sanity-run functions env remove MyFunction API_URL
|
|
734
735
|
```
|
|
735
736
|
|
|
736
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
737
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/functions/env/remove.ts)_
|
|
737
738
|
|
|
738
739
|
## `sanity-run functions logs [NAME]`
|
|
739
740
|
|
|
@@ -773,7 +774,7 @@ EXAMPLES
|
|
|
773
774
|
$ sanity-run functions logs <name> --delete
|
|
774
775
|
```
|
|
775
776
|
|
|
776
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
777
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/functions/logs.ts)_
|
|
777
778
|
|
|
778
779
|
## `sanity-run functions test [NAME]`
|
|
779
780
|
|
|
@@ -830,7 +831,7 @@ EXAMPLES
|
|
|
830
831
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
831
832
|
```
|
|
832
833
|
|
|
833
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.0.
|
|
834
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.1.0-next.gcfbd613/src/commands/functions/test.ts)_
|
|
834
835
|
|
|
835
836
|
## `sanity-run help [COMMAND]`
|
|
836
837
|
|
|
@@ -850,5 +851,5 @@ DESCRIPTION
|
|
|
850
851
|
Display help for sanity-run.
|
|
851
852
|
```
|
|
852
853
|
|
|
853
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.
|
|
854
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.53/src/commands/help.ts)_
|
|
854
855
|
<!-- commandsstop -->
|
|
@@ -3,9 +3,10 @@ import type { Logger } from '../../utils/logger.js';
|
|
|
3
3
|
import type { AssetResource, AuthParams, InstallerType } from '../../utils/types.js';
|
|
4
4
|
export declare const assetCheckUrl: string;
|
|
5
5
|
export declare const assetStashUrl: string;
|
|
6
|
-
export declare function stashAsset({ resource, auth, logger, installer, }: {
|
|
6
|
+
export declare function stashAsset({ resource, auth, blueprintFileDir, logger, installer, }: {
|
|
7
7
|
resource: AssetResource;
|
|
8
8
|
auth: AuthParams;
|
|
9
|
+
blueprintFileDir: string;
|
|
9
10
|
logger: Logger;
|
|
10
11
|
installer?: InstallerType;
|
|
11
12
|
}): Promise<{
|
|
@@ -10,14 +10,14 @@ import { isLocalFunctionResource, isStudioResource } from '../../utils/types.js'
|
|
|
10
10
|
const assetsUrl = blueprintsUrl('assets');
|
|
11
11
|
export const assetCheckUrl = `${assetsUrl}/check`;
|
|
12
12
|
export const assetStashUrl = `${assetsUrl}/stash`;
|
|
13
|
-
export async function stashAsset({ resource, auth, logger, installer, }) {
|
|
13
|
+
export async function stashAsset({ resource, auth, blueprintFileDir, logger, installer, }) {
|
|
14
14
|
try {
|
|
15
15
|
let b64;
|
|
16
16
|
let hash;
|
|
17
17
|
let extension;
|
|
18
18
|
let cleanup;
|
|
19
19
|
if (isLocalFunctionResource(resource)) {
|
|
20
|
-
const prepResult = await prepareFunctionAsset({ resource
|
|
20
|
+
const prepResult = await prepareFunctionAsset({ resource, blueprintFileDir, installer });
|
|
21
21
|
if (prepResult.success === false) {
|
|
22
22
|
return {
|
|
23
23
|
success: false,
|
|
@@ -4,7 +4,7 @@ import type { Logger } from '../../utils/logger.js';
|
|
|
4
4
|
import type { BlueprintParserError, ScopeType } from '../../utils/types.js';
|
|
5
5
|
import { type LocatedBlueprintsConfig } from './config.js';
|
|
6
6
|
import { type ConfigSource } from './resolve.js';
|
|
7
|
-
declare const SUPPORTED_FILE_EXTENSIONS: readonly [
|
|
7
|
+
declare const SUPPORTED_FILE_EXTENSIONS: readonly ['.json', '.js', '.mjs', '.ts'];
|
|
8
8
|
type BlueprintFileExtension = (typeof SUPPORTED_FILE_EXTENSIONS)[number];
|
|
9
9
|
export declare const JSON_BLUEPRINT_CONTENT: {
|
|
10
10
|
blueprintVersion: string;
|
|
@@ -12,6 +12,7 @@ export async function waitForOperation(options) {
|
|
|
12
12
|
const logHints = createHintCollector(bin);
|
|
13
13
|
let logStreamCleanup = null;
|
|
14
14
|
try {
|
|
15
|
+
log.showProgress();
|
|
15
16
|
let lastLogAt = Date.now();
|
|
16
17
|
let idleMessageShown = false;
|
|
17
18
|
let consecutiveErrors = 0;
|
|
@@ -85,4 +86,7 @@ export async function waitForOperation(options) {
|
|
|
85
86
|
logStreamCleanup();
|
|
86
87
|
throw error;
|
|
87
88
|
}
|
|
89
|
+
finally {
|
|
90
|
+
log.clearProgress();
|
|
91
|
+
}
|
|
88
92
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import invoke from '../../utils/functions/invoke
|
|
1
|
+
import invoke from '../../utils/functions/invoke/local.js';
|
|
2
2
|
export async function testAction(resource, payload, context, options) {
|
|
3
3
|
try {
|
|
4
4
|
const { json, logs, error } = await invoke(resource, payload, context, options);
|
|
@@ -2,12 +2,12 @@ import type { Logger } from '../../utils/logger.js';
|
|
|
2
2
|
export declare const EXAMPLES_CACHE_DIR: string;
|
|
3
3
|
declare const EXAMPLE_TYPES: {
|
|
4
4
|
readonly blueprint: {
|
|
5
|
-
readonly repo:
|
|
6
|
-
readonly dir:
|
|
5
|
+
readonly repo: 'sanity-io/sanity';
|
|
6
|
+
readonly dir: 'examples/blueprints';
|
|
7
7
|
};
|
|
8
8
|
readonly function: {
|
|
9
|
-
readonly repo:
|
|
10
|
-
readonly dir:
|
|
9
|
+
readonly repo: 'sanity-labs/function-recipes';
|
|
10
|
+
readonly dir: '';
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export declare function verifyExampleExists({ type, name, logger, }: {
|
package/dist/baseCommands.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const pathFlagConfig: {
|
|
|
10
10
|
description: string;
|
|
11
11
|
env: string;
|
|
12
12
|
aliases: string[];
|
|
13
|
-
char:
|
|
13
|
+
char: 'p';
|
|
14
14
|
};
|
|
15
15
|
export declare const baseFlags: {
|
|
16
16
|
json: Interfaces.BooleanFlag<boolean>;
|
|
@@ -112,14 +112,14 @@ export type Need = 'token' | 'blueprint' | 'scope' | 'stackId' | 'deployedStack'
|
|
|
112
112
|
export declare abstract class ResolvedCommand<T extends typeof Command> extends RuntimeCommand<T> {
|
|
113
113
|
static needs: readonly Need[];
|
|
114
114
|
static baseFlags: {
|
|
115
|
-
stack: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
116
|
-
'project-id': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
117
|
-
'organization-id': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
118
115
|
json: Interfaces.BooleanFlag<boolean>;
|
|
119
116
|
path: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
120
117
|
trace: Interfaces.BooleanFlag<boolean>;
|
|
121
118
|
'validate-resources': Interfaces.BooleanFlag<boolean>;
|
|
122
119
|
verbose: Interfaces.BooleanFlag<boolean>;
|
|
120
|
+
stack: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
121
|
+
'project-id': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
122
|
+
'organization-id': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
123
123
|
};
|
|
124
124
|
protected sanityToken: string;
|
|
125
125
|
protected blueprint: ReadBlueprintResult;
|
package/dist/baseCommands.js
CHANGED
|
@@ -4,6 +4,8 @@ import { findBlueprintFile, loadBlueprintFile, parseBlueprintContent, } from './
|
|
|
4
4
|
import { backfillProjectBasedStackId, readConfigFile, } from './actions/blueprints/config.js';
|
|
5
5
|
import { resolveIds } from './actions/blueprints/resolve.js';
|
|
6
6
|
import { getStack, resolveStackIdByNameOrId } from './actions/blueprints/stacks.js';
|
|
7
|
+
import config from './config.js';
|
|
8
|
+
import { CI_SETUP_DOCS_URL } from './constants.js';
|
|
7
9
|
import { presentBlueprintParserErrors } from './utils/display/errors.js';
|
|
8
10
|
import { Logger } from './utils/logger.js';
|
|
9
11
|
import { styleText } from './utils/style-text.js';
|
|
@@ -319,10 +321,15 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
319
321
|
// 5. Scope
|
|
320
322
|
if (needsScope) {
|
|
321
323
|
if (!resolved.scopeType || !resolved.scopeId) {
|
|
322
|
-
|
|
324
|
+
// In CI environments, since .sanity/blueprint.config.json is not guaranteed to exist, we can provide a more specific hint
|
|
325
|
+
const errorMessage = config.isCi
|
|
326
|
+
? 'set SANITY_PROJECT_ID or SANITY_ORGANIZATION_ID.'
|
|
327
|
+
: 'provide --project-id or --organization-id, or run `blueprints init` to create a Blueprint config (.sanity/blueprint.config.json).';
|
|
328
|
+
this.error(`Missing scope: ${errorMessage}`, {
|
|
323
329
|
suggestions: [
|
|
324
330
|
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
325
331
|
],
|
|
332
|
+
ref: CI_SETUP_DOCS_URL,
|
|
326
333
|
});
|
|
327
334
|
}
|
|
328
335
|
this.scopeType = resolved.scopeType;
|
|
@@ -341,10 +348,14 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
341
348
|
stackId = await resolveStackIdByNameOrId(stackOverride, auth, log);
|
|
342
349
|
}
|
|
343
350
|
if (!stackId) {
|
|
344
|
-
|
|
351
|
+
const errorMessage = config.isCi
|
|
352
|
+
? "couldn't determine which Stack to target. Set SANITY_BLUEPRINT_STACK_ID."
|
|
353
|
+
: `provide --stack, or set a Stack in your Blueprint config (\`${this.config.bin} blueprints config --edit\`).`;
|
|
354
|
+
this.error(`Missing Stack: ${errorMessage}`, {
|
|
345
355
|
suggestions: [
|
|
346
356
|
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
347
357
|
],
|
|
358
|
+
ref: CI_SETUP_DOCS_URL,
|
|
348
359
|
});
|
|
349
360
|
}
|
|
350
361
|
this.stackId = stackId;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
6
6
|
export default class AddCommand extends ResolvedCommand<typeof AddCommand> {
|
|
7
|
-
static needs: readonly [
|
|
7
|
+
static needs: readonly ['blueprint'];
|
|
8
8
|
static state: string;
|
|
9
9
|
static deprecationOptions: {
|
|
10
10
|
to: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class ConfigCommand extends ResolvedCommand<typeof ConfigCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['token', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class DeployCommand extends ResolvedCommand<typeof DeployCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class DestroyCommand extends ResolvedCommand<typeof DestroyCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['scope'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -6,7 +6,6 @@ export default class DoctorCommand extends RuntimeCommand<typeof DoctorCommand>
|
|
|
6
6
|
static flags: {
|
|
7
7
|
path: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
fix: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
9
|
};
|
|
11
10
|
run(): Promise<Record<string, unknown> | undefined>;
|
|
12
11
|
}
|
|
@@ -7,8 +7,9 @@ export default class DoctorCommand extends RuntimeCommand {
|
|
|
7
7
|
static summary = 'Diagnose potential issues with local Blueprint and remote Stack configuration';
|
|
8
8
|
static description = `Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication, invalid project references, or misconfigured resources.
|
|
9
9
|
|
|
10
|
-
Run this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues
|
|
11
|
-
|
|
10
|
+
Run this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues.
|
|
11
|
+
|
|
12
|
+
Supports --json for programmatic consumption of diagnostic results.`;
|
|
12
13
|
static examples = [
|
|
13
14
|
'<%= config.bin %> <%= command.id %>',
|
|
14
15
|
'<%= config.bin %> <%= command.id %> --fix',
|
|
@@ -19,11 +20,6 @@ Run this command when encountering errors with other Blueprint commands. Use --f
|
|
|
19
20
|
description: 'Interactively fix configuration issues',
|
|
20
21
|
default: false,
|
|
21
22
|
}),
|
|
22
|
-
verbose: Flags.boolean({
|
|
23
|
-
description: 'Verbose output; defaults to true',
|
|
24
|
-
default: true,
|
|
25
|
-
allowNo: true,
|
|
26
|
-
}),
|
|
27
23
|
};
|
|
28
24
|
async run() {
|
|
29
25
|
const { token } = config;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class InfoCommand extends ResolvedCommand<typeof InfoCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class LogsCommand extends ResolvedCommand<typeof LogsCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class MintDeployTokenCommand extends ResolvedCommand<typeof MintDeployTokenCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['scope'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class PlanCommand extends ResolvedCommand<typeof PlanCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['token', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class PromoteCommand extends ResolvedCommand<typeof PromoteCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class StacksCommand extends ResolvedCommand<typeof StacksCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['scope'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class AddCommand extends ResolvedCommand<typeof AddCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class BuildCommand extends ResolvedCommand<typeof BuildCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static hidden: boolean;
|
|
6
6
|
static args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class DevCommand extends ResolvedCommand<typeof DevCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../../baseCommands.js';
|
|
2
2
|
export default class EnvAddCommand extends ResolvedCommand<typeof EnvAddCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../../baseCommands.js';
|
|
2
2
|
export default class EnvListCommand extends ResolvedCommand<typeof EnvListCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../../baseCommands.js';
|
|
2
2
|
export default class EnvRemoveCommand extends ResolvedCommand<typeof EnvRemoveCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class LogsCommand extends ResolvedCommand<typeof LogsCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['deployedStack', 'blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class TestCommand extends ResolvedCommand<typeof TestCommand> {
|
|
3
|
-
static needs: readonly [
|
|
3
|
+
static needs: readonly ['blueprint'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static args: {
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -3,6 +3,7 @@ import { env } from 'node:process';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import * as pkg from 'empathic/package';
|
|
5
5
|
import getToken from './utils/get-token.js';
|
|
6
|
+
import isTrueish from './utils/isTrueish.js';
|
|
6
7
|
export const BLUEPRINT_CONFIG_VERSION = 'v2025-05-08';
|
|
7
8
|
// Default API version for Blueprints service calls.
|
|
8
9
|
// Overridable globally via env, or per-endpoint via the `version` arg to `blueprintsUrl`.
|
|
@@ -29,7 +30,11 @@ const isTest = nodeEnv === 'test';
|
|
|
29
30
|
const sanityEnv = env.SANITY_INTERNAL_ENV?.toLowerCase() ?? 'production';
|
|
30
31
|
const sanityProd = sanityEnv === 'production';
|
|
31
32
|
const isLive = sanityProd || sanityEnv === 'staging';
|
|
32
|
-
const isPublishing = env?.PUBLISHING
|
|
33
|
+
const isPublishing = isTrueish(env?.PUBLISHING);
|
|
34
|
+
// https://github.com/sanity-io/cli/blob/adf90ea6691ee6c36849e426de9729533706f47f/packages/%40sanity/cli-core/src/util/isCi.ts
|
|
35
|
+
const isCi =
|
|
36
|
+
// Travis CI, CircleCI, Gitlab CI, Appveyor, CodeShip, Travis CI, Jenkins, TeamCity
|
|
37
|
+
isTrueish(env?.CI) || isTrueish(env?.CONTINUOUS_INTEGRATION) || isTrueish(env?.BUILD_NUMBER);
|
|
33
38
|
const apiUrls = {
|
|
34
39
|
production: 'https://api.sanity.io/',
|
|
35
40
|
staging: 'https://api.sanity.work/',
|
|
@@ -74,6 +79,7 @@ export default {
|
|
|
74
79
|
isLive,
|
|
75
80
|
apiUrl,
|
|
76
81
|
populusApiUrl,
|
|
82
|
+
isCi,
|
|
77
83
|
get token() {
|
|
78
84
|
return _token === undefined ? loadToken() : _token;
|
|
79
85
|
},
|
package/dist/constants.d.ts
CHANGED
|
@@ -43,3 +43,4 @@ export declare const LABEL_MEDIA_LIBRARY_ASSET_UPDATE = "Media Library Asset Upd
|
|
|
43
43
|
export declare const LABEL_MEDIA_LIBRARY_ASSET_DELETE = "Media Library Asset Delete";
|
|
44
44
|
export declare const LABEL_SCHEDULED = "Scheduled";
|
|
45
45
|
export declare const LABEL_SYNC_TAG_INVALIDATE = "Sync Tag Invalidate";
|
|
46
|
+
export declare const CI_SETUP_DOCS_URL = "https://www.sanity.io/docs/blueprints/deploy-blueprints-from-ci";
|
package/dist/constants.js
CHANGED
|
@@ -48,3 +48,4 @@ export const LABEL_MEDIA_LIBRARY_ASSET_UPDATE = 'Media Library Asset Update';
|
|
|
48
48
|
export const LABEL_MEDIA_LIBRARY_ASSET_DELETE = 'Media Library Asset Delete';
|
|
49
49
|
export const LABEL_SCHEDULED = 'Scheduled';
|
|
50
50
|
export const LABEL_SYNC_TAG_INVALIDATE = 'Sync Tag Invalidate';
|
|
51
|
+
export const CI_SETUP_DOCS_URL = 'https://www.sanity.io/docs/blueprints/deploy-blueprints-from-ci';
|