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,9 +1,9 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { User } from '../../../../models/entities/user';
import { SchemaType } from '@/misc/schema';
import { Users } from '../../../../models';
import { name, schema } from '../schemas/active-users';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { User } from '@/models/entities/user.js';
import { SchemaType } from '@/misc/schema.js';
import { Users } from '@/models/index.js';
import { name, schema } from '../schemas/active-users.js';
type ActiveUsersLog = SchemaType<typeof schema>;

View file

@ -1,10 +1,10 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { DriveFiles } from '../../../../models';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { DriveFiles } from '@/models/index.js';
import { Not, IsNull } from 'typeorm';
import { DriveFile } from '../../../../models/entities/drive-file';
import { name, schema } from '../schemas/drive';
import { DriveFile } from '@/models/entities/drive-file.js';
import { name, schema } from '../schemas/drive.js';
type DriveLog = SchemaType<typeof schema>;

View file

@ -1,8 +1,8 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { Instances } from '../../../../models';
import { name, schema } from '../schemas/federation';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { Instances } from '@/models/index.js';
import { name, schema } from '../schemas/federation.js';
type FederationLog = SchemaType<typeof schema>;

View file

@ -1,9 +1,9 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { User } from '../../../../models/entities/user';
import { SchemaType } from '@/misc/schema';
import { Users } from '../../../../models';
import { name, schema } from '../schemas/hashtag';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { User } from '@/models/entities/user.js';
import { SchemaType } from '@/misc/schema.js';
import { Users } from '@/models/index.js';
import { name, schema } from '../schemas/hashtag.js';
type HashtagLog = SchemaType<typeof schema>;

View file

@ -1,11 +1,11 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { DriveFiles, Followings, Users, Notes } from '../../../../models';
import { DriveFile } from '../../../../models/entities/drive-file';
import { name, schema } from '../schemas/instance';
import { Note } from '../../../../models/entities/note';
import { toPuny } from '@/misc/convert-host';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { DriveFiles, Followings, Users, Notes } from '@/models/index.js';
import { DriveFile } from '@/models/entities/drive-file.js';
import { name, schema } from '../schemas/instance.js';
import { Note } from '@/models/entities/note.js';
import { toPuny } from '@/misc/convert-host.js';
type InstanceLog = SchemaType<typeof schema>;

View file

@ -1,7 +1,7 @@
import autobind from 'autobind-decorator';
import Chart, { DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { name, schema } from '../schemas/network';
import Chart, { DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { name, schema } from '../schemas/network.js';
type NetworkLog = SchemaType<typeof schema>;

View file

@ -1,10 +1,10 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { Notes } from '../../../../models';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { Notes } from '@/models/index.js';
import { Not, IsNull } from 'typeorm';
import { Note } from '../../../../models/entities/note';
import { name, schema } from '../schemas/notes';
import { Note } from '@/models/entities/note.js';
import { name, schema } from '../schemas/notes.js';
type NotesLog = SchemaType<typeof schema>;

View file

@ -1,9 +1,9 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { DriveFiles } from '../../../../models';
import { DriveFile } from '../../../../models/entities/drive-file';
import { name, schema } from '../schemas/per-user-drive';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { DriveFiles } from '@/models/index.js';
import { DriveFile } from '@/models/entities/drive-file.js';
import { name, schema } from '../schemas/per-user-drive.js';
type PerUserDriveLog = SchemaType<typeof schema>;

View file

@ -1,10 +1,10 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { Followings, Users } from '../../../../models';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { Followings, Users } from '@/models/index.js';
import { Not, IsNull } from 'typeorm';
import { User } from '../../../../models/entities/user';
import { name, schema } from '../schemas/per-user-following';
import { User } from '@/models/entities/user.js';
import { name, schema } from '../schemas/per-user-following.js';
type PerUserFollowingLog = SchemaType<typeof schema>;

View file

@ -1,10 +1,10 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { User } from '../../../../models/entities/user';
import { SchemaType } from '@/misc/schema';
import { Notes } from '../../../../models';
import { Note } from '../../../../models/entities/note';
import { name, schema } from '../schemas/per-user-notes';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { User } from '@/models/entities/user.js';
import { SchemaType } from '@/misc/schema.js';
import { Notes } from '@/models/index.js';
import { Note } from '@/models/entities/note.js';
import { name, schema } from '../schemas/per-user-notes.js';
type PerUserNotesLog = SchemaType<typeof schema>;

View file

@ -1,10 +1,10 @@
import autobind from 'autobind-decorator';
import Chart, { DeepPartial } from '../../core';
import { User } from '../../../../models/entities/user';
import { Note } from '../../../../models/entities/note';
import { SchemaType } from '@/misc/schema';
import { Users } from '../../../../models';
import { name, schema } from '../schemas/per-user-reactions';
import Chart, { DeepPartial } from '../../core.js';
import { User } from '@/models/entities/user.js';
import { Note } from '@/models/entities/note.js';
import { SchemaType } from '@/misc/schema.js';
import { Users } from '@/models/index.js';
import { name, schema } from '../schemas/per-user-reactions.js';
type PerUserReactionsLog = SchemaType<typeof schema>;

View file

@ -1,7 +1,7 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { name, schema } from '../schemas/test-grouped';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { name, schema } from '../schemas/test-grouped.js';
type TestGroupedLog = SchemaType<typeof schema>;

View file

@ -1,7 +1,7 @@
import autobind from 'autobind-decorator';
import Chart, { DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { name, schema } from '../schemas/test-unique';
import Chart, { DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { name, schema } from '../schemas/test-unique.js';
type TestUniqueLog = SchemaType<typeof schema>;

View file

@ -1,7 +1,7 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { name, schema } from '../schemas/test';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { name, schema } from '../schemas/test.js';
type TestLog = SchemaType<typeof schema>;

View file

@ -1,10 +1,10 @@
import autobind from 'autobind-decorator';
import Chart, { Obj, DeepPartial } from '../../core';
import { SchemaType } from '@/misc/schema';
import { Users } from '../../../../models';
import Chart, { Obj, DeepPartial } from '../../core.js';
import { SchemaType } from '@/misc/schema.js';
import { Users } from '@/models/index.js';
import { Not, IsNull } from 'typeorm';
import { User } from '../../../../models/entities/user';
import { name, schema } from '../schemas/users';
import { User } from '@/models/entities/user.js';
import { name, schema } from '../schemas/users.js';
type UsersLog = SchemaType<typeof schema>;

View file

@ -6,11 +6,11 @@
import * as nestedProperty from 'nested-property';
import autobind from 'autobind-decorator';
import Logger from '../logger';
import { Schema } from '@/misc/schema';
import Logger from '../logger.js';
import { Schema } from '@/misc/schema.js';
import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm';
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '../../prelude/time';
import { getChartInsertLock } from '@/misc/app-lock';
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '../../prelude/time.js';
import { getChartInsertLock } from '@/misc/app-lock.js';
const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test');

View file

@ -1,7 +1,13 @@
import Chart from './core';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import Chart from './core.js';
//const _filename = fileURLToPath(import.meta.url);
const _filename = __filename;
const _dirname = dirname(_filename);
export const entities = Object.values(require('require-all')({
dirname: __dirname + '/charts/schemas',
dirname: _dirname + '/charts/schemas',
filter: /^.+\.[jt]s$/,
resolve: (x: any) => {
return Chart.schemaToEntity(x.name, x.schema);

View file

@ -1,16 +1,16 @@
import FederationChart from './charts/classes/federation';
import NotesChart from './charts/classes/notes';
import UsersChart from './charts/classes/users';
import NetworkChart from './charts/classes/network';
import ActiveUsersChart from './charts/classes/active-users';
import InstanceChart from './charts/classes/instance';
import PerUserNotesChart from './charts/classes/per-user-notes';
import DriveChart from './charts/classes/drive';
import PerUserReactionsChart from './charts/classes/per-user-reactions';
import HashtagChart from './charts/classes/hashtag';
import PerUserFollowingChart from './charts/classes/per-user-following';
import PerUserDriveChart from './charts/classes/per-user-drive';
import { beforeShutdown } from '@/misc/before-shutdown';
import FederationChart from './charts/classes/federation.js';
import NotesChart from './charts/classes/notes.js';
import UsersChart from './charts/classes/users.js';
import NetworkChart from './charts/classes/network.js';
import ActiveUsersChart from './charts/classes/active-users.js';
import InstanceChart from './charts/classes/instance.js';
import PerUserNotesChart from './charts/classes/per-user-notes.js';
import DriveChart from './charts/classes/drive.js';
import PerUserReactionsChart from './charts/classes/per-user-reactions.js';
import HashtagChart from './charts/classes/hashtag.js';
import PerUserFollowingChart from './charts/classes/per-user-following.js';
import PerUserDriveChart from './charts/classes/per-user-drive.js';
import { beforeShutdown } from '@/misc/before-shutdown.js';
export const federationChart = new FederationChart();
export const notesChart = new NotesChart();