From a266c1452c65bee5f86d7ab080a032c41f6df9ce Mon Sep 17 00:00:00 2001 From: coderiaser Date: Tue, 3 Feb 2026 20:08:18 +0200 Subject: [PATCH] fix: cloudcmd: default -> named --- README.md | 2 +- package.json | 3 ++- server/cloudcmd.js | 4 +--- server/cloudcmd.spec.js | 2 +- server/distribute/import.spec.js | 2 +- server/markdown/index.spec.js | 2 +- server/route.spec.js | 2 +- server/server.js | 2 +- server/terminal.spec.js | 2 +- server/validate.spec.js | 2 +- test/before.js | 2 +- test/rest/config.js | 2 +- test/rest/copy.js | 2 +- test/rest/fs.js | 2 +- test/rest/move.js | 2 +- test/rest/pack.js | 2 +- test/rest/rename.js | 2 +- test/server/modulas.js | 2 +- test/static.js | 2 +- 19 files changed, 20 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ba8f2659..e10fb628 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ And create `index.js`: ```js import http from 'node:http'; -import cloudcmd from 'cloudcmd'; +import {cloudcmd} from 'cloudcmd'; import {Server} from 'socket.io'; import express from 'express'; diff --git a/package.json b/package.json index fe2b35a5..2acbce91 100644 --- a/package.json +++ b/package.json @@ -232,7 +232,8 @@ "#dom/rest": "./client/dom/rest.js", "#common/util": "./common/util.js", "#common/cloudfunc": "./common/cloudfunc.js", - "#common/entity": "./common/entity.js" + "#common/entity": "./common/entity.js", + "#server/cloudcmd": "./server/cloudcmd.js" }, "engines": { "node": ">=22" diff --git a/server/cloudcmd.js b/server/cloudcmd.js index a135b14e..60637c79 100644 --- a/server/cloudcmd.js +++ b/server/cloudcmd.js @@ -46,9 +46,7 @@ const clean = (a) => a.filter(notEmpty); const isUndefined = (a) => typeof a === 'undefined'; const isFn = (a) => typeof a === 'function'; -export default cloudcmd; - -function cloudcmd(params) { +export function cloudcmd(params) { const p = params || {}; const options = p.config || {}; const config = p.configManager || createConfig({ diff --git a/server/cloudcmd.spec.js b/server/cloudcmd.spec.js index 65344534..ace68e25 100644 --- a/server/cloudcmd.spec.js +++ b/server/cloudcmd.spec.js @@ -9,7 +9,7 @@ import cloudcmd, { _getPrefix, _initAuth, _getIndexPath, -} from './cloudcmd.js'; +} from '#server/cloudcmd'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); diff --git a/server/distribute/import.spec.js b/server/distribute/import.spec.js index f5e2539c..10e246be 100644 --- a/server/distribute/import.spec.js +++ b/server/distribute/import.spec.js @@ -2,8 +2,8 @@ import process from 'node:process'; import {promisify} from 'node:util'; import test from 'supertape'; import {tryToCatch} from 'try-to-catch'; +import {createConfigManager} from '#server/cloudcmd'; import {connect} from '../../test/before.js'; -import {createConfigManager} from '../cloudcmd.js'; import {distributeImport} from './import.js'; const distribute = { diff --git a/server/markdown/index.spec.js b/server/markdown/index.spec.js index f0f425ba..5a337bd9 100644 --- a/server/markdown/index.spec.js +++ b/server/markdown/index.spec.js @@ -4,8 +4,8 @@ import {promisify} from 'node:util'; import {tryToCatch} from 'try-to-catch'; import test from 'supertape'; import serveOnce from 'serve-once'; +import {cloudcmd} from '#server/cloudcmd'; import markdown from './index.js'; -import cloudcmd from '../cloudcmd.js'; const config = { auth: false, diff --git a/server/route.spec.js b/server/route.spec.js index fcf2f58b..7087f463 100644 --- a/server/route.spec.js +++ b/server/route.spec.js @@ -5,7 +5,7 @@ import fs from 'node:fs'; import {tryToCatch} from 'try-to-catch'; import {test, stub} from 'supertape'; import serveOnce from 'serve-once'; -import cloudcmd from './cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; import {_getReadDir} from './route.js'; const __filename = fileURLToPath(import.meta.url); diff --git a/server/server.js b/server/server.js index 00a4ee5b..e9ad5145 100644 --- a/server/server.js +++ b/server/server.js @@ -10,8 +10,8 @@ import {Server} from 'socket.io'; import tryRequire from 'tryrequire'; import wraptile from 'wraptile'; import compression from 'compression'; +import {cloudcmd} from '#server/cloudcmd'; import exit from './exit.js'; -import cloudcmd from './cloudcmd.js'; const bind = (f, self) => f.bind(self); diff --git a/server/terminal.spec.js b/server/terminal.spec.js index 9b933488..22f20282 100644 --- a/server/terminal.spec.js +++ b/server/terminal.spec.js @@ -1,6 +1,6 @@ import {test, stub} from 'supertape'; +import {createConfigManager} from '#server/cloudcmd'; import terminal from './terminal.js'; -import {createConfigManager} from './cloudcmd.js'; test('cloudcmd: terminal: disabled', (t) => { const config = createConfigManager(); diff --git a/server/validate.spec.js b/server/validate.spec.js index ca12d409..bb16fae1 100644 --- a/server/validate.spec.js +++ b/server/validate.spec.js @@ -1,7 +1,7 @@ import {test, stub} from 'supertape'; import {tryCatch} from 'try-catch'; +import {cloudcmd} from '#server/cloudcmd'; import * as validate from './validate.js'; -import cloudcmd from './cloudcmd.js'; test('validate: root: bad', (t) => { const config = { diff --git a/test/before.js b/test/before.js index e42a840a..970a4a4f 100644 --- a/test/before.js +++ b/test/before.js @@ -8,7 +8,7 @@ import express from 'express'; import {Server} from 'socket.io'; import writejson from 'writejson'; import readjson from 'readjson'; -import cloudcmd from '../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); diff --git a/test/rest/config.js b/test/rest/config.js index e7b7231e..737d422e 100644 --- a/test/rest/config.js +++ b/test/rest/config.js @@ -1,6 +1,6 @@ import serveOnce from 'serve-once'; import test from 'supertape'; -import cloudcmd from '../../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; const configManager = cloudcmd.createConfigManager(); const {request} = serveOnce(cloudcmd, { diff --git a/test/rest/copy.js b/test/rest/copy.js index 1552124b..f11ef7d4 100644 --- a/test/rest/copy.js +++ b/test/rest/copy.js @@ -4,7 +4,7 @@ import {mkdirSync} from 'node:fs'; import serveOnce from 'serve-once'; import test from 'supertape'; import {rimraf} from 'rimraf'; -import cloudcmd from '../../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); diff --git a/test/rest/fs.js b/test/rest/fs.js index 00f33e8a..721320a2 100644 --- a/test/rest/fs.js +++ b/test/rest/fs.js @@ -1,6 +1,6 @@ import serveOnce from 'serve-once'; import test from 'supertape'; -import cloudcmd from '../../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; const {request} = serveOnce(cloudcmd, { config: { diff --git a/test/rest/move.js b/test/rest/move.js index d3effaad..696b36a3 100644 --- a/test/rest/move.js +++ b/test/rest/move.js @@ -2,7 +2,7 @@ import {EventEmitter} from 'node:events'; import wait from '@iocmd/wait'; import {test, stub} from 'supertape'; import serveOnce from 'serve-once'; -import cloudcmd from '../../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; test('cloudcmd: rest: move', async (t) => { const move = new EventEmitter(); diff --git a/test/rest/pack.js b/test/rest/pack.js index 76696b7e..8a970299 100644 --- a/test/rest/pack.js +++ b/test/rest/pack.js @@ -7,7 +7,7 @@ import tar from 'tar-stream'; import gunzip from 'gunzip-maybe'; import pullout from 'pullout'; import serveOnce from 'serve-once'; -import cloudcmd from '../../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); diff --git a/test/rest/rename.js b/test/rest/rename.js index 863c87c1..8dd8e1f8 100644 --- a/test/rest/rename.js +++ b/test/rest/rename.js @@ -3,7 +3,7 @@ import test from 'supertape'; import {Volume} from 'memfs'; import {ufs} from 'unionfs'; import serveOnce from 'serve-once'; -import cloudcmd from '../../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; test('cloudcmd: rest: rename', async (t) => { const volume = { diff --git a/test/server/modulas.js b/test/server/modulas.js index 0c359107..5c7c6d9e 100644 --- a/test/server/modulas.js +++ b/test/server/modulas.js @@ -3,7 +3,7 @@ import {dirname, join} from 'node:path'; import {fileURLToPath} from 'node:url'; import serveOnce from 'serve-once'; import {test, stub} from 'supertape'; -import cloudcmd from '../../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; import modulas from '../../server/modulas.js'; const __filename = fileURLToPath(import.meta.url); diff --git a/test/static.js b/test/static.js index f28fedf5..1b725955 100644 --- a/test/static.js +++ b/test/static.js @@ -2,7 +2,7 @@ import {Buffer} from 'node:buffer'; import serveOnce from 'serve-once'; import test from 'supertape'; import criton from 'criton'; -import cloudcmd from '../server/cloudcmd.js'; +import {cloudcmd} from '#server/cloudcmd'; const config = { auth: false,