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,6 +1,4 @@
|
||||||
'use strict';
|
export default {
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
'F2 - Rename file': async ({DOM}) => {
|
'F2 - Rename file': async ({DOM}) => {
|
||||||
await DOM.renameCurrent();
|
await DOM.renameCurrent();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const buildEnv = (is17 || is20) && {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'start': () => 'node bin/cloudcmd.mjs',
|
'start': () => 'node bin/cloudcmd.js',
|
||||||
'start:dev': async () => await run('start', null, {
|
'start:dev': async () => await run('start', null, {
|
||||||
NODE_ENV: 'development',
|
NODE_ENV: 'development',
|
||||||
}),
|
}),
|
||||||
|
|
@ -41,7 +41,7 @@ export default {
|
||||||
'wisdom': async () => await run(['lint:all', 'build', 'test'], null, {
|
'wisdom': async () => await run(['lint:all', 'build', 'test'], null, {
|
||||||
CI: 1,
|
CI: 1,
|
||||||
}),
|
}),
|
||||||
'wisdom:type': () => 'bin/release.mjs',
|
'wisdom:type': () => 'bin/release.js',
|
||||||
'coverage': async () => [testEnv, `c8 ${await cutEnv('test')}`],
|
'coverage': async () => [testEnv, `c8 ${await cutEnv('test')}`],
|
||||||
'coverage:report': () => 'c8 report --reporter=lcov',
|
'coverage:report': () => 'c8 report --reporter=lcov',
|
||||||
'report': () => 'c8 report --reporter=lcov',
|
'report': () => 'c8 report --reporter=lcov',
|
||||||
|
|
@ -20,7 +20,7 @@ bower.json
|
||||||
manifest.yml
|
manifest.yml
|
||||||
deno.json
|
deno.json
|
||||||
|
|
||||||
bin/release.mjs
|
bin/release.*
|
||||||
|
|
||||||
client
|
client
|
||||||
img/logo/cloudcmd-hq.png
|
img/logo/cloudcmd-hq.png
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@
|
||||||
"*.md"
|
"*.md"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"package-json/add-type": "off"
|
"package-json/add-type": "off",
|
||||||
|
"esm/add-index-to-import": "off"
|
||||||
},
|
},
|
||||||
"match": {
|
"match": {
|
||||||
".filesystem.json": {
|
".filesystem.json": {
|
||||||
|
|
|
||||||
|
|
@ -117,28 +117,28 @@ export default {
|
||||||
'config': `${dirCss}/config.css`,
|
'config': `${dirCss}/config.css`,
|
||||||
'terminal': `${dirCss}/terminal.css`,
|
'terminal': `${dirCss}/terminal.css`,
|
||||||
'user-menu': `${dirCss}/user-menu.css`,
|
'user-menu': `${dirCss}/user-menu.css`,
|
||||||
'sw': `${dir}/sw/sw.mjs`,
|
'sw': `${dir}/sw/sw.js`,
|
||||||
'cloudcmd': `${dir}/cloudcmd.mjs`,
|
'cloudcmd': `${dir}/cloudcmd.js`,
|
||||||
[`${modules}/edit`]: `${dirModules}/edit.mjs`,
|
[`${modules}/edit`]: `${dirModules}/edit.js`,
|
||||||
[`${modules}/edit-file`]: `${dirModules}/edit-file.mjs`,
|
[`${modules}/edit-file`]: `${dirModules}/edit-file.js`,
|
||||||
[`${modules}/edit-file-vim`]: `${dirModules}/edit-file-vim.mjs`,
|
[`${modules}/edit-file-vim`]: `${dirModules}/edit-file-vim.js`,
|
||||||
[`${modules}/edit-names`]: `${dirModules}/edit-names.mjs`,
|
[`${modules}/edit-names`]: `${dirModules}/edit-names.js`,
|
||||||
[`${modules}/edit-names-vim`]: `${dirModules}/edit-names-vim.mjs`,
|
[`${modules}/edit-names-vim`]: `${dirModules}/edit-names-vim.js`,
|
||||||
[`${modules}/menu`]: `${dirModules}/menu/index.mjs`,
|
[`${modules}/menu`]: `${dirModules}/menu/index.js`,
|
||||||
[`${modules}/view`]: `${dirModules}/view/index.mjs`,
|
[`${modules}/view`]: `${dirModules}/view/index.js`,
|
||||||
[`${modules}/help`]: `${dirModules}/help.mjs`,
|
[`${modules}/help`]: `${dirModules}/help.js`,
|
||||||
[`${modules}/markdown`]: `${dirModules}/markdown.mjs`,
|
[`${modules}/markdown`]: `${dirModules}/markdown.js`,
|
||||||
[`${modules}/config`]: `${dirModules}/config/index.mjs`,
|
[`${modules}/config`]: `${dirModules}/config/index.js`,
|
||||||
[`${modules}/contact`]: `${dirModules}/contact.js`,
|
[`${modules}/contact`]: `${dirModules}/contact.js`,
|
||||||
[`${modules}/upload`]: `${dirModules}/upload.mjs`,
|
[`${modules}/upload`]: `${dirModules}/upload.js`,
|
||||||
[`${modules}/operation`]: `${dirModules}/operation/index.mjs`,
|
[`${modules}/operation`]: `${dirModules}/operation/index.js`,
|
||||||
[`${modules}/konsole`]: `${dirModules}/konsole.mjs`,
|
[`${modules}/konsole`]: `${dirModules}/konsole.js`,
|
||||||
[`${modules}/terminal`]: `${dirModules}/terminal.mjs`,
|
[`${modules}/terminal`]: `${dirModules}/terminal.js`,
|
||||||
[`${modules}/terminal-run`]: `${dirModules}/terminal-run.mjs`,
|
[`${modules}/terminal-run`]: `${dirModules}/terminal-run.js`,
|
||||||
[`${modules}/cloud`]: `${dirModules}/cloud.mjs`,
|
[`${modules}/cloud`]: `${dirModules}/cloud.js`,
|
||||||
[`${modules}/user-menu`]: `${dirModules}/user-menu/index.mjs`,
|
[`${modules}/user-menu`]: `${dirModules}/user-menu/index.js`,
|
||||||
[`${modules}/polyfill`]: `${dirModules}/polyfill.mjs`,
|
[`${modules}/polyfill`]: `${dirModules}/polyfill.js`,
|
||||||
[`${modules}/command-line`]: `${dirModules}/command-line.mjs`,
|
[`${modules}/command-line`]: `${dirModules}/command-line.js`,
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
|
|
@ -7,10 +7,10 @@ import {tryToCatch} from 'try-to-catch';
|
||||||
import {createSimport} from 'simport';
|
import {createSimport} from 'simport';
|
||||||
import parse from 'yargs-parser';
|
import parse from 'yargs-parser';
|
||||||
import exit from '../server/exit.js';
|
import exit from '../server/exit.js';
|
||||||
import {createConfig, configPath} from '../server/config.mjs';
|
import {createConfig, configPath} from '../server/config.js';
|
||||||
import * as env from '../server/env.mjs';
|
import * as env from '../server/env.js';
|
||||||
import prefixer from '../server/prefixer.js';
|
import prefixer from '../server/prefixer.js';
|
||||||
import * as validate from '../server/validate.mjs';
|
import * as validate from '../server/validate.js';
|
||||||
|
|
||||||
process.on('unhandledRejection', exit);
|
process.on('unhandledRejection', exit);
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ async function main() {
|
||||||
if (args.showConfig)
|
if (args.showConfig)
|
||||||
await showConfig();
|
await showConfig();
|
||||||
|
|
||||||
const {distributeImport} = await simport('../server/distribute/import.mjs');
|
const {distributeImport} = await simport('../server/distribute/import.js');
|
||||||
const importConfig = promisify(distributeImport);
|
const importConfig = promisify(distributeImport);
|
||||||
|
|
||||||
await start(options, config);
|
await start(options, config);
|
||||||
|
|
@ -279,7 +279,7 @@ function version() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function start(options, config) {
|
async function start(options, config) {
|
||||||
const SERVER = `${DIR_SERVER}server.mjs`;
|
const SERVER = `../server/server.js`;
|
||||||
|
|
||||||
if (!args.server)
|
if (!args.server)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import {promisify} from 'node:util';
|
import {promisify} from 'node:util';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import {tryToCatch} from 'try-to-catch';
|
import {tryToCatch} from 'try-to-catch';
|
||||||
|
|
@ -13,10 +13,10 @@ import {
|
||||||
buildFromJSON,
|
buildFromJSON,
|
||||||
} from '#common/cloudfunc';
|
} from '#common/cloudfunc';
|
||||||
import * as Images from '#dom/images';
|
import * as Images from '#dom/images';
|
||||||
import {unregisterSW} from './sw/register.mjs';
|
import {unregisterSW} from './sw/register.js';
|
||||||
import {getJsonFromFileTable} from './get-json-from-file-table.mjs';
|
import {getJsonFromFileTable} from './get-json-from-file-table.js';
|
||||||
import {Key} from './key/index.mjs';
|
import {Key} from './key/index.js';
|
||||||
import {loadModule} from './load-module.mjs';
|
import {loadModule} from './load-module.js';
|
||||||
|
|
||||||
const noJS = (a) => a.replace(/.js$/, '');
|
const noJS = (a) => a.replace(/.js$/, '');
|
||||||
|
|
||||||
|
|
@ -5,10 +5,10 @@ import load from 'load.js';
|
||||||
import * as Util from '#common/util';
|
import * as Util from '#common/util';
|
||||||
import * as CloudFunc from '#common/cloudfunc';
|
import * as CloudFunc from '#common/cloudfunc';
|
||||||
import DOM from '#dom';
|
import DOM from '#dom';
|
||||||
import {registerSW, listenSW} from './sw/register.mjs';
|
import {registerSW, listenSW} from './sw/register.js';
|
||||||
import {initSortPanel, sortPanel} from './sort.mjs';
|
import {initSortPanel, sortPanel} from './sort.js';
|
||||||
import {createCloudCmd} from './client.mjs';
|
import {createCloudCmd} from './client.js';
|
||||||
import * as Listeners from './listeners/index.mjs';
|
import * as Listeners from './listeners/index.js';
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === 'development';
|
const isDev = process.env.NODE_ENV === 'development';
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import {create} from 'auto-globals';
|
import {create} from 'auto-globals';
|
||||||
import wraptile from 'wraptile';
|
import wraptile from 'wraptile';
|
||||||
import * as currentFile from './current-file.mjs';
|
import * as currentFile from './current-file.js';
|
||||||
|
|
||||||
const id = (a) => a;
|
const id = (a) => a;
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {create} from 'auto-globals';
|
import {create} from 'auto-globals';
|
||||||
import {tryCatch} from 'try-catch';
|
import {tryCatch} from 'try-catch';
|
||||||
import {isContainClass} from './dom-tree.mjs';
|
import {isContainClass} from './dom-tree.js';
|
||||||
|
|
||||||
test('dom: isContainClass: no element', (t) => {
|
test('dom: isContainClass: no element', (t) => {
|
||||||
const [e] = tryCatch(isContainClass);
|
const [e] = tryCatch(isContainClass);
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test} from 'supertape';
|
import {test} from 'supertape';
|
||||||
import * as eventStore from './event-store.mjs';
|
import * as eventStore from './event-store.js';
|
||||||
|
|
||||||
test('event-store: get', (t) => {
|
test('event-store: get', (t) => {
|
||||||
const el = {};
|
const el = {};
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import itype from 'itype';
|
import itype from 'itype';
|
||||||
import * as EventStore from './event-store.mjs';
|
import * as EventStore from './event-store.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* safe add event listener
|
* safe add event listener
|
||||||
|
|
@ -102,13 +102,13 @@ export function show(position, panel) {
|
||||||
/**
|
/**
|
||||||
* hide load image
|
* hide load image
|
||||||
*/
|
*/
|
||||||
export const hide = () => {
|
export function hide() {
|
||||||
const element = Images.get();
|
const element = Images.get();
|
||||||
|
|
||||||
DOM.hide(element);
|
DOM.hide(element);
|
||||||
|
|
||||||
return Images;
|
return Images;
|
||||||
};
|
}
|
||||||
|
|
||||||
export const setProgress = (value, title) => {
|
export const setProgress = (value, title) => {
|
||||||
const DATA = 'data-progress';
|
const DATA = 'data-progress';
|
||||||
|
|
@ -7,15 +7,15 @@ import {getExt} from '#common/util';
|
||||||
import * as Storage from '#dom/storage';
|
import * as Storage from '#dom/storage';
|
||||||
import * as RESTful from '#dom/rest';
|
import * as RESTful from '#dom/rest';
|
||||||
import * as Images from '#dom/images';
|
import * as Images from '#dom/images';
|
||||||
import renameCurrent from './operations/rename-current.mjs';
|
import renameCurrent from './operations/rename-current.js';
|
||||||
import * as CurrentFile from './current-file.mjs';
|
import * as CurrentFile from './current-file.js';
|
||||||
import * as DOMTree from './dom-tree.mjs';
|
import * as DOMTree from './dom-tree.js';
|
||||||
import * as Cmd from './cmd.mjs';
|
import * as Cmd from './cmd.js';
|
||||||
import * as IO from './io/index.mjs';
|
import * as IO from './io/index.js';
|
||||||
import {uploadDirectory} from './directory.mjs';
|
import {uploadDirectory} from './directory.js';
|
||||||
import * as Buffer from './buffer.mjs';
|
import * as Buffer from './buffer.js';
|
||||||
import {loadRemote as _loadRemote} from './load-remote.mjs';
|
import {loadRemote as _loadRemote} from './load-remote.js';
|
||||||
import {selectByPattern} from './select-by-pattern.mjs';
|
import {selectByPattern} from './select-by-pattern.js';
|
||||||
|
|
||||||
const {assign} = Object;
|
const {assign} = Object;
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {FS} from '#common/cloudfunc';
|
import {FS} from '#common/cloudfunc';
|
||||||
import {sendRequest as _sendRequest} from './send-request.mjs';
|
import {sendRequest as _sendRequest} from './send-request.js';
|
||||||
|
|
||||||
const {assign} = Object;
|
const {assign} = Object;
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import * as io from './index.mjs';
|
import * as io from './index.js';
|
||||||
|
|
||||||
test('client: dom: io', (t) => {
|
test('client: dom: io', (t) => {
|
||||||
const sendRequest = stub();
|
const sendRequest = stub();
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test} from 'supertape';
|
import {test} from 'supertape';
|
||||||
import {_replaceHash} from './send-request.mjs';
|
import {_replaceHash} from './send-request.js';
|
||||||
|
|
||||||
test('cloudcmd: client: io: replaceHash', (t) => {
|
test('cloudcmd: client: io: replaceHash', (t) => {
|
||||||
const url = '/hello/####world';
|
const url = '/hello/####world';
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import {callbackify} from 'node:util';
|
import {callbackify} from 'node:util';
|
||||||
import rendy from 'rendy';
|
import rendy from 'rendy';
|
||||||
import itype from 'itype';
|
import itype from 'itype';
|
||||||
import load from 'load.js';
|
import * as load from 'load.js';
|
||||||
import {tryToCatch} from 'try-to-catch';
|
import {tryToCatch} from 'try-to-catch';
|
||||||
import {findObjByNameInArr} from '#common/util';
|
import {findObjByNameInArr} from '#common/util';
|
||||||
import * as Files from '#dom/files';
|
import * as Files from '#dom/files';
|
||||||
|
|
@ -3,7 +3,7 @@ import capitalize from 'just-capitalize';
|
||||||
import * as _Dialog from '#dom/dialog';
|
import * as _Dialog from '#dom/dialog';
|
||||||
import * as Storage from '#dom/storage';
|
import * as Storage from '#dom/storage';
|
||||||
import * as RESTful from '#dom/rest';
|
import * as RESTful from '#dom/rest';
|
||||||
import * as _currentFile from '../current-file.mjs';
|
import * as _currentFile from '../current-file.js';
|
||||||
|
|
||||||
export default async (current, overrides = {}) => {
|
export default async (current, overrides = {}) => {
|
||||||
const {
|
const {
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import renameCurrent from './rename-current.mjs';
|
import renameCurrent from './rename-current.js';
|
||||||
|
|
||||||
test('cloudcmd: client: dom: renameCurrent: isCurrentFile', async (t) => {
|
test('cloudcmd: client: dom: renameCurrent: isCurrentFile', async (t) => {
|
||||||
const current = {};
|
const current = {};
|
||||||
|
|
@ -2,7 +2,7 @@ import {tryToCatch} from 'try-to-catch';
|
||||||
import * as Dialog from '#dom/dialog';
|
import * as Dialog from '#dom/dialog';
|
||||||
import * as Images from '#dom/images';
|
import * as Images from '#dom/images';
|
||||||
import {encode} from '#common/entity';
|
import {encode} from '#common/entity';
|
||||||
import * as IO from './io/index.mjs';
|
import * as IO from './io/index.js';
|
||||||
|
|
||||||
const handleError = (promise) => async (...args) => {
|
const handleError = (promise) => async (...args) => {
|
||||||
const [e, data] = await tryToCatch(promise, ...args);
|
const [e, data] = await tryToCatch(promise, ...args);
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import {alert, prompt} from '#dom/dialog';
|
import {alert, prompt} from '#dom/dialog';
|
||||||
import {getRegExp} from '#common/util';
|
import {getRegExp} from '#common/util';
|
||||||
import {getCurrentName} from './current-file.mjs';
|
import {getCurrentName} from './current-file.js';
|
||||||
import {
|
import {
|
||||||
isSelected,
|
isSelected,
|
||||||
toggleSelectedFile,
|
toggleSelectedFile,
|
||||||
} from './cmd.mjs';
|
} from './cmd.js';
|
||||||
|
|
||||||
let SelectType = '*.*';
|
let SelectType = '*.*';
|
||||||
|
|
||||||
|
|
@ -5,7 +5,7 @@ import * as load from '#dom/load';
|
||||||
import {alert} from '#dom/dialog';
|
import {alert} from '#dom/dialog';
|
||||||
import {FS} from '#common/cloudfunc';
|
import {FS} from '#common/cloudfunc';
|
||||||
import * as Images from '#dom/images';
|
import * as Images from '#dom/images';
|
||||||
import {getCurrentDirPath} from './current-file.mjs';
|
import {getCurrentDirPath} from './current-file.js';
|
||||||
|
|
||||||
const loadFile = wraptile(_loadFile);
|
const loadFile = wraptile(_loadFile);
|
||||||
const onEnd = wraptile(_onEnd);
|
const onEnd = wraptile(_onEnd);
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
import clipboard from '@cloudcmd/clipboard';
|
import clipboard from '@cloudcmd/clipboard';
|
||||||
import {fullstore} from 'fullstore';
|
import {fullstore} from 'fullstore';
|
||||||
import * as Events from '#dom/events';
|
import * as Events from '#dom/events';
|
||||||
import * as Buffer from '../dom/buffer.mjs';
|
import * as Buffer from '../dom/buffer.js';
|
||||||
import * as KEY from './key.mjs';
|
import * as KEY from './key.js';
|
||||||
import _vim from './vim/index.mjs';
|
import _vim from './vim/index.js';
|
||||||
import setCurrentByChar from './set-current-by-char.mjs';
|
import setCurrentByChar from './set-current-by-char.js';
|
||||||
import {createBinder} from './binder.mjs';
|
import {createBinder} from './binder.js';
|
||||||
|
|
||||||
const Chars = fullstore();
|
const Chars = fullstore();
|
||||||
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import autoGlobals from 'auto-globals';
|
import autoGlobals from 'auto-globals';
|
||||||
import supertape from 'supertape';
|
import supertape from 'supertape';
|
||||||
import {ESC} from './key.mjs';
|
import {ESC} from './key.js';
|
||||||
import {Key, _listener} from './index.mjs';
|
import {Key, _listener} from './index.js';
|
||||||
import {getDOM, getCloudCmd} from './vim/globals.fixture.mjs';
|
import {getDOM, getCloudCmd} from './vim/globals.fixture.js';
|
||||||
|
|
||||||
const test = autoGlobals(supertape);
|
const test = autoGlobals(supertape);
|
||||||
const {stub} = supertape;
|
const {stub} = supertape;
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {getDOM} from './globals.fixture.mjs';
|
import {getDOM} from './globals.fixture.js';
|
||||||
import {_next, _previous} from './find.mjs';
|
import {_next, _previous} from './find.js';
|
||||||
|
|
||||||
globalThis.DOM = getDOM();
|
globalThis.DOM = getDOM();
|
||||||
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
/* global CloudCmd */
|
/* global CloudCmd */
|
||||||
/* global DOM */
|
/* global DOM */
|
||||||
import vim from './vim.mjs';
|
import vim from './vim.js';
|
||||||
import * as finder from './find.mjs';
|
import * as finder from './find.js';
|
||||||
import {
|
import {
|
||||||
setCurrent,
|
setCurrent,
|
||||||
selectFileNotParent,
|
selectFileNotParent,
|
||||||
} from './set-current.mjs';
|
} from './set-current.js';
|
||||||
|
|
||||||
export default (key, event, overrides = {}) => {
|
export default (key, event, overrides = {}) => {
|
||||||
const defaults = {
|
const defaults = {
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import {getDOM, getCloudCmd} from './globals.fixture.mjs';
|
import {getDOM, getCloudCmd} from './globals.fixture.js';
|
||||||
import vim, {selectFile as vimSelectFile} from './index.mjs';
|
import vim, {selectFile as vimSelectFile} from './index.js';
|
||||||
|
|
||||||
globalThis.DOM = getDOM();
|
globalThis.DOM = getDOM();
|
||||||
globalThis.CloudCmd = getCloudCmd();
|
globalThis.CloudCmd = getCloudCmd();
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import vim from './vim.mjs';
|
import vim from './vim.js';
|
||||||
|
|
||||||
test('vim: no operations', (t) => {
|
test('vim: no operations', (t) => {
|
||||||
const result = vim('hello', {});
|
const result = vim('hello', {});
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {getIndex} from './get-index.mjs';
|
import {getIndex} from './get-index.js';
|
||||||
|
|
||||||
test('cloudcmd: client: listeners: getIndex: not found', (t) => {
|
test('cloudcmd: client: listeners: getIndex: not found', (t) => {
|
||||||
const array = ['hello'];
|
const array = ['hello'];
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {getRange} from './get-range.mjs';
|
import {getRange} from './get-range.js';
|
||||||
|
|
||||||
test('cloudcmd: client: listeners: getRange: direct', (t) => {
|
test('cloudcmd: client: listeners: getRange: direct', (t) => {
|
||||||
const expected = [
|
const expected = [
|
||||||
|
|
@ -7,13 +7,13 @@ import clipboard from '@cloudcmd/clipboard';
|
||||||
import * as Events from '#dom/events';
|
import * as Events from '#dom/events';
|
||||||
import {uploadFiles} from '#dom/upload-files';
|
import {uploadFiles} from '#dom/upload-files';
|
||||||
import {FS} from '#common/cloudfunc';
|
import {FS} from '#common/cloudfunc';
|
||||||
import {getRange} from './get-range.mjs';
|
import {getRange} from './get-range.js';
|
||||||
import {getIndex} from './get-index.mjs';
|
import {getIndex} from './get-index.js';
|
||||||
|
|
||||||
const NBSP_REG = RegExp(String.fromCharCode(160), 'g');
|
const NBSP_REG = RegExp(String.fromCharCode(160), 'g');
|
||||||
const SPACE = ' ';
|
const SPACE = ' ';
|
||||||
|
|
||||||
export const init = async () => {
|
export async function init() {
|
||||||
contextMenu();
|
contextMenu();
|
||||||
dragndrop();
|
dragndrop();
|
||||||
unload();
|
unload();
|
||||||
|
|
@ -21,7 +21,7 @@ export const init = async () => {
|
||||||
resize();
|
resize();
|
||||||
header();
|
header();
|
||||||
await config();
|
await config();
|
||||||
};
|
}
|
||||||
|
|
||||||
const unselect = (event) => {
|
const unselect = (event) => {
|
||||||
const isMac = /Mac/.test(globalThis.navigator.platform);
|
const isMac = /Mac/.test(globalThis.navigator.platform);
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
/* global CloudCmd */
|
/* global CloudCmd */
|
||||||
import * as Dialog from '#dom/dialog';
|
import * as Dialog from '#dom/dialog';
|
||||||
|
|
||||||
export const init = () => {};
|
export function init() {}
|
||||||
|
|
||||||
CloudCmd.CommandLine = {
|
CloudCmd.CommandLine = {
|
||||||
init,
|
init,
|
||||||
show,
|
show,
|
||||||
|
|
@ -12,7 +12,7 @@ import * as Events from '#dom/events';
|
||||||
import * as Files from '#dom/files';
|
import * as Files from '#dom/files';
|
||||||
import {getTitle} from '#common/cloudfunc';
|
import {getTitle} from '#common/cloudfunc';
|
||||||
import * as Images from '#dom/images';
|
import * as Images from '#dom/images';
|
||||||
import * as input from './input.mjs';
|
import * as input from './input.js';
|
||||||
|
|
||||||
const {Dialog, setTitle} = DOM;
|
const {Dialog, setTitle} = DOM;
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ let Template;
|
||||||
|
|
||||||
const loadCSS = load.css;
|
const loadCSS = load.css;
|
||||||
|
|
||||||
export const init = async () => {
|
export async function init() {
|
||||||
if (!CloudCmd.config('configDialog'))
|
if (!CloudCmd.config('configDialog'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ export const init = async () => {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
initSocket();
|
initSocket();
|
||||||
};
|
}
|
||||||
|
|
||||||
const {config, Key} = CloudCmd;
|
const {config, Key} = CloudCmd;
|
||||||
|
|
||||||
|
|
@ -1,36 +1,34 @@
|
||||||
/* global CloudCmd */
|
/* global CloudCmd */
|
||||||
/* global DOM */
|
/* global DOM */
|
||||||
|
import olark from '@cloudcmd/olark';
|
||||||
|
import * as Images from '#dom/images';
|
||||||
|
|
||||||
'use strict';
|
CloudCmd.Contact = {
|
||||||
|
init,
|
||||||
CloudCmd.Contact = exports;
|
show,
|
||||||
|
hide,
|
||||||
const olark = require('@cloudcmd/olark');
|
};
|
||||||
const Images = require('#dom/images');
|
|
||||||
|
|
||||||
const {Events} = DOM;
|
const {Events} = DOM;
|
||||||
const {Key} = CloudCmd;
|
const {Key} = CloudCmd;
|
||||||
|
|
||||||
module.exports.show = show;
|
export function init() {
|
||||||
module.exports.hide = hide;
|
|
||||||
|
|
||||||
module.exports.init = () => {
|
|
||||||
Events.addKey(onKey);
|
Events.addKey(onKey);
|
||||||
|
|
||||||
olark.identify('6216-545-10-4223');
|
olark.identify('6216-545-10-4223');
|
||||||
olark('api.box.onExpand', show);
|
olark('api.box.onExpand', show);
|
||||||
olark('api.box.onShow', show);
|
olark('api.box.onShow', show);
|
||||||
olark('api.box.onShrink', hide);
|
olark('api.box.onShrink', hide);
|
||||||
};
|
}
|
||||||
|
|
||||||
function show() {
|
export function show() {
|
||||||
Key.unsetBind();
|
Key.unsetBind();
|
||||||
Images.hide();
|
Images.hide();
|
||||||
|
|
||||||
olark('api.box.expand');
|
olark('api.box.expand');
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
export function hide() {
|
||||||
Key.setBind();
|
Key.setBind();
|
||||||
olark('api.box.hide');
|
olark('api.box.hide');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,3 @@ export function show() {
|
||||||
export function hide() {
|
export function hide() {
|
||||||
CloudCmd.View.hide();
|
CloudCmd.View.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ export async function init() {
|
||||||
type: 'file',
|
type: 'file',
|
||||||
});
|
});
|
||||||
|
|
||||||
const {createCloudMenu} = await import('./cloudmenu.mjs');
|
const {createCloudMenu} = await import('./cloudmenu.js');
|
||||||
|
|
||||||
const {name} = fm.dataset;
|
const {name} = fm.dataset;
|
||||||
|
|
||||||
|
|
@ -5,9 +5,9 @@ import exec from 'execon';
|
||||||
import load from 'load.js';
|
import load from 'load.js';
|
||||||
import {tryToCatch} from 'try-to-catch';
|
import {tryToCatch} from 'try-to-catch';
|
||||||
import {encode} from '#common/entity';
|
import {encode} from '#common/entity';
|
||||||
import {removeExtension} from './remove-extension.mjs';
|
import {removeExtension} from './remove-extension.js';
|
||||||
import {setListeners} from './set-listeners.mjs';
|
import {setListeners} from './set-listeners.js';
|
||||||
import {getNextCurrentName} from './get-next-current-name.mjs';
|
import {getNextCurrentName} from './get-next-current-name.js';
|
||||||
|
|
||||||
const {DOM, CloudCmd} = globalThis;
|
const {DOM, CloudCmd} = globalThis;
|
||||||
|
|
||||||
|
|
@ -190,11 +190,11 @@ function getPacker(type) {
|
||||||
return packTarFn;
|
return packTarFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const hide = () => {
|
export function hide() {
|
||||||
CloudCmd.View.hide();
|
CloudCmd.View.hide();
|
||||||
};
|
}
|
||||||
|
|
||||||
export const show = (operation, data) => {
|
export function show(operation, data) {
|
||||||
if (!Loaded)
|
if (!Loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -215,7 +215,7 @@ export const show = (operation, data) => {
|
||||||
|
|
||||||
if (operation === 'extract')
|
if (operation === 'extract')
|
||||||
return Operation.extract();
|
return Operation.extract();
|
||||||
};
|
}
|
||||||
|
|
||||||
Operation.copy = processFiles({
|
Operation.copy = processFiles({
|
||||||
type: 'copy',
|
type: 'copy',
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {removeExtension} from './remove-extension.mjs';
|
import {removeExtension} from './remove-extension.js';
|
||||||
|
|
||||||
test('cloudcmd: client: modules: operation: removeExtension: .tar.gz', (t) => {
|
test('cloudcmd: client: modules: operation: removeExtension: .tar.gz', (t) => {
|
||||||
const name = 'hello';
|
const name = 'hello';
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* global DOM */
|
/* global DOM */
|
||||||
import forEachKey from 'for-each-key';
|
import forEachKey from 'for-each-key';
|
||||||
import wraptile from 'wraptile';
|
import wraptile from 'wraptile';
|
||||||
import {format} from './format.mjs';
|
import {format} from './format.js';
|
||||||
|
|
||||||
const {Dialog, Images} = DOM;
|
const {Dialog, Images} = DOM;
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import {scrollIntoViewIfNeeded} from './polyfill.mjs';
|
import {scrollIntoViewIfNeeded} from './polyfill.js';
|
||||||
|
|
||||||
test('cloudcmd: client: polyfill: scrollIntoViewIfNeeded', (t) => {
|
test('cloudcmd: client: polyfill: scrollIntoViewIfNeeded', (t) => {
|
||||||
const scroll = stub();
|
const scroll = stub();
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {getUserMenu} from './get-user-menu.mjs';
|
import {getUserMenu} from './get-user-menu.js';
|
||||||
|
|
||||||
test('user-menu: getUserMenu', (t) => {
|
test('user-menu: getUserMenu', (t) => {
|
||||||
const menu = `module.exports = {
|
const menu = `module.exports = {
|
||||||
|
|
@ -10,11 +10,11 @@ import {tryToCatch} from 'try-to-catch';
|
||||||
import {codeFrameColumns} from '@babel/code-frame';
|
import {codeFrameColumns} from '@babel/code-frame';
|
||||||
import * as Dialog from '#dom/dialog';
|
import * as Dialog from '#dom/dialog';
|
||||||
import * as Images from '#dom/images';
|
import * as Images from '#dom/images';
|
||||||
import {getUserMenu} from './get-user-menu.mjs';
|
import {getUserMenu} from './get-user-menu.js';
|
||||||
import {navigate} from './navigate.mjs';
|
import {navigate} from './navigate.js';
|
||||||
import {parseError} from './parse-error.mjs';
|
import {parseError} from './parse-error.js';
|
||||||
import {parseUserMenu} from './parse-user-menu.mjs';
|
import {parseUserMenu} from './parse-user-menu.js';
|
||||||
import {runSelected} from './run.mjs';
|
import {runSelected} from './run.js';
|
||||||
|
|
||||||
const loadCSS = load.css;
|
const loadCSS = load.css;
|
||||||
const sourceStore = fullstore();
|
const sourceStore = fullstore();
|
||||||
|
|
@ -4,7 +4,7 @@ import {
|
||||||
K,
|
K,
|
||||||
UP,
|
UP,
|
||||||
DOWN,
|
DOWN,
|
||||||
} from '../../key/key.mjs';
|
} from '../../key/key.js';
|
||||||
|
|
||||||
const store = fullstore(1);
|
const store = fullstore(1);
|
||||||
const isDigit = (a) => /^\d+$/.test(a);
|
const isDigit = (a) => /^\d+$/.test(a);
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {navigate} from './navigate.mjs';
|
import {navigate} from './navigate.js';
|
||||||
import {
|
import {
|
||||||
UP,
|
UP,
|
||||||
DOWN,
|
DOWN,
|
||||||
J,
|
J,
|
||||||
K,
|
K,
|
||||||
} from '../../key/key.mjs';
|
} from '../../key/key.js';
|
||||||
|
|
||||||
test('cloudcmd: user-menu: navigate: DOWN', (t) => {
|
test('cloudcmd: user-menu: navigate: DOWN', (t) => {
|
||||||
const el = {
|
const el = {
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import test from 'supertape';
|
import test from 'supertape';
|
||||||
import {parseError} from './parse-error.mjs';
|
import {parseError} from './parse-error.js';
|
||||||
|
|
||||||
test('user-menu: parse-error', (t) => {
|
test('user-menu: parse-error', (t) => {
|
||||||
const result = parseError({
|
const result = parseError({
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import {parseUserMenu} from './parse-user-menu.mjs';
|
import {parseUserMenu} from './parse-user-menu.js';
|
||||||
|
|
||||||
test('cloudcmd: user menu: parse', (t) => {
|
test('cloudcmd: user menu: parse', (t) => {
|
||||||
const fn = stub();
|
const fn = stub();
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {test, stub} from 'supertape';
|
import {test, stub} from 'supertape';
|
||||||
import {runSelected} from './run.mjs';
|
import {runSelected} from './run.js';
|
||||||
|
|
||||||
test('cloudcmd: client: user menu: run', async (t) => {
|
test('cloudcmd: client: user menu: run', async (t) => {
|
||||||
const runUserMenu = stub();
|
const runUserMenu = stub();
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
isImage,
|
isImage,
|
||||||
isAudio,
|
isAudio,
|
||||||
getType,
|
getType,
|
||||||
} from './types.mjs';
|
} from './types.js';
|
||||||
|
|
||||||
const CloudCmd = globalThis.CloudCmd || {};
|
const CloudCmd = globalThis.CloudCmd || {};
|
||||||
const DOM = globalThis.DOM || {};
|
const DOM = globalThis.DOM || {};
|
||||||
|
|
@ -6,7 +6,7 @@ import {
|
||||||
_viewHtml,
|
_viewHtml,
|
||||||
_Config,
|
_Config,
|
||||||
_createIframe,
|
_createIframe,
|
||||||
} from './index.mjs';
|
} from './index.js';
|
||||||
|
|
||||||
const test = autoGlobals(tape);
|
const test = autoGlobals(tape);
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue