@sanity/runtime-cli 5.2.0 → 6.0.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.
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/5.2.0 linux-x64 node-v22.15.0
23
+ @sanity/runtime-cli/6.0.0 linux-x64 node-v22.15.0
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -77,7 +77,7 @@ EXAMPLES
77
77
  $ sanity-run blueprints add function --name my-function --fn-type document-publish --lang js
78
78
  ```
79
79
 
80
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/add.ts)_
80
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/add.ts)_
81
81
 
82
82
  ## `sanity-run blueprints config`
83
83
 
@@ -105,7 +105,7 @@ EXAMPLES
105
105
  $ sanity-run blueprints config --edit --project-id <projectId>
106
106
  ```
107
107
 
108
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/config.ts)_
108
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/config.ts)_
109
109
 
110
110
  ## `sanity-run blueprints deploy`
111
111
 
@@ -127,7 +127,7 @@ EXAMPLES
127
127
  $ sanity-run blueprints deploy --no-wait
128
128
  ```
129
129
 
130
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/deploy.ts)_
130
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/deploy.ts)_
131
131
 
132
132
  ## `sanity-run blueprints destroy`
133
133
 
@@ -148,7 +148,7 @@ EXAMPLES
148
148
  $ sanity-run blueprints destroy
149
149
  ```
150
150
 
151
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/destroy.ts)_
151
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/destroy.ts)_
152
152
 
153
153
  ## `sanity-run blueprints info`
154
154
 
@@ -165,7 +165,7 @@ EXAMPLES
165
165
  $ sanity-run blueprints info
166
166
  ```
167
167
 
168
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/info.ts)_
168
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/info.ts)_
169
169
 
170
170
  ## `sanity-run blueprints init [DIR]`
171
171
 
@@ -197,7 +197,7 @@ EXAMPLES
197
197
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --project-id <projectId>
198
198
  ```
199
199
 
200
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/init.ts)_
200
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/init.ts)_
201
201
 
202
202
  ## `sanity-run blueprints logs`
203
203
 
@@ -219,7 +219,7 @@ EXAMPLES
219
219
  $ sanity-run blueprints logs --watch
220
220
  ```
221
221
 
222
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/logs.ts)_
222
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/logs.ts)_
223
223
 
224
224
  ## `sanity-run blueprints plan`
225
225
 
@@ -236,7 +236,7 @@ EXAMPLES
236
236
  $ sanity-run blueprints plan
237
237
  ```
238
238
 
239
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/blueprints/plan.ts)_
239
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/blueprints/plan.ts)_
240
240
 
241
241
  ## `sanity-run functions dev`
242
242
 
@@ -256,7 +256,7 @@ EXAMPLES
256
256
  $ sanity-run functions dev --port 8974
257
257
  ```
258
258
 
259
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/functions/dev.ts)_
259
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/functions/dev.ts)_
260
260
 
261
261
  ## `sanity-run functions env add NAME KEY VALUE`
262
262
 
@@ -278,7 +278,7 @@ EXAMPLES
278
278
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
279
279
  ```
280
280
 
281
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/functions/env/add.ts)_
281
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/functions/env/add.ts)_
282
282
 
283
283
  ## `sanity-run functions env list NAME`
284
284
 
@@ -298,7 +298,7 @@ EXAMPLES
298
298
  $ sanity-run functions env list MyFunction
299
299
  ```
300
300
 
301
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/functions/env/list.ts)_
301
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/functions/env/list.ts)_
302
302
 
303
303
  ## `sanity-run functions env remove NAME KEY`
304
304
 
@@ -319,7 +319,7 @@ EXAMPLES
319
319
  $ sanity-run functions env remove MyFunction API_URL
320
320
  ```
321
321
 
322
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/functions/env/remove.ts)_
322
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/functions/env/remove.ts)_
323
323
 
324
324
  ## `sanity-run functions logs NAME`
325
325
 
@@ -351,7 +351,7 @@ EXAMPLES
351
351
  $ sanity-run functions logs <name> --delete
352
352
  ```
353
353
 
354
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/functions/logs.ts)_
354
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/functions/logs.ts)_
355
355
 
356
356
  ## `sanity-run functions test NAME`
357
357
 
@@ -384,7 +384,7 @@ EXAMPLES
384
384
  $ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
385
385
  ```
386
386
 
387
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v5.2.0/src/commands/functions/test.ts)_
387
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v6.0.0/src/commands/functions/test.ts)_
388
388
 
389
389
  ## `sanity-run help [COMMAND]`
390
390
 
@@ -1,4 +1,5 @@
1
1
  import type { BlueprintParserError, LocalBlueprint, LocalResource } from '../../utils/types.js';
2
+ export { BLUEPRINT_CONFIG_FILE, BLUEPRINT_CONFIG_VERSION, BLUEPRINT_DIR } from '../../config.js';
2
3
  declare const SUPPORTED_FILE_EXTENSIONS: readonly [".json", ".js", ".mjs", ".cjs", ".ts"];
3
4
  type BlueprintFileExtension = (typeof SUPPORTED_FILE_EXTENSIONS)[number];
4
5
  export declare const DEFAULT_BLUEPRINT_CONTENT: LocalBlueprint;
@@ -60,4 +61,3 @@ export declare function updateBlueprintValues({ blueprintFilePath, values, }: {
60
61
  blueprintFilePath: string;
61
62
  values: LocalBlueprint['values'];
62
63
  }): void;
63
- export {};
@@ -3,9 +3,11 @@ import { createRequire } from 'node:module';
3
3
  import { basename, dirname, extname, join } from 'node:path';
4
4
  import { cwd } from 'node:process';
5
5
  import { findUpSync } from 'find-up';
6
+ import { BLUEPRINT_CONFIG_FILE, BLUEPRINT_CONFIG_VERSION, BLUEPRINT_DIR } from '../../config.js';
6
7
  import { isLocalFunctionResource } from '../../utils/types.js';
7
8
  import { validateFunctionResource } from '../../utils/validate/resource.js';
8
9
  import { blueprintParserValidator } from '../../utils/vendor/parser-validator.js';
10
+ export { BLUEPRINT_CONFIG_FILE, BLUEPRINT_CONFIG_VERSION, BLUEPRINT_DIR } from '../../config.js';
9
11
  const SUPPORTED_FILE_EXTENSIONS = ['.json', '.js', '.mjs', '.cjs', '.ts'];
10
12
  const SUPPORTED_FILE_NAMES_IN_PRIORITY_ORDER = SUPPORTED_FILE_EXTENSIONS.map((ext) => `blueprint${ext}`);
11
13
  export const DEFAULT_BLUEPRINT_CONTENT = {
@@ -174,7 +176,7 @@ export function writeBlueprintToDisk({ blueprintFilePath, content = DEFAULT_BLUE
174
176
  export function readConfigFile(blueprintFilePath) {
175
177
  if (blueprintFilePath) {
176
178
  const blueprintDir = dirname(blueprintFilePath);
177
- const configPath = join(blueprintDir, '.blueprint', 'config.json');
179
+ const configPath = join(blueprintDir, BLUEPRINT_DIR, BLUEPRINT_CONFIG_FILE);
178
180
  if (existsSync(configPath)) {
179
181
  try {
180
182
  const config = JSON.parse(readFileSync(configPath, 'utf8'));
@@ -185,7 +187,7 @@ export function readConfigFile(blueprintFilePath) {
185
187
  }
186
188
  }
187
189
  }
188
- const configFilePath = join(cwd(), '.blueprint', 'config.json');
190
+ const configFilePath = join(cwd(), BLUEPRINT_DIR, BLUEPRINT_CONFIG_FILE);
189
191
  if (!existsSync(configFilePath))
190
192
  return null;
191
193
  try {
@@ -198,8 +200,8 @@ export function readConfigFile(blueprintFilePath) {
198
200
  }
199
201
  export function writeConfigFile({ blueprintFilePath, projectId, stackId, }) {
200
202
  const blueprintDir = blueprintFilePath ? dirname(blueprintFilePath) : cwd();
201
- const configDir = join(blueprintDir, '.blueprint');
202
- const configPath = join(configDir, 'config.json');
203
+ const configDir = join(blueprintDir, BLUEPRINT_DIR);
204
+ const configPath = join(configDir, BLUEPRINT_CONFIG_FILE);
203
205
  if (!existsSync(configDir)) {
204
206
  mkdirSync(configDir, { recursive: true });
205
207
  }
@@ -214,6 +216,8 @@ export function writeConfigFile({ blueprintFilePath, projectId, stackId, }) {
214
216
  }
215
217
  config.projectId = projectId;
216
218
  config.stackId = stackId;
219
+ config.blueprintConfigVersion = BLUEPRINT_CONFIG_VERSION;
220
+ config.updatedAt = Date.now();
217
221
  writeFileSync(configPath, JSON.stringify(config, null, 2));
218
222
  }
219
223
  export function addResourceToBlueprint({ blueprintFilePath, resource, }) {
package/dist/config.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ export declare const BLUEPRINT_CONFIG_VERSION = "v2025-05-08";
2
+ export declare const BLUEPRINT_DIR = ".sanity";
3
+ export declare const BLUEPRINT_CONFIG_FILE = "blueprint.config.json";
1
4
  declare const _default: {
2
5
  isTest: boolean;
3
6
  apiUrl: string;
package/dist/config.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { env } from 'node:process';
2
2
  import getToken from './utils/get-token.js';
3
+ export const BLUEPRINT_CONFIG_VERSION = 'v2025-05-08';
4
+ export const BLUEPRINT_DIR = '.sanity';
5
+ export const BLUEPRINT_CONFIG_FILE = 'blueprint.config.json';
3
6
  const nodeEnv = env.NODE_ENV?.toLowerCase() ?? 'production';
4
7
  const isTest = nodeEnv === 'test';
5
8
  const sanityEnv = env.SANITY_INTERNAL_ENV?.toLowerCase() ?? 'production';
@@ -2,7 +2,7 @@ import chalk from 'chalk';
2
2
  import highlight from 'color-json';
3
3
  import inquirer from 'inquirer';
4
4
  import Spinner from 'yocto-spinner';
5
- import { writeConfigFile } from '../../actions/blueprints/blueprint.js';
5
+ import { BLUEPRINT_CONFIG_FILE, BLUEPRINT_DIR, writeConfigFile, } from '../../actions/blueprints/blueprint.js';
6
6
  import { getProject, listProjects } from '../../actions/blueprints/projects.js';
7
7
  import { createStack, getStack, listStacks } from '../../actions/blueprints/stacks.js';
8
8
  import { niceId, warn } from '../../utils/display/colors.js';
@@ -15,7 +15,7 @@ export async function blueprintConfigCore(options) {
15
15
  if (!configStackId && !configProjectId) {
16
16
  log(warn('Missing local configuration.'));
17
17
  if (!editConfig) {
18
- // blueprint.json exists but no config.json
18
+ // blueprint.json exists but no config JSON
19
19
  log(`Use \`${bin} blueprints config --edit\` to set a configuration.`);
20
20
  return { success: true }; // not necessarily fatal
21
21
  }
@@ -63,8 +63,11 @@ export async function blueprintConfigCore(options) {
63
63
  error: 'Project ID is required.',
64
64
  };
65
65
  }
66
- // LAUNCH LIMIT: 1 Stack per Project - configStackId is always inferred from projectId if not set in config.json
67
- let updatedStackId = flagStackId ?? configStackId; // ?? (await promptForStackId({projectId: newProjectId, knownStackId: configStackId}))
66
+ // LAUNCH LIMIT: 1 Stack per Project - configStackId is always inferred from projectId if not set in config JSON
67
+ let updatedStackId = flagStackId ?? // flag first
68
+ configStackId ?? // existing config second
69
+ `ST-${updatedProjectId}`; /*??*/ // LAUNCH LIMIT: 1 Stack per Project - project-based third
70
+ // (await promptForStackId({projectId: updatedProjectId, knownStackId: configStackId})) // prompt for stackId
68
71
  const isProjectBasedId = updatedStackId === `ST-${updatedProjectId}`;
69
72
  log(`\n${chalk.bold('New configuration:')}`);
70
73
  log(` Sanity Project: ${niceId(updatedProjectId)}`);
@@ -110,15 +113,18 @@ export async function blueprintConfigCore(options) {
110
113
  if (isProjectBasedId)
111
114
  updatedStackId = undefined;
112
115
  try {
113
- // update or create .blueprint/config.json
116
+ // update or create config JSON
114
117
  writeConfigFile({ projectId: updatedProjectId, stackId: updatedStackId });
115
118
  log('Configuration updated successfully.');
116
119
  return { success: true };
117
120
  }
118
121
  catch (error) {
119
- log('Unable to update config. These values should be set in .blueprint/config.json');
122
+ log(`Unable to update config. These values should be set in ${BLUEPRINT_DIR}/${BLUEPRINT_CONFIG_FILE}`);
120
123
  log(highlight(JSON.stringify({ metadata: { projectId: updatedProjectId, stackId: updatedStackId } }, null, 2)));
121
- return { success: false, error: 'Be sure to update your ./blueprint/config.json' };
124
+ return {
125
+ success: false,
126
+ error: `Be sure to update your ${BLUEPRINT_DIR}/${BLUEPRINT_CONFIG_FILE}`,
127
+ };
122
128
  }
123
129
  }
124
130
  // Default return (shouldn't reach here with proper flow control)
@@ -2,7 +2,7 @@ import { join } from 'node:path';
2
2
  import { cwd } from 'node:process';
3
3
  import chalk from 'chalk';
4
4
  import inquirer from 'inquirer';
5
- import { findBlueprintFile, writeBlueprintToDisk, writeConfigFile, } from '../../actions/blueprints/blueprint.js';
5
+ import { BLUEPRINT_CONFIG_FILE, BLUEPRINT_DIR, findBlueprintFile, writeBlueprintToDisk, writeConfigFile, } from '../../actions/blueprints/blueprint.js';
6
6
  import { getProject, listProjects } from '../../actions/blueprints/projects.js';
7
7
  import { createStack, getStack, listStacks } from '../../actions/blueprints/stacks.js';
8
8
  import { niceId } from '../../utils/display/colors.js';
@@ -57,7 +57,7 @@ export async function blueprintInitCore(options) {
57
57
  writeBlueprintToDisk({ blueprintFilePath: filePath });
58
58
  log(`Created new blueprint: ${dirProvided ?? '.'}/${fileName}`);
59
59
  writeConfigFile({ blueprintFilePath: filePath, projectId, stackId });
60
- log(`Created new config file: ${dirProvided ?? '.'}/.blueprint/config.json`);
60
+ log(`Created new config file: ${dirProvided ?? '.'}/${BLUEPRINT_DIR}/${BLUEPRINT_CONFIG_FILE}`);
61
61
  if (blueprintExtension === 'ts') {
62
62
  log('\nNote: TypeScript support requires "tsx" to be installed. Run: npm install -D tsx');
63
63
  }
@@ -782,5 +782,5 @@
782
782
  ]
783
783
  }
784
784
  },
785
- "version": "5.2.0"
785
+ "version": "6.0.0"
786
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.2.0",
4
+ "version": "6.0.0",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",