@sanity/runtime-cli 17.13.1-next.g2772647 → 17.13.1-next.g5faa770

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
@@ -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.13.1-next.g2772647/src/commands/blueprints/add.ts)_
93
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/config.ts)_
130
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/deploy.ts)_
186
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/destroy.ts)_
224
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/doctor.ts)_
256
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/info.ts)_
294
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/init.ts)_
358
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/logs.ts)_
404
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/mint-deploy-token.ts)_
449
+ _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/plan.ts)_
482
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/promote.ts)_
518
+ _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/blueprints/stacks.ts)_
559
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/functions/add.ts)_
611
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/functions/dev.ts)_
646
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/functions/env/add.ts)_
679
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/functions/env/list.ts)_
709
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/functions/env/remove.ts)_
741
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/functions/logs.ts)_
781
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/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.13.1-next.g2772647/src/commands/functions/test.ts)_
839
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.13.1-next.g5faa770/src/commands/functions/test.ts)_
840
840
 
841
841
  ## `sanity-run help [COMMAND]`
842
842
 
@@ -1,6 +1,6 @@
1
1
  import { SANITY_FUNCTION_PREFIX } from '../../constants.js';
2
- import { APP_BUILD_SPECS, prepareApplicationAsset, } from '../../utils/applications/prepare-asset.js';
3
2
  import { resolveDeployedResources } from '../../utils/blueprints/resolve-deployed-resources.js';
3
+ import { BUNDLE_SPECS, prepareBundleAsset, } from '../../utils/bundles/prepare-asset.js';
4
4
  import { CODE_OPERATION_UNCONFIRMED, EXIT_OPERATION_UNCONFIRMED } from '../../utils/exit-codes.js';
5
5
  import { prepareAsset as prepareFunctionAsset } from '../../utils/functions/prepare-asset.js';
6
6
  import { runCommand } from '../../utils/package-manager.js';
@@ -13,9 +13,9 @@ import { updateStack } from './stacks.js';
13
13
  */
14
14
  const preDeployConfigs = [
15
15
  {
16
- resourceType: (type) => type in APP_BUILD_SPECS,
16
+ resourceType: (type) => type in BUNDLE_SPECS,
17
17
  async prepareAsset(options) {
18
- return prepareApplicationAsset({
18
+ return prepareBundleAsset({
19
19
  resource: options.resource,
20
20
  blueprintFileDir: options.blueprintFileDir,
21
21
  });
@@ -14,6 +14,7 @@ export declare const SANITY_PROJECT_DATASET = "sanity.project.dataset";
14
14
  export declare const SANITY_PROJECT_WEBHOOK = "sanity.project.webhook";
15
15
  export declare const SANITY_STUDIO = "sanity.studio";
16
16
  export declare const SANITY_APPLICATION = "sanity.application";
17
+ export declare const SANITY_INSTALLATION_CONFIG = "sanity.installation.config";
17
18
  export declare const EVENT_DOCUMENT_PUBLISH = "document-publish";
18
19
  export declare const EVENT_DOCUMENT_CREATE = "document-create";
19
20
  export declare const EVENT_DOCUMENT_UPDATE = "document-update";
package/dist/constants.js CHANGED
@@ -13,6 +13,7 @@ export const SANITY_PROJECT_DATASET = 'sanity.project.dataset';
13
13
  export const SANITY_PROJECT_WEBHOOK = 'sanity.project.webhook';
14
14
  export const SANITY_STUDIO = 'sanity.studio';
15
15
  export const SANITY_APPLICATION = 'sanity.application';
16
+ export const SANITY_INSTALLATION_CONFIG = 'sanity.installation.config';
16
17
  export const EVENT_DOCUMENT_PUBLISH = 'document-publish';
17
18
  export const EVENT_DOCUMENT_CREATE = 'document-create';
18
19
  export const EVENT_DOCUMENT_UPDATE = 'document-update';
@@ -6,6 +6,7 @@ import { checkUserPermission } from '../../actions/sanity/access.js';
6
6
  import { getClientMetadata } from '../../utils/blueprints/deploy-metadata.js';
7
7
  import { extractDurableConfig } from '../../utils/blueprints/extract-durable-config.js';
8
8
  import { createHintCollector } from '../../utils/blueprints/hints.js';
9
+ import { stampInstallationConfigVersion } from '../../utils/blueprints/stamp-installation-config-version.js';
9
10
  import { createWaitFor } from '../../utils/blueprints/wait-for.js';
10
11
  import { formatStudioUrls } from '../../utils/display/blueprints-formatting.js';
11
12
  import { check, niceId, severe } from '../../utils/display/presenters.js';
@@ -42,6 +43,7 @@ export async function blueprintDeployCore(options) {
42
43
  }
43
44
  const resources = [...blueprint.resources];
44
45
  await extractDurableConfig(resources, blueprintFileDir);
46
+ await stampInstallationConfigVersion(resources, blueprintFileDir);
45
47
  let spinner;
46
48
  const preDeployResult = await preDeploy({
47
49
  scopeType,
@@ -2,6 +2,7 @@ import { dirname } from 'node:path';
2
2
  import { planStack, resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
3
3
  import { extractDurableConfig } from '../../utils/blueprints/extract-durable-config.js';
4
4
  import { createHintCollector } from '../../utils/blueprints/hints.js';
5
+ import { stampInstallationConfigVersion } from '../../utils/blueprints/stamp-installation-config-version.js';
5
6
  import { formatDeploymentPlan, formatResourceTree, hasActionableChanges, } from '../../utils/display/blueprints-formatting.js';
6
7
  import { runCommand } from '../../utils/package-manager.js';
7
8
  import { styleText } from '../../utils/style-text.js';
@@ -12,6 +13,7 @@ export async function blueprintPlanCore(options) {
12
13
  const { scopeType, scopeId, stackId: blueprintStackId, parsedBlueprint, resources, fileInfo, } = blueprint;
13
14
  log(`${styleText(['bold', 'blueBright'], 'Local Blueprint')} ${styleText('dim', `(${fileInfo.fileName})`)}`);
14
15
  await extractDurableConfig(resources, dirname(fileInfo.blueprintFilePath));
16
+ await stampInstallationConfigVersion(resources, dirname(fileInfo.blueprintFilePath));
15
17
  log(formatResourceTree(resources));
16
18
  if (!token || !scopeType || !scopeId) {
17
19
  log(styleText('dim', 'Unable to retrieve live Stack deployment for comparison'));
@@ -0,0 +1,9 @@
1
+ import type { BlueprintResource } from '@sanity/blueprints';
2
+ /**
3
+ * Stamps the installed `sanity` version onto each media-library config resource
4
+ * before pre-deploy. The version is a label Brett stores on the config snapshot,
5
+ * mirroring what `sanity deploy` sends for a media-library config; it is not what
6
+ * the runtime loads. Other installation config types are left alone: the
7
+ * media-library tie to the `sanity` package is specific to it.
8
+ */
9
+ export declare const stampInstallationConfigVersion: (resources: BlueprintResource[], blueprintFileDir: string) => Promise<void>;
@@ -0,0 +1,28 @@
1
+ import { resolve } from 'node:path';
2
+ import { getLocalPackageVersion } from '@sanity/cli-core/package-manager';
3
+ import { SANITY_INSTALLATION_CONFIG } from '../../constants.js';
4
+ /**
5
+ * Stamps the installed `sanity` version onto each media-library config resource
6
+ * before pre-deploy. The version is a label Brett stores on the config snapshot,
7
+ * mirroring what `sanity deploy` sends for a media-library config; it is not what
8
+ * the runtime loads. Other installation config types are left alone: the
9
+ * media-library tie to the `sanity` package is specific to it.
10
+ */
11
+ export const stampInstallationConfigVersion = async (resources, blueprintFileDir) => {
12
+ for (const resource of resources) {
13
+ if (resource.type !== SANITY_INSTALLATION_CONFIG)
14
+ continue;
15
+ const config = resource;
16
+ if (config.appType !== 'media-library')
17
+ continue;
18
+ // Update values not included in the blueprint.
19
+ if (config.version !== undefined)
20
+ continue;
21
+ const workDir = resolve(blueprintFileDir, config.root);
22
+ const version = await getLocalPackageVersion('sanity', workDir);
23
+ if (!version) {
24
+ throw new Error(`Unable to determine the installed 'sanity' version for installation config resource '${config.name}'; is 'sanity' installed in '${config.root}'?`);
25
+ }
26
+ config.version = version;
27
+ }
28
+ };
@@ -1,11 +1,11 @@
1
1
  import { type BuildStudioEventListener } from '@sanity/cli-build/_internal/build';
2
2
  import type { Output } from '@sanity/cli-core';
3
3
  import type { AssetPrepResult } from '../types.js';
4
- import type { BlueprintApplicationResource, BlueprintStudioResource } from './types.js';
5
- export type ApplicationBuildResource = BlueprintStudioResource | BlueprintApplicationResource;
6
- type BuildContext<R extends ApplicationBuildResource> = {
4
+ import type { BlueprintApplicationResource, BlueprintInstallationConfigResource, BlueprintStudioResource } from './types.js';
5
+ export type BundleResource = BlueprintStudioResource | BlueprintApplicationResource | BlueprintInstallationConfigResource;
6
+ type BuildContext<R extends BundleResource> = {
7
7
  resource: R;
8
- appId: string;
8
+ appId: string | undefined;
9
9
  workDir: string;
10
10
  outDir: string;
11
11
  output: Output;
@@ -14,18 +14,25 @@ type BuildContext<R extends ApplicationBuildResource> = {
14
14
  type BuildResult = {
15
15
  mismatchedPackages?: string[];
16
16
  };
17
- export declare const APP_BUILD_SPECS: {
17
+ export declare const BUNDLE_SPECS: {
18
18
  'sanity.studio': {
19
+ requiresAppId: true;
19
20
  build: typeof buildStudioBundle;
20
21
  };
21
22
  'sanity.application': {
23
+ requiresAppId: true;
22
24
  build: typeof buildApplicationBundle;
23
25
  };
26
+ 'sanity.installation.config': {
27
+ requiresAppId: false;
28
+ build: typeof buildInstallationConfigBundle;
29
+ };
24
30
  };
25
- export declare function prepareApplicationAsset<R extends ApplicationBuildResource>({ blueprintFileDir, resource, }: {
31
+ export declare function prepareBundleAsset<R extends BundleResource>({ blueprintFileDir, resource, }: {
26
32
  blueprintFileDir: string;
27
33
  resource: R;
28
34
  }): Promise<AssetPrepResult>;
29
35
  declare function buildStudioBundle({ resource, appId, workDir, outDir, output, eventListener, }: BuildContext<BlueprintStudioResource>): Promise<BuildResult>;
30
36
  declare function buildApplicationBundle({ resource, appId, workDir, outDir, output, eventListener, }: BuildContext<BlueprintApplicationResource>): Promise<BuildResult>;
37
+ declare function buildInstallationConfigBundle({ resource, workDir, outDir, output, eventListener, }: BuildContext<BlueprintInstallationConfigResource>): Promise<BuildResult>;
31
38
  export {};
@@ -7,15 +7,16 @@ import { createGzip } from 'node:zlib';
7
7
  import { buildApp, buildStudio, compareDependencyVersions, } from '@sanity/cli-build/_internal/build';
8
8
  import { getLocalPackageVersion } from '@sanity/cli-core';
9
9
  import { pack } from 'tar-fs';
10
- export const APP_BUILD_SPECS = {
11
- 'sanity.studio': { build: buildStudioBundle },
12
- 'sanity.application': { build: buildApplicationBundle },
10
+ export const BUNDLE_SPECS = {
11
+ 'sanity.studio': { requiresAppId: true, build: buildStudioBundle },
12
+ 'sanity.application': { requiresAppId: true, build: buildApplicationBundle },
13
+ 'sanity.installation.config': { requiresAppId: false, build: buildInstallationConfigBundle },
13
14
  };
14
- export async function prepareApplicationAsset({ blueprintFileDir, resource, }) {
15
+ export async function prepareBundleAsset({ blueprintFileDir, resource, }) {
15
16
  // The lookup can't prove it yields the spec matching this R, so it's asserted once here.
16
- const spec = APP_BUILD_SPECS[resource.type];
17
+ const spec = BUNDLE_SPECS[resource.type];
17
18
  const appId = getAppId(resource);
18
- if (!appId) {
19
+ if (spec.requiresAppId && !appId) {
19
20
  return {
20
21
  success: false,
21
22
  async cleanup() { },
@@ -25,6 +26,15 @@ export async function prepareApplicationAsset({ blueprintFileDir, resource, }) {
25
26
  let cleanup = async () => { };
26
27
  const assetPath = String(resource.root);
27
28
  const workDir = path.resolve(blueprintFileDir, assetPath);
29
+ // Defence in depth alongside blueprints-node's own check: an absolute path or one
30
+ // that climbs above the blueprint dir would bundle files outside the project.
31
+ if (path.isAbsolute(assetPath) || path.relative(blueprintFileDir, workDir).startsWith('..')) {
32
+ return {
33
+ success: false,
34
+ cleanup,
35
+ error: `Property 'root' on resource with type '${resource.type}' must be under the blueprint directory`,
36
+ };
37
+ }
28
38
  try {
29
39
  const workDirStat = await stat(workDir);
30
40
  if (!workDirStat.isDirectory()) {
@@ -44,7 +54,7 @@ export async function prepareApplicationAsset({ blueprintFileDir, resource, }) {
44
54
  };
45
55
  }
46
56
  try {
47
- const outDir = await mkdtemp(join(tmpdir(), `app-build-`));
57
+ const outDir = await mkdtemp(join(tmpdir(), `bundle-`));
48
58
  const outFile = `${outDir}.tar.gz`;
49
59
  cleanup = async () => {
50
60
  await rm(outDir, { force: true, recursive: true });
@@ -132,24 +142,45 @@ async function buildApplicationBundle({ resource, appId, workDir, outDir, output
132
142
  if (extraWindow) {
133
143
  throw new Error(`Application resource '${resource.name}' declares more than one window view; at most one is allowed`);
134
144
  }
135
- let mismatchedPackages;
136
145
  await buildApp({
146
+ ...sharedBuildAppOptions({ appId, workDir, outDir, output, eventListener }),
137
147
  appId,
138
148
  appTitle: resource.title,
149
+ entry: window?.src,
150
+ workbenchAppId: appId,
151
+ exposes: {
152
+ views: views.map(toWorkbenchView),
153
+ webWorkers: resource.webWorkers,
154
+ },
155
+ });
156
+ // a workbench app never auto-updates, so no dependency mismatches are compared
157
+ return {};
158
+ }
159
+ async function buildInstallationConfigBundle({ resource, workDir, outDir, output, eventListener, }) {
160
+ await buildApp({
161
+ ...sharedBuildAppOptions({ appId: undefined, workDir, outDir, output, eventListener }),
162
+ appId: undefined,
163
+ appTitle: undefined,
164
+ entry: undefined,
165
+ workbenchAppId: undefined,
166
+ exposes: { config: { appType: resource.appType, fields: resource.fields } },
167
+ });
168
+ return {};
169
+ }
170
+ // Options a workbench build (application or installation config) always sets the
171
+ // same way; each caller adds only what differs (identity, entry, exposes).
172
+ function sharedBuildAppOptions({ appId, workDir, outDir, output, eventListener, }) {
173
+ return {
139
174
  autoUpdatesEnabled: false,
140
175
  checkAppId() { },
141
176
  async compareDependencyVersions(packages) {
142
- const result = await compareDependencyVersions(packages, workDir, { appId });
143
- mismatchedPackages = result.mismatched.map((m) => m.pkg);
144
- return result;
177
+ return compareDependencyVersions(packages, workDir, { appId });
145
178
  },
146
179
  determineBasePath() {
147
180
  return '/';
148
181
  },
149
- entry: window?.src,
150
182
  isWorkbenchApp: true,
151
183
  isBlueprints: true,
152
- workbenchAppId: appId,
153
184
  minify: true,
154
185
  outDir,
155
186
  output,
@@ -161,12 +192,7 @@ async function buildApplicationBundle({ resource, appId, workDir, outDir, output
161
192
  vite: undefined,
162
193
  workDir,
163
194
  eventListener,
164
- exposes: {
165
- views: views.map(toWorkbenchView),
166
- webWorkers: resource.webWorkers,
167
- },
168
- });
169
- return { mismatchedPackages };
195
+ };
170
196
  }
171
197
  // blueprints-node emits `type` (window views as `app`); workbench-cli discriminates on `surface`.
172
198
  function toWorkbenchView(view) {
@@ -43,4 +43,19 @@ export interface BlueprintApplicationResource extends BlueprintResource<Blueprin
43
43
  views?: ApplicationView[];
44
44
  webWorkers?: WebWorker[];
45
45
  }
46
+ type InstallationConfigField = {
47
+ name: string;
48
+ title: string;
49
+ src: string;
50
+ public?: boolean;
51
+ };
52
+ export interface BlueprintInstallationConfigResource extends BlueprintResource {
53
+ type: 'sanity.installation.config';
54
+ appType: 'media-library';
55
+ /** Build directory, relative to the blueprint file; contains package.json. Field `src` resolves against it. */
56
+ root: string;
57
+ fields: InstallationConfigField[];
58
+ /** Stamped by the CLI before pre-deploy; the authored shape from blueprints-node has none. */
59
+ version?: string;
60
+ }
46
61
  export {};
@@ -1,6 +1,6 @@
1
1
  import { formatDateTime, formatElapsed } from '@sanity/cli-core/dates';
2
2
  import { treeify } from 'array-treeify';
3
- import { SANITY_ACCESS_ROBOT, SANITY_ACCESS_ROLE, SANITY_APPLICATION, SANITY_FUNCTION_DOCUMENT, SANITY_FUNCTION_DURABLE, SANITY_FUNCTION_MEDIA_LIBRARY_ASSET, SANITY_FUNCTION_PUBSUB, SANITY_FUNCTION_SCHEDULED, SANITY_FUNCTION_SYNC_TAG_INVALIDATE, SANITY_PROJECT, SANITY_PROJECT_CORS, SANITY_PROJECT_DATASET, SANITY_PROJECT_WEBHOOK, SANITY_STUDIO, } from '../../constants.js';
3
+ import { SANITY_ACCESS_ROBOT, SANITY_ACCESS_ROLE, SANITY_APPLICATION, SANITY_FUNCTION_DOCUMENT, SANITY_FUNCTION_DURABLE, SANITY_FUNCTION_MEDIA_LIBRARY_ASSET, SANITY_FUNCTION_PUBSUB, SANITY_FUNCTION_SCHEDULED, SANITY_FUNCTION_SYNC_TAG_INVALIDATE, SANITY_INSTALLATION_CONFIG, SANITY_PROJECT, SANITY_PROJECT_CORS, SANITY_PROJECT_DATASET, SANITY_PROJECT_WEBHOOK, SANITY_STUDIO, } from '../../constants.js';
4
4
  import { styleText } from '../style-text.js';
5
5
  import { isCorsOriginResource, isDatasetResource, isRobotResource, isRoleResource, isStudioResource, isWebhookResource, } from '../types.js';
6
6
  import { capitalize, niceId, renderSection } from './presenters.js';
@@ -69,6 +69,10 @@ const RESOURCE_CATEGORIES = {
69
69
  label: 'Applications',
70
70
  displayNameAttribute: 'title',
71
71
  },
72
+ [SANITY_INSTALLATION_CONFIG]: {
73
+ label: 'Installation configs',
74
+ displayNameAttribute: 'name',
75
+ },
72
76
  };
73
77
  const categoryByLabel = Object.values(RESOURCE_CATEGORIES).reduce((acc, curr) => {
74
78
  acc[curr.label] = curr;
@@ -3148,5 +3148,5 @@
3148
3148
  ]
3149
3149
  }
3150
3150
  },
3151
- "version": "17.13.1-next.g2772647"
3151
+ "version": "17.13.1-next.g5faa770"
3152
3152
  }
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": "17.13.1-next.g2772647",
4
+ "version": "17.13.1-next.g5faa770",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
File without changes