@jbrowse/cli 3.6.4 → 3.7.0
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.
|
@@ -128,7 +128,7 @@ async function run(args) {
|
|
|
128
128
|
}
|
|
129
129
|
const configType = type || determineConnectionType(url);
|
|
130
130
|
const id = connectionId ||
|
|
131
|
-
[configType, assemblyNames,
|
|
131
|
+
[configType, assemblyNames, Date.now()].filter(f => !!f).join('-');
|
|
132
132
|
const connectionConfig = {
|
|
133
133
|
type: configType,
|
|
134
134
|
name: name || id,
|
|
@@ -8,14 +8,10 @@ exports.parsePort = parsePort;
|
|
|
8
8
|
exports.generateKey = generateKey;
|
|
9
9
|
exports.setupConfigFile = setupConfigFile;
|
|
10
10
|
exports.setupRoutes = setupRoutes;
|
|
11
|
-
exports.setupServer = setupServer;
|
|
12
11
|
exports.startServer = startServer;
|
|
13
12
|
const crypto_1 = __importDefault(require("crypto"));
|
|
14
13
|
const fs_1 = __importDefault(require("fs"));
|
|
15
|
-
const os_1 = __importDefault(require("os"));
|
|
16
14
|
const path_1 = __importDefault(require("path"));
|
|
17
|
-
const cors_1 = __importDefault(require("cors"));
|
|
18
|
-
const express_1 = __importDefault(require("express"));
|
|
19
15
|
const utils_1 = require("../utils");
|
|
20
16
|
/**
|
|
21
17
|
* Validates if a port number is in the valid range
|
|
@@ -176,44 +172,6 @@ function setupRoutes({ app, baseDir, outFile, key, serverRef, }) {
|
|
|
176
172
|
});
|
|
177
173
|
});
|
|
178
174
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Sets up the Express server with routes
|
|
181
|
-
*/
|
|
182
|
-
function setupServer({ baseDir, outFile, bodySizeLimit, }) {
|
|
183
|
-
// Create Express application
|
|
184
|
-
const app = (0, express_1.default)();
|
|
185
|
-
// Configure middleware
|
|
186
|
-
app.use(express_1.default.static(baseDir));
|
|
187
|
-
app.use((0, cors_1.default)());
|
|
188
|
-
app.use(express_1.default.json({ limit: bodySizeLimit }));
|
|
189
|
-
// Add error handling middleware
|
|
190
|
-
app.use((err, _req, res, next) => {
|
|
191
|
-
if (err) {
|
|
192
|
-
console.error('Server error:', err);
|
|
193
|
-
res.status(500).setHeader('Content-Type', 'text/plain');
|
|
194
|
-
res.send('Internal Server Error');
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
next();
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
// Generate admin key and store it
|
|
201
|
-
const key = generateKey();
|
|
202
|
-
const keyPath = path_1.default.join(os_1.default.tmpdir(), `jbrowse-admin-${key}`);
|
|
203
|
-
try {
|
|
204
|
-
fs_1.default.writeFileSync(keyPath, key);
|
|
205
|
-
(0, utils_1.debug)(`Admin key stored at ${keyPath}`);
|
|
206
|
-
}
|
|
207
|
-
catch (error) {
|
|
208
|
-
console.error(`Failed to write admin key to ${keyPath}:`, error.message);
|
|
209
|
-
// Continue anyway, as this is not critical
|
|
210
|
-
}
|
|
211
|
-
// Create server reference for shutdown route
|
|
212
|
-
const serverRef = { current: null };
|
|
213
|
-
// Set up routes
|
|
214
|
-
setupRoutes({ app, baseDir, outFile, key, serverRef });
|
|
215
|
-
return { app, key, keyPath, serverRef };
|
|
216
|
-
}
|
|
217
175
|
/**
|
|
218
176
|
* Starts the server and sets up shutdown handlers
|
|
219
177
|
*/
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.run = run;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
4
10
|
const util_1 = require("util");
|
|
5
|
-
const
|
|
11
|
+
const cors_1 = __importDefault(require("cors"));
|
|
12
|
+
const express_1 = __importDefault(require("express"));
|
|
6
13
|
const admin_server_utils_1 = require("./admin-server-utils");
|
|
14
|
+
const utils_1 = require("../utils");
|
|
7
15
|
async function run(args) {
|
|
8
16
|
const options = {
|
|
9
17
|
help: {
|
|
@@ -45,10 +53,47 @@ async function run(args) {
|
|
|
45
53
|
// Parse and validate port
|
|
46
54
|
const port = (0, admin_server_utils_1.parsePort)({ portStr: flags.port });
|
|
47
55
|
// Set up the Express server
|
|
48
|
-
const { app, key, keyPath, serverRef } =
|
|
56
|
+
// const { app, key, keyPath, serverRef } = setupServer({
|
|
57
|
+
// baseDir,
|
|
58
|
+
// outFile,
|
|
59
|
+
// bodySizeLimit,
|
|
60
|
+
// })
|
|
61
|
+
const app = (0, express_1.default)();
|
|
62
|
+
// Configure middleware
|
|
63
|
+
app.use(express_1.default.static(baseDir));
|
|
64
|
+
app.use((0, cors_1.default)());
|
|
65
|
+
app.use(express_1.default.json({ limit: bodySizeLimit }));
|
|
66
|
+
// Add error handling middleware
|
|
67
|
+
app.use((err, _req, res, next) => {
|
|
68
|
+
if (err) {
|
|
69
|
+
console.error('Server error:', err);
|
|
70
|
+
res.status(500).setHeader('Content-Type', 'text/plain');
|
|
71
|
+
res.send('Internal Server Error');
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
next();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// Generate admin key and store it
|
|
78
|
+
const key = (0, admin_server_utils_1.generateKey)();
|
|
79
|
+
const keyPath = path_1.default.join(os_1.default.tmpdir(), `jbrowse-admin-${key}`);
|
|
80
|
+
try {
|
|
81
|
+
fs_1.default.writeFileSync(keyPath, key);
|
|
82
|
+
(0, utils_1.debug)(`Admin key stored at ${keyPath}`);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error(`Failed to write admin key to ${keyPath}:`, error.message);
|
|
86
|
+
// Continue anyway, as this is not critical
|
|
87
|
+
}
|
|
88
|
+
// Create server reference for shutdown route
|
|
89
|
+
const serverRef = { current: null };
|
|
90
|
+
// Set up routes
|
|
91
|
+
(0, admin_server_utils_1.setupRoutes)({
|
|
92
|
+
app,
|
|
49
93
|
baseDir,
|
|
50
94
|
outFile,
|
|
51
|
-
|
|
95
|
+
key,
|
|
96
|
+
serverRef,
|
|
52
97
|
});
|
|
53
98
|
// Start the server and set up shutdown handlers
|
|
54
99
|
(0, admin_server_utils_1.startServer)({ app, port, key, outFile, keyPath, serverRef });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "A command line tool for working with JBrowse 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -43,10 +43,11 @@
|
|
|
43
43
|
"express": "^5.1.0",
|
|
44
44
|
"ixixx": "^2.0.1",
|
|
45
45
|
"json-parse-better-errors": "^1.0.2",
|
|
46
|
-
"node-fetch-native": "^1.6.4"
|
|
46
|
+
"node-fetch-native": "^1.6.4",
|
|
47
|
+
"tmp": "^0.2.1"
|
|
47
48
|
},
|
|
48
49
|
"publishConfig": {
|
|
49
50
|
"access": "public"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "85bdd0d58286b7adbfd408146b15847676317635"
|
|
52
53
|
}
|