Skip to content

@salesforce/b2c-tooling-sdk / operations/mrt / pushBundle

Function: pushBundle()

pushBundle(options, auth): Promise<PushResult>

Defined in: packages/b2c-tooling-sdk/src/operations/mrt/push.ts:101

Pushes a bundle to a Managed Runtime project.

This function creates a bundle from the build directory and uploads it to the specified MRT project. Optionally, it can also deploy the bundle to a target environment.

Parameters

options

PushOptions

Push configuration options

auth

AuthStrategy

Authentication strategy (ApiKeyStrategy)

Returns

Promise<PushResult>

Result of the push operation

Throws

Error if push fails

Example

typescript
import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
import { pushBundle } from '@salesforce/b2c-tooling-sdk/operations/mrt';

const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');

const result = await pushBundle({
  projectSlug: 'my-storefront',
  ssrOnly: ['ssr.js'],
  ssrShared: ['**/*.js', 'static/**/*'],
  buildDirectory: './build',
  message: 'Release v1.0.0',
  target: 'staging'  // Optional: deploy after push
}, auth);

console.log(`Bundle ${result.bundleId} pushed to ${result.projectSlug}`);
if (result.deployed) {
  console.log(`Deployed to ${result.target}`);
}

All rights reserved.