play-publish-changes: a release is ready only when the store page shows an older version; unknown reads are not determined, never a mismatch
This commit is contained in:
parent
4e2ffd6b3d
commit
26f9559e1a
6 changed files with 40 additions and 15 deletions
|
|
@ -1,18 +1,20 @@
|
|||
// 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 { type ReadyChange, readyToPublish, readyUndetermined } from '../lib/play-publish';
|
||||
import { playPublicPage } from '../lib/play-public';
|
||||
import { playClient } from './client';
|
||||
|
||||
export async function readyFromApi(root: string, config: ShipConfig): Promise<ReadyChange[]> {
|
||||
export async function readyFromApi(root: string, config: ShipConfig): Promise<ReadyChange[] & { undetermined?: boolean }> {
|
||||
const pkg = need(config.play?.packageName, 'play.packageName');
|
||||
const play = await playClient(root, pkg);
|
||||
let out: ReadyChange[] = [];
|
||||
let out: ReadyChange[] & { undetermined?: boolean } = [];
|
||||
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 });
|
||||
const data = { tracks, publicPage, managedPublishing: config.play?.managedPublishing ?? null };
|
||||
out = readyToPublish(data);
|
||||
out.undetermined = !out.length && readyUndetermined(data);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue