@jbrowse/cli 3.5.1 → 3.6.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 +291 -607
- package/bin/run +1 -6
- package/bundle/index.js +4459 -0
- package/package.json +12 -37
- package/bin/dev +0 -17
- package/bin/dev.cmd +0 -3
- package/bin/run.cmd +0 -3
- package/lib/base.js +0 -157
- package/lib/commands/add-assembly.js +0 -491
- package/lib/commands/add-connection.js +0 -170
- package/lib/commands/add-track-json.js +0 -67
- package/lib/commands/add-track.js +0 -564
- package/lib/commands/admin-server.js +0 -153
- package/lib/commands/create.js +0 -111
- package/lib/commands/make-pif.js +0 -116
- package/lib/commands/remove-track.js +0 -37
- package/lib/commands/set-default-session.js +0 -98
- package/lib/commands/sort-bed.js +0 -45
- package/lib/commands/sort-gff.js +0 -45
- package/lib/commands/text-index.js +0 -380
- package/lib/commands/upgrade.js +0 -109
- package/lib/fetchWithProxy.js +0 -12
- package/lib/index.js +0 -6
- package/lib/types/common.js +0 -128
- package/lib/types/gff3Adapter.js +0 -73
- package/lib/types/vcfAdapter.js +0 -76
- package/lib/util.js +0 -35
- package/oclif.manifest.json +0 -1169
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "A command line tool for working with JBrowse 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
7
|
-
"jbrowse2"
|
|
8
|
-
"oclif"
|
|
7
|
+
"jbrowse2"
|
|
9
8
|
],
|
|
10
9
|
"license": "Apache-2.0",
|
|
11
10
|
"homepage": "https://jbrowse.org",
|
|
@@ -16,39 +15,27 @@
|
|
|
16
15
|
"directory": "products/jbrowse-cli"
|
|
17
16
|
},
|
|
18
17
|
"author": "JBrowse Team",
|
|
19
|
-
"main": "
|
|
20
|
-
"types": "lib/index.d.ts",
|
|
18
|
+
"main": "dist/index.js",
|
|
21
19
|
"bin": {
|
|
22
20
|
"jbrowse": "./bin/run"
|
|
23
21
|
},
|
|
24
22
|
"files": [
|
|
25
23
|
"/bin",
|
|
26
|
-
"/
|
|
27
|
-
"/
|
|
28
|
-
"/oclif.manifest.json"
|
|
24
|
+
"/bundle",
|
|
25
|
+
"/dist"
|
|
29
26
|
],
|
|
30
27
|
"engines": {
|
|
31
|
-
"node": ">=
|
|
28
|
+
"node": ">=18.3.0"
|
|
32
29
|
},
|
|
33
30
|
"scripts": {
|
|
34
31
|
"prebuild": "npm run clean",
|
|
35
|
-
"build": "tsc --build",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"prepack": "npm run clean && npm run build && npm run manifest && npm run docs",
|
|
39
|
-
"manifest": "oclif manifest",
|
|
40
|
-
"version": "npm run docs && npm run docs:version:add",
|
|
32
|
+
"build": "tsc --build && webpack",
|
|
33
|
+
"clean": "rimraf dist bundle",
|
|
34
|
+
"prepack": "npm run clean && npm run docs",
|
|
41
35
|
"predocs": "npm run build",
|
|
42
|
-
"docs": "
|
|
43
|
-
"docs:create": "oclif readme",
|
|
44
|
-
"docs:format": "prettier --write README.md",
|
|
45
|
-
"docs:version:add": "git add README.md"
|
|
36
|
+
"docs": "./generate_readme.sh > README.md"
|
|
46
37
|
},
|
|
47
38
|
"dependencies": {
|
|
48
|
-
"@oclif/core": "^4.0.19",
|
|
49
|
-
"@oclif/plugin-help": "^6.0.15",
|
|
50
|
-
"boxen": "^4.2.0",
|
|
51
|
-
"chalk": "^4.1.0",
|
|
52
39
|
"cli-progress": "^3.9.0",
|
|
53
40
|
"command-exists": "^1.2.9",
|
|
54
41
|
"cors": "^2.8.5",
|
|
@@ -56,22 +43,10 @@
|
|
|
56
43
|
"express": "^4.17.1",
|
|
57
44
|
"ixixx": "^2.0.1",
|
|
58
45
|
"json-parse-better-errors": "^1.0.2",
|
|
59
|
-
"node-fetch-native": "^1.6.4"
|
|
60
|
-
"tslib": "^2.3.1"
|
|
61
|
-
},
|
|
62
|
-
"devDependencies": {
|
|
63
|
-
"typescript": "^5.1.3"
|
|
64
|
-
},
|
|
65
|
-
"oclif": {
|
|
66
|
-
"commands": "./lib/commands",
|
|
67
|
-
"bin": "jbrowse",
|
|
68
|
-
"plugins": [
|
|
69
|
-
"@oclif/plugin-help"
|
|
70
|
-
],
|
|
71
|
-
"repositoryPrefix": "<%- repo %>/blob/v<%- version %>/products/jbrowse-cli/<%- commandPath %>"
|
|
46
|
+
"node-fetch-native": "^1.6.4"
|
|
72
47
|
},
|
|
73
48
|
"publishConfig": {
|
|
74
49
|
"access": "public"
|
|
75
50
|
},
|
|
76
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "133a68815ab348d156c18d83cffc997356c3cfbb"
|
|
77
52
|
}
|
package/bin/dev
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const oclif = require('@oclif/core')
|
|
4
|
-
|
|
5
|
-
const path = require('path')
|
|
6
|
-
const project = path.join(__dirname, '..', 'tsconfig.json')
|
|
7
|
-
|
|
8
|
-
// In dev mode -> use ts-node and dev plugins
|
|
9
|
-
process.env.NODE_ENV = 'development'
|
|
10
|
-
|
|
11
|
-
require('ts-node').register({ project })
|
|
12
|
-
|
|
13
|
-
// In dev mode, always show stack traces
|
|
14
|
-
oclif.settings.debug = true
|
|
15
|
-
|
|
16
|
-
// Start the CLI
|
|
17
|
-
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
|
package/bin/dev.cmd
DELETED
package/bin/run.cmd
DELETED
package/lib/base.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* By convention, exit codes in this base class are below 100
|
|
4
|
-
*/
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const fs_1 = require("fs");
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const core_1 = require("@oclif/core");
|
|
12
|
-
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
13
|
-
const fetchWithProxy_1 = __importDefault(require("./fetchWithProxy"));
|
|
14
|
-
class JBrowseCommand extends core_1.Command {
|
|
15
|
-
async init() { }
|
|
16
|
-
async readFile(location) {
|
|
17
|
-
return fs_1.promises.readFile(location, { encoding: 'utf8' });
|
|
18
|
-
}
|
|
19
|
-
async readJsonFile(location) {
|
|
20
|
-
let contents;
|
|
21
|
-
try {
|
|
22
|
-
contents = await fs_1.promises.readFile(location, { encoding: 'utf8' });
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
this.error(error instanceof Error ? error : `${error}`, {
|
|
26
|
-
suggestions: [
|
|
27
|
-
`Make sure the file "${location}" exists or use --out to point to a directory with a config.json`,
|
|
28
|
-
'Run `jbrowse add-assembly` to create a config file',
|
|
29
|
-
],
|
|
30
|
-
exit: 40,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
let result;
|
|
34
|
-
try {
|
|
35
|
-
result = (0, json_parse_better_errors_1.default)(contents);
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
this.error(error instanceof Error ? error : `${error}`, {
|
|
39
|
-
suggestions: [`Make sure "${location}" is a valid JSON file`],
|
|
40
|
-
exit: 50,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
async writeJsonFile(location, contents) {
|
|
46
|
-
this.debug(`Writing JSON file to ${process.cwd()} ${location}`);
|
|
47
|
-
return fs_1.promises.writeFile(location, JSON.stringify(contents, null, 2));
|
|
48
|
-
}
|
|
49
|
-
async resolveFileLocation(location, check = true, inPlace = false) {
|
|
50
|
-
let locationUrl;
|
|
51
|
-
try {
|
|
52
|
-
locationUrl = new URL(location);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
// ignore
|
|
56
|
-
}
|
|
57
|
-
if (locationUrl) {
|
|
58
|
-
if (check) {
|
|
59
|
-
// @ts-expect-error
|
|
60
|
-
const response = await (0, fetchWithProxy_1.default)(locationUrl, { method: 'HEAD' });
|
|
61
|
-
if (!response.ok) {
|
|
62
|
-
throw new Error(`${locationUrl} result ${response.statusText}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return locationUrl.href;
|
|
66
|
-
}
|
|
67
|
-
let locationPath;
|
|
68
|
-
try {
|
|
69
|
-
locationPath = check ? await fs_1.promises.realpath(location) : location;
|
|
70
|
-
}
|
|
71
|
-
catch (e) {
|
|
72
|
-
// ignore
|
|
73
|
-
}
|
|
74
|
-
if (locationPath) {
|
|
75
|
-
const filePath = path_1.default.relative(process.cwd(), locationPath);
|
|
76
|
-
if (inPlace && filePath.startsWith('..')) {
|
|
77
|
-
this.warn(`Location ${filePath} is not in the JBrowse directory. Make sure it is still in your server directory.`);
|
|
78
|
-
}
|
|
79
|
-
return inPlace ? location : filePath;
|
|
80
|
-
}
|
|
81
|
-
return this.error(`Could not resolve to a file or a URL: "${location}"`, {
|
|
82
|
-
exit: 40,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
async readInlineOrFileJson(inlineOrFileName) {
|
|
86
|
-
let result;
|
|
87
|
-
// see if it's inline JSON
|
|
88
|
-
try {
|
|
89
|
-
result = (0, json_parse_better_errors_1.default)(inlineOrFileName);
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
this.debug(`Not valid inline JSON, attempting to parse as filename: '${inlineOrFileName}'`);
|
|
93
|
-
// not inline JSON, must be location of a JSON file
|
|
94
|
-
result = await this.readJsonFile(inlineOrFileName);
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
async fetchGithubVersions() {
|
|
99
|
-
let versions = [];
|
|
100
|
-
for await (const iter of this.fetchVersions()) {
|
|
101
|
-
versions = [...versions, ...iter];
|
|
102
|
-
}
|
|
103
|
-
return versions;
|
|
104
|
-
}
|
|
105
|
-
async getLatest() {
|
|
106
|
-
for await (const versions of this.fetchVersions()) {
|
|
107
|
-
// if a release was just uploaded, or an erroneous build was made then it
|
|
108
|
-
// might have no build asset
|
|
109
|
-
const nonprereleases = versions
|
|
110
|
-
.filter(release => !release.prerelease)
|
|
111
|
-
.filter(release => release.assets?.length);
|
|
112
|
-
if (nonprereleases.length > 0) {
|
|
113
|
-
// @ts-expect-error
|
|
114
|
-
const file = nonprereleases[0].assets.find(f => f.name.includes('jbrowse-web'))?.browser_download_url;
|
|
115
|
-
if (!file) {
|
|
116
|
-
throw new Error('no jbrowse-web download found');
|
|
117
|
-
}
|
|
118
|
-
return file;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
throw new Error('no version tags found');
|
|
122
|
-
}
|
|
123
|
-
async *fetchVersions() {
|
|
124
|
-
let page = 1;
|
|
125
|
-
let result;
|
|
126
|
-
do {
|
|
127
|
-
const url = `https://api.github.com/repos/GMOD/jbrowse-components/releases?page=${page}`;
|
|
128
|
-
const response = await (0, fetchWithProxy_1.default)(url);
|
|
129
|
-
if (response.ok) {
|
|
130
|
-
result = (await response.json());
|
|
131
|
-
yield result.filter(release => release.tag_name.startsWith('v'));
|
|
132
|
-
page++;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
throw new Error(`HTTP ${response.status} fetching ${url}`);
|
|
136
|
-
}
|
|
137
|
-
} while (result.length);
|
|
138
|
-
}
|
|
139
|
-
async getTag(tag) {
|
|
140
|
-
const response = await (0, fetchWithProxy_1.default)(`https://api.github.com/repos/GMOD/jbrowse-components/releases/tags/${tag}`);
|
|
141
|
-
if (response.ok) {
|
|
142
|
-
const result = (await response.json());
|
|
143
|
-
const file = result.assets?.find(f => f.name.includes('jbrowse-web'))?.browser_download_url;
|
|
144
|
-
if (!file) {
|
|
145
|
-
this.error('Could not find version specified. Use --listVersions to see all available versions', { exit: 90 });
|
|
146
|
-
}
|
|
147
|
-
return file;
|
|
148
|
-
}
|
|
149
|
-
return this.error(`Could not find version: ${response.statusText}`, {
|
|
150
|
-
exit: 90,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
async getBranch(branch) {
|
|
154
|
-
return `https://s3.amazonaws.com/jbrowse.org/code/jb2/${branch}/jbrowse-web-${branch}.zip`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
exports.default = JBrowseCommand;
|