Skip to content

Commit 811a47f

Browse files
committed
feature: cloudcmd: bin: get rid of require
1 parent 47acb8f commit 811a47f

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

bin/cloudcmd.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

33
import process from 'node:process';
4-
import {createRequire} from 'node:module';
54
import {promisify} from 'node:util';
65
import {tryToCatch} from 'try-to-catch';
76
import parse from 'yargs-parser';
@@ -15,7 +14,6 @@ import Info from '../package.json' with {
1514
};
1615

1716
process.on('unhandledRejection', exit);
18-
const require = createRequire(import.meta.url);
1917

2018
const isUndefined = (a) => typeof a === 'undefined';
2119

@@ -30,8 +28,6 @@ const config = createConfig({
3028
configPath,
3129
});
3230

33-
const DIR_SERVER = '../server/';
34-
3531
const maybeRoot = (a) => {
3632
if (a === '.')
3733
return process.cwd();
@@ -180,7 +176,7 @@ async function main() {
180176
return exit(error);
181177

182178
if (args.repl)
183-
repl();
179+
await repl();
184180

185181
validate.columns(args.columns);
186182
validate.theme(args.theme);
@@ -339,9 +335,9 @@ async function help() {
339335
console.log('\nGeneral help using Cloud Commander: <%s>', url);
340336
}
341337

342-
function repl() {
338+
async function repl() {
343339
console.log('REPL mode enabled (telnet localhost 1337)');
344-
require(`${DIR_SERVER}repl`);
340+
await import('../server/repl.js');
345341
}
346342

347343
async function checkUpdate() {

0 commit comments

Comments
 (0)