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,13 @@
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { Context } from 'cafy';
import * as path from 'path';
import * as glob from 'glob';
import { Schema } from '@/misc/schema';
import { Schema } from '@/misc/schema.js';
//const _filename = fileURLToPath(import.meta.url);
const _filename = __filename;
const _dirname = dirname(_filename);
export type Param = {
validator: Context<any>;
@@ -102,7 +108,7 @@ export interface IEndpoint {
}
const files = glob.sync('**/*.js', {
cwd: path.resolve(__dirname + '/endpoints/')
cwd: path.resolve(_dirname + '/endpoints/')
});
const endpoints: IEndpoint[] = files.map(f => {