mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-17 16:38:18 +00:00
feature: cloudcmd: migrate to ESM
This commit is contained in:
parent
e8a81c49ea
commit
4533a25c6f
184 changed files with 339 additions and 388 deletions
|
|
@ -1,9 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const RENAME_FILE = 'Rename file';
|
||||
const CDN = 'https://cdn.jsdelivr.net/gh/cloudcmd/user-menu@1.2.4';
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
'__settings': {
|
||||
select: [RENAME_FILE],
|
||||
run: false,
|
||||
|
|
@ -135,7 +133,8 @@ async function readDefaultMenu({prefix}) {
|
|||
return await res.text();
|
||||
}
|
||||
|
||||
module.exports._selectNames = selectNames;
|
||||
export const _selectNames = selectNames;
|
||||
|
||||
function selectNames(names, panel, {selectFile, getCurrentByName}) {
|
||||
for (const name of names) {
|
||||
const file = getCurrentByName(name, panel);
|
||||
|
|
@ -143,7 +142,8 @@ function selectNames(names, panel, {selectFile, getCurrentByName}) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports._compare = compare;
|
||||
export const _compare = compare;
|
||||
|
||||
function compare(a, b) {
|
||||
const result = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
'use strict';
|
||||
import {stub} from '@cloudcmd/stub';
|
||||
import {tryToCatch} from 'try-to-catch';
|
||||
import wraptile from 'wraptile';
|
||||
import {test as tape} from 'supertape';
|
||||
import autoGlobals from 'auto-globals';
|
||||
import defaultMenu, {_selectNames, _compare} from './user-menu.js';
|
||||
|
||||
const {stub} = require('@cloudcmd/stub');
|
||||
const {tryToCatch} = require('try-to-catch');
|
||||
const wraptile = require('wraptile');
|
||||
const {test: tape} = require('supertape');
|
||||
const autoGlobals = require('auto-globals');
|
||||
const defaultMenu = require('./user-menu');
|
||||
const test = autoGlobals(tape);
|
||||
const {create} = autoGlobals;
|
||||
const {_data} = defaultMenu;
|
||||
|
|
@ -261,7 +260,6 @@ test('cloudcmd: static: user menu: compare directories', async (t) => {
|
|||
});
|
||||
|
||||
test('cloudcmd: static: user menu: compare directories: select names', (t) => {
|
||||
const {_selectNames} = defaultMenu;
|
||||
const selectFile = stub();
|
||||
const file = {};
|
||||
const getCurrentByName = stub().returns(file);
|
||||
|
|
@ -279,7 +277,6 @@ test('cloudcmd: static: user menu: compare directories: select names', (t) => {
|
|||
});
|
||||
|
||||
test('cloudcmd: static: user menu: compare directories: select names: getCurrentByName', (t) => {
|
||||
const {_selectNames} = defaultMenu;
|
||||
const selectFile = stub();
|
||||
const getCurrentByName = stub();
|
||||
|
||||
|
|
@ -297,7 +294,6 @@ test('cloudcmd: static: user menu: compare directories: select names: getCurrent
|
|||
});
|
||||
|
||||
test('cloudcmd: static: user menu: compare directories: select names: compare', (t) => {
|
||||
const {_compare} = defaultMenu;
|
||||
const a = [1, 2];
|
||||
const b = [1, 3];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue