crt-ship 0.1.0: CLI, Claude Code skills and templates for shipping mobile games to Google Play and the App Store
This commit is contained in:
commit
ecb3dc3dc3
64 changed files with 4509 additions and 0 deletions
26
cli/apple/bundle.ts
Normal file
26
cli/apple/bundle.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Register the bundle id (Certificates, Identifiers & Profiles) through the API. Idempotent.
|
||||
// crt-ship apple bundle [--name "My Game"] [--dry]
|
||||
// The App Store Connect app record itself can NOT be created through the API: do that in the web UI afterwards
|
||||
// (Apps > + > New App, pick this bundle id), see the appstore-first-release skill.
|
||||
import type { Ctx } from '../lib/ctx';
|
||||
import { need } from '../lib/ctx';
|
||||
import { done, log } from '../lib/log';
|
||||
import { ascClient } from './asc';
|
||||
|
||||
export async function run(ctx: Ctx): Promise<void> {
|
||||
const { config, root } = ctx.loaded;
|
||||
const bundleId = need(config.apple?.bundleId, 'apple.bundleId');
|
||||
const c = await ascClient(root, bundleId, config.apple?.appId);
|
||||
const found = (await c.asc('GET', `/v1/bundleIds?filter[identifier]=${encodeURIComponent(bundleId)}`)).data
|
||||
.filter((b: { attributes: { identifier: string } }) => b.attributes.identifier === bundleId);
|
||||
if (found.length) { log('apple', `bundle id ${bundleId} already registered (${found[0].attributes.platform})`); }
|
||||
else if (ctx.args.has('dry')) { log('apple', `bundle id ${bundleId} missing (dry run, not registering)`); return; }
|
||||
else {
|
||||
await c.asc('POST', '/v1/bundleIds', { data: { type: 'bundleIds', attributes: { identifier: bundleId, name: ctx.args.str('name', config.app.name).replace(/[^A-Za-z0-9 ]/g, ' ').trim(), platform: 'IOS' } } });
|
||||
log('apple', `bundle id ${bundleId} registered`);
|
||||
}
|
||||
const apps = (await c.asc('GET', `/v1/apps?filter[bundleId]=${encodeURIComponent(bundleId)}`)).data;
|
||||
if (apps.length) log('apple', `app record: ${apps[0].attributes.name} (Apple ID ${apps[0].id}); put it in apple.appId`);
|
||||
else log('apple', 'no app record yet: App Store Connect > Apps > + > New App (UI only), then re-run `apple status`');
|
||||
done('apple', 'bundle done');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue