Skip to content

Commit

Permalink
manifest target (#251)
Browse files Browse the repository at this point in the history
* manifest target

* fix tests
  • Loading branch information
taranvohra authored Oct 3, 2023
1 parent 83d8b9f commit 5f9c5c9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/five-planets-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@gitbook/cli': minor
'@gitbook/api': minor
---

- Bump API client to use the latest spec
- Update CLI to use the latest manifest with target support
1 change: 1 addition & 0 deletions packages/cli/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface IntegrationManifest {
icon?: string;
description?: string;
summary?: string;
target?: api.IntegrationTarget;
scopes?: api.IntegrationScope[];
categories?: api.IntegrationCategory[];
blocks?: api.IntegrationBlock[];
Expand Down
9 changes: 9 additions & 0 deletions packages/cli/src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { buildScriptFromManifest } from './build';
import { resolveFile } from './manifest';
import { getAPIClient } from './remote';

const targetAll = api.IntegrationTarget.All;

/**
* Publish the integration to GitBook.
* If it already exists, it'll update it.
Expand All @@ -22,6 +24,12 @@ export async function publishIntegration(

const api = await getAPIClient(true);

if (typeof manifest.target === 'string' && manifest.target !== targetAll) {
console.log(
`ℹ️ Publishing integration with "${manifest.target}" as target for installations. Keep in mind this cannot be changed later.`
);
}

// Publish the integration.
const created = await api.integrations.publishIntegration(manifest.name, {
title: manifest.title,
Expand All @@ -36,6 +44,7 @@ export async function publishIntegration(
configurations: manifest.configurations,
secrets: manifest.secrets,
visibility: manifest.visibility,
target: manifest.target,
organization: manifest.organization,
externalLinks: manifest.externalLinks,
entities: manifest.entities,
Expand Down

0 comments on commit 5f9c5c9

Please sign in to comment.