mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
chore(cloudcmd) lint
This commit is contained in:
parent
81e76857da
commit
ef10ebe97c
40 changed files with 137 additions and 134 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module.exports = {
|
||||
extends: [
|
||||
'plugin:putout/recommended',
|
||||
'plugin:putout/safe',
|
||||
],
|
||||
plugins: [
|
||||
'putout',
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ const {
|
|||
join,
|
||||
} = require('path');
|
||||
|
||||
const {env} = process;
|
||||
const isDev = env.NODE_ENV === 'development';
|
||||
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||
|
||||
const {env} = process;
|
||||
const isDev = env.NODE_ENV === 'development';
|
||||
|
||||
const extractCSS = (a) => new ExtractTextPlugin(`${a}.css`);
|
||||
const extractMain = extractCSS('[name]');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const {env} = process;
|
||||
const isDev = env.NODE_ENV === 'development';
|
||||
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const {env} = process;
|
||||
|
||||
const isDev = env.NODE_ENV === 'development';
|
||||
|
||||
const plugins = [
|
||||
new HtmlWebpackPlugin({
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const DIR_SERVER = '../server/';
|
||||
|
||||
import {createRequire} from 'module';
|
||||
import {promisify} from 'util';
|
||||
import tryToCatch from 'try-to-catch';
|
||||
|
|
@ -14,13 +12,17 @@ import {
|
|||
configPath,
|
||||
} from '../server/config.js';
|
||||
|
||||
const config = createConfig({
|
||||
configPath,
|
||||
});
|
||||
|
||||
import env from '../server/env.js';
|
||||
import prefixer from '../server/prefixer.js';
|
||||
|
||||
process.on('unhandledRejection', exit);
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
const Info = require('../package.json');
|
||||
|
||||
const simport = createSimport(import.meta.url);
|
||||
|
||||
const choose = (a, b) => {
|
||||
if (a === undefined)
|
||||
return b;
|
||||
|
|
@ -28,12 +30,11 @@ const choose = (a, b) => {
|
|||
return a;
|
||||
};
|
||||
|
||||
process.on('unhandledRejection', exit);
|
||||
const config = createConfig({
|
||||
configPath,
|
||||
});
|
||||
|
||||
const simport = createSimport(import.meta.url);
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
const Info = require('../package.json');
|
||||
const DIR_SERVER = '../server/';
|
||||
|
||||
const maybeRoot = (a) => {
|
||||
if (a === '.')
|
||||
|
|
|
|||
|
|
@ -11,15 +11,11 @@ const {addSlashToEnd} = require('format-io');
|
|||
const pascalCase = require('just-pascal-case');
|
||||
const currify = require('currify');
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const Images = require('./dom/images');
|
||||
|
||||
const {unregisterSW} = require('./sw/register');
|
||||
const getJsonFromFileTable = require('./get-json-from-file-table');
|
||||
const Key = require('./key');
|
||||
|
||||
const noJS = (a) => a.replace(/.js$/, '');
|
||||
|
||||
const {
|
||||
apiURL,
|
||||
formatMsg,
|
||||
|
|
@ -28,6 +24,10 @@ const {
|
|||
|
||||
const loadModule = require('./load-module');
|
||||
|
||||
const noJS = (a) => a.replace(/.js$/, '');
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
inherits(CloudCmdProto, Emitify);
|
||||
|
||||
module.exports = new CloudCmdProto(DOM);
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ require('../css/columns/name-size.css');
|
|||
const wraptile = require('wraptile');
|
||||
const load = require('load.js');
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const {
|
||||
registerSW,
|
||||
listenSW,
|
||||
} = require('./sw/register');
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
// prevent additional loading of emitify
|
||||
window.Emitify = require('emitify');
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ const {
|
|||
stub,
|
||||
} = require('supertape');
|
||||
const {create} = require('auto-globals');
|
||||
const id = (a) => a;
|
||||
const wraptile = require('wraptile');
|
||||
const returns = wraptile(id);
|
||||
|
||||
const currentFile = require('./current-file');
|
||||
const id = (a) => a;
|
||||
|
||||
const returns = wraptile(id);
|
||||
const {_CURRENT_FILE} = currentFile;
|
||||
|
||||
test('current-file: setCurrentName: setAttribute', (t) => {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ test('event-store: get', (t) => {
|
|||
[el, name, fn],
|
||||
];
|
||||
|
||||
t.deepEqual(result, expected, 'should equal');
|
||||
t.deepEqual(result, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
@ -29,6 +29,6 @@ test('event-store: clear', (t) => {
|
|||
const result = eventStore.get();
|
||||
const expected = [];
|
||||
|
||||
t.deepEqual(result, expected, 'should equal');
|
||||
t.deepEqual(result, expected);
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ const {alert} = require('./dialog');
|
|||
|
||||
const {FS} = require('../../common/cloudfunc');
|
||||
|
||||
const onEnd = wraptile(_onEnd);
|
||||
const {getCurrentDirPath: getPathWhenRootEmpty} = require('.');
|
||||
const loadFile = wraptile(_loadFile);
|
||||
|
||||
const {getCurrentDirPath: getPathWhenRootEmpty} = require('.');
|
||||
const onEnd = wraptile(_onEnd);
|
||||
|
||||
module.exports = (dir, files) => {
|
||||
if (!files) {
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
/* global CloudCmd, DOM */
|
||||
|
||||
const Info = DOM.CurrentInfo;
|
||||
|
||||
const clipboard = require('@cloudcmd/clipboard');
|
||||
|
||||
const Buffer = require('../dom/buffer');
|
||||
const Events = require('../dom/events');
|
||||
|
||||
const Events = require('../dom/events');
|
||||
const KEY = require('./key');
|
||||
|
||||
const vim = require('./vim');
|
||||
const setCurrentByChar = require('./set-current-by-char');
|
||||
const {createBinder} = require('./binder');
|
||||
|
||||
const fullstore = require('fullstore');
|
||||
|
||||
const Info = DOM.CurrentInfo;
|
||||
const Chars = fullstore();
|
||||
|
||||
const toggleVim = (keyCode) => {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
const autoGlobals = require('auto-globals');
|
||||
const test = autoGlobals(require('supertape'));
|
||||
const stub = require('@cloudcmd/stub');
|
||||
const mockRequire = require('mock-require');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
const {ESC} = require('./key');
|
||||
|
||||
const {
|
||||
getDOM,
|
||||
getCloudCmd,
|
||||
} = require('./vim/globals.fixture');
|
||||
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
const test = autoGlobals(require('supertape'));
|
||||
|
||||
global.DOM = getDOM();
|
||||
global.CloudCmd = getCloudCmd();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const Info = DOM.CurrentInfo;
|
||||
const {escapeRegExp} = require('../../common/util');
|
||||
const Info = DOM.CurrentInfo;
|
||||
|
||||
module.exports = function setCurrentByChar(char, charStore) {
|
||||
let firstByName;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,10 @@ const {
|
|||
stub,
|
||||
} = require('supertape');
|
||||
const mockRequire = require('mock-require');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
const dir = '../';
|
||||
|
||||
const pathVim = join(dir, 'vim');
|
||||
const pathFind = join(dir, 'vim', 'find');
|
||||
|
||||
const {
|
||||
getDOM,
|
||||
|
|
@ -22,11 +20,14 @@ const {
|
|||
global.DOM = getDOM();
|
||||
global.CloudCmd = getCloudCmd();
|
||||
|
||||
const {DOM} = global;
|
||||
const {Buffer} = DOM;
|
||||
|
||||
const vim = require(pathVim);
|
||||
|
||||
const {DOM} = global;
|
||||
|
||||
const {Buffer} = DOM;
|
||||
const pathFind = join(dir, 'vim', 'find');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
test('cloudcmd: client: key: set next file: no', (t) => {
|
||||
const element = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ const tryToCatch = require('try-to-catch');
|
|||
const clipboard = require('@cloudcmd/clipboard');
|
||||
|
||||
const getRange = require('./get-range');
|
||||
const getIndex = currify(require('./get-index'));
|
||||
const uploadFiles = require('../dom/upload-files');
|
||||
|
||||
const {FS} = require('../../common/cloudfunc');
|
||||
|
||||
const getIndex = currify(require('./get-index'));
|
||||
|
||||
const NBSP_REG = RegExp(String.fromCharCode(160), 'g');
|
||||
const SPACE = ' ';
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ const exec = require('execon');
|
|||
const currify = require('currify');
|
||||
const load = require('load.js');
|
||||
|
||||
const {log} = CloudCmd;
|
||||
|
||||
const {ajax} = require('../dom/load');
|
||||
|
||||
const Files = require('../dom/files');
|
||||
const Images = require('../dom/images');
|
||||
const {log} = CloudCmd;
|
||||
|
||||
const upload = currify(_upload);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ const {promisify} = require('es6-promisify');
|
|||
const tryToCatch = require('try-to-catch');
|
||||
const createElement = require('@cloudcmd/create-element');
|
||||
const load = require('load.js');
|
||||
const loadJS = load.js;
|
||||
|
||||
const {MAX_FILE_SIZE: maxSize} = require('../../common/cloudfunc');
|
||||
|
||||
const {time, timeEnd} = require('../../common/util');
|
||||
const loadJS = load.js;
|
||||
|
||||
const Name = 'Edit';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
/* global DOM */
|
||||
|
||||
const forEachKey = require('for-each-key');
|
||||
|
||||
const wraptile = require('wraptile');
|
||||
const format = require('./format');
|
||||
|
||||
const {
|
||||
Dialog,
|
||||
Images,
|
||||
} = DOM;
|
||||
|
||||
const forEachKey = require('for-each-key');
|
||||
const wraptile = require('wraptile');
|
||||
|
||||
const format = require('./format');
|
||||
|
||||
module.exports = (options) => (emitter) => {
|
||||
const {
|
||||
operation,
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
require('css-modules-require-hook/preset');
|
||||
|
||||
const autoGlobals = require('auto-globals');
|
||||
const test = autoGlobals(require('supertape'));
|
||||
const stub = require('@cloudcmd/stub');
|
||||
const mockRequire = require('mock-require');
|
||||
const test = autoGlobals(require('supertape'));
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
test('cloudcmd: client: view: initConfig', (t) => {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
const autoGlobals = require('auto-globals');
|
||||
const tape = require('supertape');
|
||||
|
||||
const test = autoGlobals(tape);
|
||||
|
||||
const stub = require('@cloudcmd/stub');
|
||||
|
||||
const tryCatch = require('try-catch');
|
||||
const {reRequire} = require('mock-require');
|
||||
const test = autoGlobals(tape);
|
||||
|
||||
test('sw: listen', (t) => {
|
||||
const {listenSW} = reRequire('./register');
|
||||
|
|
|
|||
|
|
@ -1,20 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
const DIR = __dirname + '/';
|
||||
const DIR_ROOT = DIR + '../';
|
||||
const DIR_COMMON = DIR + '../common/';
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const fs = require('fs');
|
||||
const cloudfunc = require(DIR_COMMON + 'cloudfunc');
|
||||
|
||||
const authentication = require(DIR + 'auth');
|
||||
const {
|
||||
createConfig,
|
||||
configPath,
|
||||
} = require(DIR + 'config');
|
||||
|
||||
const modulas = require(DIR + 'modulas');
|
||||
|
||||
const userMenu = require(DIR + 'user-menu');
|
||||
const rest = require(DIR + 'rest');
|
||||
const route = require(DIR + 'route');
|
||||
|
|
@ -22,8 +21,8 @@ const validate = require(DIR + 'validate');
|
|||
const prefixer = require(DIR + 'prefixer');
|
||||
const terminal = require(DIR + 'terminal');
|
||||
const distribute = require(DIR + 'distribute');
|
||||
|
||||
const currify = require('currify');
|
||||
|
||||
const apart = require('apart');
|
||||
const ponse = require('ponse');
|
||||
const restafary = require('restafary');
|
||||
|
|
@ -34,6 +33,7 @@ const dword = require('dword');
|
|||
const deepword = require('deepword');
|
||||
const nomine = require('nomine');
|
||||
const fileop = require('@cloudcmd/fileop');
|
||||
const DIR_ROOT = DIR + '../';
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const getDist = (isDev) => isDev ? 'dist-dev' : 'dist';
|
||||
|
|
|
|||
|
|
@ -12,12 +12,6 @@ const DIR = './';
|
|||
const cloudcmdPath = DIR + 'cloudcmd';
|
||||
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
const {
|
||||
createConfigManager,
|
||||
_getPrefix,
|
||||
_initAuth,
|
||||
} = cloudcmd;
|
||||
|
||||
const {request} = require('serve-once')(cloudcmd, {
|
||||
config: {
|
||||
auth: false,
|
||||
|
|
@ -25,6 +19,12 @@ const {request} = require('serve-once')(cloudcmd, {
|
|||
},
|
||||
});
|
||||
|
||||
const {
|
||||
createConfigManager,
|
||||
_getPrefix,
|
||||
_initAuth,
|
||||
} = cloudcmd;
|
||||
|
||||
test('cloudcmd: defaults: config', (t) => {
|
||||
const configManager = createConfigManager();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,16 @@
|
|||
|
||||
const DIR_SERVER = __dirname + '/';
|
||||
const DIR_COMMON = '../common/';
|
||||
const DIR = DIR_SERVER + '../';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const fs = require('fs');
|
||||
const Emitter = require('events');
|
||||
const {homedir} = require('os');
|
||||
|
||||
const exit = require(DIR_SERVER + 'exit');
|
||||
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
||||
|
||||
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
||||
const currify = require('currify');
|
||||
|
||||
const wraptile = require('wraptile');
|
||||
const tryToCatch = require('try-to-catch');
|
||||
const pullout = require('pullout');
|
||||
|
|
@ -22,6 +21,7 @@ const jju = require('jju');
|
|||
const writejson = require('writejson');
|
||||
const tryCatch = require('try-catch');
|
||||
const criton = require('criton');
|
||||
const DIR = DIR_SERVER + '../';
|
||||
const HOME = homedir();
|
||||
|
||||
const resolve = Promise.resolve.bind(Promise);
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ const {
|
|||
createConfig,
|
||||
_cryptoPass,
|
||||
} = require(configPath);
|
||||
const config = createConfig();
|
||||
|
||||
const {apiURL} = require(root + 'common/cloudfunc');
|
||||
|
||||
const fixture = require('./config.fixture');
|
||||
|
||||
const {connect} = require('../test/before');
|
||||
const config = createConfig();
|
||||
|
||||
test('config: manage', (t) => {
|
||||
t.equal(undefined, config(), 'should return "undefined"');
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ const squad = require('squad');
|
|||
const fullstore = require('fullstore');
|
||||
|
||||
const io = require('socket.io-client');
|
||||
const forEachKey = currify(require('for-each-key'));
|
||||
|
||||
const log = require('./log');
|
||||
|
||||
const env = require('../env');
|
||||
const forEachKey = currify(require('for-each-key'));
|
||||
|
||||
const {
|
||||
importStr,
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ const ponse = require('ponse');
|
|||
const threadIt = require('thread-it');
|
||||
const {read} = require('redzip');
|
||||
|
||||
const parse = threadIt(join(__dirname, 'worker'));
|
||||
|
||||
const root = require('../root');
|
||||
|
||||
const parse = threadIt(join(__dirname, 'worker'));
|
||||
|
||||
threadIt.init();
|
||||
|
||||
// warm up
|
||||
|
|
|
|||
|
|
@ -10,20 +10,20 @@ const test = require('supertape');
|
|||
|
||||
const markdown = require('.');
|
||||
|
||||
const _markdown = promisify(markdown);
|
||||
const fixtureDir = join(__dirname, 'fixture');
|
||||
const cloudcmd = require('../..');
|
||||
const config = {
|
||||
auth: false,
|
||||
};
|
||||
|
||||
const configManager = cloudcmd.createConfigManager();
|
||||
|
||||
const {request} = require('serve-once')(cloudcmd, {
|
||||
config,
|
||||
configManager,
|
||||
});
|
||||
|
||||
const fixtureDir = join(__dirname, 'fixture');
|
||||
|
||||
const _markdown = promisify(markdown);
|
||||
|
||||
test('cloudcmd: markdown: error', async (t) => {
|
||||
const {body} = await request.get('/api/v1/markdown/not-found');
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ const root = require(DIR_SERVER + 'root');
|
|||
const prefixer = require(DIR_SERVER + 'prefixer');
|
||||
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
||||
|
||||
const getPrefix = (config) => prefixer(config('prefix'));
|
||||
const Columns = require(`${DIR_SERVER}/columns`);
|
||||
|
||||
const onceRequire = once(require);
|
||||
const Template = require(`${DIR_SERVER}/template`);
|
||||
|
||||
const {FS} = CloudFunc;
|
||||
|
||||
const sendIndex = (params, data) => {
|
||||
const ponseParams = {
|
||||
|
|
@ -33,10 +35,8 @@ const sendIndex = (params, data) => {
|
|||
ponse.send(data, ponseParams);
|
||||
};
|
||||
|
||||
const {FS} = CloudFunc;
|
||||
|
||||
const Columns = require(`${DIR_SERVER}/columns`);
|
||||
const Template = require(`${DIR_SERVER}/template`);
|
||||
const onceRequire = once(require);
|
||||
const getPrefix = (config) => prefixer(config('prefix'));
|
||||
|
||||
const getReadDir = (config) => {
|
||||
if (!config('dropbox'))
|
||||
|
|
|
|||
|
|
@ -8,19 +8,19 @@ const fs = require('fs');
|
|||
const tryToCatch = require('try-to-catch');
|
||||
const {test, stub} = require('supertape');
|
||||
const mockRequire = require('mock-require');
|
||||
const cloudcmdPath = './cloudcmd';
|
||||
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
|
||||
const serveOnce = require('serve-once');
|
||||
const {createConfigManager} = cloudcmd;
|
||||
|
||||
const routePath = './route';
|
||||
const fixtureDir = path.join(__dirname, '..', 'test', 'fixture');
|
||||
const {
|
||||
reRequire,
|
||||
stopAll,
|
||||
} = mockRequire;
|
||||
|
||||
const fixtureDir = path.join(__dirname, '..', 'test', 'fixture');
|
||||
|
||||
const routePath = './route';
|
||||
const cloudcmdPath = './cloudcmd';
|
||||
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
const {createConfigManager} = cloudcmd;
|
||||
const serveOnce = require('serve-once');
|
||||
const defaultConfig = {
|
||||
auth: false,
|
||||
dropbox: false,
|
||||
|
|
|
|||
|
|
@ -12,25 +12,25 @@ const wraptile = require('wraptile');
|
|||
const compression = require('compression');
|
||||
const threadIt = require('thread-it');
|
||||
|
||||
const two = currify((f, a, b) => f(a, b));
|
||||
const exit = require(DIR_SERVER + 'exit');
|
||||
const opn = require('open');
|
||||
|
||||
const express = require('express');
|
||||
const io = require('socket.io');
|
||||
const tryRequire = require('tryrequire');
|
||||
|
||||
const exitPort = two(exit, 'cloudcmd --port: %s');
|
||||
const bind = (f, self) => f.bind(self);
|
||||
const promisifySelf = squad(promisify, bind);
|
||||
|
||||
const two = currify((f, a, b) => f(a, b));
|
||||
const shutdown = wraptile(async (promises) => {
|
||||
console.log('closing cloudcmd...');
|
||||
await Promise.all(promises);
|
||||
threadIt.terminate();
|
||||
process.exit(0);
|
||||
});
|
||||
const promisifySelf = squad(promisify, bind);
|
||||
|
||||
const opn = require('open');
|
||||
const express = require('express');
|
||||
const io = require('socket.io');
|
||||
|
||||
const tryRequire = require('tryrequire');
|
||||
const exitPort = two(exit, 'cloudcmd --port: %s');
|
||||
const logger = tryRequire('morgan');
|
||||
|
||||
module.exports = async (options, config) => {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ const {
|
|||
|
||||
const mockRequire = require('mock-require');
|
||||
|
||||
const terminalPath = './terminal';
|
||||
const terminal = require('./terminal');
|
||||
const {createConfigManager} = require('./cloudcmd');
|
||||
const terminalPath = './terminal';
|
||||
|
||||
const {stopAll} = mockRequire;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ const {
|
|||
} = require('supertape');
|
||||
const tryCatch = require('try-catch');
|
||||
const mockRequire = require('mock-require');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
const dir = '..';
|
||||
|
||||
const validatePath = `${dir}/server/validate`;
|
||||
const exitPath = `${dir}/server/exit`;
|
||||
const columnsPath = `${dir}/server/columns`;
|
||||
const cloudcmdPath = `${dir}/server/cloudcmd`;
|
||||
|
||||
const cloudcmdPath = `${dir}/server/cloudcmd`;
|
||||
const validate = require(validatePath);
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
const columnsPath = `${dir}/server/columns`;
|
||||
|
||||
const exitPath = `${dir}/server/exit`;
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
test('validate: root: bad', (t) => {
|
||||
const config = {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
const autoGlobals = require('auto-globals');
|
||||
const test = autoGlobals(require('supertape'));
|
||||
const stub = require('@cloudcmd/stub');
|
||||
const tryToCatch = require('try-to-catch');
|
||||
const wraptile = require('wraptile');
|
||||
|
||||
const defaultMenu = require('./user-menu');
|
||||
|
||||
const test = autoGlobals(require('supertape'));
|
||||
|
||||
const {create} = autoGlobals;
|
||||
|
||||
const {_data} = defaultMenu;
|
||||
|
|
@ -173,7 +173,7 @@ test('cloudcmd: static: user menu: compare directories: select names: compare',
|
|||
2,
|
||||
];
|
||||
|
||||
t.deepEqual(result, expected, 'should equal');
|
||||
t.deepEqual(result, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ const tryCatch = require('try-catch');
|
|||
|
||||
const DIR = __dirname + '/../../';
|
||||
const COMMONDIR = DIR + 'common/';
|
||||
const TMPLDIR = DIR + 'tmpl/';
|
||||
|
||||
const {
|
||||
time,
|
||||
timeEnd,
|
||||
|
|
@ -17,10 +15,12 @@ const CloudFuncPath = COMMONDIR + 'cloudfunc';
|
|||
const CloudFunc = require(CloudFuncPath);
|
||||
|
||||
const test = require('supertape');
|
||||
const {reRequire} = require('mock-require');
|
||||
|
||||
const {reRequire} = require('mock-require');
|
||||
const htmlLooksLike = require('html-looks-like');
|
||||
|
||||
const readFilesSync = require('@cloudcmd/read-files-sync');
|
||||
const TMPLDIR = DIR + 'tmpl/';
|
||||
|
||||
const FS_DIR = TMPLDIR + 'fs/';
|
||||
const EXPECT_PATH = __dirname + '/cloudfunc.html';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ const {join} = require('path');
|
|||
const test = require('supertape');
|
||||
const rimraf = require('rimraf');
|
||||
|
||||
const fixtureDir = join(__dirname, '..', 'fixture') + '/';
|
||||
const config = {
|
||||
root: join(__dirname, '..'),
|
||||
};
|
||||
|
|
@ -19,6 +18,8 @@ const {request} = require('serve-once')(cloudcmd, {
|
|||
configManager,
|
||||
});
|
||||
|
||||
const fixtureDir = join(__dirname, '..', 'fixture') + '/';
|
||||
|
||||
test('cloudcmd: rest: copy', async (t) => {
|
||||
const tmp = join(fixtureDir, 'tmp');
|
||||
const files = {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ const {Volume} = require('memfs');
|
|||
const {ufs} = require('unionfs');
|
||||
|
||||
const mockRequire = require('mock-require');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
const serveOnce = require('serve-once');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
const cloudcmdPath = '../../';
|
||||
const dir = cloudcmdPath + 'server/';
|
||||
|
|
|
|||
|
|
@ -14,10 +14,9 @@ const pathTarFixture = join(__dirname, '..', 'fixture/pack.tar.gz');
|
|||
const pathZipFixture = join(__dirname, '..', 'fixture/pack.zip');
|
||||
const cloudcmdPath = '../..';
|
||||
|
||||
const fixture = {
|
||||
tar: fs.readFileSync(pathTarFixture),
|
||||
zip: fs.readFileSync(pathZipFixture),
|
||||
};
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
|
||||
const serveOnce = require('serve-once');
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
|
@ -26,9 +25,10 @@ const defaultOptions = {
|
|||
},
|
||||
};
|
||||
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
|
||||
const serveOnce = require('serve-once');
|
||||
const fixture = {
|
||||
tar: fs.readFileSync(pathTarFixture),
|
||||
zip: fs.readFileSync(pathZipFixture),
|
||||
};
|
||||
const {request} = serveOnce(cloudcmd, defaultOptions);
|
||||
|
||||
const once = promisify((name, extract, fn) => {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ const {Volume} = require('memfs');
|
|||
const {ufs} = require('unionfs');
|
||||
|
||||
const mockRequire = require('mock-require');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
const serveOnce = require('serve-once');
|
||||
const {reRequire, stopAll} = mockRequire;
|
||||
|
||||
const cloudcmdPath = '../../';
|
||||
const dir = cloudcmdPath + 'server/';
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ const {once} = require('events');
|
|||
const test = require('supertape');
|
||||
const io = require('socket.io-client');
|
||||
|
||||
const configPath = path.join(__dirname, '../..', 'server', 'config');
|
||||
const {connect} = require('../before');
|
||||
const configPath = path.join(__dirname, '../..', 'server', 'config');
|
||||
const configFn = require(configPath).createConfig();
|
||||
|
||||
test('cloudcmd: console: enabled', async (t) => {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ test('cloudcmd: modules', async (t) => {
|
|||
options,
|
||||
});
|
||||
|
||||
t.deepEqual(body, expected, 'should equal');
|
||||
t.deepEqual(body, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ const test = require('supertape');
|
|||
const criton = require('criton');
|
||||
|
||||
const cloudcmd = require('..');
|
||||
const configFn = cloudcmd.createConfigManager();
|
||||
|
||||
const config = {
|
||||
auth: false,
|
||||
};
|
||||
|
||||
const {request} = require('serve-once')(cloudcmd, {
|
||||
config,
|
||||
});
|
||||
const configFn = cloudcmd.createConfigManager();
|
||||
|
||||
test('cloudcmd: static', async (t) => {
|
||||
const name = 'package.json';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue