rudeshark.net/src/tools/resync-remote-user.ts
syuilo b9cb6d1c10 refactor: refactoring imports
将来ESMに移行しやすいように
Related: #7658

なんかmochaが起動しなくなってるけど理由不明
すぐ直したい
2021-08-19 18:33:41 +09:00

31 lines
653 B
TypeScript

import { initDb } from '@/db/postgre.js';
import { parseAcct } from '@/misc/acct.js';
async function main(acct: string): Promise<any> {
await initDb();
const { resolveUser } = await import('@/remote/resolve-user');
const { username, host } = parseAcct(acct);
await resolveUser(username, host, {}, true);
}
// get args
const args = process.argv.slice(2);
let acct = args[0];
// normalize args
acct = acct.replace(/^@/, '');
// check args
if (!acct.match(/^\w+@\w/)) {
throw `Invalid acct format. Valid format are user@host`;
}
console.log(`resync ${acct}`);
main(acct).then(() => {
console.log('Done');
}).catch(e => {
console.warn(e);
});