18 lines
961 B
TypeScript
18 lines
961 B
TypeScript
// Read-only: the production releases waiting in Publishing overview (managed publishing), from the tracks and the public store page.
|
|
import type { ShipConfig } from '../lib/config';
|
|
import { need } from '../lib/ctx';
|
|
import { type ReadyChange, readyToPublish } from '../lib/play-publish';
|
|
import { playPublicPage } from '../lib/play-public';
|
|
import { playClient } from './client';
|
|
|
|
export async function readyFromApi(root: string, config: ShipConfig): Promise<ReadyChange[]> {
|
|
const pkg = need(config.play?.packageName, 'play.packageName');
|
|
const play = await playClient(root, pkg);
|
|
let out: ReadyChange[] = [];
|
|
await play.read(async id => {
|
|
const tracks = (await play.call<{ tracks?: unknown[] }>('GET', `${play.API}/edits/${id}/tracks`)).tracks ?? [];
|
|
const publicPage = await playPublicPage(play.packageName);
|
|
out = readyToPublish({ tracks, publicPage, managedPublishing: config.play?.managedPublishing ?? null });
|
|
});
|
|
return out;
|
|
}
|