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
37
cli/init.ts
Normal file
37
cli/init.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// Copies the templates into the current project without overwriting anything, and makes sure .crt-ship/ is ignored.
|
||||
// crt-ship init [--dir .]
|
||||
import { appendFileSync, copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { dirname, join, resolve } from 'node:path';
|
||||
import type { Args } from './lib/args';
|
||||
import { log } from './lib/log';
|
||||
|
||||
const T = join(import.meta.dir, '..', 'templates');
|
||||
const FILES: [string, string][] = [
|
||||
['crt-ship.config.ts', 'crt-ship.config.ts'],
|
||||
['listing.md', 'store/listing.md'],
|
||||
['appstore.md', 'store/appstore.md'],
|
||||
['shots-copy.json', 'store/shots/copy.json'],
|
||||
['app-privacy.md', 'store/app-privacy.md'],
|
||||
['declarations.md', 'store/declarations.md'],
|
||||
['privacy-policy.html', 'store/privacy-policy.html'],
|
||||
['credentials.example.json', '.crt-ship/credentials.json'],
|
||||
];
|
||||
|
||||
export async function run(args: Args): Promise<void> {
|
||||
const root = resolve(args.str('dir', '.'));
|
||||
for (const [from, to] of FILES) {
|
||||
const dest = join(root, to);
|
||||
if (existsSync(dest)) { log('init', `keep ${to} (exists)`); continue; }
|
||||
mkdirSync(dirname(dest), { recursive: true });
|
||||
copyFileSync(join(T, from), dest);
|
||||
log('init', `create ${to}`);
|
||||
}
|
||||
const gi = join(root, '.gitignore');
|
||||
const cur = existsSync(gi) ? readFileSync(gi, 'utf8') : '';
|
||||
if (!/^\/?\.crt-ship\/?$/m.test(cur)) {
|
||||
if (cur) appendFileSync(gi, `${cur.endsWith('\n') ? '' : '\n'}# crt-ship: credentials, fonts, temp files\n.crt-ship/\n`);
|
||||
else writeFileSync(gi, '# crt-ship: credentials, fonts, temp files\n.crt-ship/\n');
|
||||
log('init', '.gitignore: added .crt-ship/');
|
||||
}
|
||||
log('init', 'next: edit crt-ship.config.ts and .crt-ship/credentials.json, then `crt-ship check`');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue