feature: cloudcmd: bin: get rid of require

This commit is contained in:
coderiaser 2026-03-29 12:37:36 +03:00
parent 47acb8fdf7
commit a423739cb8
2 changed files with 4 additions and 8 deletions

View file

@ -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() {

View file

@ -37,7 +37,7 @@ RUN apt-get update && apt-get upgrade && apt-get autoremove && \
echo "set editing-mode vi" >> /etc/inputrc && \
echo "TAB: menu-complete" >> /etc/inputrc && \
echo "set UTF-8" && \
echo" > configure languages" && \
echo " > configure languages" && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
echo "ru_RU.UTF-8 UTF-8" >> /etc/locale.gen && \
echo "uk_UA.UTF-8 UTF-8" >> /etc/locale.gen && \