refactor: refactoring imports
将来ESMに移行しやすいように Related: #7658 なんかmochaが起動しなくなってるけど理由不明 すぐ直したい
This commit is contained in:
@@ -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 => {
|
||||
|
Reference in New Issue
Block a user