Skip to content

Commit a74972c

Browse files
committed
feat: add --with-external-source option to use fallback source (services.api, rss feeds)
1 parent 7b20612 commit a74972c

5 files changed

Lines changed: 371 additions & 56 deletions

File tree

.vscode/launch.json

Lines changed: 22 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"request": "launch",
6+
"name": "list --with-external-source",
7+
"type": "node",
8+
"program": "${workspaceFolder}/src/cli.ts",
9+
"cwd": "${workspaceFolder}",
10+
"env": {},
11+
"runtimeExecutable": "deno",
12+
"runtimeArgs": ["run", "--unstable", "--inspect-brk", "--allow-all"],
13+
"args": ["list", "--with-external-source"],
14+
"attachSimplePort": 9229
15+
},
416
{
517
"request": "launch",
618
"name": "list",
@@ -9,15 +21,8 @@
921
"cwd": "${workspaceFolder}",
1022
"env": {},
1123
"runtimeExecutable": "deno",
12-
"runtimeArgs": [
13-
"run",
14-
"--unstable",
15-
"--inspect-brk",
16-
"--allow-all"
17-
],
18-
"args": [
19-
"list"
20-
],
24+
"runtimeArgs": ["run", "--unstable", "--inspect-brk", "--allow-all"],
25+
"args": ["list"],
2126
"attachSimplePort": 9229
2227
},
2328
{
@@ -28,18 +33,8 @@
2833
"cwd": "${workspaceFolder}",
2934
"env": {},
3035
"runtimeExecutable": "deno",
31-
"runtimeArgs": [
32-
"run",
33-
"--unstable",
34-
"--inspect-brk",
35-
"--allow-all"
36-
],
37-
"args": [
38-
"list",
39-
"--versions",
40-
"--all",
41-
"--all-lifecycles"
42-
],
36+
"runtimeArgs": ["run", "--unstable", "--inspect-brk", "--allow-all"],
37+
"args": ["list", "--versions", "--all", "--all-lifecycles"],
4338
"attachSimplePort": 9229
4439
},
4540
{
@@ -50,15 +45,8 @@
5045
"cwd": "${workspaceFolder}",
5146
"env": {},
5247
"runtimeExecutable": "deno",
53-
"runtimeArgs": [
54-
"run",
55-
"--unstable",
56-
"--inspect-brk",
57-
"--allow-all"
58-
],
59-
"args": [
60-
"6000.0.25f1"
61-
],
48+
"runtimeArgs": ["run", "--unstable", "--inspect-brk", "--allow-all"],
49+
"args": ["6000.0.25f1"],
6250
"attachSimplePort": 9229
6351
},
6452
{
@@ -69,15 +57,8 @@
6957
"cwd": "${workspaceFolder}",
7058
"env": {},
7159
"runtimeExecutable": "deno",
72-
"runtimeArgs": [
73-
"run",
74-
"--unstable",
75-
"--inspect-brk",
76-
"--allow-all"
77-
],
78-
"args": [
79-
"6000.0.25f2"
80-
],
60+
"runtimeArgs": ["run", "--unstable", "--inspect-brk", "--allow-all"],
61+
"args": ["6000.0.25f2"],
8162
"attachSimplePort": 9229
8263
},
8364
{
@@ -88,15 +69,8 @@
8869
"cwd": "${workspaceFolder}",
8970
"env": {},
9071
"runtimeExecutable": "deno",
91-
"runtimeArgs": [
92-
"run",
93-
"--unstable",
94-
"--inspect-brk",
95-
"--allow-all"
96-
],
97-
"args": [
98-
"--help"
99-
],
72+
"runtimeArgs": ["run", "--unstable", "--inspect-brk", "--allow-all"],
73+
"args": ["--help"],
10074
"attachSimplePort": 9229
10175
}
10276
]

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ deno install -A -f -n unity-changeset https://deno.land/x/unity_changeset/src/cl
114114
-h, --help - Show this help.
115115
-V, --version - Show the version number for this program.
116116
--db [url] - Use cached database instead of GraphQL API. If `url` is not specified, use the default database.
117+
--with-external-source - Merge external Unity release sources into the database or GraphQL results.
117118
```
118119

119120
```
@@ -156,6 +157,7 @@ deno install -A -f -n unity-changeset https://deno.land/x/unity_changeset/src/cl
156157
--minor-version-only, --minor-versions - Outputs only the minor version (no changesets)
157158
--json - Output in json format
158159
--pretty-json - Output in pretty json format
160+
--with-external-source - Merge external Unity release sources into the database or GraphQL results.
159161
```
160162

161163
### Get a changeset for specific version:
@@ -165,6 +167,13 @@ $ unity-changeset 2020.2.14f1
165167
d81f64f5201d
166168
```
167169

170+
### Get a changeset for specific version with external sources:
171+
172+
```sh
173+
$ unity-changeset 2020.2.14f1 --with-external-source
174+
d81f64f5201d
175+
```
176+
168177
### Get a changeset for specific version
169178

170179
```sh
@@ -259,6 +268,16 @@ $ unity-changeset list --latest-patch
259268
2017.1.5f1 9758a36cfaa6
260269
```
261270

271+
### List changesets with external sources
272+
273+
This option merges changesets from Unity's public release API at `services.api.unity.com` and Unity's RSS feeds.
274+
275+
```sh
276+
$ unity-changeset list --all --with-external-source
277+
2020.2.0b13 655e1a328b90
278+
...
279+
```
280+
262281
### Install a specific version of Unity via UnityHub
263282

264283
```sh

src/cli.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ new Command()
3131
.example("unity-changeset 2018.4.36f1", "Get changeset of Unity 2018.4.36f1 ('6cd387d23174' will be output).")
3232
.arguments("<version>")
3333
.option("--db [url]", "Use cached database instead of GraphQL API. If `url` is not specified, use the default database.")
34+
.option("--with-external-source", "Merge external Unity release sources into the database or GraphQL results.")
3435
.action((options, version) => {
35-
getUnityChangeset(version, options.db)
36+
getUnityChangeset(version, options.db, options.withExternalSource || false)
3637
.then((c) => console.log(c.changeset))
3738
.catch(() => {
3839
console.error("The given version was not found.");
@@ -80,6 +81,7 @@ new Command()
8081
// Database options.
8182
.group("Database options")
8283
.option("--db [url]", "Use cached database instead of GraphQL API. If `url` is not specified, use the default database.")
84+
.option("--with-external-source", "Merge external Unity release sources into the database or GraphQL results.")
8385
.action((options) => {
8486
// Search mode.
8587
const searchMode = options.all
@@ -126,7 +128,15 @@ new Command()
126128
? FormatMode.PrettyJson
127129
: FormatMode.None;
128130

129-
listChangesets(searchMode, filterOptions, groupMode, outputMode, formatMode, options.db)
131+
listChangesets(
132+
searchMode,
133+
filterOptions,
134+
groupMode,
135+
outputMode,
136+
formatMode,
137+
options.db,
138+
options.withExternalSource || false,
139+
)
130140
.then((result) => console.log(result));
131141
}),
132142
)

0 commit comments

Comments
 (0)