sandstone-cli 1.1.8 → 1.1.9

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.
@@ -26,7 +26,7 @@ export async function createCommand(_project, opts) {
26
26
  default: false,
27
27
  })).projectType) === true ? 'library' : 'pack';
28
28
  const sv = (v) => new SemVer(v);
29
- const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('0.14.0-alpha.13'), sv('0.5.4')], [sv('1.0.0-alpha.5'), sv('1.1.6')]];
29
+ const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('0.14.0-alpha.13'), sv('0.5.4')], [sv('1.0.0-alpha.6'), sv('1.1.9')]];
30
30
  const stableIndex = 0;
31
31
  const { version } = await inquirer.prompt({
32
32
  name: 'version',
@@ -19,16 +19,14 @@ export async function installVanillaCommand(_libraries) {
19
19
  const search = async (term) => {
20
20
  const options = [];
21
21
  const optionColumn = [0, 0, 0];
22
- for await (const { id, displayName } of await (await fetch(`${base}/packs?category=Library&sort=downloads${term ? `&search=${term}` : ''}`)).json()) {
23
- const meta = await (await fetch(`${base}/packs/${id}/meta`)).json();
24
- const owner = await (await fetch(`${base}/users/${meta.owner}`)).json();
25
- const { display: { description } } = await (await fetch(`${base}/packs/${id}`)).json();
22
+ const scopes = ['data.display.description', 'meta.rawId', 'meta.stats.downloads.total', 'owner.displayName'].map((scope) => `scope=${scope}`).join('&');
23
+ for await (const { id, displayName, meta, data, owner } of await (await fetch(`${base}/packs?category=Library&sort=downloads&${scopes}${term ? `&search=${encodeURIComponent(term)}` : ''}`)).json()) {
26
24
  const option = {
27
25
  id: meta.rawId,
28
26
  name: displayName,
29
27
  owner: owner.displayName,
30
28
  downloads: `${meta.stats.downloads.total}`,
31
- description: description,
29
+ description: data.display.description,
32
30
  };
33
31
  if (manifest && !manifest[id] && !manifest[meta.rawId]) {
34
32
  if (option.name.length > optionColumn[0])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandstone-cli",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "The CLI for Sandstone - the minecraft pack creation library.",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "homepage": "https://github.com/sandstone-mc/sandstone-cli#readme",
43
43
  "dependencies": {
44
- "@types/node": "^20.9.0",
44
+ "@types/node": "^20.10.0",
45
45
  "chalk": "^5.3.0",
46
46
  "chalk-template": "^1.1.0",
47
47
  "chokidar": "^3.5.3",
@@ -45,7 +45,7 @@ export async function createCommand(_project: string, opts: CreateOptions) {
45
45
 
46
46
  const sv = (v: string) => new SemVer(v)
47
47
 
48
- const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('0.14.0-alpha.13'), sv('0.5.4')], [sv('1.0.0-alpha.5'), sv('1.1.6')]] as const
48
+ const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('0.14.0-alpha.13'), sv('0.5.4')], [sv('1.0.0-alpha.6'), sv('1.1.9')]] as const
49
49
 
50
50
  const stableIndex = 0
51
51
 
@@ -9,13 +9,13 @@ export async function installNativeCommand() {
9
9
  console.log('unimplemented')
10
10
  }
11
11
 
12
- type SmithedSearch = { id: string, displayName: string }[]
13
-
14
- type SmithedMeta = { rawId: string, stats: { downloads: { total: number } }, owner: string }
15
-
16
- type SmithedUser = { displayName: string }
17
-
18
- type SmithedPack = { display: { description: string } }
12
+ type SmithedSearch = {
13
+ id: string,
14
+ displayName: string,
15
+ data: { display: { description: string } },
16
+ meta: { rawId: string, stats: { downloads: { total: number } }, owner: string }
17
+ owner: { displayName: string }
18
+ }[]
19
19
 
20
20
  export async function installVanillaCommand(_libraries: string[]) {
21
21
  let libraries: [string, boolean][] = _libraries.map((lib) => [lib, false])
@@ -35,18 +35,16 @@ export async function installVanillaCommand(_libraries: string[]) {
35
35
 
36
36
  const optionColumn = [0, 0, 0]
37
37
 
38
- for await (const { id, displayName } of (await (await fetch(`${base}/packs?category=Library&sort=downloads${term ? `&search=${term}` : ''}`)).json() as SmithedSearch)) {
38
+ const scopes = ['data.display.description', 'meta.rawId', 'meta.stats.downloads.total', 'owner.displayName'].map((scope) => `scope=${scope}`).join('&')
39
39
 
40
- const meta = await (await fetch(`${base}/packs/${id}/meta`)).json() as SmithedMeta
41
- const owner = await(await fetch(`${base}/users/${meta.owner}`)).json() as SmithedUser
42
- const { display: { description }} = await(await fetch(`${base}/packs/${id}`)).json() as SmithedPack
40
+ for await (const { id, displayName, meta, data, owner } of (await (await fetch(`${base}/packs?category=Library&sort=downloads&${scopes}${term ? `&search=${encodeURIComponent(term)}` : ''}`)).json() as SmithedSearch)) {
43
41
 
44
42
  const option = {
45
43
  id: meta.rawId,
46
44
  name: displayName,
47
45
  owner: owner.displayName,
48
46
  downloads: `${meta.stats.downloads.total}`,
49
- description: description,
47
+ description: data.display.description,
50
48
  }
51
49
 
52
50
  if (manifest && !manifest[id] && !manifest[meta.rawId]) {