Fix dirname for Node 18

This commit is contained in:
Cohee
2024-10-11 00:06:02 +03:00
parent 478976f647
commit c67c0cbf7e
2 changed files with 6 additions and 3 deletions

View File

@ -3,12 +3,14 @@
// 1. node plugins.js update
// 2. node plugins.js install <plugin-git-url>
// More operations coming soon.
import { default as git } from 'simple-git';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { default as git } from 'simple-git';
import { color } from './src/util.js';
const __dirname = import.meta.dirname;
const __dirname = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
process.chdir(__dirname);
const pluginsPath = './plugins';