Fix dirname for Node 18

c67c0cbf7e8acf06af1b668b7080d3a2e44920ae

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +6 -3Showing whitespace changes
plugins.js+4 -2
@@ -3,12 +3,14 @@
33// 1. node plugins.js update
44// 2. node plugins.js install <plugin-git-url>
55// More operations coming soon.
6-import { default as git } from 'simple-git';
76import * as fs from 'node:fs';
87import * as path from 'node:path';
8+import { fileURLToPath } from 'node:url';
9+
10+import { default as git } from 'simple-git';
911import { color } from './src/util.js';
1012
1113const __dirname = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
1214process.chdir(__dirname);
1315const pluginsPath = './plugins';
1416
server.js+2 -1
@@ -8,6 +8,7 @@ import * as path from 'node:path';
88import * as util from 'node:util';
99import * as net from 'node:net';
1010import * as dns from 'node:dns';
11+import { fileURLToPath } from 'node:url';
1112
1213// cli/fs related library imports
1314import open from 'open';
@@ -214,7 +215,7 @@ const cliArguments = yargs(hideBin(process.argv))
214215 }).parseSync();
215216
216217// change all relative paths
217218const serverDirectory = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
218219console.log(`Node version: ${process.version}. Running in ${process.env.NODE_ENV} environment. Server directory: ${serverDirectory}`);
219220process.chdir(serverDirectory);
220221