@sanity/runtime-cli 5.1.0 → 5.2.0

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.
Files changed (46) hide show
  1. package/README.md +23 -22
  2. package/dist/actions/blueprints/blueprint.d.ts +9 -5
  3. package/dist/actions/blueprints/index.d.ts +1 -1
  4. package/dist/actions/blueprints/index.js +1 -1
  5. package/dist/baseCommands.d.ts +10 -0
  6. package/dist/baseCommands.js +23 -11
  7. package/dist/commands/blueprints/add.d.ts +0 -8
  8. package/dist/commands/blueprints/add.js +12 -93
  9. package/dist/commands/blueprints/config.d.ts +2 -24
  10. package/dist/commands/blueprints/config.js +12 -179
  11. package/dist/commands/blueprints/deploy.js +12 -69
  12. package/dist/commands/blueprints/destroy.d.ts +5 -4
  13. package/dist/commands/blueprints/destroy.js +21 -61
  14. package/dist/commands/blueprints/info.js +11 -19
  15. package/dist/commands/blueprints/init.d.ts +0 -16
  16. package/dist/commands/blueprints/init.js +10 -167
  17. package/dist/commands/blueprints/logs.js +14 -67
  18. package/dist/commands/blueprints/plan.js +8 -13
  19. package/dist/commands/blueprints/stacks.js +10 -19
  20. package/dist/cores/blueprints/add.d.ts +13 -0
  21. package/dist/cores/blueprints/add.js +107 -0
  22. package/dist/cores/blueprints/config.d.ts +13 -0
  23. package/dist/cores/blueprints/config.js +222 -0
  24. package/dist/cores/blueprints/deploy.d.ts +14 -0
  25. package/dist/cores/blueprints/deploy.js +81 -0
  26. package/dist/cores/blueprints/destroy.d.ts +13 -0
  27. package/dist/cores/blueprints/destroy.js +106 -0
  28. package/dist/cores/blueprints/index.d.ts +18 -0
  29. package/dist/cores/blueprints/index.js +9 -0
  30. package/dist/cores/blueprints/info.d.ts +11 -0
  31. package/dist/cores/blueprints/info.js +33 -0
  32. package/dist/cores/blueprints/init.d.ts +15 -0
  33. package/dist/cores/blueprints/init.js +190 -0
  34. package/dist/cores/blueprints/logs.d.ts +11 -0
  35. package/dist/cores/blueprints/logs.js +74 -0
  36. package/dist/cores/blueprints/plan.d.ts +6 -0
  37. package/dist/cores/blueprints/plan.js +11 -0
  38. package/dist/cores/blueprints/stacks.d.ts +10 -0
  39. package/dist/cores/blueprints/stacks.js +30 -0
  40. package/dist/cores/index.d.ts +20 -0
  41. package/dist/cores/index.js +1 -0
  42. package/dist/utils/display/blueprints-formatting.js +12 -11
  43. package/dist/utils/display/colors.d.ts +3 -1
  44. package/dist/utils/display/colors.js +8 -2
  45. package/oclif.manifest.json +29 -15
  46. package/package.json +5 -1
@@ -0,0 +1,190 @@
1
+ import { join } from 'node:path';
2
+ import { cwd } from 'node:process';
3
+ import chalk from 'chalk';
4
+ import inquirer from 'inquirer';
5
+ import { findBlueprintFile, writeBlueprintToDisk, writeConfigFile, } from '../../actions/blueprints/blueprint.js';
6
+ import { getProject, listProjects } from '../../actions/blueprints/projects.js';
7
+ import { createStack, getStack, listStacks } from '../../actions/blueprints/stacks.js';
8
+ import { niceId } from '../../utils/display/colors.js';
9
+ const LAUNCH_LIMIT_STACK_PER_PROJECT = true;
10
+ export async function blueprintInitCore(options) {
11
+ const { log, token, args, flags } = options;
12
+ try {
13
+ const { 'blueprint-type': flagBlueprintType, 'project-id': flagProjectId, 'stack-id': flagStackId, 'stack-name': flagStackName, dir: flagDir, } = flags;
14
+ const { dir: argDir } = args;
15
+ const dirProvided = argDir || flagDir;
16
+ const here = cwd();
17
+ const dir = argDir || flagDir || here;
18
+ const existingBlueprint = findBlueprintFile(dir);
19
+ if (existingBlueprint) {
20
+ return { success: false, error: 'Existing Blueprint found.' };
21
+ }
22
+ const blueprintExtension = flagBlueprintType || (await promptForBlueprintType());
23
+ if (!blueprintExtension) {
24
+ return { success: false, error: 'Blueprint type is required.' };
25
+ }
26
+ let projectId = flagProjectId;
27
+ let stackId = flagStackId;
28
+ if (!projectId) {
29
+ const pickedProject = await promptForProject(token);
30
+ projectId = pickedProject.projectId;
31
+ }
32
+ if (flagStackName) {
33
+ // using --stack-name gets around "LAUNCH LIMIT: 1 Stack per Project"
34
+ const stack = await createEmptyStack({
35
+ token,
36
+ projectId,
37
+ name: flagStackName,
38
+ projectBased: false,
39
+ });
40
+ stackId = stack.id;
41
+ }
42
+ const auth = { token: token, projectId };
43
+ if (!stackId) {
44
+ // LAUNCH LIMIT: 1 Stack per Project - do not prompt for Stack, just create one
45
+ if (LAUNCH_LIMIT_STACK_PER_PROJECT) {
46
+ await createProjectBasedStack(auth, token, log);
47
+ // do not set stackId, to avoid saving it to the config file
48
+ }
49
+ else {
50
+ stackId = await promptForStackId({ projectId, token });
51
+ }
52
+ }
53
+ const fileName = `blueprint.${blueprintExtension}`;
54
+ const filePath = join(dir, fileName);
55
+ if (dirProvided)
56
+ log(`New Blueprint created: ${dirProvided}/`);
57
+ writeBlueprintToDisk({ blueprintFilePath: filePath });
58
+ log(`Created new blueprint: ${dirProvided ?? '.'}/${fileName}`);
59
+ writeConfigFile({ blueprintFilePath: filePath, projectId, stackId });
60
+ log(`Created new config file: ${dirProvided ?? '.'}/.blueprint/config.json`);
61
+ if (blueprintExtension === 'ts') {
62
+ log('\nNote: TypeScript support requires "tsx" to be installed. Run: npm install -D tsx');
63
+ }
64
+ return { success: true };
65
+ }
66
+ catch (error) {
67
+ const errorMessage = error instanceof Error ? error.message : String(error);
68
+ log(`Error: ${errorMessage}`);
69
+ return { success: false, error: errorMessage };
70
+ }
71
+ }
72
+ async function promptForBlueprintType() {
73
+ const { pickedBlueprintsType } = await inquirer.prompt([
74
+ {
75
+ type: 'list',
76
+ name: 'pickedBlueprintsType',
77
+ message: 'Choose a blueprint type:',
78
+ choices: [
79
+ { name: 'JSON (Recommended)', value: 'json' },
80
+ { name: 'JavaScript', value: 'js', disabled: true },
81
+ { name: 'TypeScript', value: 'ts', disabled: true },
82
+ ],
83
+ default: 'json',
84
+ },
85
+ ]);
86
+ return pickedBlueprintsType;
87
+ }
88
+ async function promptForProject(token) {
89
+ const { ok: projectsOk, error: projectsErr, projects } = await listProjects({ token });
90
+ if (!projectsOk) {
91
+ throw new Error(projectsErr ?? 'Unknown error listing projects');
92
+ }
93
+ if (projects.length === 0) {
94
+ throw new Error('No Sanity projects found. Use `npx sanity init` to create one.');
95
+ }
96
+ const projectChoices = projects.map(({ displayName, id: projectId }) => ({
97
+ name: `"${displayName}" ${niceId(projectId)}`,
98
+ value: { projectId, displayName },
99
+ }));
100
+ const { pickedProject } = await inquirer.prompt([
101
+ {
102
+ type: 'list',
103
+ name: 'pickedProject',
104
+ message: 'Select your Sanity project:',
105
+ choices: projectChoices,
106
+ },
107
+ ]);
108
+ return pickedProject;
109
+ }
110
+ async function promptForStackId({ projectId, token, }) {
111
+ const { ok: stacksOk, error: stacksErr, stacks } = await listStacks({ token, projectId });
112
+ if (!stacksOk) {
113
+ throw new Error(stacksErr || 'Failed to list Stacks');
114
+ }
115
+ const stackChoices = [
116
+ { name: chalk.bold('✨ Create a new Stack'), value: 'new' },
117
+ ];
118
+ if (stacks.length > 0) {
119
+ stackChoices.push(new inquirer.Separator(chalk.underline('Use an existing Stack:')));
120
+ stackChoices.push(...stacks.map((s) => ({
121
+ name: `"${s.name}" ${niceId(s.id)} ${chalk.dim(`(${s.resources.length} res)`)}`,
122
+ value: s.id,
123
+ })));
124
+ }
125
+ const { pickedStackId } = await inquirer.prompt([
126
+ {
127
+ type: 'list',
128
+ name: 'pickedStackId',
129
+ message: 'Select an existing deployment or create a new one:',
130
+ choices: stackChoices,
131
+ },
132
+ ]);
133
+ if (pickedStackId === 'new') {
134
+ const { stackName } = await inquirer.prompt([
135
+ {
136
+ type: 'input',
137
+ name: 'stackName',
138
+ message: 'Enter a name for your Stack:',
139
+ validate: (input) => input.length > 0 || 'Stack name is required',
140
+ },
141
+ ]);
142
+ const stack = await createEmptyStack({
143
+ token,
144
+ projectId,
145
+ name: stackName,
146
+ });
147
+ return stack.id;
148
+ }
149
+ return pickedStackId;
150
+ }
151
+ async function createEmptyStack({ token, projectId, name, projectBased = true, }) {
152
+ const stackPayload = {
153
+ name,
154
+ projectId,
155
+ useProjectBasedId: projectBased,
156
+ document: { resources: [] },
157
+ };
158
+ const auth = { token, projectId };
159
+ const response = await createStack({ stackPayload, auth });
160
+ if (!response.ok) {
161
+ throw new Error(response.error || 'Failed to create new Stack');
162
+ }
163
+ return response.stack;
164
+ }
165
+ // LAUNCH LIMIT: 1 Stack per Project - create exclusive stack for project
166
+ async function createProjectBasedStack(auth, token, log) {
167
+ const { projectId } = auth;
168
+ // get project
169
+ const { ok: projectOk, project } = await getProject(auth);
170
+ if (!projectOk) {
171
+ throw new Error('Failed to find Project while creating Stack');
172
+ }
173
+ const projectDisplayName = project.displayName;
174
+ // check if project has a stack
175
+ const inferredStackId = `ST-${projectId}`;
176
+ const { stack: existingStack, ok: stackOk } = await getStack({ stackId: inferredStackId, auth });
177
+ // if existing stack, return stack
178
+ if (stackOk && existingStack) {
179
+ log(chalk.red(`Found existing deployment for "${projectDisplayName}" Blueprint`));
180
+ log(chalk.red('Deploying an empty Blueprint will override the existing deployment.'));
181
+ return existingStack;
182
+ }
183
+ // if not, create a stack
184
+ const stack = await createEmptyStack({
185
+ token,
186
+ projectId,
187
+ name: projectDisplayName,
188
+ });
189
+ return stack;
190
+ }
@@ -0,0 +1,11 @@
1
+ import type { AuthParams, Stack } from '../../utils/types.js';
2
+ import type { CoreConfig, CoreResult } from '../index.js';
3
+ export interface BlueprintLogsOptions extends CoreConfig {
4
+ auth: AuthParams;
5
+ stackId: string;
6
+ deployedStack: Stack;
7
+ flags: {
8
+ watch?: boolean;
9
+ };
10
+ }
11
+ export declare function blueprintLogsCore(options: BlueprintLogsOptions): Promise<CoreResult>;
@@ -0,0 +1,74 @@
1
+ import chalk from 'chalk';
2
+ import Spinner from 'yocto-spinner';
3
+ import { findNewestLogTimestamp, getLogs, getRecentLogs, isNewerLog, streamLogs, } from '../../actions/blueprints/logs.js';
4
+ import { formatTitle } from '../../utils/display/blueprints-formatting.js';
5
+ import { bold, niceId } from '../../utils/display/colors.js';
6
+ import { formatLogEntry, formatLogsByDay, organizeLogsByDay, } from '../../utils/display/logs-formatting.js';
7
+ export async function blueprintLogsCore(options) {
8
+ const { log, auth, stackId, deployedStack, flags } = options;
9
+ const { watch = false } = flags;
10
+ const spinner = Spinner({
11
+ text: `Fetching recent logs for deployment ${niceId(stackId)}`,
12
+ }).start();
13
+ try {
14
+ if (watch) {
15
+ const { ok, logs, error } = await getLogs(stackId, auth);
16
+ if (!ok) {
17
+ spinner.error(`${chalk.red('Failed')} to retrieve logs`);
18
+ log(`Error: ${error || 'Unknown error'}`);
19
+ return { success: false, error: error || 'Failed to retrieve logs' };
20
+ }
21
+ spinner.stop().clear();
22
+ log(`${formatTitle('Blueprint', deployedStack.name)} ${niceId(stackId)} logs`);
23
+ if (logs.length > 0) {
24
+ log('\nMost recent logs:');
25
+ const recentLogs = getRecentLogs(logs);
26
+ for (const logEntry of recentLogs) {
27
+ log(` ${formatLogEntry(logEntry)}`);
28
+ }
29
+ }
30
+ else {
31
+ log(`No recent logs found for deployment ${niceId(stackId)}`);
32
+ }
33
+ const onOpen = () => {
34
+ log(`Watching for new logs... ${bold('ctrl+c')} to stop`);
35
+ };
36
+ let newestTimestamp = findNewestLogTimestamp(logs);
37
+ const renderLog = (logEntry) => {
38
+ if (!isNewerLog(logEntry, newestTimestamp))
39
+ return;
40
+ newestTimestamp = new Date(logEntry.timestamp).getTime();
41
+ log(formatLogEntry(logEntry, true));
42
+ };
43
+ streamLogs(stackId, auth, renderLog, onOpen, (error) => log(`${chalk.red('Error:')} ${error}`));
44
+ // Return a special key for streaming mode
45
+ return {
46
+ success: true,
47
+ streaming: new Promise(() => { }),
48
+ };
49
+ }
50
+ // Regular non-streaming logs
51
+ const { ok, logs, error } = await getLogs(stackId, auth);
52
+ if (!ok) {
53
+ spinner.error(`${chalk.red('Failed')} to retrieve logs`);
54
+ log(`Error: ${error || 'Unknown error'}`);
55
+ return { success: false, error: error || 'Failed to retrieve logs' };
56
+ }
57
+ if (logs.length === 0) {
58
+ spinner.info(`No logs found for deployment ${stackId}`);
59
+ return { success: true };
60
+ }
61
+ spinner.success(`${formatTitle('Blueprint', deployedStack.name)} Logs`);
62
+ log(`Found ${bold(logs.length.toString())} log entries for deployment ${niceId(stackId)}\n`);
63
+ // Organize and format logs by day
64
+ const logsByDay = organizeLogsByDay(logs);
65
+ log(formatLogsByDay(logsByDay));
66
+ return { success: true };
67
+ }
68
+ catch (err) {
69
+ spinner.error('Failed to retrieve logs');
70
+ const errorMessage = err instanceof Error ? err.message : String(err);
71
+ log(`Error: ${errorMessage}`);
72
+ return { success: false, error: errorMessage };
73
+ }
74
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReadBlueprintResult } from '../../actions/blueprints/blueprint.js';
2
+ import type { CoreConfig, CoreResult } from '../index.js';
3
+ export interface BlueprintPlanOptions extends CoreConfig {
4
+ blueprint: ReadBlueprintResult;
5
+ }
6
+ export declare function blueprintPlanCore(options: BlueprintPlanOptions): Promise<CoreResult>;
@@ -0,0 +1,11 @@
1
+ import { formatResourceTree, formatTitle } from '../../utils/display/blueprints-formatting.js';
2
+ export async function blueprintPlanCore(options) {
3
+ const { bin = 'sanity', log, blueprint } = options;
4
+ const { parsedBlueprint, fileInfo } = blueprint;
5
+ const { resources } = parsedBlueprint;
6
+ log(`${formatTitle('Deployment', 'Plan')}`);
7
+ log(`(${fileInfo.fileName})\n`);
8
+ log(formatResourceTree(resources));
9
+ log(`\nRun \`${bin} blueprints deploy\` to deploy these changes`);
10
+ return { success: true };
11
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReadBlueprintResult } from '../../actions/blueprints/blueprint.js';
2
+ import type { CoreConfig, CoreResult } from '../index.js';
3
+ export interface BlueprintStacksOptions extends CoreConfig {
4
+ token: string;
5
+ blueprint: ReadBlueprintResult;
6
+ flags: {
7
+ projectId?: string;
8
+ };
9
+ }
10
+ export declare function blueprintStacksCore(options: BlueprintStacksOptions): Promise<CoreResult>;
@@ -0,0 +1,30 @@
1
+ import chalk from 'chalk';
2
+ import { listStacks } from '../../actions/blueprints/stacks.js';
3
+ import { formatStacksListing } from '../../utils/display/blueprints-formatting.js';
4
+ import { niceId } from '../../utils/display/colors.js';
5
+ export async function blueprintStacksCore(options) {
6
+ const { log, token, blueprint, flags } = options;
7
+ const { projectId: blueprintProjectId, stackId: blueprintStackId } = blueprint;
8
+ const projectId = flags.projectId || blueprintProjectId;
9
+ if (!projectId) {
10
+ log('Run in a Blueprint directory or provide a Project with --projectId');
11
+ return { success: false, error: 'No Project ID provided' };
12
+ }
13
+ try {
14
+ const { ok, stacks, error } = await listStacks({ token, projectId });
15
+ if (!ok)
16
+ return { success: false, error: error || 'Failed to list stacks' };
17
+ if (!stacks || stacks.length === 0) {
18
+ log('No stacks found');
19
+ return { success: true };
20
+ }
21
+ log(`${chalk.bold('Project')} ${niceId(projectId)} ${chalk.bold('Stacks')}:\n`);
22
+ log(formatStacksListing(stacks, blueprintStackId));
23
+ return { success: true };
24
+ }
25
+ catch (error) {
26
+ const errorMessage = error instanceof Error ? error.message : String(error);
27
+ log(`Error: ${errorMessage}`);
28
+ return { success: false, error: errorMessage };
29
+ }
30
+ }
@@ -0,0 +1,20 @@
1
+ export * as blueprintsCores from './blueprints/index.js';
2
+ export interface CoreConfig {
3
+ /** The CLI binary name. */
4
+ bin: string;
5
+ /** The log output function. */
6
+ log: (message: string) => void;
7
+ }
8
+ export type CoreResult = {
9
+ /** Something went wrong. */
10
+ success: false;
11
+ /** The error message, if the operation failed. */
12
+ error: string;
13
+ streaming?: never;
14
+ } | {
15
+ /** Everything went well. */
16
+ success: true;
17
+ /** The streaming function, if the operation is streaming. */
18
+ streaming?: Promise<void>;
19
+ error?: never;
20
+ };
@@ -0,0 +1 @@
1
+ export * as blueprintsCores from './blueprints/index.js';
@@ -1,23 +1,24 @@
1
1
  import { treeify } from 'array-treeify';
2
- import { blue, bold, boldnblue, green, niceId, red, yellow } from './colors.js';
2
+ import chalk from 'chalk';
3
+ import { niceId } from './colors.js';
3
4
  import { formatDate, formatDuration } from './dates.js';
4
5
  export function formatTitle(title, name) {
5
- return `${boldnblue(title)} ${bold(`"${name}"`)}`;
6
+ return `${chalk.bold.blue(title)} ${chalk.bold(`"${name}"`)}`;
6
7
  }
7
8
  export function formatResourceTree(resources) {
8
9
  if (!resources || resources.length === 0) {
9
- return ' Zero deployed resources';
10
+ return ' Zero resources';
10
11
  }
11
12
  const output = [];
12
- output.push(`${blue('Blueprint Resources')} [${resources.length}]`);
13
+ output.push(`${chalk.blue('Blueprint Resources')} [${resources.length}]`);
13
14
  const functionResources = resources.filter((r) => r.type?.startsWith('sanity.function.'));
14
15
  const otherResources = resources.filter((r) => !r.type?.startsWith('sanity.function.'));
15
16
  const hasOtherResources = otherResources.length > 0;
16
17
  if (functionResources.length > 0) {
17
18
  const functionsOutput = [];
18
- functionsOutput.push(`${bold('Functions')} [${functionResources.length}]`);
19
+ functionsOutput.push(`${chalk.bold('Functions')} [${functionResources.length}]`);
19
20
  const functionResourcesOutput = functionResources.map((fn) => {
20
- const name = green(fn.displayName || fn.name);
21
+ const name = chalk.green(fn.displayName || fn.name);
21
22
  const externalId = fn.externalId ? `Fn${niceId(fn.externalId)}` : '';
22
23
  return `"${name}" ${externalId}`;
23
24
  });
@@ -26,9 +27,9 @@ export function formatResourceTree(resources) {
26
27
  }
27
28
  if (hasOtherResources) {
28
29
  const otherOutput = [];
29
- otherOutput.push(`${bold('Other Resources')} [${otherResources.length}]`);
30
+ otherOutput.push(`${chalk.bold('Other Resources')} [${otherResources.length}]`);
30
31
  const otherResourcesOutput = otherResources.map((other) => {
31
- return `"${yellow(other.displayName ?? other.name ?? 'unnamed')}"`;
32
+ return `"${chalk.yellow(other.displayName ?? other.name ?? 'unnamed')}"`;
32
33
  });
33
34
  otherOutput.push(otherResourcesOutput);
34
35
  output.push(otherOutput);
@@ -40,7 +41,7 @@ export function formatStackInfo(stack, isCurrentStack = false) {
40
41
  const isStack = 'id' in stack;
41
42
  const infoOutput = [];
42
43
  if (isStack) {
43
- const stackName = isCurrentStack ? boldnblue(stack.name) : bold(stack.name);
44
+ const stackName = isCurrentStack ? chalk.bold.blue(stack.name) : chalk.bold(stack.name);
44
45
  output.push(`"${stackName}" ${niceId(stack.id)}${isCurrentStack ? ' (current)' : ''}`);
45
46
  }
46
47
  else {
@@ -63,7 +64,7 @@ export function formatStackInfo(stack, isCurrentStack = false) {
63
64
  if (operation.id)
64
65
  operationOutput.push(`Recent Operation ${niceId(operation.id)}:`);
65
66
  if (operation.status) {
66
- const operationColor = operation.status === 'COMPLETED' ? green : red;
67
+ const operationColor = operation.status === 'COMPLETED' ? chalk.green : chalk.red;
67
68
  const status = operation.status || 'UNKNOWN';
68
69
  operationOutput.push(`Status: ${operationColor(status)}`);
69
70
  }
@@ -71,7 +72,7 @@ export function formatStackInfo(stack, isCurrentStack = false) {
71
72
  operationOutput.push(`Started: ${formatDate(operation.createdAt)}`);
72
73
  if (operation.status === 'COMPLETED' && operation.completedAt && operation.createdAt) {
73
74
  operationOutput.push(`Completed: ${formatDate(operation.completedAt)}`);
74
- operationOutput.push(`Duration: ${yellow(formatDuration(operation.createdAt, operation.completedAt))}`);
75
+ operationOutput.push(`Duration: ${chalk.yellow(formatDuration(operation.createdAt, operation.completedAt))}`);
75
76
  }
76
77
  infoOutput.push(operationOutput);
77
78
  }
@@ -5,5 +5,7 @@ export declare function blue(str: string): string;
5
5
  export declare function green(str: string): string;
6
6
  export declare function red(str: string): string;
7
7
  export declare function yellow(str: string): string;
8
- export declare function boldnblue(str: string): string;
8
+ export declare function info(str: string): string;
9
+ export declare function warn(str: string): string;
10
+ export declare function severe(str: string): string;
9
11
  export declare function niceId(id: string | undefined): string;
@@ -22,8 +22,14 @@ export function red(str) {
22
22
  export function yellow(str) {
23
23
  return chalk.yellow(str);
24
24
  }
25
- export function boldnblue(str) {
26
- return chalk.bold.blue(str);
25
+ export function info(str) {
26
+ return `${chalk.blue('❯')} ${str}`;
27
+ }
28
+ export function warn(str) {
29
+ return `${chalk.yellow('❯')} ${str}`;
30
+ }
31
+ export function severe(str) {
32
+ return `${chalk.red('❯')} ${str}`;
27
33
  }
28
34
  export function niceId(id) {
29
35
  if (!id)
@@ -12,7 +12,7 @@
12
12
  "required": true
13
13
  }
14
14
  },
15
- "description": "Add a (function) resource to a Blueprint",
15
+ "description": "Add a Resource to a Blueprint",
16
16
  "examples": [
17
17
  "<%= config.bin %> <%= command.id %> function",
18
18
  "<%= config.bin %> <%= command.id %> function --name my-function",
@@ -22,7 +22,7 @@
22
22
  "flags": {
23
23
  "name": {
24
24
  "char": "n",
25
- "description": "Name of the resource to add",
25
+ "description": "Name of the Resource to add",
26
26
  "name": "name",
27
27
  "hasDynamicHelp": false,
28
28
  "multiple": false,
@@ -35,7 +35,7 @@
35
35
  "dependsOn": [
36
36
  "name"
37
37
  ],
38
- "description": "Type of new function",
38
+ "description": "Type of new Function",
39
39
  "name": "fn-type",
40
40
  "hasDynamicHelp": false,
41
41
  "multiple": false,
@@ -49,7 +49,7 @@
49
49
  "function-language",
50
50
  "lang"
51
51
  ],
52
- "description": "Language of the new function",
52
+ "description": "Language of the new Function",
53
53
  "name": "language",
54
54
  "default": "ts",
55
55
  "hasDynamicHelp": false,
@@ -152,7 +152,6 @@
152
152
  "pluginName": "@sanity/runtime-cli",
153
153
  "pluginType": "core",
154
154
  "strict": true,
155
- "enableJsonFlag": false,
156
155
  "isESM": true,
157
156
  "relativePath": [
158
157
  "dist",
@@ -201,34 +200,47 @@
201
200
  ],
202
201
  "flags": {
203
202
  "force": {
203
+ "aliases": [
204
+ "f"
205
+ ],
204
206
  "description": "Force destroy (skip confirmation)",
205
207
  "name": "force",
206
208
  "allowNo": false,
207
209
  "type": "boolean"
208
210
  },
209
- "projectId": {
211
+ "project-id": {
212
+ "aliases": [
213
+ "projectId",
214
+ "project"
215
+ ],
210
216
  "dependsOn": [
211
- "id",
217
+ "stack-id",
212
218
  "force"
213
219
  ],
214
220
  "description": "Project associated with the Stack (defaults to current Project)",
215
221
  "hidden": true,
216
- "name": "projectId",
222
+ "name": "project-id",
217
223
  "hasDynamicHelp": false,
218
224
  "multiple": false,
219
225
  "type": "option"
220
226
  },
221
- "id": {
222
- "dependsOn": [
223
- "projectId",
224
- "force"
227
+ "stack-id": {
228
+ "aliases": [
229
+ "stackId",
230
+ "stack"
225
231
  ],
226
232
  "description": "Stack ID to destroy (defaults to current Stack)",
227
233
  "hidden": true,
228
- "name": "id",
234
+ "name": "stack-id",
229
235
  "hasDynamicHelp": false,
230
236
  "multiple": false,
231
237
  "type": "option"
238
+ },
239
+ "no-wait": {
240
+ "description": "Do not wait for destruction to complete",
241
+ "name": "no-wait",
242
+ "allowNo": false,
243
+ "type": "boolean"
232
244
  }
233
245
  },
234
246
  "hasDynamicHelp": false,
@@ -386,10 +398,12 @@
386
398
  ],
387
399
  "flags": {
388
400
  "watch": {
401
+ "aliases": [
402
+ "follow"
403
+ ],
389
404
  "char": "w",
390
405
  "description": "Watch for new logs (streaming mode)",
391
406
  "name": "watch",
392
- "required": false,
393
407
  "allowNo": false,
394
408
  "type": "boolean"
395
409
  }
@@ -768,5 +782,5 @@
768
782
  ]
769
783
  }
770
784
  },
771
- "version": "5.1.0"
785
+ "version": "5.2.0"
772
786
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
3
  "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
- "version": "5.1.0",
4
+ "version": "5.2.0",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -23,6 +23,10 @@
23
23
  "types": "./dist/actions/functions/index.d.ts",
24
24
  "import": "./dist/actions/functions/index.js"
25
25
  },
26
+ "./cores/blueprints": {
27
+ "types": "./dist/cores/blueprints/index.d.ts",
28
+ "import": "./dist/cores/blueprints/index.js"
29
+ },
26
30
  "./utils": {
27
31
  "types": "./dist/utils/index.d.ts",
28
32
  "import": "./dist/utils/index.js"