Rename to storebound (plugin, CLI, config file, credentials folder, repo)
This commit is contained in:
parent
ecb3dc3dc3
commit
0ca1d464e4
52 changed files with 171 additions and 171 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Per-project config (crt-ship.config.ts at the project root). Everything game-specific lives here; credentials never
|
||||
// Per-project config (storebound.config.ts at the project root). Everything game-specific lives here; credentials never
|
||||
// do (see credentials.ts). The file default-exports a plain object; `import type { ShipConfig }` is optional.
|
||||
import { existsSync } from 'node:fs';
|
||||
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
||||
|
|
@ -227,9 +227,9 @@ export function validateConfig(c: unknown): string[] {
|
|||
|
||||
export interface Loaded { config: ShipConfig; root: string; path: string; resolve(p: string): string }
|
||||
|
||||
const NAMES = ['crt-ship.config.ts', 'crt-ship.config.js', 'crt-ship.config.json'];
|
||||
const NAMES = ['storebound.config.ts', 'storebound.config.js', 'storebound.config.json'];
|
||||
|
||||
/** Finds crt-ship.config.* from `start` upwards (or uses `explicit`), imports and validates it. */
|
||||
/** Finds storebound.config.* from `start` upwards (or uses `explicit`), imports and validates it. */
|
||||
export async function loadConfig(explicit?: string, start = process.cwd()): Promise<Loaded> {
|
||||
let path = explicit ? resolve(explicit) : '';
|
||||
if (!path) {
|
||||
|
|
@ -239,7 +239,7 @@ export async function loadConfig(explicit?: string, start = process.cwd()): Prom
|
|||
if (dirname(d) === d) break;
|
||||
}
|
||||
}
|
||||
if (!path || !existsSync(path)) throw new Error('no crt-ship.config.ts found (run `crt-ship init` or pass --config)');
|
||||
if (!path || !existsSync(path)) throw new Error('no storebound.config.ts found (run `storebound init` or pass --config)');
|
||||
const mod = await import(path);
|
||||
const config = (mod.default ?? mod) as ShipConfig;
|
||||
const errors = validateConfig(config);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Credentials never live in crt-ship.config.ts or in git. Sources, first hit wins:
|
||||
// Credentials never live in storebound.config.ts or in git. Sources, first hit wins:
|
||||
// 1. environment: PLAY_SERVICE_ACCOUNT (path to the JSON key, or the JSON itself), ASC_KEY_ID, ASC_ISSUER_ID,
|
||||
// ASC_P8 (path to AuthKey_<id>.p8, or the PEM itself)
|
||||
// 2. <project>/.crt-ship/credentials.json (gitignored), same names:
|
||||
// 2. <project>/.storebound/credentials.json (gitignored), same names:
|
||||
// { "PLAY_SERVICE_ACCOUNT": "...", "ASC_KEY_ID": "...", "ASC_ISSUER_ID": "...", "ASC_P8": "...",
|
||||
// "reviewContact": { "firstName": "", "lastName": "", "phone": "", "email": "" } }
|
||||
// 3. ASC_P8 only: ~/.appstoreconnect/private_keys/AuthKey_<ASC_KEY_ID>.p8 (where Xcode / altool keep it)
|
||||
|
|
@ -16,7 +16,7 @@ export interface ReviewContact { firstName: string; lastName: string; phone: str
|
|||
type Store = Record<string, unknown>;
|
||||
|
||||
function fileStore(root: string): Store {
|
||||
const p = join(root, '.crt-ship', 'credentials.json');
|
||||
const p = join(root, '.storebound', 'credentials.json');
|
||||
if (!existsSync(p)) return {};
|
||||
try { return JSON.parse(readFileSync(p, 'utf8')) as Store; } catch (e) { throw new Error(`${p}: ${(e as Error).message}`); }
|
||||
}
|
||||
|
|
@ -40,20 +40,20 @@ export function parseServiceAccount(text: string): ServiceAccount {
|
|||
|
||||
export function playServiceAccount(root: string): ServiceAccount {
|
||||
const v = value(root, 'PLAY_SERVICE_ACCOUNT');
|
||||
if (!v) throw new Error('PLAY_SERVICE_ACCOUNT is not set (env, or .crt-ship/credentials.json): path to the service account JSON key');
|
||||
if (!v) throw new Error('PLAY_SERVICE_ACCOUNT is not set (env, or .storebound/credentials.json): path to the service account JSON key');
|
||||
return parseServiceAccount(inline(v, /^\s*\{/));
|
||||
}
|
||||
|
||||
export function ascKey(root: string): AscKey {
|
||||
const keyId = value(root, 'ASC_KEY_ID');
|
||||
const issuerId = value(root, 'ASC_ISSUER_ID');
|
||||
if (!keyId || !issuerId) throw new Error('ASC_KEY_ID and ASC_ISSUER_ID are not set (env, or .crt-ship/credentials.json)');
|
||||
if (!keyId || !issuerId) throw new Error('ASC_KEY_ID and ASC_ISSUER_ID are not set (env, or .storebound/credentials.json)');
|
||||
const p8 = value(root, 'ASC_P8') ?? join(homedir(), '.appstoreconnect/private_keys', `AuthKey_${keyId}.p8`);
|
||||
if (!/BEGIN PRIVATE KEY/.test(p8) && !existsSync(p8.replace(/^~(?=\/)/, homedir()))) throw new Error(`App Store Connect key not found: ${p8} (set ASC_P8)`);
|
||||
return { keyId, issuerId, pem: inline(p8, /BEGIN PRIVATE KEY/) };
|
||||
}
|
||||
|
||||
/** App Review contact from .crt-ship/credentials.json (personal data, so never in the config). */
|
||||
/** App Review contact from .storebound/credentials.json (personal data, so never in the config). */
|
||||
export function reviewContact(root: string): ReviewContact | null {
|
||||
const c = fileStore(root).reviewContact as Partial<ReviewContact> | undefined;
|
||||
if (!c?.email) return null;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { playCodes } from './config';
|
|||
export interface Ctx { loaded: Loaded; args: Args }
|
||||
|
||||
export function need<T>(v: T | undefined, what: string): T {
|
||||
if (v === undefined || v === null) throw new Error(`crt-ship.config.ts: ${what} is not set`);
|
||||
if (v === undefined || v === null) throw new Error(`storebound.config.ts: ${what} is not set`);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Plain, line-based progress output: easy to follow live and easy to tail when a long upload runs in the background
|
||||
// (`crt-ship play images > .crt-ship/images.log 2>&1 &`). Every line carries a timestamp and a tag.
|
||||
// (`storebound play images > .storebound/images.log 2>&1 &`). Every line carries a timestamp and a tag.
|
||||
const t0 = Date.now();
|
||||
const stamp = (): string => new Date().toISOString().slice(11, 19);
|
||||
const since = (): string => `${((Date.now() - t0) / 1000).toFixed(0)}s`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue