mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-17 16:38:18 +00:00
feature: cloudcmd: bin: get rid of require
This commit is contained in:
parent
47acb8fdf7
commit
a423739cb8
2 changed files with 4 additions and 8 deletions
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import process from 'node:process';
|
||||
import {createRequire} from 'node:module';
|
||||
import {promisify} from 'node:util';
|
||||
import {tryToCatch} from 'try-to-catch';
|
||||
import parse from 'yargs-parser';
|
||||
|
|
@ -15,7 +14,6 @@ import Info from '../package.json' with {
|
|||
};
|
||||
|
||||
process.on('unhandledRejection', exit);
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
const isUndefined = (a) => typeof a === 'undefined';
|
||||
|
||||
|
|
@ -30,8 +28,6 @@ const config = createConfig({
|
|||
configPath,
|
||||
});
|
||||
|
||||
const DIR_SERVER = '../server/';
|
||||
|
||||
const maybeRoot = (a) => {
|
||||
if (a === '.')
|
||||
return process.cwd();
|
||||
|
|
@ -180,7 +176,7 @@ async function main() {
|
|||
return exit(error);
|
||||
|
||||
if (args.repl)
|
||||
repl();
|
||||
await repl();
|
||||
|
||||
validate.columns(args.columns);
|
||||
validate.theme(args.theme);
|
||||
|
|
@ -339,9 +335,9 @@ async function help() {
|
|||
console.log('\nGeneral help using Cloud Commander: <%s>', url);
|
||||
}
|
||||
|
||||
function repl() {
|
||||
async function repl() {
|
||||
console.log('REPL mode enabled (telnet localhost 1337)');
|
||||
require(`${DIR_SERVER}repl`);
|
||||
await import('../server/repl.js');
|
||||
}
|
||||
|
||||
async function checkUpdate() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue