refactor: refactoring imports

将来ESMに移行しやすいように
Related: #7658

なんかmochaが起動しなくなってるけど理由不明
すぐ直したい
This commit is contained in:
syuilo
2021-08-19 18:33:41 +09:00
parent 31e3aaeda0
commit b9cb6d1c10
663 changed files with 3194 additions and 3134 deletions

View File

@@ -1,7 +1,7 @@
// ex) node built/tools/accept-migration Yo 1000000000001
import { createConnection } from 'typeorm';
import config from '@/config';
import config from '@/config/index.js';
createConnection({
type: 'postgres',

View File

@@ -1,5 +1,5 @@
import { Emojis } from '../models';
import { genId } from '@/misc/gen-id';
import { Emojis } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
async function main(name: string, url: string, alias?: string): Promise<any> {
const aliases = alias != null ? [ alias ] : [];

View File

@@ -1,6 +1,6 @@
import { initDb } from '../db/postgre';
import { initDb } from '../db/postgre.js';
import { getRepository } from 'typeorm';
import { User } from '../models/entities/user';
import { User } from '@/models/entities/user.js';
async function main(username: string) {
if (!username) throw `username required`;

View File

@@ -1,6 +1,6 @@
import { initDb } from '../db/postgre';
import { initDb } from '../db/postgre.js';
import { getRepository } from 'typeorm';
import { User } from '../models/entities/user';
import { User } from '@/models/entities/user.js';
async function main(username: string) {
if (!username) throw `username required`;

View File

@@ -1,4 +1,4 @@
import { updateQuestion } from '../remote/activitypub/models/question';
import { updateQuestion } from '@/remote/activitypub/models/question.js';
async function main(uri: string): Promise<any> {
return await updateQuestion(uri);

View File

@@ -1,9 +1,9 @@
import { initDb } from '@/db/postgre';
import { parseAcct } from '@/misc/acct';
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 { resolveUser } = await import('@/remote/resolve-user');
const { username, host } = parseAcct(acct);
await resolveUser(username, host, {}, true);

View File

@@ -1,4 +1,4 @@
import { Users, Signins } from '../models';
import { Users, Signins } from '@/models/index.js';
// node built/tools/show-signin-history username
// => {Success} {Date} {IPAddrsss}