feature: client: modules: operation: migrate to ESM

This commit is contained in:
coderiaser 2026-01-29 18:52:38 +02:00
parent ad6831712b
commit ebfdf8c087
6 changed files with 10 additions and 18 deletions

View file

@ -1,6 +1,4 @@
'use strict';
module.exports = (operation, from, to) => {
export const format = (operation, from, to) => {
if (!to)
return `${operation} ${from}`;

View file

@ -1,11 +1,9 @@
'use strict';
const currify = require('currify');
import currify from 'currify';
const not = currify((array, value) => !array.includes(value));
const notOneOf = currify((a, b) => a.filter(not(b)));
module.exports = (currentName, names, removedNames) => {
export const getNextCurrentName = (currentName, names, removedNames) => {
const i = names.indexOf(currentName);
const nextNames = notOneOf(names, removedNames);

View file

@ -5,9 +5,9 @@ import exec from 'execon';
import load from 'load.js';
import {tryToCatch} from 'try-to-catch';
import {encode} from '../../../common/entity.js';
import removeExtension from './remove-extension.js';
import {removeExtension} from './remove-extension.mjs';
import {setListeners} from './set-listeners.mjs';
import getNextCurrentName from './get-next-current-name.js';
import {getNextCurrentName} from './get-next-current-name.mjs';
const {DOM, CloudCmd} = globalThis;

View file

@ -1,8 +1,6 @@
'use strict';
import {getExt} from '#common/util';
const {getExt} = require('#common/util');
module.exports = (name) => {
export const removeExtension = (name) => {
const ext = getExtension(name);
return name.replace(ext, '');

View file

@ -1,7 +1,5 @@
'use strict';
const test = require('supertape');
const removeExtension = require(`./remove-extension`);
import test from 'supertape';
import {removeExtension} from './remove-extension.mjs';
test('cloudcmd: client: modules: operation: removeExtension: .tar.gz', (t) => {
const name = 'hello';

View file

@ -1,7 +1,7 @@
/* global DOM */
import forEachKey from 'for-each-key';
import wraptile from 'wraptile';
import format from './format.js';
import {format} from './format.mjs';
const {Dialog, Images} = DOM;