@sanity/runtime-cli 15.0.5 → 15.1.1
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 +32 -24
- package/dist/actions/blueprints/config.d.ts +2 -2
- package/dist/actions/blueprints/config.js +1 -1
- package/dist/commands/blueprints/destroy.js +1 -1
- package/dist/commands/blueprints/init.js +6 -2
- package/dist/commands/blueprints/plan.js +0 -1
- package/dist/cores/blueprints/deploy.js +8 -3
- package/dist/cores/blueprints/destroy.js +19 -3
- package/dist/cores/blueprints/plan.js +7 -1
- package/dist/server/static/components/app.css +29 -570
- package/dist/server/static/index.html +1 -0
- package/dist/server/static/vendor/design-tokens/color.css +107 -0
- package/dist/server/static/vendor/design-tokens/container.css +12 -0
- package/dist/server/static/vendor/design-tokens/fontFamily.css +8 -0
- package/dist/server/static/vendor/design-tokens/fontWeight.css +10 -0
- package/dist/server/static/vendor/design-tokens/index.css +14 -0
- package/dist/server/static/vendor/design-tokens/radius.css +14 -0
- package/dist/server/static/vendor/design-tokens/shadow.css +12 -0
- package/dist/server/static/vendor/design-tokens/space.css +16 -0
- package/dist/server/static/vendor/design-tokens/typography.css +32 -0
- package/dist/utils/blueprints/{log-hints.d.ts → hints.d.ts} +7 -7
- package/dist/utils/blueprints/{log-hints.js → hints.js} +9 -6
- package/oclif.manifest.json +8 -4
- package/package.json +8 -4
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/15.
|
|
23
|
+
@sanity/runtime-cli/15.1.1 linux-x64 node-v24.15.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/v15.
|
|
106
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/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/v15.
|
|
143
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/config.ts)_
|
|
144
144
|
|
|
145
145
|
## `sanity-run blueprints deploy`
|
|
146
146
|
|
|
@@ -191,7 +191,7 @@ EXAMPLES
|
|
|
191
191
|
$ sanity-run blueprints deploy --new-stack-name <new-name>
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
194
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/deploy.ts)_
|
|
195
195
|
|
|
196
196
|
## `sanity-run blueprints destroy`
|
|
197
197
|
|
|
@@ -213,8 +213,8 @@ FLAGS
|
|
|
213
213
|
DESCRIPTION
|
|
214
214
|
Destroy a remote Stack deployment and its resources
|
|
215
215
|
|
|
216
|
-
Permanently removes the remote Stack and all its provisioned resources. Your
|
|
217
|
-
|
|
216
|
+
Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files
|
|
217
|
+
remain intact; "stackId" is unset in your local config.
|
|
218
218
|
|
|
219
219
|
This is a destructive operation. You will be prompted to confirm unless --force is specified.
|
|
220
220
|
|
|
@@ -226,7 +226,7 @@ EXAMPLES
|
|
|
226
226
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
229
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/destroy.ts)_
|
|
230
230
|
|
|
231
231
|
## `sanity-run blueprints doctor`
|
|
232
232
|
|
|
@@ -257,7 +257,7 @@ EXAMPLES
|
|
|
257
257
|
$ sanity-run blueprints doctor --fix
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
260
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/doctor.ts)_
|
|
261
261
|
|
|
262
262
|
## `sanity-run blueprints info`
|
|
263
263
|
|
|
@@ -294,7 +294,7 @@ EXAMPLES
|
|
|
294
294
|
$ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
297
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/info.ts)_
|
|
298
298
|
|
|
299
299
|
## `sanity-run blueprints init [DIR]`
|
|
300
300
|
|
|
@@ -340,12 +340,20 @@ EXAMPLES
|
|
|
340
340
|
|
|
341
341
|
$ sanity-run blueprints init --blueprint-type <json|js|ts>
|
|
342
342
|
|
|
343
|
-
$ sanity-run blueprints init --
|
|
343
|
+
$ sanity-run blueprints init --organization-id <organizationId>
|
|
344
344
|
|
|
345
|
-
$ sanity-run blueprints init --
|
|
345
|
+
$ sanity-run blueprints init --project-id <projectId>
|
|
346
|
+
|
|
347
|
+
$ sanity-run blueprints init --stack-name <newStackName>
|
|
348
|
+
|
|
349
|
+
$ sanity-run blueprints init --stack-id <existingStackId>
|
|
350
|
+
|
|
351
|
+
$ sanity-run blueprints init new-stack --type <json|js|ts> --org <organizationId> --name <newStackName>
|
|
352
|
+
|
|
353
|
+
$ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
|
|
346
354
|
```
|
|
347
355
|
|
|
348
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
356
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/init.ts)_
|
|
349
357
|
|
|
350
358
|
## `sanity-run blueprints logs`
|
|
351
359
|
|
|
@@ -391,7 +399,7 @@ EXAMPLES
|
|
|
391
399
|
$ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
|
|
392
400
|
```
|
|
393
401
|
|
|
394
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
402
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/logs.ts)_
|
|
395
403
|
|
|
396
404
|
## `sanity-run blueprints mint-deploy-token`
|
|
397
405
|
|
|
@@ -436,7 +444,7 @@ EXAMPLES
|
|
|
436
444
|
$ sanity-run blueprints mint-deploy-token --organization-id <orgId>
|
|
437
445
|
```
|
|
438
446
|
|
|
439
|
-
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
447
|
+
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/mint-deploy-token.ts)_
|
|
440
448
|
|
|
441
449
|
## `sanity-run blueprints plan`
|
|
442
450
|
|
|
@@ -469,7 +477,7 @@ EXAMPLES
|
|
|
469
477
|
$ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
|
|
470
478
|
```
|
|
471
479
|
|
|
472
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
480
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/plan.ts)_
|
|
473
481
|
|
|
474
482
|
## `sanity-run blueprints promote`
|
|
475
483
|
|
|
@@ -505,7 +513,7 @@ EXAMPLES
|
|
|
505
513
|
$ sanity-run blueprints promote --new-stack-name <new-name>
|
|
506
514
|
```
|
|
507
515
|
|
|
508
|
-
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
516
|
+
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/promote.ts)_
|
|
509
517
|
|
|
510
518
|
## `sanity-run blueprints stacks`
|
|
511
519
|
|
|
@@ -541,7 +549,7 @@ EXAMPLES
|
|
|
541
549
|
$ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
|
|
542
550
|
```
|
|
543
551
|
|
|
544
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
552
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/blueprints/stacks.ts)_
|
|
545
553
|
|
|
546
554
|
## `sanity-run functions add`
|
|
547
555
|
|
|
@@ -593,7 +601,7 @@ EXAMPLES
|
|
|
593
601
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
594
602
|
```
|
|
595
603
|
|
|
596
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
604
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/functions/add.ts)_
|
|
597
605
|
|
|
598
606
|
## `sanity-run functions dev`
|
|
599
607
|
|
|
@@ -628,7 +636,7 @@ EXAMPLES
|
|
|
628
636
|
$ sanity-run functions dev --timeout 60
|
|
629
637
|
```
|
|
630
638
|
|
|
631
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
639
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/functions/dev.ts)_
|
|
632
640
|
|
|
633
641
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
634
642
|
|
|
@@ -658,7 +666,7 @@ EXAMPLES
|
|
|
658
666
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
659
667
|
```
|
|
660
668
|
|
|
661
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
669
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/functions/env/add.ts)_
|
|
662
670
|
|
|
663
671
|
## `sanity-run functions env list NAME`
|
|
664
672
|
|
|
@@ -685,7 +693,7 @@ EXAMPLES
|
|
|
685
693
|
$ sanity-run functions env list MyFunction
|
|
686
694
|
```
|
|
687
695
|
|
|
688
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
696
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/functions/env/list.ts)_
|
|
689
697
|
|
|
690
698
|
## `sanity-run functions env remove NAME KEY`
|
|
691
699
|
|
|
@@ -714,7 +722,7 @@ EXAMPLES
|
|
|
714
722
|
$ sanity-run functions env remove MyFunction API_URL
|
|
715
723
|
```
|
|
716
724
|
|
|
717
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
725
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/functions/env/remove.ts)_
|
|
718
726
|
|
|
719
727
|
## `sanity-run functions logs [NAME]`
|
|
720
728
|
|
|
@@ -754,7 +762,7 @@ EXAMPLES
|
|
|
754
762
|
$ sanity-run functions logs <name> --delete
|
|
755
763
|
```
|
|
756
764
|
|
|
757
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
765
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/functions/logs.ts)_
|
|
758
766
|
|
|
759
767
|
## `sanity-run functions test [NAME]`
|
|
760
768
|
|
|
@@ -811,7 +819,7 @@ EXAMPLES
|
|
|
811
819
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
812
820
|
```
|
|
813
821
|
|
|
814
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v15.
|
|
822
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v15.1.1/src/commands/functions/test.ts)_
|
|
815
823
|
|
|
816
824
|
## `sanity-run help [COMMAND]`
|
|
817
825
|
|
|
@@ -32,7 +32,7 @@ export declare function writeConfigFile(blueprintFilePath: string, options: {
|
|
|
32
32
|
export interface ConfigPatch {
|
|
33
33
|
organizationId?: string | null;
|
|
34
34
|
projectId?: string | null;
|
|
35
|
-
stackId?: string;
|
|
35
|
+
stackId?: string | null;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Update the config file with the given properties.
|
|
@@ -42,7 +42,7 @@ export interface ConfigPatch {
|
|
|
42
42
|
* @param updateableProperties - the properties to update
|
|
43
43
|
* @param updateableProperties.organizationId - the organization ID (null to remove)
|
|
44
44
|
* @param updateableProperties.projectId - the project ID (null to remove)
|
|
45
|
-
* @param updateableProperties.stackId - the stack ID
|
|
45
|
+
* @param updateableProperties.stackId - the stack ID (null to remove)
|
|
46
46
|
*/
|
|
47
47
|
export declare function patchConfigFile(blueprintFilePath: string, updateableProperties: ConfigPatch): BlueprintsConfig;
|
|
48
48
|
/**
|
|
@@ -59,7 +59,7 @@ export function writeConfigFile(blueprintFilePath, options) {
|
|
|
59
59
|
* @param updateableProperties - the properties to update
|
|
60
60
|
* @param updateableProperties.organizationId - the organization ID (null to remove)
|
|
61
61
|
* @param updateableProperties.projectId - the project ID (null to remove)
|
|
62
|
-
* @param updateableProperties.stackId - the stack ID
|
|
62
|
+
* @param updateableProperties.stackId - the stack ID (null to remove)
|
|
63
63
|
*/
|
|
64
64
|
export function patchConfigFile(blueprintFilePath, updateableProperties) {
|
|
65
65
|
const existingConfig = readConfigFile(blueprintFilePath);
|
|
@@ -5,7 +5,7 @@ import { Logger } from '../../utils/logger.js';
|
|
|
5
5
|
export default class DestroyCommand extends ResolvedCommand {
|
|
6
6
|
static needs = ['token', 'blueprint'];
|
|
7
7
|
static summary = 'Destroy a remote Stack deployment and its resources';
|
|
8
|
-
static description = `Permanently removes the remote Stack and all its provisioned resources. Your
|
|
8
|
+
static description = `Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files remain intact; "stackId" is unset in your local config.
|
|
9
9
|
|
|
10
10
|
This is a destructive operation. You will be prompted to confirm unless --force is specified.
|
|
11
11
|
|
|
@@ -16,8 +16,12 @@ After initialization, use 'blueprints plan' to preview changes, then 'blueprints
|
|
|
16
16
|
'<%= config.bin %> <%= command.id %>',
|
|
17
17
|
'<%= config.bin %> <%= command.id %> [directory]',
|
|
18
18
|
'<%= config.bin %> <%= command.id %> --blueprint-type <json|js|ts>',
|
|
19
|
-
'<%= config.bin %> <%= command.id %> --
|
|
20
|
-
'<%= config.bin %> <%= command.id %> --
|
|
19
|
+
'<%= config.bin %> <%= command.id %> --organization-id <organizationId>',
|
|
20
|
+
'<%= config.bin %> <%= command.id %> --project-id <projectId>',
|
|
21
|
+
'<%= config.bin %> <%= command.id %> --stack-name <newStackName>',
|
|
22
|
+
'<%= config.bin %> <%= command.id %> --stack-id <existingStackId>',
|
|
23
|
+
'<%= config.bin %> <%= command.id %> new-stack --type <json|js|ts> --org <organizationId> --name <newStackName>',
|
|
24
|
+
'<%= config.bin %> <%= command.id %> old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>',
|
|
21
25
|
];
|
|
22
26
|
static args = {
|
|
23
27
|
dir: Args.string({
|
|
@@ -24,7 +24,6 @@ Run 'blueprints plan' after making local changes to your Blueprint manifest to v
|
|
|
24
24
|
log: Logger(this.log.bind(this), this.flags),
|
|
25
25
|
token: this.sanityToken,
|
|
26
26
|
blueprint: this.blueprint,
|
|
27
|
-
validateResources: this.flags['validate-resources'],
|
|
28
27
|
flags: this.flags,
|
|
29
28
|
});
|
|
30
29
|
if (!result.success)
|
|
@@ -2,7 +2,7 @@ import { setTimeout as sleep } from 'node:timers/promises';
|
|
|
2
2
|
import { stashAsset } from '../../actions/blueprints/assets.js';
|
|
3
3
|
import { setupLogPolling } from '../../actions/blueprints/logs-polling.js';
|
|
4
4
|
import { getStack, updateStack } from '../../actions/blueprints/stacks.js';
|
|
5
|
-
import {
|
|
5
|
+
import { createHintCollector } from '../../utils/blueprints/hints.js';
|
|
6
6
|
import { niceId } from '../../utils/display/presenters.js';
|
|
7
7
|
import { styleText } from '../../utils/style-text.js';
|
|
8
8
|
import { isAssetResource } from '../../utils/types.js';
|
|
@@ -61,10 +61,15 @@ export async function blueprintDeployCore(options) {
|
|
|
61
61
|
});
|
|
62
62
|
if (!deployOk) {
|
|
63
63
|
spinner.fail(`${styleText('red', 'Failed')} to update Stack deployment`);
|
|
64
|
+
const hints = createHintCollector(bin);
|
|
65
|
+
if (deployError) {
|
|
66
|
+
hints.inspectMessage(deployError);
|
|
67
|
+
}
|
|
64
68
|
return {
|
|
65
69
|
success: false,
|
|
66
70
|
error: deployError || 'Failed to update Stack deployment',
|
|
67
71
|
suggestions: [
|
|
72
|
+
...hints.getSuggestions(),
|
|
68
73
|
`Run \`npx ${bin} blueprints plan\` to preview changes before deploying.`,
|
|
69
74
|
`Run \`npx ${bin} blueprints doctor\` to check your configuration.`,
|
|
70
75
|
],
|
|
@@ -82,7 +87,7 @@ export async function blueprintDeployCore(options) {
|
|
|
82
87
|
}
|
|
83
88
|
log(styleText('dim', 'Stack deployment progress:'));
|
|
84
89
|
log('');
|
|
85
|
-
const logHints =
|
|
90
|
+
const logHints = createHintCollector(bin);
|
|
86
91
|
let logStreamCleanup = null;
|
|
87
92
|
try {
|
|
88
93
|
let lastLogAt = Date.now();
|
|
@@ -96,7 +101,7 @@ export async function blueprintDeployCore(options) {
|
|
|
96
101
|
onActivity: () => {
|
|
97
102
|
lastLogAt = Date.now();
|
|
98
103
|
},
|
|
99
|
-
onLogEntry: (logEntry) => logHints.
|
|
104
|
+
onLogEntry: (logEntry) => logHints.inspectLog(logEntry),
|
|
100
105
|
});
|
|
101
106
|
while (true) {
|
|
102
107
|
const { ok, stack: currentStack } = await getStack({ stackId: stack.id, auth, logger: log });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
2
2
|
import { confirm } from '@inquirer/prompts';
|
|
3
|
+
import { patchConfigFile } from '../../actions/blueprints/config.js';
|
|
3
4
|
import { setupLogPolling } from '../../actions/blueprints/logs-polling.js';
|
|
4
5
|
import { destroyStack, getStack, resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
|
|
5
|
-
import {
|
|
6
|
+
import { createHintCollector } from '../../utils/blueprints/hints.js';
|
|
6
7
|
import { niceId } from '../../utils/display/presenters.js';
|
|
7
8
|
import { styleText } from '../../utils/style-text.js';
|
|
8
9
|
export async function blueprintDestroyCore(options) {
|
|
@@ -32,6 +33,7 @@ export async function blueprintDestroyCore(options) {
|
|
|
32
33
|
});
|
|
33
34
|
if (!ok)
|
|
34
35
|
return { success: false, error: error || 'Failed to destroy Stack deployment' };
|
|
36
|
+
clearLocalStackIdFromConfig(blueprint, stack.id, log);
|
|
35
37
|
if (noWait) {
|
|
36
38
|
log(styleText(['bold', 'magenta'], 'Stack destruction started!'));
|
|
37
39
|
return { success: true, json: { stackId: stack.id, stackName: stack.name } };
|
|
@@ -112,6 +114,7 @@ export async function blueprintDestroyCore(options) {
|
|
|
112
114
|
return { success: false, error: error || 'Failed to destroy Stack deployment' };
|
|
113
115
|
}
|
|
114
116
|
destroySpinner.stop().clear();
|
|
117
|
+
clearLocalStackIdFromConfig(blueprint, stack.id, log);
|
|
115
118
|
if (noWait) {
|
|
116
119
|
log(styleText(['bold', 'magenta'], 'Stack destruction started!'));
|
|
117
120
|
return { success: true, json: { stackId: stack.id, stackName: stack.name } };
|
|
@@ -130,11 +133,24 @@ export async function blueprintDestroyCore(options) {
|
|
|
130
133
|
return { success: false, error: errorMessage };
|
|
131
134
|
}
|
|
132
135
|
}
|
|
136
|
+
function clearLocalStackIdFromConfig(blueprint, destroyedStackId, log) {
|
|
137
|
+
if (!blueprint.blueprintConfig)
|
|
138
|
+
return;
|
|
139
|
+
if (blueprint.blueprintConfig.stackId !== destroyedStackId)
|
|
140
|
+
return;
|
|
141
|
+
try {
|
|
142
|
+
patchConfigFile(blueprint.fileInfo.blueprintFilePath, { stackId: null });
|
|
143
|
+
log(styleText('dim', 'Removed stackId from .sanity/blueprint.config.json'));
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
log(styleText('yellow', 'Could not update .sanity/blueprint.config.json. Remove stackId manually.'));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
133
149
|
async function waitForDestruction(options) {
|
|
134
150
|
const { stackId, stackName, operationId, auth, log, bin } = options;
|
|
135
151
|
log(styleText('dim', 'Stack destruction progress:'));
|
|
136
152
|
log('');
|
|
137
|
-
const logHints =
|
|
153
|
+
const logHints = createHintCollector(bin);
|
|
138
154
|
let logStreamCleanup = null;
|
|
139
155
|
try {
|
|
140
156
|
let lastLogAt = Date.now();
|
|
@@ -147,7 +163,7 @@ async function waitForDestruction(options) {
|
|
|
147
163
|
onActivity: () => {
|
|
148
164
|
lastLogAt = Date.now();
|
|
149
165
|
},
|
|
150
|
-
onLogEntry: (logEntry) => logHints.
|
|
166
|
+
onLogEntry: (logEntry) => logHints.inspectLog(logEntry),
|
|
151
167
|
});
|
|
152
168
|
while (true) {
|
|
153
169
|
const { ok, stack: currentStack } = await getStack({ stackId, auth, logger: log });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { planStack, resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
|
|
2
|
+
import { createHintCollector } from '../../utils/blueprints/hints.js';
|
|
2
3
|
import { formatDeploymentPlan, formatResourceTree, hasActionableChanges, } from '../../utils/display/blueprints-formatting.js';
|
|
3
4
|
import { styleText } from '../../utils/style-text.js';
|
|
4
5
|
export async function blueprintPlanCore(options) {
|
|
@@ -42,9 +43,11 @@ export async function blueprintPlanCore(options) {
|
|
|
42
43
|
});
|
|
43
44
|
spinner.stop().clear();
|
|
44
45
|
if (!planResponse.ok) {
|
|
46
|
+
const hints = createHintCollector(bin);
|
|
45
47
|
if (planResponse.problems) {
|
|
46
48
|
log('');
|
|
47
49
|
for (const problem of planResponse.problems) {
|
|
50
|
+
hints.inspectMessage(problem.message);
|
|
48
51
|
const messages = problem.message
|
|
49
52
|
.split('\n')
|
|
50
53
|
.map((s) => s.trim())
|
|
@@ -60,7 +63,10 @@ export async function blueprintPlanCore(options) {
|
|
|
60
63
|
return {
|
|
61
64
|
success: false,
|
|
62
65
|
error: 'Deployment plan has problems',
|
|
63
|
-
suggestions: [
|
|
66
|
+
suggestions: [
|
|
67
|
+
...hints.getSuggestions(),
|
|
68
|
+
`Fix the issues above, then run \`npx ${bin} blueprints deploy\`.`,
|
|
69
|
+
],
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
72
|
log('');
|