mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-22 18:29:26 +00:00
chore: cloudcmd: actions: lint ☘️
This commit is contained in:
parent
9f52ed795d
commit
84c6935ae4
7 changed files with 73 additions and 72 deletions
|
|
@ -19,7 +19,8 @@ await main();
|
|||
async function main() {
|
||||
const history = '## Version history\n\n';
|
||||
const link = '//github.com/coderaiser/cloudcmd/releases/tag/';
|
||||
const template = '- *{{ date }}*, ' +
|
||||
const template =
|
||||
'- *{{ date }}*, ' +
|
||||
'**[v{{ version }}]' +
|
||||
'(' + link +
|
||||
'v{{ version }})**\n';
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ module.exports.buildFromJSON = (params) => {
|
|||
Path(path);
|
||||
|
||||
fileTable += `${header}<ul data-name="js-files" class="files">`;
|
||||
|
||||
/* Если мы не в корне */
|
||||
if (path !== '/') {
|
||||
const dotDot = getDotDot(path);
|
||||
|
|
@ -204,43 +203,43 @@ module.exports.buildFromJSON = (params) => {
|
|||
|
||||
fileTable += files
|
||||
.filter(filterOutDotFiles({
|
||||
showDotFiles,
|
||||
}))
|
||||
showDotFiles,
|
||||
}))
|
||||
.map(updateField)
|
||||
.map((file) => {
|
||||
const name = encode(file.name);
|
||||
const link = prefix + FS + path + name;
|
||||
|
||||
const {
|
||||
type,
|
||||
mode,
|
||||
date,
|
||||
owner,
|
||||
size,
|
||||
} = file;
|
||||
|
||||
const linkResult = rendy(templateLink, {
|
||||
link,
|
||||
title: name,
|
||||
name,
|
||||
attribute: getAttribute(file.type),
|
||||
});
|
||||
|
||||
const dataName = getDataName(file.name);
|
||||
const attribute = `draggable="true" ${dataName}`;
|
||||
|
||||
return rendy(templateFile, {
|
||||
tag: 'li',
|
||||
attribute,
|
||||
className: '',
|
||||
type,
|
||||
name: linkResult,
|
||||
size,
|
||||
date,
|
||||
owner,
|
||||
mode,
|
||||
});
|
||||
})
|
||||
const name = encode(file.name);
|
||||
const link = prefix + FS + path + name;
|
||||
|
||||
const {
|
||||
type,
|
||||
mode,
|
||||
date,
|
||||
owner,
|
||||
size,
|
||||
} = file;
|
||||
|
||||
const linkResult = rendy(templateLink, {
|
||||
link,
|
||||
title: name,
|
||||
name,
|
||||
attribute: getAttribute(file.type),
|
||||
});
|
||||
|
||||
const dataName = getDataName(file.name);
|
||||
const attribute = `draggable="true" ${dataName}`;
|
||||
|
||||
return rendy(templateFile, {
|
||||
tag: 'li',
|
||||
attribute,
|
||||
className: '',
|
||||
type,
|
||||
name: linkResult,
|
||||
size,
|
||||
date,
|
||||
owner,
|
||||
mode,
|
||||
});
|
||||
})
|
||||
.join('');
|
||||
|
||||
fileTable += '</ul>';
|
||||
|
|
|
|||
|
|
@ -6,22 +6,22 @@ const repl = require('node:repl');
|
|||
|
||||
module.exports = net
|
||||
.createServer((socket) => {
|
||||
const {pid} = process;
|
||||
const addr = socket.remoteAddress;
|
||||
const port = socket.remotePort;
|
||||
|
||||
const r = repl.start({
|
||||
prompt: `[${pid} ${addr}:${port}>`,
|
||||
input: socket,
|
||||
output: socket,
|
||||
terminal: true,
|
||||
useGlobal: false,
|
||||
});
|
||||
|
||||
r.on('exit', () => {
|
||||
socket.end();
|
||||
});
|
||||
|
||||
r.context.socket = socket;
|
||||
})
|
||||
const {pid} = process;
|
||||
const addr = socket.remoteAddress;
|
||||
const port = socket.remotePort;
|
||||
|
||||
const r = repl.start({
|
||||
prompt: `[${pid} ${addr}:${port}>`,
|
||||
input: socket,
|
||||
output: socket,
|
||||
terminal: true,
|
||||
useGlobal: false,
|
||||
});
|
||||
|
||||
r.on('exit', () => {
|
||||
socket.end();
|
||||
});
|
||||
|
||||
r.context.socket = socket;
|
||||
})
|
||||
.listen(1337);
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ module.exports = (config) => {
|
|||
const data = Object
|
||||
.keys(config)
|
||||
.map((name) => [
|
||||
name,
|
||||
config[name],
|
||||
]);
|
||||
name,
|
||||
config[name],
|
||||
]);
|
||||
|
||||
if (!data.length)
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ async function onGET({req, res, menuName, readFile}) {
|
|||
function getError(error, source) {
|
||||
return montag`
|
||||
const e = Error(\`<pre>${codeframe({
|
||||
error,
|
||||
source,
|
||||
highlightCode: false,
|
||||
})}</pre>\`);
|
||||
error,
|
||||
source,
|
||||
highlightCode: false,
|
||||
})}</pre>\`);
|
||||
|
||||
e.code = 'frame';
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ const data = {
|
|||
}],
|
||||
};
|
||||
|
||||
let Expect = '<div data-name="js-path" class="reduce-text" title="/etc/X11/">' +
|
||||
let Expect =
|
||||
'<div data-name="js-path" class="reduce-text" title="/etc/X11/">' +
|
||||
'<span data-name="js-copy-path" class="path-icon icon-copy-to-clipboard"' +
|
||||
' title="copy path (Ctrl+P)">' +
|
||||
'</span>' +
|
||||
|
|
@ -74,13 +75,13 @@ test('cloudfunc: render', (t) => {
|
|||
const isNotOk = Expect
|
||||
.split('')
|
||||
.some((item, number) => {
|
||||
const ret = result[number] !== item;
|
||||
|
||||
if (ret)
|
||||
i = number;
|
||||
|
||||
return ret;
|
||||
});
|
||||
const ret = result[number] !== item;
|
||||
|
||||
if (ret)
|
||||
i = number;
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
||||
timeEnd('CloudFunc.buildFromJSON');
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ test('cloudcmd: rest: pack: zip: put: file', async (t) => {
|
|||
config,
|
||||
};
|
||||
|
||||
const name = String(Math.random()) + '.zip';
|
||||
const name = `${Math.random()}.zip`;
|
||||
|
||||
await request.put(`/api/v1/pack`, {
|
||||
options,
|
||||
|
|
@ -192,7 +192,7 @@ test('cloudcmd: rest: pack: zip: put: response', async (t) => {
|
|||
config,
|
||||
};
|
||||
|
||||
const name = String(Math.random()) + '.zip';
|
||||
const name = `${Math.random()}.zip`;
|
||||
|
||||
const {body} = await request.put(`/api/v1/pack`, {
|
||||
options,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue