#!/usr/bin/env bun // crt-ship: ship a mobile game to Google Play and the App Store from the terminal. // Run `crt-ship help` for the command list. Config: crt-ship.config.ts; credentials: env or .crt-ship/. import { parseArgs } from './lib/args'; import { loadConfig } from './lib/config'; import type { Ctx } from './lib/ctx'; type Mod = { run(ctx: Ctx): Promise }; const COMMANDS: Record Promise, string]> = { 'check': [() => import('./check'), 'validate config, copy files, data safety answers and products (offline)'], 'play products': [() => import('./play/products'), 'one-time products: create / update, regional prices, activate'], 'play listing': [() => import('./play/listing'), 'app details + title / short / full description per language'], 'play images': [() => import('./play/images'), 'icon, feature graphic, phone / 7" / 10" screenshots per language'], 'play data-safety': [() => import('./play/data-safety'), 'Data safety form (CSV import through the API)'], 'play release': [() => import('./play/release'), 'upload an AAB and put it on tracks with release notes'], 'play status': [() => import('./play/status'), 'tracks, listings, products (read-only)'], 'apple bundle': [() => import('./apple/bundle'), 'register the bundle id; finds the app record'], 'apple iap': [() => import('./apple/iap'), 'in-app purchases, localizations, price schedules, availability'], 'apple iap-review': [() => import('./apple/iap-review'), 'IAP review screenshots + product states'], 'apple listing': [() => import('./apple/listing'), 'version, build, name / subtitle / description / keywords per locale'], 'apple screenshots': [() => import('./apple/screenshots'), '6.9" + 6.5" screenshots per locale'], 'apple appinfo': [() => import('./apple/appinfo'), 'categories, age rating, content rights, Free price, territories'], 'apple review-details': [() => import('./apple/review-details'), 'App Review contact + notes'], 'apple status': [() => import('./apple/status'), 'versions, builds, IAPs, review submissions (--cancel-submission )'], 'icons': [() => import('./icons'), 'App Store / Play / web / adaptive / legacy launcher icons from one artwork'], 'shots capture': [() => import('./shots/capture'), 'raw frames from a running build of your game (playwright)'], 'shots fonts': [() => import('./shots/fonts'), 'download font subsets for the copy (CJK / Arabic / Cyrillic ...)'], 'shots render': [() => import('./shots/render'), 'store screenshots + feature graphic in every size and language'], 'shots jpeg': [() => import('./shots/jpeg'), 'JPEG q92 copies of the Play renders (4x faster uploads)'], }; function help(): void { console.log(`crt-ship ยท ship mobile games to Google Play and the App Store usage: crt-ship [options] init copy the templates (config, listing, copy, privacy policy) into this project ${Object.entries(COMMANDS).map(([k, [, d]]) => ` ${k.padEnd(25)} ${d}`).join('\n')} common options: --config --dry (no writes) --only --yes (skip confirmations) credentials: PLAY_SERVICE_ACCOUNT, ASC_KEY_ID, ASC_ISSUER_ID, ASC_P8 (env or .crt-ship/credentials.json) docs: README.md and the skills/ folder of the toolchain`); } async function main(): Promise { const argv = process.argv.slice(2); const [a, b] = argv; if (!a || a === 'help' || a === '--help' || a === '-h') return help(); if (a === 'init') return (await import('./init')).run(parseArgs(argv.slice(1))); const key = COMMANDS[`${a} ${b}`] ? `${a} ${b}` : COMMANDS[a] ? a : ''; if (!key) { console.error(`unknown command: ${argv.slice(0, 2).join(' ')}\n`); help(); process.exit(2); } const args = parseArgs(argv.slice(key.split(' ').length)); const loaded = await loadConfig(args.get('config')); await (await COMMANDS[key]![0]()).run({ loaded, args }); } main().catch(e => { console.error(`\nerror: ${(e as Error).message}`); process.exit(1); });