@jbrowse/cli 2.6.2 → 2.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.
- package/README.md +274 -206
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +6 -3
- package/lib/base.js +32 -80
- package/lib/commands/add-assembly.js +29 -27
- package/lib/commands/add-connection.js +43 -37
- package/lib/commands/add-track-json.js +9 -10
- package/lib/commands/add-track.js +74 -73
- package/lib/commands/admin-server.js +7 -7
- package/lib/commands/create.js +14 -16
- package/lib/commands/remove-track.js +9 -11
- package/lib/commands/set-default-session.js +14 -17
- package/lib/commands/text-index.js +86 -101
- package/lib/commands/upgrade.js +13 -14
- package/lib/fetchWithProxy.js +1 -1
- package/lib/index.js +2 -2
- package/lib/types/common.js +2 -2
- package/lib/types/gff3Adapter.js +54 -88
- package/lib/types/vcfAdapter.js +58 -93
- package/oclif.manifest.json +918 -1
- package/package.json +10 -12
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
@@ -27,10 +27,10 @@ function makeLocationProtocol(protocol) {
|
|
|
27
27
|
throw new Error(`invalid protocol ${protocol}`);
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
const isUrl = (loc) => loc
|
|
30
|
+
const isUrl = (loc) => loc?.match(/^https?:\/\//);
|
|
31
31
|
class AddTrack extends base_1.default {
|
|
32
32
|
async run() {
|
|
33
|
-
const { args: runArgs, flags: runFlags } = this.parse(AddTrack);
|
|
33
|
+
const { args: runArgs, flags: runFlags } = await this.parse(AddTrack);
|
|
34
34
|
const { track: argsTrack } = runArgs;
|
|
35
35
|
const { config, skipCheck, force, overwrite, category, description, load, subDir, target, protocol, out, indexFile: index, bed1, bed2, } = runFlags;
|
|
36
36
|
const output = target || out || '.';
|
|
@@ -87,7 +87,7 @@ class AddTrack extends base_1.default {
|
|
|
87
87
|
}
|
|
88
88
|
// only add track if there is an existing config.json
|
|
89
89
|
const configContents = await this.readJsonFile(this.target);
|
|
90
|
-
if (!configContents.assemblies
|
|
90
|
+
if (!configContents.assemblies?.length) {
|
|
91
91
|
this.error('No assemblies found. Please add one before adding tracks', {
|
|
92
92
|
exit: 150,
|
|
93
93
|
});
|
|
@@ -101,9 +101,16 @@ class AddTrack extends base_1.default {
|
|
|
101
101
|
name = name || trackId;
|
|
102
102
|
assemblyNames = assemblyNames || configContents.assemblies[0].name;
|
|
103
103
|
const configObj = config ? (0, json_parse_better_errors_1.default)(config) : {};
|
|
104
|
-
const trackConfig =
|
|
104
|
+
const trackConfig = {
|
|
105
|
+
type: trackType,
|
|
106
|
+
trackId,
|
|
105
107
|
name,
|
|
106
|
-
adapter,
|
|
108
|
+
adapter,
|
|
109
|
+
category: category?.split(',').map(c => c.trim()),
|
|
110
|
+
assemblyNames: assemblyNames.split(',').map(a => a.trim()),
|
|
111
|
+
description,
|
|
112
|
+
...configObj,
|
|
113
|
+
};
|
|
107
114
|
// any special track modifications go here
|
|
108
115
|
if (trackType === 'AlignmentsTrack') {
|
|
109
116
|
const assembly = configContents.assemblies.find(asm => asm.name === assemblyNames);
|
|
@@ -167,25 +174,23 @@ class AddTrack extends base_1.default {
|
|
|
167
174
|
if (/\.anchors(.simple)?$/i.test(location)) {
|
|
168
175
|
return {
|
|
169
176
|
file: location,
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
171
177
|
bed1: bed1,
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
173
178
|
bed2: bed2,
|
|
174
179
|
};
|
|
175
180
|
}
|
|
176
|
-
if (/\.bam$/i.test(location)) {
|
|
181
|
+
else if (/\.bam$/i.test(location)) {
|
|
177
182
|
return {
|
|
178
183
|
file: location,
|
|
179
184
|
index: index || `${location}.bai`,
|
|
180
185
|
};
|
|
181
186
|
}
|
|
182
|
-
if (/\.cram$/i.test(location)) {
|
|
187
|
+
else if (/\.cram$/i.test(location)) {
|
|
183
188
|
return {
|
|
184
189
|
file: location,
|
|
185
190
|
index: index || `${location}.crai`,
|
|
186
191
|
};
|
|
187
192
|
}
|
|
188
|
-
if (/\.gff3?\.b?gz$/i.test(location) ||
|
|
193
|
+
else if (/\.gff3?\.b?gz$/i.test(location) ||
|
|
189
194
|
/\.vcf\.b?gz$/i.test(location) ||
|
|
190
195
|
/\.bed\.b?gz$/i.test(location)) {
|
|
191
196
|
return {
|
|
@@ -193,25 +198,26 @@ class AddTrack extends base_1.default {
|
|
|
193
198
|
index: index || `${location}.tbi`,
|
|
194
199
|
};
|
|
195
200
|
}
|
|
196
|
-
if (/\.(fa|fasta|fas|fna|mfa)$/i.test(location)) {
|
|
201
|
+
else if (/\.(fa|fasta|fas|fna|mfa)$/i.test(location)) {
|
|
197
202
|
return {
|
|
198
203
|
file: location,
|
|
199
204
|
index: index || `${location}.fai`,
|
|
200
205
|
};
|
|
201
206
|
}
|
|
202
|
-
if (/\.(fa|fasta|fas|fna|mfa)\.b?gz$/i.test(location)) {
|
|
207
|
+
else if (/\.(fa|fasta|fas|fna|mfa)\.b?gz$/i.test(location)) {
|
|
203
208
|
return {
|
|
204
209
|
file: location,
|
|
205
210
|
index: `${location}.fai`,
|
|
206
211
|
index2: `${location}.gzi`,
|
|
207
212
|
};
|
|
208
213
|
}
|
|
209
|
-
if (/\.2bit$/i.test(location) ||
|
|
214
|
+
else if (/\.2bit$/i.test(location) ||
|
|
210
215
|
/\/trackData.jsonz?$/i.test(location) ||
|
|
211
216
|
/\/sparql$/i.test(location) ||
|
|
212
217
|
/\.out(.gz)?$/i.test(location) ||
|
|
213
218
|
/\.paf(.gz)?$/i.test(location) ||
|
|
214
219
|
/\.delta(.gz)?$/i.test(location) ||
|
|
220
|
+
/\.bed?$/i.test(location) ||
|
|
215
221
|
/\.(bw|bigwig)$/i.test(location) ||
|
|
216
222
|
/\.(bb|bigbed)$/i.test(location) ||
|
|
217
223
|
/\.vcf$/i.test(location) ||
|
|
@@ -233,101 +239,96 @@ class AddTrack extends base_1.default {
|
|
|
233
239
|
bamLocation: makeLocation(location),
|
|
234
240
|
index: {
|
|
235
241
|
location: makeLocation(index || `${location}.bai`),
|
|
236
|
-
indexType:
|
|
242
|
+
indexType: index?.toUpperCase().endsWith('CSI') ? 'CSI' : 'BAI',
|
|
237
243
|
},
|
|
238
244
|
};
|
|
239
245
|
}
|
|
240
|
-
if (/\.cram$/i.test(location)) {
|
|
246
|
+
else if (/\.cram$/i.test(location)) {
|
|
241
247
|
return {
|
|
242
248
|
type: 'CramAdapter',
|
|
243
249
|
cramLocation: makeLocation(location),
|
|
244
250
|
craiLocation: makeLocation(`${location}.crai`),
|
|
245
251
|
};
|
|
246
252
|
}
|
|
247
|
-
if (/\.gff3?$/i.test(location)) {
|
|
253
|
+
else if (/\.gff3?$/i.test(location)) {
|
|
248
254
|
return {
|
|
249
255
|
type: 'Gff3Adapter',
|
|
250
256
|
gffLocation: makeLocation(location),
|
|
251
257
|
};
|
|
252
258
|
}
|
|
253
|
-
if (/\.gff3?\.b?gz$/i.test(location)) {
|
|
259
|
+
else if (/\.gff3?\.b?gz$/i.test(location)) {
|
|
254
260
|
return {
|
|
255
261
|
type: 'Gff3TabixAdapter',
|
|
256
262
|
gffGzLocation: makeLocation(location),
|
|
257
263
|
index: {
|
|
258
264
|
location: makeLocation(index || `${location}.tbi`),
|
|
259
|
-
indexType:
|
|
265
|
+
indexType: index?.toUpperCase().endsWith('CSI') ? 'CSI' : 'TBI',
|
|
260
266
|
},
|
|
261
267
|
};
|
|
262
268
|
}
|
|
263
|
-
if (/\.gtf?$/i.test(location)) {
|
|
269
|
+
else if (/\.gtf?$/i.test(location)) {
|
|
264
270
|
return {
|
|
265
271
|
type: 'GtfAdapter',
|
|
266
272
|
gtfLocation: makeLocation(location),
|
|
267
273
|
};
|
|
268
274
|
}
|
|
269
|
-
if (/\.vcf$/i.test(location)) {
|
|
275
|
+
else if (/\.vcf$/i.test(location)) {
|
|
270
276
|
return {
|
|
271
277
|
type: 'VcfAdapter',
|
|
272
278
|
vcfLocation: makeLocation(location),
|
|
273
279
|
};
|
|
274
280
|
}
|
|
275
|
-
if (/\.vcf\.b?gz$/i.test(location)) {
|
|
281
|
+
else if (/\.vcf\.b?gz$/i.test(location)) {
|
|
276
282
|
return {
|
|
277
283
|
type: 'VcfTabixAdapter',
|
|
278
284
|
vcfGzLocation: makeLocation(location),
|
|
279
285
|
index: {
|
|
280
286
|
location: makeLocation(index || `${location}.tbi`),
|
|
281
|
-
indexType:
|
|
287
|
+
indexType: index?.toUpperCase().endsWith('CSI') ? 'CSI' : 'TBI',
|
|
282
288
|
},
|
|
283
289
|
};
|
|
284
290
|
}
|
|
285
|
-
if (/\.vcf\.idx$/i.test(location)) {
|
|
291
|
+
else if (/\.vcf\.idx$/i.test(location)) {
|
|
286
292
|
return {
|
|
287
293
|
type: 'UNSUPPORTED',
|
|
288
294
|
};
|
|
289
295
|
}
|
|
290
|
-
if (/\.bed$/i.test(location)) {
|
|
296
|
+
else if (/\.bed$/i.test(location)) {
|
|
291
297
|
return {
|
|
292
|
-
type: '
|
|
298
|
+
type: 'BedAdapter',
|
|
299
|
+
bedLocation: makeLocation(location),
|
|
293
300
|
};
|
|
294
301
|
}
|
|
295
|
-
if (/\.bed\.b?gz$/i.test(location)) {
|
|
302
|
+
else if (/\.bed\.b?gz$/i.test(location)) {
|
|
296
303
|
return {
|
|
297
304
|
type: 'BedTabixAdapter',
|
|
298
305
|
bedGzLocation: makeLocation(location),
|
|
299
306
|
index: {
|
|
300
307
|
location: makeLocation(index || `${location}.tbi`),
|
|
301
|
-
indexType:
|
|
308
|
+
indexType: index?.toUpperCase().endsWith('CSI') ? 'CSI' : 'TBI',
|
|
302
309
|
},
|
|
303
310
|
};
|
|
304
311
|
}
|
|
305
|
-
if (/\.
|
|
306
|
-
return {
|
|
307
|
-
type: 'BedAdapter',
|
|
308
|
-
bedLocation: makeLocation(location),
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
if (/\.(bb|bigbed)$/i.test(location)) {
|
|
312
|
+
else if (/\.(bb|bigbed)$/i.test(location)) {
|
|
312
313
|
return {
|
|
313
314
|
type: 'BigBedAdapter',
|
|
314
315
|
bigBedLocation: makeLocation(location),
|
|
315
316
|
};
|
|
316
317
|
}
|
|
317
|
-
if (/\.(bw|bigwig)$/i.test(location)) {
|
|
318
|
+
else if (/\.(bw|bigwig)$/i.test(location)) {
|
|
318
319
|
return {
|
|
319
320
|
type: 'BigWigAdapter',
|
|
320
321
|
bigWigLocation: makeLocation(location),
|
|
321
322
|
};
|
|
322
323
|
}
|
|
323
|
-
if (/\.(fa|fasta|fna|mfa)$/i.test(location)) {
|
|
324
|
+
else if (/\.(fa|fasta|fna|mfa)$/i.test(location)) {
|
|
324
325
|
return {
|
|
325
326
|
type: 'IndexedFastaAdapter',
|
|
326
327
|
fastaLocation: makeLocation(location),
|
|
327
328
|
faiLocation: makeLocation(index || `${location}.fai`),
|
|
328
329
|
};
|
|
329
330
|
}
|
|
330
|
-
if (/\.(fa|fasta|fna|mfa)\.b?gz$/i.test(location)) {
|
|
331
|
+
else if (/\.(fa|fasta|fna|mfa)\.b?gz$/i.test(location)) {
|
|
331
332
|
return {
|
|
332
333
|
type: 'BgzipFastaAdapter',
|
|
333
334
|
fastaLocation: makeLocation(location),
|
|
@@ -335,60 +336,60 @@ class AddTrack extends base_1.default {
|
|
|
335
336
|
gziLocation: makeLocation(`${location}.gzi`),
|
|
336
337
|
};
|
|
337
338
|
}
|
|
338
|
-
if (/\.2bit$/i.test(location)) {
|
|
339
|
+
else if (/\.2bit$/i.test(location)) {
|
|
339
340
|
return {
|
|
340
341
|
type: 'TwoBitAdapter',
|
|
341
342
|
twoBitLocation: makeLocation(location),
|
|
342
343
|
};
|
|
343
344
|
}
|
|
344
|
-
if (/\.sizes$/i.test(location)) {
|
|
345
|
+
else if (/\.sizes$/i.test(location)) {
|
|
345
346
|
return {
|
|
346
347
|
type: 'UNSUPPORTED',
|
|
347
348
|
};
|
|
348
349
|
}
|
|
349
|
-
if (/\/trackData.jsonz?$/i.test(location)) {
|
|
350
|
+
else if (/\/trackData.jsonz?$/i.test(location)) {
|
|
350
351
|
return {
|
|
351
352
|
type: 'NCListAdapter',
|
|
352
353
|
rootUrlTemplate: makeLocation(location),
|
|
353
354
|
};
|
|
354
355
|
}
|
|
355
|
-
if (/\/sparql$/i.test(location)) {
|
|
356
|
+
else if (/\/sparql$/i.test(location)) {
|
|
356
357
|
return {
|
|
357
358
|
type: 'SPARQLAdapter',
|
|
358
359
|
endpoint: location,
|
|
359
360
|
};
|
|
360
361
|
}
|
|
361
|
-
if (/\.hic$/i.test(location)) {
|
|
362
|
+
else if (/\.hic$/i.test(location)) {
|
|
362
363
|
return {
|
|
363
364
|
type: 'HicAdapter',
|
|
364
365
|
hicLocation: makeLocation(location),
|
|
365
366
|
};
|
|
366
367
|
}
|
|
367
|
-
if (/\.paf(.gz)?$/i.test(location)) {
|
|
368
|
+
else if (/\.paf(.gz)?$/i.test(location)) {
|
|
368
369
|
return {
|
|
369
370
|
type: 'PAFAdapter',
|
|
370
371
|
pafLocation: makeLocation(location),
|
|
371
372
|
};
|
|
372
373
|
}
|
|
373
|
-
if (/\.out(.gz)?$/i.test(location)) {
|
|
374
|
+
else if (/\.out(.gz)?$/i.test(location)) {
|
|
374
375
|
return {
|
|
375
376
|
type: 'MashMapAdapter',
|
|
376
377
|
outLocation: makeLocation(location),
|
|
377
378
|
};
|
|
378
379
|
}
|
|
379
|
-
if (/\.chain(.gz)?$/i.test(location)) {
|
|
380
|
+
else if (/\.chain(.gz)?$/i.test(location)) {
|
|
380
381
|
return {
|
|
381
382
|
type: 'ChainAdapter',
|
|
382
383
|
chainLocation: makeLocation(location),
|
|
383
384
|
};
|
|
384
385
|
}
|
|
385
|
-
if (/\.delta(.gz)?$/i.test(location)) {
|
|
386
|
+
else if (/\.delta(.gz)?$/i.test(location)) {
|
|
386
387
|
return {
|
|
387
388
|
type: 'DeltaAdapter',
|
|
388
389
|
deltaLocation: makeLocation(location),
|
|
389
390
|
};
|
|
390
391
|
}
|
|
391
|
-
if (/\.anchors(.gz)?$/i.test(location)) {
|
|
392
|
+
else if (/\.anchors(.gz)?$/i.test(location)) {
|
|
392
393
|
return {
|
|
393
394
|
type: 'MCScanAnchorsAdapter',
|
|
394
395
|
mcscanAnchorsLocation: makeLocation(location),
|
|
@@ -396,7 +397,7 @@ class AddTrack extends base_1.default {
|
|
|
396
397
|
bed2Location: bed2 ? makeLocation(bed2) : undefined,
|
|
397
398
|
};
|
|
398
399
|
}
|
|
399
|
-
if (/\.anchors.simple(.gz)?$/i.test(location)) {
|
|
400
|
+
else if (/\.anchors.simple(.gz)?$/i.test(location)) {
|
|
400
401
|
return {
|
|
401
402
|
type: 'MCScanSimpleAnchorsAdapter',
|
|
402
403
|
mcscanSimpleAnchorsLocation: makeLocation(location),
|
|
@@ -418,6 +419,7 @@ class AddTrack extends base_1.default {
|
|
|
418
419
|
TwoBitAdapter: 'ReferenceSequenceTrack',
|
|
419
420
|
VcfTabixAdapter: 'VariantTrack',
|
|
420
421
|
VcfAdapter: 'VariantTrack',
|
|
422
|
+
BedAdapter: 'FeatureTrack',
|
|
421
423
|
HicAdapter: 'HicTrack',
|
|
422
424
|
PAFAdapter: 'SyntenyTrack',
|
|
423
425
|
DeltaAdapter: 'SyntenyTrack',
|
|
@@ -449,76 +451,75 @@ AddTrack.examples = [
|
|
|
449
451
|
'# --load inPlace adds a track without doing file operations',
|
|
450
452
|
'$ jbrowse add-track /url/relative/path.bam --load inPlace',
|
|
451
453
|
];
|
|
452
|
-
AddTrack.args =
|
|
453
|
-
{
|
|
454
|
-
name: 'track',
|
|
454
|
+
AddTrack.args = {
|
|
455
|
+
track: core_1.Args.string({
|
|
455
456
|
required: true,
|
|
456
457
|
description: `Track file or URL`,
|
|
457
|
-
},
|
|
458
|
-
|
|
458
|
+
}),
|
|
459
|
+
};
|
|
459
460
|
AddTrack.flags = {
|
|
460
|
-
trackType:
|
|
461
|
+
trackType: core_1.Flags.string({
|
|
461
462
|
char: 't',
|
|
462
463
|
description: `Type of track, by default inferred from track file`,
|
|
463
464
|
}),
|
|
464
|
-
name:
|
|
465
|
+
name: core_1.Flags.string({
|
|
465
466
|
char: 'n',
|
|
466
467
|
description: 'Name of the track. Will be defaulted to the trackId if none specified',
|
|
467
468
|
}),
|
|
468
|
-
indexFile:
|
|
469
|
+
indexFile: core_1.Flags.string({
|
|
469
470
|
description: 'Optional index file for the track',
|
|
470
471
|
}),
|
|
471
|
-
description:
|
|
472
|
+
description: core_1.Flags.string({
|
|
472
473
|
char: 'd',
|
|
473
474
|
description: 'Optional description of the track',
|
|
474
475
|
}),
|
|
475
|
-
assemblyNames:
|
|
476
|
+
assemblyNames: core_1.Flags.string({
|
|
476
477
|
char: 'a',
|
|
477
478
|
description: 'Assembly name or names for track as comma separated string. If none, will default to the assembly in your config file',
|
|
478
479
|
}),
|
|
479
|
-
category:
|
|
480
|
+
category: core_1.Flags.string({
|
|
480
481
|
description: 'Optional Comma separated string of categories to group tracks',
|
|
481
482
|
}),
|
|
482
|
-
config:
|
|
483
|
+
config: core_1.Flags.string({
|
|
483
484
|
description: `Any extra config settings to add to a track. i.e '{"defaultRendering": "density"}'`,
|
|
484
485
|
}),
|
|
485
|
-
target:
|
|
486
|
+
target: core_1.Flags.string({
|
|
486
487
|
description: 'path to config file in JB2 installation to write out to.',
|
|
487
488
|
}),
|
|
488
|
-
out:
|
|
489
|
+
out: core_1.Flags.string({
|
|
489
490
|
description: 'synonym for target',
|
|
490
491
|
}),
|
|
491
|
-
subDir:
|
|
492
|
+
subDir: core_1.Flags.string({
|
|
492
493
|
description: 'when using --load a file, output to a subdirectory of the target dir',
|
|
493
494
|
default: '',
|
|
494
495
|
}),
|
|
495
|
-
help:
|
|
496
|
-
trackId:
|
|
496
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
497
|
+
trackId: core_1.Flags.string({
|
|
497
498
|
description: 'trackId for the track, by default inferred from filename, must be unique throughout config',
|
|
498
499
|
}),
|
|
499
|
-
load:
|
|
500
|
+
load: core_1.Flags.string({
|
|
500
501
|
char: 'l',
|
|
501
502
|
description: 'Required flag when using a local file. Choose how to manage the track. Copy, symlink, or move the track to the JBrowse directory. Or inPlace to leave track alone',
|
|
502
503
|
options: ['copy', 'symlink', 'move', 'inPlace'],
|
|
503
504
|
}),
|
|
504
|
-
skipCheck:
|
|
505
|
+
skipCheck: core_1.Flags.boolean({
|
|
505
506
|
description: 'Skip check for whether or not the file or URL exists or if you are in a JBrowse directory',
|
|
506
507
|
}),
|
|
507
|
-
overwrite:
|
|
508
|
+
overwrite: core_1.Flags.boolean({
|
|
508
509
|
description: 'Overwrites existing track if it shares the same trackId',
|
|
509
510
|
}),
|
|
510
|
-
force:
|
|
511
|
+
force: core_1.Flags.boolean({
|
|
511
512
|
char: 'f',
|
|
512
513
|
description: 'Equivalent to `--skipCheck --overwrite`',
|
|
513
514
|
}),
|
|
514
|
-
protocol:
|
|
515
|
+
protocol: core_1.Flags.string({
|
|
515
516
|
description: 'Force protocol to a specific value',
|
|
516
517
|
default: 'uri',
|
|
517
518
|
}),
|
|
518
|
-
bed1:
|
|
519
|
+
bed1: core_1.Flags.string({
|
|
519
520
|
description: 'Used only for mcscan anchors/simpleAnchors types',
|
|
520
521
|
}),
|
|
521
|
-
bed2:
|
|
522
|
+
bed2: core_1.Flags.string({
|
|
522
523
|
description: 'Used only for mcscan anchors/simpleAnchors types',
|
|
523
524
|
}),
|
|
524
525
|
};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const crypto_1 = __importDefault(require("crypto"));
|
|
@@ -22,7 +22,7 @@ function generateKey() {
|
|
|
22
22
|
}
|
|
23
23
|
class AdminServer extends base_1.default {
|
|
24
24
|
async run() {
|
|
25
|
-
const { flags: runFlags } = this.parse(AdminServer);
|
|
25
|
+
const { flags: runFlags } = await this.parse(AdminServer);
|
|
26
26
|
const { root, bodySizeLimit } = runFlags;
|
|
27
27
|
const output = root || '.';
|
|
28
28
|
const isDir = fs_1.default.lstatSync(output).isDirectory();
|
|
@@ -67,7 +67,7 @@ class AdminServer extends base_1.default {
|
|
|
67
67
|
const filename = req.body.configPath
|
|
68
68
|
? path_1.default.join(baseDir, req.body.configPath)
|
|
69
69
|
: outFile;
|
|
70
|
-
if (filename.
|
|
70
|
+
if (!filename.startsWith(baseDir)) {
|
|
71
71
|
throw new Error(`Cannot perform directory traversal outside of ${baseDir}`);
|
|
72
72
|
}
|
|
73
73
|
await this.writeJsonFile(filename, req.body.config);
|
|
@@ -126,18 +126,18 @@ class AdminServer extends base_1.default {
|
|
|
126
126
|
AdminServer.description = 'Start up a small admin server for JBrowse configuration';
|
|
127
127
|
AdminServer.examples = ['$ jbrowse admin-server', '$ jbrowse admin-server -p 8888'];
|
|
128
128
|
AdminServer.flags = {
|
|
129
|
-
port:
|
|
129
|
+
port: core_1.Flags.string({
|
|
130
130
|
char: 'p',
|
|
131
131
|
description: 'Specifified port to start the server on;\nDefault is 9090.',
|
|
132
132
|
}),
|
|
133
|
-
root:
|
|
133
|
+
root: core_1.Flags.string({
|
|
134
134
|
description: 'path to the root of the JB2 installation.\nCreates ./config.json if nonexistent. note that you can navigate to ?config=path/to/subconfig.json in the web browser and it will write to rootDir/path/to/subconfig.json',
|
|
135
135
|
}),
|
|
136
|
-
bodySizeLimit:
|
|
136
|
+
bodySizeLimit: core_1.Flags.string({
|
|
137
137
|
description: 'Size limit of the update message; may need to increase if config is large.\nArgument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.',
|
|
138
138
|
default: '25mb',
|
|
139
139
|
}),
|
|
140
|
-
help:
|
|
140
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
141
141
|
};
|
|
142
142
|
exports.default = AdminServer;
|
|
143
143
|
function getNetworkAddress() {
|
package/lib/commands/create.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
9
9
|
const base_1 = __importDefault(require("../base"));
|
|
@@ -11,7 +11,7 @@ const decompress_1 = __importDefault(require("decompress"));
|
|
|
11
11
|
const fsPromises = fs_1.default.promises;
|
|
12
12
|
class Create extends base_1.default {
|
|
13
13
|
async run() {
|
|
14
|
-
const { args: runArgs, flags: runFlags } = this.parse(Create);
|
|
14
|
+
const { args: runArgs, flags: runFlags } = await this.parse(Create);
|
|
15
15
|
const { localPath: argsPath } = runArgs;
|
|
16
16
|
this.debug(`Want to install path at: ${argsPath}`);
|
|
17
17
|
const { force, url, listVersions, tag, branch, nightly } = runFlags;
|
|
@@ -50,9 +50,8 @@ class Create extends base_1.default {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
async catch(error) {
|
|
53
|
-
var _a;
|
|
54
53
|
// @ts-expect-error
|
|
55
|
-
if (
|
|
54
|
+
if (error.parse?.output.flags.listVersions) {
|
|
56
55
|
const versions = (await this.fetchGithubVersions()).map(version => version.tag_name);
|
|
57
56
|
this.log(`All JBrowse versions:\n${versions.join('\n')}`);
|
|
58
57
|
this.exit();
|
|
@@ -77,35 +76,34 @@ Create.examples = [
|
|
|
77
76
|
'# List available versions',
|
|
78
77
|
'$ jbrowse create --listVersions',
|
|
79
78
|
];
|
|
80
|
-
Create.args =
|
|
81
|
-
{
|
|
82
|
-
name: 'localPath',
|
|
79
|
+
Create.args = {
|
|
80
|
+
localPath: core_1.Args.string({
|
|
83
81
|
required: true,
|
|
84
82
|
description: `Location where JBrowse 2 will be installed`,
|
|
85
|
-
},
|
|
86
|
-
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
87
85
|
Create.flags = {
|
|
88
|
-
help:
|
|
89
|
-
force:
|
|
86
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
87
|
+
force: core_1.Flags.boolean({
|
|
90
88
|
char: 'f',
|
|
91
89
|
description: 'Overwrites existing JBrowse 2 installation if present in path',
|
|
92
90
|
}),
|
|
93
91
|
// will need to account for pagenation once there is a lot of releases
|
|
94
|
-
listVersions:
|
|
92
|
+
listVersions: core_1.Flags.boolean({
|
|
95
93
|
char: 'l',
|
|
96
94
|
description: 'Lists out all versions of JBrowse 2',
|
|
97
95
|
}),
|
|
98
|
-
branch:
|
|
96
|
+
branch: core_1.Flags.string({
|
|
99
97
|
description: 'Download a development build from a named git branch',
|
|
100
98
|
}),
|
|
101
|
-
nightly:
|
|
99
|
+
nightly: core_1.Flags.boolean({
|
|
102
100
|
description: 'Download the latest development build from the main branch',
|
|
103
101
|
}),
|
|
104
|
-
url:
|
|
102
|
+
url: core_1.Flags.string({
|
|
105
103
|
char: 'u',
|
|
106
104
|
description: 'A direct URL to a JBrowse 2 release',
|
|
107
105
|
}),
|
|
108
|
-
tag:
|
|
106
|
+
tag: core_1.Flags.string({
|
|
109
107
|
char: 't',
|
|
110
108
|
description: 'Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest',
|
|
111
109
|
}),
|
|
@@ -3,36 +3,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const base_1 = __importDefault(require("../base"));
|
|
9
9
|
class RemoveTrackJson extends base_1.default {
|
|
10
10
|
async run() {
|
|
11
|
-
|
|
12
|
-
const { args, flags: runFlags } = this.parse(RemoveTrackJson);
|
|
11
|
+
const { args, flags: runFlags } = await this.parse(RemoveTrackJson);
|
|
13
12
|
const output = runFlags.target || runFlags.out || '.';
|
|
14
13
|
const isDir = (await fs_1.promises.lstat(output)).isDirectory();
|
|
15
14
|
this.target = isDir ? `${output}/config.json` : output;
|
|
16
15
|
const { track: inputId } = args;
|
|
17
16
|
const config = await this.readJsonFile(this.target);
|
|
18
|
-
config.tracks =
|
|
17
|
+
config.tracks = config.tracks?.filter(({ trackId }) => trackId !== inputId);
|
|
19
18
|
await this.writeJsonFile(this.target, config);
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
RemoveTrackJson.description = 'Remove a track configuration from a JBrowse 2 configuration. Be aware that this can cause crashes in saved sessions that refer to this track!';
|
|
23
22
|
RemoveTrackJson.examples = ['$ jbrowse remove-track-json trackId'];
|
|
24
|
-
RemoveTrackJson.args =
|
|
25
|
-
{
|
|
26
|
-
name: 'track',
|
|
23
|
+
RemoveTrackJson.args = {
|
|
24
|
+
track: core_1.Args.string({
|
|
27
25
|
required: true,
|
|
28
26
|
description: `track JSON file or command line arg blob`,
|
|
29
|
-
},
|
|
30
|
-
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
31
29
|
RemoveTrackJson.flags = {
|
|
32
|
-
target:
|
|
30
|
+
target: core_1.Flags.string({
|
|
33
31
|
description: 'path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent',
|
|
34
32
|
}),
|
|
35
|
-
out:
|
|
33
|
+
out: core_1.Flags.string({
|
|
36
34
|
description: 'synonym for target',
|
|
37
35
|
}),
|
|
38
36
|
};
|