mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
feature: client: modules: operation: migrate to ESM
This commit is contained in:
parent
ad6831712b
commit
ebfdf8c087
6 changed files with 10 additions and 18 deletions
|
|
@ -1,6 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = (operation, from, to) => {
|
||||
export const format = (operation, from, to) => {
|
||||
if (!to)
|
||||
return `${operation} ${from}`;
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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, '');
|
||||
|
|
@ -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';
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue