@nicemeta/file-manager 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +45 -0
- package/dist/cli.cjs +353 -0
- package/dist/lib-static/file-manager/css/file-manager.css +1 -0
- package/dist/lib-static/file-manager/fonts/symbols.woff2 +0 -0
- package/dist/lib-static/file-manager/index.html +44 -0
- package/dist/openapi.json +1 -0
- package/dist/openapi.yaml +219 -0
- package/dist/static/swagger-ui.html +15 -0
- package/package.json +37 -0
- package/src/app.js +84 -0
- package/src/openapi.yaml +219 -0
- package/static/swagger-ui.html +15 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { parseArgs } = require('node:util');
|
|
5
|
+
const { createApp } = require('../src/app');
|
|
6
|
+
const pkg = require('../package.json');
|
|
7
|
+
|
|
8
|
+
const { values } = parseArgs({
|
|
9
|
+
options: {
|
|
10
|
+
port: { type: 'string', short: 'p', default: '12001' },
|
|
11
|
+
host: { type: 'string', short: 'H', default: '127.0.0.1' },
|
|
12
|
+
root: { type: 'string', short: 'r' },
|
|
13
|
+
help: { type: 'boolean', short: 'h', default: false },
|
|
14
|
+
version: { type: 'boolean', short: 'v', default: false },
|
|
15
|
+
},
|
|
16
|
+
strict: true,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (values.version) { console.log(pkg.version); process.exit(0); }
|
|
20
|
+
if (values.help) {
|
|
21
|
+
console.log(`file-manager v${pkg.version}
|
|
22
|
+
|
|
23
|
+
Usage: file-manager [options]
|
|
24
|
+
|
|
25
|
+
Options:
|
|
26
|
+
-p, --port <n> Server port (default: 12001)
|
|
27
|
+
-H, --host <addr> Listening host (default: 127.0.0.1)
|
|
28
|
+
-r, --root <path> Root directory (default: current directory)
|
|
29
|
+
-v, --version Show version
|
|
30
|
+
-h, --help Show this help`);
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const port = parseInt(values.port, 10);
|
|
35
|
+
const host = values.host;
|
|
36
|
+
const root = values.root || process.cwd();
|
|
37
|
+
|
|
38
|
+
const app = createApp({ root });
|
|
39
|
+
|
|
40
|
+
app.listen(port, host, () => {
|
|
41
|
+
console.log(`File Manager v${pkg.version}`);
|
|
42
|
+
console.log(` UI: http://${host}:${port}/file-manager/index.html`);
|
|
43
|
+
console.log(` API docs: http://${host}:${port}/file-manager/swagger-ui/index.html`);
|
|
44
|
+
console.log(` Root: ${root}`);
|
|
45
|
+
});
|