@sanity/runtime-cli 17.10.0 → 17.11.1-next.gc1820a0
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 +20 -20
- package/dist/actions/blueprints/blueprint.js +1 -1
- package/dist/actions/blueprints/pre-deploy.js +7 -6
- package/dist/actions/blueprints/wait-for-operation.js +2 -1
- package/dist/actions/sanity/examples.js +9 -2
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/cores/blueprints/config.js +18 -8
- package/dist/cores/blueprints/deploy.js +9 -8
- package/dist/cores/blueprints/destroy.js +7 -6
- package/dist/cores/blueprints/doctor.js +15 -2
- package/dist/cores/blueprints/init.d.ts +2 -0
- package/dist/cores/blueprints/init.js +56 -20
- package/dist/cores/blueprints/plan.js +11 -6
- package/dist/cores/blueprints/promote.js +3 -2
- package/dist/cores/functions/add.js +11 -7
- package/dist/cores/functions/env/add.js +2 -1
- package/dist/cores/functions/logs.js +50 -6
- package/dist/cores/index.d.ts +5 -0
- package/dist/server/static/vendor/vendor.bundle.js +13 -6
- package/dist/utils/blueprints/hints.js +8 -3
- package/dist/utils/display/prompt.d.ts +15 -2
- package/dist/utils/display/prompt.js +70 -8
- package/dist/utils/package-manager.d.ts +20 -0
- package/dist/utils/package-manager.js +63 -0
- package/dist/utils/types.d.ts +9 -0
- package/oclif.manifest.json +1 -1
- package/package.json +21 -22
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ EXAMPLES
|
|
|
90
90
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
93
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/add.ts)_
|
|
94
94
|
|
|
95
95
|
## `sanity-run blueprints config`
|
|
96
96
|
|
|
@@ -127,7 +127,7 @@ EXAMPLES
|
|
|
127
127
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
130
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/config.ts)_
|
|
131
131
|
|
|
132
132
|
## `sanity-run blueprints deploy`
|
|
133
133
|
|
|
@@ -183,7 +183,7 @@ EXAMPLES
|
|
|
183
183
|
$ sanity-run blueprints deploy --new-stack-name <new-name>
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
186
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/deploy.ts)_
|
|
187
187
|
|
|
188
188
|
## `sanity-run blueprints destroy`
|
|
189
189
|
|
|
@@ -221,7 +221,7 @@ EXAMPLES
|
|
|
221
221
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
224
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/destroy.ts)_
|
|
225
225
|
|
|
226
226
|
## `sanity-run blueprints doctor`
|
|
227
227
|
|
|
@@ -253,7 +253,7 @@ EXAMPLES
|
|
|
253
253
|
$ sanity-run blueprints doctor --fix
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
256
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/doctor.ts)_
|
|
257
257
|
|
|
258
258
|
## `sanity-run blueprints info`
|
|
259
259
|
|
|
@@ -291,7 +291,7 @@ EXAMPLES
|
|
|
291
291
|
$ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
294
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/info.ts)_
|
|
295
295
|
|
|
296
296
|
## `sanity-run blueprints init [DIR]`
|
|
297
297
|
|
|
@@ -355,7 +355,7 @@ EXAMPLES
|
|
|
355
355
|
$ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
|
|
356
356
|
```
|
|
357
357
|
|
|
358
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
358
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/init.ts)_
|
|
359
359
|
|
|
360
360
|
## `sanity-run blueprints logs`
|
|
361
361
|
|
|
@@ -401,7 +401,7 @@ EXAMPLES
|
|
|
401
401
|
$ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
404
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/logs.ts)_
|
|
405
405
|
|
|
406
406
|
## `sanity-run blueprints mint-deploy-token`
|
|
407
407
|
|
|
@@ -446,7 +446,7 @@ EXAMPLES
|
|
|
446
446
|
$ sanity-run blueprints mint-deploy-token --organization-id <orgId>
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
-
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
449
|
+
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/mint-deploy-token.ts)_
|
|
450
450
|
|
|
451
451
|
## `sanity-run blueprints plan`
|
|
452
452
|
|
|
@@ -479,7 +479,7 @@ EXAMPLES
|
|
|
479
479
|
$ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
|
|
480
480
|
```
|
|
481
481
|
|
|
482
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
482
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/plan.ts)_
|
|
483
483
|
|
|
484
484
|
## `sanity-run blueprints promote`
|
|
485
485
|
|
|
@@ -515,7 +515,7 @@ EXAMPLES
|
|
|
515
515
|
$ sanity-run blueprints promote --new-stack-name <new-name>
|
|
516
516
|
```
|
|
517
517
|
|
|
518
|
-
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
518
|
+
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/promote.ts)_
|
|
519
519
|
|
|
520
520
|
## `sanity-run blueprints stacks`
|
|
521
521
|
|
|
@@ -556,7 +556,7 @@ EXAMPLES
|
|
|
556
556
|
$ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
|
|
557
557
|
```
|
|
558
558
|
|
|
559
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
559
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/blueprints/stacks.ts)_
|
|
560
560
|
|
|
561
561
|
## `sanity-run functions add`
|
|
562
562
|
|
|
@@ -608,7 +608,7 @@ EXAMPLES
|
|
|
608
608
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
609
609
|
```
|
|
610
610
|
|
|
611
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
611
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/functions/add.ts)_
|
|
612
612
|
|
|
613
613
|
## `sanity-run functions dev`
|
|
614
614
|
|
|
@@ -643,7 +643,7 @@ EXAMPLES
|
|
|
643
643
|
$ sanity-run functions dev --timeout 60
|
|
644
644
|
```
|
|
645
645
|
|
|
646
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
646
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/functions/dev.ts)_
|
|
647
647
|
|
|
648
648
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
649
649
|
|
|
@@ -676,7 +676,7 @@ EXAMPLES
|
|
|
676
676
|
$ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
|
|
677
677
|
```
|
|
678
678
|
|
|
679
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
679
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/functions/env/add.ts)_
|
|
680
680
|
|
|
681
681
|
## `sanity-run functions env list NAME`
|
|
682
682
|
|
|
@@ -706,7 +706,7 @@ EXAMPLES
|
|
|
706
706
|
$ sanity-run functions env list --stack <name-or-id> MyFunction
|
|
707
707
|
```
|
|
708
708
|
|
|
709
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
709
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/functions/env/list.ts)_
|
|
710
710
|
|
|
711
711
|
## `sanity-run functions env remove NAME KEY`
|
|
712
712
|
|
|
@@ -738,7 +738,7 @@ EXAMPLES
|
|
|
738
738
|
$ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
|
|
739
739
|
```
|
|
740
740
|
|
|
741
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
741
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/functions/env/remove.ts)_
|
|
742
742
|
|
|
743
743
|
## `sanity-run functions logs [NAME]`
|
|
744
744
|
|
|
@@ -778,7 +778,7 @@ EXAMPLES
|
|
|
778
778
|
$ sanity-run functions logs <name> --delete
|
|
779
779
|
```
|
|
780
780
|
|
|
781
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
781
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/functions/logs.ts)_
|
|
782
782
|
|
|
783
783
|
## `sanity-run functions test [NAME]`
|
|
784
784
|
|
|
@@ -836,7 +836,7 @@ EXAMPLES
|
|
|
836
836
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
837
837
|
```
|
|
838
838
|
|
|
839
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
839
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.11.1-next.gc1820a0/src/commands/functions/test.ts)_
|
|
840
840
|
|
|
841
841
|
## `sanity-run help [COMMAND]`
|
|
842
842
|
|
|
@@ -856,5 +856,5 @@ DESCRIPTION
|
|
|
856
856
|
Display help for sanity-run.
|
|
857
857
|
```
|
|
858
858
|
|
|
859
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.
|
|
859
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.3.0/src/commands/help.ts)_
|
|
860
860
|
<!-- commandsstop -->
|
|
@@ -24,7 +24,7 @@ import {defineBlueprint, defineDocumentFunction} from '@sanity/blueprints'
|
|
|
24
24
|
|
|
25
25
|
export default defineBlueprint({
|
|
26
26
|
resources: [
|
|
27
|
-
// defineDocumentFunction({name: 'my-function'}),
|
|
27
|
+
// defineDocumentFunction({name: 'my-function', event: {on: ['create', 'update']}}),
|
|
28
28
|
],
|
|
29
29
|
})
|
|
30
30
|
`.trim();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolveDeployedResources } from '../../utils/blueprints/resolve-deployed-resources.js';
|
|
2
2
|
import { CODE_OPERATION_UNCONFIRMED, EXIT_OPERATION_UNCONFIRMED } from '../../utils/exit-codes.js';
|
|
3
|
+
import { runCommand } from '../../utils/package-manager.js';
|
|
3
4
|
import { styleText } from '../../utils/style-text.js';
|
|
4
5
|
import { isAssetResource, } from '../../utils/types.js';
|
|
5
6
|
import { processAssets } from './process-assets.js';
|
|
@@ -67,8 +68,8 @@ async function preDeployStack(options) {
|
|
|
67
68
|
success: false,
|
|
68
69
|
error: deployError || 'Failed to complete Stack pre-deployment',
|
|
69
70
|
suggestions: [
|
|
70
|
-
`Run
|
|
71
|
-
`Run
|
|
71
|
+
`Run \`${runCommand(bin)} blueprints plan\` to preview changes before deploying.`,
|
|
72
|
+
`Run \`${runCommand(bin)} blueprints doctor\` to check your configuration.`,
|
|
72
73
|
],
|
|
73
74
|
};
|
|
74
75
|
}
|
|
@@ -97,8 +98,8 @@ async function preDeployStack(options) {
|
|
|
97
98
|
exitCode: EXIT_OPERATION_UNCONFIRMED,
|
|
98
99
|
suggestions: [
|
|
99
100
|
'The pre-deployment may or may not have finished on Sanity servers.',
|
|
100
|
-
`Run
|
|
101
|
-
`Run
|
|
101
|
+
`Run \`${runCommand(bin)} blueprints info\` to check status.`,
|
|
102
|
+
`Run \`${runCommand(bin)} blueprints logs --watch\` to keep streaming logs.`,
|
|
102
103
|
],
|
|
103
104
|
};
|
|
104
105
|
}
|
|
@@ -109,8 +110,8 @@ async function preDeployStack(options) {
|
|
|
109
110
|
suggestions: [
|
|
110
111
|
...outcome.logHints,
|
|
111
112
|
'Review the pre-deployment output above for error details.',
|
|
112
|
-
`Run
|
|
113
|
-
`Run
|
|
113
|
+
`Run \`${runCommand(bin)} blueprints logs --verbose\` for more context.`,
|
|
114
|
+
`Run \`${runCommand(bin)} blueprints plan\` to identify issues with your Blueprint.`,
|
|
114
115
|
],
|
|
115
116
|
};
|
|
116
117
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
2
2
|
import { createHintCollector } from '../../utils/blueprints/hints.js';
|
|
3
|
+
import { runCommand } from '../../utils/package-manager.js';
|
|
3
4
|
import { setupLogPolling } from './logs-polling.js';
|
|
4
5
|
import { classifyOperationPoll, getOperation, OPERATION_POLL_INITIAL_DELAY_MS, OPERATION_POLL_INTERVAL_MS, OPERATION_POLL_MAX_CONSECUTIVE_ERRORS, } from './operations.js';
|
|
5
6
|
const IDLE_SPINNER_DELAY_MS = 30_000;
|
|
@@ -95,7 +96,7 @@ export async function waitForOperation(options) {
|
|
|
95
96
|
Math.floor((idleFor - IDLE_SPINNER_DELAY_MS) / IDLE_SPINNER_UPDATE_INTERVAL_MS) *
|
|
96
97
|
IDLE_SPINNER_UPDATE_INTERVAL_MS;
|
|
97
98
|
const elapsedIdleSeconds = elapsedIdleMs / 1000;
|
|
98
|
-
const text = `No new activity for ${elapsedIdleSeconds} seconds. The ${progressNoun} is still running on Sanity servers. You can safely exit and check status later with
|
|
99
|
+
const text = `No new activity for ${elapsedIdleSeconds} seconds. The ${progressNoun} is still running on Sanity servers. You can safely exit and check status later with \`${runCommand(bin)} blueprints info\`.`;
|
|
99
100
|
if (idleSpinner)
|
|
100
101
|
idleSpinner.start(text);
|
|
101
102
|
else
|
|
@@ -71,7 +71,13 @@ async function extractExampleFromArchive({ archiveStream, exampleType, exampleNa
|
|
|
71
71
|
if (cleanPath.startsWith(`${fullPath}/`) || cleanPath === fullPath) {
|
|
72
72
|
if (type === 'file') {
|
|
73
73
|
const chunks = [];
|
|
74
|
-
stream.on('data', (chunk) =>
|
|
74
|
+
stream.on('data', (chunk) => {
|
|
75
|
+
if (!(chunk instanceof Uint8Array)) {
|
|
76
|
+
stream.destroy(new TypeError('Expected archive entry data to be a Uint8Array'));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
chunks.push(chunk);
|
|
80
|
+
});
|
|
75
81
|
stream.on('end', () => {
|
|
76
82
|
const content = Buffer.concat(chunks).toString('utf8');
|
|
77
83
|
files[cleanPath.replace(`${fullPath}/`, '')] = content;
|
|
@@ -88,7 +94,8 @@ async function extractExampleFromArchive({ archiveStream, exampleType, exampleNa
|
|
|
88
94
|
next();
|
|
89
95
|
}
|
|
90
96
|
});
|
|
91
|
-
//
|
|
97
|
+
// not ideal to cast as unknown as Writable...
|
|
98
|
+
// but tar-stream uses streamx, which interoperates with Node streams
|
|
92
99
|
await pipeline(archiveStream, createGunzip(), extractStream);
|
|
93
100
|
if (Object.keys(files).length === 0)
|
|
94
101
|
return null;
|
package/dist/constants.d.ts
CHANGED
|
@@ -52,3 +52,5 @@ export declare const LABEL_SCHEDULED = "Scheduled";
|
|
|
52
52
|
export declare const LABEL_SYNC_TAG_INVALIDATE = "Sync Tag Invalidate";
|
|
53
53
|
export declare const CI_SETUP_DOCS_URL = "https://www.sanity.io/docs/blueprints/deploy-blueprints-from-ci";
|
|
54
54
|
export declare const STEP_PHASE_GLYPH: Record<DurableStepPhase, string>;
|
|
55
|
+
/** Stands in for environment variable values, which are never echoed back to the user */
|
|
56
|
+
export declare const ENV_MASK = "********";
|
package/dist/constants.js
CHANGED
|
@@ -2,7 +2,8 @@ import { patchConfigFile, writeConfigFile, } from '../../actions/blueprints/conf
|
|
|
2
2
|
import { resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
|
|
3
3
|
import { formatDateTime } from '../../utils/display/dates.js';
|
|
4
4
|
import { filePathRelativeToCwd, labeledId, warn } from '../../utils/display/presenters.js';
|
|
5
|
-
import { runScopeAndStackWizard } from '../../utils/display/prompt.js';
|
|
5
|
+
import { CancelledError, runScopeAndStackWizard } from '../../utils/display/prompt.js';
|
|
6
|
+
import { runCommand } from '../../utils/package-manager.js';
|
|
6
7
|
import { styleText } from '../../utils/style-text.js';
|
|
7
8
|
export async function blueprintConfigCore(options) {
|
|
8
9
|
const { bin = 'sanity', blueprint, log, token, flags } = options;
|
|
@@ -19,7 +20,7 @@ export async function blueprintConfigCore(options) {
|
|
|
19
20
|
log('No Blueprint config found at .sanity/blueprint.config.json.');
|
|
20
21
|
}
|
|
21
22
|
if (!editConfig) {
|
|
22
|
-
log(`Run
|
|
23
|
+
log(`Run \`${runCommand(bin)} blueprints doctor\` for diagnostics.`);
|
|
23
24
|
return { success: true }; // not necessarily fatal
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -82,12 +83,21 @@ export async function blueprintConfigCore(options) {
|
|
|
82
83
|
log('');
|
|
83
84
|
const knownOrganizationId = configScopeType === 'organization' ? configScopeId : undefined;
|
|
84
85
|
const knownProjectId = configScopeType === 'project' ? configScopeId : undefined;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
let wizardResult;
|
|
87
|
+
try {
|
|
88
|
+
wizardResult = await runScopeAndStackWizard({
|
|
89
|
+
token,
|
|
90
|
+
knownOrganizationId,
|
|
91
|
+
knownProjectId,
|
|
92
|
+
logger: log,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (error instanceof CancelledError) {
|
|
97
|
+
return { success: false, error: 'Configuration cancelled.', cancelled: true };
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
91
101
|
if (!wizardResult.scopeId)
|
|
92
102
|
return { success: false, error: 'Scope selection is required.' };
|
|
93
103
|
try {
|
|
@@ -7,6 +7,7 @@ import { extractDurableConfig } from '../../utils/blueprints/extract-durable-con
|
|
|
7
7
|
import { createHintCollector } from '../../utils/blueprints/hints.js';
|
|
8
8
|
import { check, niceId, severe } from '../../utils/display/presenters.js';
|
|
9
9
|
import { CODE_OPERATION_UNCONFIRMED, EXIT_OPERATION_UNCONFIRMED } from '../../utils/exit-codes.js';
|
|
10
|
+
import { runCommand } from '../../utils/package-manager.js';
|
|
10
11
|
import { styleText } from '../../utils/style-text.js';
|
|
11
12
|
import { getWarnings } from '../../utils/warnings.js';
|
|
12
13
|
export async function blueprintDeployCore(options) {
|
|
@@ -29,7 +30,7 @@ export async function blueprintDeployCore(options) {
|
|
|
29
30
|
success: false,
|
|
30
31
|
error: 'A Stack operation is already in progress.',
|
|
31
32
|
suggestions: [
|
|
32
|
-
`Run
|
|
33
|
+
`Run \`${runCommand(bin)} blueprints info\` to check operation status.`,
|
|
33
34
|
'Wait for the current operation to complete, then try again.',
|
|
34
35
|
],
|
|
35
36
|
};
|
|
@@ -76,8 +77,8 @@ export async function blueprintDeployCore(options) {
|
|
|
76
77
|
error: deployError || 'Failed to update Stack deployment',
|
|
77
78
|
suggestions: [
|
|
78
79
|
...hints.getSuggestions(),
|
|
79
|
-
`Run
|
|
80
|
-
`Run
|
|
80
|
+
`Run \`${runCommand(bin)} blueprints plan\` to preview changes before deploying.`,
|
|
81
|
+
`Run \`${runCommand(bin)} blueprints doctor\` to check your configuration.`,
|
|
81
82
|
],
|
|
82
83
|
};
|
|
83
84
|
}
|
|
@@ -92,7 +93,7 @@ export async function blueprintDeployCore(options) {
|
|
|
92
93
|
: Promise.resolve(null);
|
|
93
94
|
if (noWait) {
|
|
94
95
|
logger(styleText(['bold', 'green'], 'Stack deployment started!'));
|
|
95
|
-
logger(`Use
|
|
96
|
+
logger(`Use \`${runCommand(bin)} blueprints info\` to check status`);
|
|
96
97
|
const legacyWarning = await legacyPermissionsNoticePromise;
|
|
97
98
|
const warnings = [...(legacyWarning ? [legacyWarning] : []), ...workspaceWarnings];
|
|
98
99
|
return {
|
|
@@ -132,8 +133,8 @@ export async function blueprintDeployCore(options) {
|
|
|
132
133
|
exitCode: EXIT_OPERATION_UNCONFIRMED,
|
|
133
134
|
suggestions: [
|
|
134
135
|
'The deployment may or may not have finished on Sanity servers.',
|
|
135
|
-
`Run
|
|
136
|
-
`Run
|
|
136
|
+
`Run \`${runCommand(bin)} blueprints info\` to check status.`,
|
|
137
|
+
`Run \`${runCommand(bin)} blueprints logs --watch\` to keep streaming logs.`,
|
|
137
138
|
],
|
|
138
139
|
};
|
|
139
140
|
}
|
|
@@ -143,8 +144,8 @@ export async function blueprintDeployCore(options) {
|
|
|
143
144
|
suggestions: [
|
|
144
145
|
...outcome.logHints,
|
|
145
146
|
'Review the deployment output above for error details.',
|
|
146
|
-
`Run
|
|
147
|
-
`Run
|
|
147
|
+
`Run \`${runCommand(bin)} blueprints logs --verbose\` for more context.`,
|
|
148
|
+
`Run \`${runCommand(bin)} blueprints plan\` to identify issues with your Blueprint.`,
|
|
148
149
|
],
|
|
149
150
|
};
|
|
150
151
|
}
|
|
@@ -5,6 +5,7 @@ import { destroyStack, getStack, resolveStackIdByNameOrId } from '../../actions/
|
|
|
5
5
|
import { waitForOperation } from '../../actions/blueprints/wait-for-operation.js';
|
|
6
6
|
import { niceId } from '../../utils/display/presenters.js';
|
|
7
7
|
import { CODE_OPERATION_UNCONFIRMED, EXIT_OPERATION_UNCONFIRMED } from '../../utils/exit-codes.js';
|
|
8
|
+
import { runCommand } from '../../utils/package-manager.js';
|
|
8
9
|
import { styleText } from '../../utils/style-text.js';
|
|
9
10
|
export async function blueprintDestroyCore(options) {
|
|
10
11
|
const { bin = 'sanity', log, token, scopeType, scopeId, localStackId, blueprintConfig, flags, } = options;
|
|
@@ -64,8 +65,8 @@ export async function blueprintDestroyCore(options) {
|
|
|
64
65
|
success: false,
|
|
65
66
|
error: 'Stack deployment not found',
|
|
66
67
|
suggestions: [
|
|
67
|
-
`Run
|
|
68
|
-
`Run
|
|
68
|
+
`Run \`${runCommand(bin)} blueprints stacks\` to list available Stacks.`,
|
|
69
|
+
`Run \`${runCommand(bin)} blueprints doctor\` to check your configuration.`,
|
|
69
70
|
],
|
|
70
71
|
};
|
|
71
72
|
}
|
|
@@ -164,8 +165,8 @@ async function waitForDestruction(options) {
|
|
|
164
165
|
exitCode: EXIT_OPERATION_UNCONFIRMED,
|
|
165
166
|
suggestions: [
|
|
166
167
|
'The destruction may or may not have finished on Sanity servers.',
|
|
167
|
-
`Run
|
|
168
|
-
`Run
|
|
168
|
+
`Run \`${runCommand(bin)} blueprints info\` to view current Stack status.`,
|
|
169
|
+
`Run \`${runCommand(bin)} blueprints logs --watch\` to keep streaming logs.`,
|
|
169
170
|
],
|
|
170
171
|
};
|
|
171
172
|
}
|
|
@@ -175,8 +176,8 @@ async function waitForDestruction(options) {
|
|
|
175
176
|
suggestions: [
|
|
176
177
|
...outcome.logHints,
|
|
177
178
|
'Review the destruction output above for error details.',
|
|
178
|
-
`Run
|
|
179
|
-
`Run
|
|
179
|
+
`Run \`${runCommand(bin)} blueprints logs --verbose\` for more context.`,
|
|
180
|
+
`Run \`${runCommand(bin)} blueprints info\` to view current Stack status.`,
|
|
180
181
|
],
|
|
181
182
|
};
|
|
182
183
|
}
|
|
@@ -10,6 +10,7 @@ import config, { RUNTIME_CLI_VERSION } from '../../config.js';
|
|
|
10
10
|
import { formatDateTime } from '../../utils/display/dates.js';
|
|
11
11
|
import { presentBlueprintParserErrors } from '../../utils/display/errors.js';
|
|
12
12
|
import { advise, check, filePathRelativeToCwd, niceId, renderSection, severe, unsure, } from '../../utils/display/presenters.js';
|
|
13
|
+
import { runCommand } from '../../utils/package-manager.js';
|
|
13
14
|
import { styleText } from '../../utils/style-text.js';
|
|
14
15
|
import { createTracedFetch } from '../../utils/traced-fetch.js';
|
|
15
16
|
import { validTokenOrErrorMessage } from '../../utils/validated-token.js';
|
|
@@ -374,7 +375,9 @@ export async function blueprintDoctorCore(options) {
|
|
|
374
375
|
return {
|
|
375
376
|
success: false,
|
|
376
377
|
error: `${errorMessage}. Unable to fix: Blueprint manifest is missing or invalid`,
|
|
377
|
-
suggestions: [
|
|
378
|
+
suggestions: [
|
|
379
|
+
`Run \`${runCommand(bin)} blueprints init\` to create a new Blueprint manifest.`,
|
|
380
|
+
],
|
|
378
381
|
data: { diagnostics: flatDiagnostics },
|
|
379
382
|
};
|
|
380
383
|
}
|
|
@@ -389,12 +392,22 @@ export async function blueprintDoctorCore(options) {
|
|
|
389
392
|
if (fixResult.success) {
|
|
390
393
|
return { ...fixResult, warnings: hasWarnings ? warnings : undefined };
|
|
391
394
|
}
|
|
395
|
+
if (fixResult.cancelled) {
|
|
396
|
+
return {
|
|
397
|
+
success: false,
|
|
398
|
+
error: `${errorMessage}. Unable to fix: ${fixResult.error}`,
|
|
399
|
+
cancelled: true,
|
|
400
|
+
data: { diagnostics: flatDiagnostics },
|
|
401
|
+
};
|
|
402
|
+
}
|
|
392
403
|
return fixResult;
|
|
393
404
|
}
|
|
394
405
|
return {
|
|
395
406
|
success: false,
|
|
396
407
|
error: errorMessage,
|
|
397
|
-
suggestions: [
|
|
408
|
+
suggestions: [
|
|
409
|
+
`Run \`${runCommand(bin)} blueprints doctor --fix\` to fix configuration issues.`,
|
|
410
|
+
],
|
|
398
411
|
data: { diagnostics: flatDiagnostics },
|
|
399
412
|
};
|
|
400
413
|
}
|
|
@@ -36,6 +36,8 @@ export declare function resolveScopeAndStack(params: {
|
|
|
36
36
|
stackId: string | undefined;
|
|
37
37
|
stackName: string | undefined;
|
|
38
38
|
knownProjectId?: string;
|
|
39
|
+
/** Where the Blueprint lands; its folder name seeds the new Stack name. */
|
|
40
|
+
blueprintDir?: string;
|
|
39
41
|
log: Logger;
|
|
40
42
|
token: string;
|
|
41
43
|
}): Promise<ResolvedScope>;
|