@sanity/runtime-cli 10.0.0 → 10.0.2

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/10.0.0 linux-x64 node-v22.17.0
23
+ @sanity/runtime-cli/10.0.2 linux-x64 node-v22.17.1
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -86,7 +86,7 @@ EXAMPLES
86
86
  $ sanity-run blueprints add function --name my-function --fn-type document-publish --lang js
87
87
  ```
88
88
 
89
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/add.ts)_
89
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/add.ts)_
90
90
 
91
91
  ## `sanity-run blueprints config`
92
92
 
@@ -117,7 +117,7 @@ EXAMPLES
117
117
  $ sanity-run blueprints config --edit --project-id <projectId> --stack-id <stackId>
118
118
  ```
119
119
 
120
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/config.ts)_
120
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/config.ts)_
121
121
 
122
122
  ## `sanity-run blueprints deploy`
123
123
 
@@ -139,7 +139,7 @@ EXAMPLES
139
139
  $ sanity-run blueprints deploy --no-wait
140
140
  ```
141
141
 
142
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/deploy.ts)_
142
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/deploy.ts)_
143
143
 
144
144
  ## `sanity-run blueprints destroy`
145
145
 
@@ -164,7 +164,7 @@ EXAMPLES
164
164
  $ sanity-run blueprints destroy --stack-id <stackId> --project-id <projectId> --force --no-wait
165
165
  ```
166
166
 
167
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/destroy.ts)_
167
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/destroy.ts)_
168
168
 
169
169
  ## `sanity-run blueprints info`
170
170
 
@@ -186,7 +186,7 @@ EXAMPLES
186
186
  $ sanity-run blueprints info --stack-id <stackId>
187
187
  ```
188
188
 
189
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/info.ts)_
189
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/info.ts)_
190
190
 
191
191
  ## `sanity-run blueprints init [DIR]`
192
192
 
@@ -224,7 +224,7 @@ EXAMPLES
224
224
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
225
225
  ```
226
226
 
227
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/init.ts)_
227
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/init.ts)_
228
228
 
229
229
  ## `sanity-run blueprints logs`
230
230
 
@@ -246,7 +246,7 @@ EXAMPLES
246
246
  $ sanity-run blueprints logs --watch
247
247
  ```
248
248
 
249
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/logs.ts)_
249
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/logs.ts)_
250
250
 
251
251
  ## `sanity-run blueprints plan`
252
252
 
@@ -263,7 +263,7 @@ EXAMPLES
263
263
  $ sanity-run blueprints plan
264
264
  ```
265
265
 
266
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/plan.ts)_
266
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/plan.ts)_
267
267
 
268
268
  ## `sanity-run blueprints stacks`
269
269
 
@@ -285,7 +285,7 @@ EXAMPLES
285
285
  $ sanity-run blueprints stacks --project-id <projectId>
286
286
  ```
287
287
 
288
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/blueprints/stacks.ts)_
288
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/blueprints/stacks.ts)_
289
289
 
290
290
  ## `sanity-run functions dev`
291
291
 
@@ -305,7 +305,7 @@ EXAMPLES
305
305
  $ sanity-run functions dev --port 8974
306
306
  ```
307
307
 
308
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/functions/dev.ts)_
308
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/functions/dev.ts)_
309
309
 
310
310
  ## `sanity-run functions env add NAME KEY VALUE`
311
311
 
@@ -327,7 +327,7 @@ EXAMPLES
327
327
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
328
328
  ```
329
329
 
330
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/functions/env/add.ts)_
330
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/functions/env/add.ts)_
331
331
 
332
332
  ## `sanity-run functions env list NAME`
333
333
 
@@ -347,7 +347,7 @@ EXAMPLES
347
347
  $ sanity-run functions env list MyFunction
348
348
  ```
349
349
 
350
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/functions/env/list.ts)_
350
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/functions/env/list.ts)_
351
351
 
352
352
  ## `sanity-run functions env remove NAME KEY`
353
353
 
@@ -368,7 +368,7 @@ EXAMPLES
368
368
  $ sanity-run functions env remove MyFunction API_URL
369
369
  ```
370
370
 
371
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/functions/env/remove.ts)_
371
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/functions/env/remove.ts)_
372
372
 
373
373
  ## `sanity-run functions logs NAME`
374
374
 
@@ -402,7 +402,7 @@ EXAMPLES
402
402
  $ sanity-run functions logs <name> --delete
403
403
  ```
404
404
 
405
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/functions/logs.ts)_
405
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/functions/logs.ts)_
406
406
 
407
407
  ## `sanity-run functions test NAME`
408
408
 
@@ -437,7 +437,7 @@ EXAMPLES
437
437
  $ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
438
438
  ```
439
439
 
440
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.0/src/commands/functions/test.ts)_
440
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v10.0.2/src/commands/functions/test.ts)_
441
441
 
442
442
  ## `sanity-run help [COMMAND]`
443
443
 
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { cwd } from 'node:process';
4
4
  import AdmZip from 'adm-zip';
5
+ import getFolderSize from 'get-folder-size';
5
6
  import config from '../../config.js';
6
7
  import { resolveResourceDependencies } from '../../utils/functions/resolve-dependencies.js';
7
8
  import { shouldAutoResolveDependencies } from '../../utils/functions/should-auto-resolve-deps.js';
@@ -10,6 +11,7 @@ import getHeaders from '../../utils/get-headers.js';
10
11
  import { transpileFunction } from '../../utils/transpile/transpile-function.js';
11
12
  const { apiUrl } = config;
12
13
  export const stashUrl = `${apiUrl}vX/blueprints/assets/stash`;
14
+ const MAX_ASSET_SIZE = 209_715_200; // 200 MB in bytes
13
15
  export async function stashAsset({ resource, auth, }) {
14
16
  if (!resource.src)
15
17
  throw new Error('Resource src is required');
@@ -32,6 +34,11 @@ export async function stashAsset({ resource, auth, }) {
32
34
  }
33
35
  try {
34
36
  const stats = await fs.promises.stat(functionPath);
37
+ // This works for files and folders
38
+ const size = await getFolderSize.loose(functionPath);
39
+ if (size > MAX_ASSET_SIZE) {
40
+ throw new Error('Resource is larger than max asset size of 200 MB.');
41
+ }
35
42
  const zip = new AdmZip();
36
43
  if (stats.isDirectory()) {
37
44
  zip.addLocalFolder(functionPath);
@@ -78,7 +78,6 @@ export async function blueprintDestroyCore(options) {
78
78
  destroySpinner.stop().clear();
79
79
  if (noWait) {
80
80
  log(chalk.bold.magenta('Destruction started!'));
81
- log(`Use \`${bin} blueprints info\` to check status`);
82
81
  return { success: true };
83
82
  }
84
83
  log(chalk.dim('Destruction progress:'));
@@ -901,5 +901,5 @@
901
901
  ]
902
902
  }
903
903
  },
904
- "version": "10.0.0"
904
+ "version": "10.0.2"
905
905
  }
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": "10.0.0",
4
+ "version": "10.0.2",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -86,6 +86,7 @@
86
86
  "chalk": "^5.4.1",
87
87
  "eventsource": "^4.0.0",
88
88
  "find-up": "^7.0.0",
89
+ "get-folder-size": "^5.0.0",
89
90
  "groq-js": "^1.16.1",
90
91
  "inquirer": "^12.6.1",
91
92
  "jiti": "^2.4.2",