# Configure post-install settings for a package

> Status: Beta

> Run a Function after a package installs and choose the Custom App that opens, using the Rippling CLI.

A package can run a Function when someone installs it, and it can open a Custom App afterward. Add a setup Function to the equipment request package from [Package and publish Metadata components](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/package-and-publish), then choose the Custom App that opens after the package installs.

* * *

## Requirements

-   Complete [Package and publish Metadata components](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/package-and-publish), or have a Rippling project with a published package version.
-   Open the project that you packaged, with its dependencies installed.
-   Use a [CLI context](https://developer.rippling.com/documentation/rippling-platform/rippling-cli/accounts-and-contexts) for your Developer account that has `packages.read-write` access. The commands below use `developer-account` as the context name. Replace it with yours.

* * *

## Run a Function after the package installs

Add the Function to your project:

```bash
rippling project add function --name setup-equipment-requests
```

The CLI creates `functions/setup-equipment-requests.ts`, which exports `SetupEquipmentRequests`, and adds it to the manifest, `rippling.manifest.ts`. The CLI also creates `functions/setup-equipment-requests.handler.ts`, where your setup logic goes. The starter handler returns a message, so you can try the flow before you add logic. The Function runs with the permissions of the person who installs the package. Installing an unmanaged package again can run it again, so write it to be safe to repeat.

Next, import the Function in `package.manifest.ts` and pass it as `postInstallFunction`. Leave `version` as the CLI saved it, because `--bump` updates it. Your number can differ from the one shown here.

package.manifest.ts

```ts
import { definePackageManifest } from '@rippling/rippling-sdk';
import manifest from './rippling.manifest';
import { SetupEquipmentRequests } from './functions/setup-equipment-requests';

export default definePackageManifest({
  package: {
    "key": "equipment_requests_demo",
    "name": "Equipment Requests Demo",
    "type": "unmanaged",
    "description": "A package of custom Rippling components."
  },
  version: "0.1.0",
  manifest,
  postInstallFunction: SetupEquipmentRequests,
});
```

Create and publish the next version. The CLI includes the Function in the version and sets it as the post-install Function:

```bash
rippling --context developer-account project package . --bump --force-publish --json
```

To try it, install the new version in a sandbox that doesn't have the package yet, as in [Install the package in a second sandbox](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/package-and-publish#install-the-package-in-a-second-sandbox). If the Function fails, the installation status is `COMPLETE_WITH_WARNINGS` and the installed components stay in place.

* * *

## Choose the Custom App that opens after the package installs

By default, installing the package opens the first Custom App in it, if there is one. To choose a different one, add a Custom App to your project:

```bash
rippling project add custom-app --name equipment-requests
```

The CLI creates `custom-apps/equipment-requests.ts`, which exports `EquipmentRequests`. Import it in `package.manifest.ts` and pass it as `postInstallLandingComponent`:

package.manifest.ts

```ts
import { definePackageManifest } from '@rippling/rippling-sdk';
import manifest from './rippling.manifest';
import { SetupEquipmentRequests } from './functions/setup-equipment-requests';
import { EquipmentRequests } from './custom-apps/equipment-requests';

export default definePackageManifest({
  package: {
    "key": "equipment_requests_demo",
    "name": "Equipment Requests Demo",
    "type": "unmanaged",
    "description": "A package of custom Rippling components."
  },
  version: "0.1.1",
  manifest,
  postInstallFunction: SetupEquipmentRequests,
  postInstallLandingComponent: EquipmentRequests,
});
```

Then create and publish a new version:

```bash
rippling --context developer-account project package . --bump --force-publish --json
```

* * *

## Fix post-install settings on a draft

If a post-install setting is invalid, the CLI creates the version but stops before it publishes it. To correct the settings on that draft without creating another version:

1.  In `package.manifest.ts`, set `version` to the draft's version.
2.  Update `postInstallFunction` or `postInstallLandingComponent`.
3.  Run:

```bash
rippling --context developer-account project package . --settings-only
```

A setting that you omit stays unchanged. Set a setting to `null` to clear the post-install Function, or to reset the Custom App that opens to the default.

This command updates the settings on a draft and leaves the draft's components as they are. To add a Function or Custom App, or to change a published version, create a new version.

* * *

## See also

-   [Get started with Metadata](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/get-started)
-   [Package and publish Metadata components](https://developer.rippling.com/documentation/js-sdk/metadata-sdk/package-and-publish)
-   [CLI package commands](https://developer.rippling.com/documentation/rippling-platform/rippling-cli/packages)

Source: https://developer.rippling.com/documentation/js-sdk/metadata-sdk/post-install

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
