@sonolus/generate-static 5.4.9 → 5.5.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/dist/index.js +42 -44
- package/dist/schemas/database.js +22 -25
- package/dist/schemas/items/background.js +16 -19
- package/dist/schemas/items/effect.js +15 -18
- package/dist/schemas/items/engine.js +23 -26
- package/dist/schemas/items/level.js +21 -24
- package/dist/schemas/items/particle.js +15 -18
- package/dist/schemas/items/playlist.js +14 -17
- package/dist/schemas/items/post.js +13 -16
- package/dist/schemas/items/replay.js +15 -18
- package/dist/schemas/items/skin.js +15 -18
- package/dist/schemas/localizationText.js +2 -5
- package/dist/schemas/ordering.js +11 -14
- package/dist/schemas/serverInfo.js +7 -10
- package/dist/schemas/srl.js +4 -7
- package/dist/schemas/tag.js +5 -8
- package/dist/schemas/test.js +1 -2
- package/dist/server/database.js +1 -5
- package/dist/server/items/background.js +3 -7
- package/dist/server/items/effect.js +3 -7
- package/dist/server/items/engine.js +12 -16
- package/dist/server/items/item.js +1 -2
- package/dist/server/items/level.js +15 -19
- package/dist/server/items/particle.js +3 -7
- package/dist/server/items/playlist.js +6 -10
- package/dist/server/items/post.js +11 -0
- package/dist/server/items/replay.js +6 -10
- package/dist/server/items/skin.js +3 -7
- package/dist/server/localization.js +1 -2
- package/dist/server/sonolus.js +1 -2
- package/dist/server/tag.js +1 -5
- package/dist/utils/json.js +7 -11
- package/dist/utils/test.js +1 -2
- package/package.json +12 -11
- package/dist/server/items/post-item.js +0 -15
package/dist/index.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const json_1 = require("./utils/json");
|
|
19
|
-
const options = new commander_1.Command()
|
|
2
|
+
import { Icon, Text, localize as sonolusLocalize, } from '@sonolus/core';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import { databaseSchema } from './schemas/database.js';
|
|
6
|
+
import { orderingSchema } from './schemas/ordering.js';
|
|
7
|
+
import { toBackgroundItem } from './server/items/background.js';
|
|
8
|
+
import { toEffectItem } from './server/items/effect.js';
|
|
9
|
+
import { toEngineItem } from './server/items/engine.js';
|
|
10
|
+
import { toLevelItem } from './server/items/level.js';
|
|
11
|
+
import { toParticleItem } from './server/items/particle.js';
|
|
12
|
+
import { toPlaylistItem } from './server/items/playlist.js';
|
|
13
|
+
import { toPostItem } from './server/items/post.js';
|
|
14
|
+
import { toReplayItem } from './server/items/replay.js';
|
|
15
|
+
import { toSkinItem } from './server/items/skin.js';
|
|
16
|
+
import { parse } from './utils/json.js';
|
|
17
|
+
const options = new Command()
|
|
20
18
|
.name('sonolus-generate-static')
|
|
21
|
-
.version('5.
|
|
19
|
+
.version('5.5.0')
|
|
22
20
|
.option('-i, --input <value>', 'input directory', 'pack')
|
|
23
21
|
.option('-o, --output <value>', 'output directory', 'static')
|
|
24
22
|
.option('-a, --address [value]', 'address')
|
|
@@ -60,8 +58,8 @@ const outputItems = (dirname, sonolus, items, itemType, toItem) => {
|
|
|
60
58
|
leaderboards: [],
|
|
61
59
|
sections: [
|
|
62
60
|
{
|
|
63
|
-
title:
|
|
64
|
-
icon:
|
|
61
|
+
title: Text.Recommended,
|
|
62
|
+
icon: Icon.Star,
|
|
65
63
|
itemType,
|
|
66
64
|
items: items
|
|
67
65
|
.slice(index + 1, index + 6)
|
|
@@ -69,38 +67,38 @@ const outputItems = (dirname, sonolus, items, itemType, toItem) => {
|
|
|
69
67
|
},
|
|
70
68
|
],
|
|
71
69
|
};
|
|
72
|
-
|
|
70
|
+
fs.outputJsonSync(`${pathOutput}/sonolus/${dirname}/${item.name}`, itemDetails);
|
|
73
71
|
}
|
|
74
72
|
console.log('[INFO]', `${pathOutput}/sonolus/${dirname}/list`);
|
|
75
73
|
const list = {
|
|
76
74
|
pageCount: 1,
|
|
77
75
|
items: items.map((item) => toItem(sonolus, item)),
|
|
78
76
|
};
|
|
79
|
-
|
|
77
|
+
fs.outputJsonSync(`${pathOutput}/sonolus/${dirname}/list`, list);
|
|
80
78
|
console.log('[INFO]', `${pathOutput}/sonolus/${dirname}/info`);
|
|
81
79
|
const itemInfo = {
|
|
82
80
|
banner: sonolus.db.info.banner,
|
|
83
81
|
sections: [
|
|
84
82
|
{
|
|
85
|
-
title:
|
|
83
|
+
title: Text.Newest,
|
|
86
84
|
itemType,
|
|
87
85
|
items: items.slice(0, 5).map((item) => toItem(sonolus, item)),
|
|
88
86
|
},
|
|
89
87
|
],
|
|
90
88
|
};
|
|
91
|
-
|
|
89
|
+
fs.outputJsonSync(`${pathOutput}/sonolus/${dirname}/info`, itemInfo);
|
|
92
90
|
};
|
|
93
91
|
try {
|
|
94
92
|
console.log('[INFO]', 'Generating:', pathInput);
|
|
95
93
|
console.log();
|
|
96
|
-
|
|
94
|
+
fs.emptyDirSync(pathOutput);
|
|
97
95
|
const sonolus = {
|
|
98
|
-
db:
|
|
96
|
+
db: parse(`${pathInput}/db.json`, databaseSchema),
|
|
99
97
|
address,
|
|
100
|
-
localize: (text) => (
|
|
98
|
+
localize: (text) => sonolusLocalize(text, targetLocale, fallbackLocale),
|
|
101
99
|
};
|
|
102
|
-
const ordering =
|
|
103
|
-
?
|
|
100
|
+
const ordering = fs.existsSync(`${pathInput}/ordering.json`)
|
|
101
|
+
? parse(`${pathInput}/ordering.json`, orderingSchema)
|
|
104
102
|
: {};
|
|
105
103
|
orderDb(sonolus.db, ordering);
|
|
106
104
|
console.log('[INFO]', `${pathOutput}/sonolus/info`);
|
|
@@ -125,29 +123,29 @@ try {
|
|
|
125
123
|
},
|
|
126
124
|
banner: sonolus.db.info.banner,
|
|
127
125
|
};
|
|
128
|
-
|
|
126
|
+
fs.outputJsonSync(`${pathOutput}/sonolus/info`, serverInfo);
|
|
129
127
|
console.log('[INFO]', `${pathOutput}/sonolus/package`);
|
|
130
128
|
const packageInfo = {};
|
|
131
|
-
|
|
132
|
-
outputItems('posts', sonolus, sonolus.db.posts, 'post',
|
|
133
|
-
outputItems('playlists', sonolus, sonolus.db.playlists, 'playlist',
|
|
134
|
-
outputItems('levels', sonolus, sonolus.db.levels, 'level',
|
|
135
|
-
outputItems('skins', sonolus, sonolus.db.skins, 'skin',
|
|
136
|
-
outputItems('backgrounds', sonolus, sonolus.db.backgrounds, 'background',
|
|
137
|
-
outputItems('effects', sonolus, sonolus.db.effects, 'effect',
|
|
138
|
-
outputItems('particles', sonolus, sonolus.db.particles, 'particle',
|
|
139
|
-
outputItems('engines', sonolus, sonolus.db.engines, 'engine',
|
|
140
|
-
outputItems('replays', sonolus, sonolus.db.replays, 'replay',
|
|
129
|
+
fs.outputJsonSync(`${pathOutput}/sonolus/package`, packageInfo);
|
|
130
|
+
outputItems('posts', sonolus, sonolus.db.posts, 'post', toPostItem);
|
|
131
|
+
outputItems('playlists', sonolus, sonolus.db.playlists, 'playlist', toPlaylistItem);
|
|
132
|
+
outputItems('levels', sonolus, sonolus.db.levels, 'level', toLevelItem);
|
|
133
|
+
outputItems('skins', sonolus, sonolus.db.skins, 'skin', toSkinItem);
|
|
134
|
+
outputItems('backgrounds', sonolus, sonolus.db.backgrounds, 'background', toBackgroundItem);
|
|
135
|
+
outputItems('effects', sonolus, sonolus.db.effects, 'effect', toEffectItem);
|
|
136
|
+
outputItems('particles', sonolus, sonolus.db.particles, 'particle', toParticleItem);
|
|
137
|
+
outputItems('engines', sonolus, sonolus.db.engines, 'engine', toEngineItem);
|
|
138
|
+
outputItems('replays', sonolus, sonolus.db.replays, 'replay', toReplayItem);
|
|
141
139
|
console.log('[INFO]', `${pathOutput}/sonolus/levels/result/info`);
|
|
142
140
|
const levelResultInfo = {};
|
|
143
|
-
|
|
141
|
+
fs.outputJsonSync(`${pathOutput}/sonolus/levels/result/info`, levelResultInfo);
|
|
144
142
|
console.log('[INFO]', `${pathOutput}/sonolus/repository`);
|
|
145
|
-
|
|
143
|
+
fs.copySync(`${pathInput}/repository`, `${pathOutput}/sonolus/repository`);
|
|
146
144
|
console.log();
|
|
147
145
|
console.log('[SUCCESS]', 'Generated to:', pathOutput);
|
|
148
146
|
}
|
|
149
147
|
catch (error) {
|
|
150
148
|
console.log();
|
|
151
149
|
console.error('[FAILED]', error);
|
|
152
|
-
|
|
150
|
+
fs.removeSync(pathOutput);
|
|
153
151
|
}
|
package/dist/schemas/database.js
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
particles: typebox_1.Type.Array(particle_1.databaseParticleItemSchema),
|
|
24
|
-
engines: typebox_1.Type.Array(engine_1.databaseEngineItemSchema),
|
|
25
|
-
replays: typebox_1.Type.Array(replay_1.databaseReplayItemSchema),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { databaseBackgroundItemSchema } from './items/background.js';
|
|
3
|
+
import { databaseEffectItemSchema } from './items/effect.js';
|
|
4
|
+
import { databaseEngineItemSchema } from './items/engine.js';
|
|
5
|
+
import { databaseLevelItemSchema } from './items/level.js';
|
|
6
|
+
import { databaseParticleItemSchema } from './items/particle.js';
|
|
7
|
+
import { databasePlaylistItemSchema } from './items/playlist.js';
|
|
8
|
+
import { databasePostItemSchema } from './items/post.js';
|
|
9
|
+
import { databaseReplayItemSchema } from './items/replay.js';
|
|
10
|
+
import { databaseSkinItemSchema } from './items/skin.js';
|
|
11
|
+
import { databaseServerInfoSchema } from './serverInfo.js';
|
|
12
|
+
export const databaseSchema = Type.Object({
|
|
13
|
+
info: databaseServerInfoSchema,
|
|
14
|
+
posts: Type.Array(databasePostItemSchema),
|
|
15
|
+
playlists: Type.Array(databasePlaylistItemSchema),
|
|
16
|
+
levels: Type.Array(databaseLevelItemSchema),
|
|
17
|
+
skins: Type.Array(databaseSkinItemSchema),
|
|
18
|
+
backgrounds: Type.Array(databaseBackgroundItemSchema),
|
|
19
|
+
effects: Type.Array(databaseEffectItemSchema),
|
|
20
|
+
particles: Type.Array(databaseParticleItemSchema),
|
|
21
|
+
engines: Type.Array(databaseEngineItemSchema),
|
|
22
|
+
replays: Type.Array(databaseReplayItemSchema),
|
|
26
23
|
});
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
data: srl_1.srlSchema,
|
|
18
|
-
image: srl_1.srlSchema,
|
|
19
|
-
configuration: srl_1.srlSchema,
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databaseBackgroundItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(2),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
subtitle: localizationTextSchema,
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
thumbnail: srlSchema,
|
|
14
|
+
data: srlSchema,
|
|
15
|
+
image: srlSchema,
|
|
16
|
+
configuration: srlSchema,
|
|
20
17
|
});
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
thumbnail: srl_1.srlSchema,
|
|
17
|
-
data: srl_1.srlSchema,
|
|
18
|
-
audio: srl_1.srlSchema,
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databaseEffectItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(5),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
subtitle: localizationTextSchema,
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
thumbnail: srlSchema,
|
|
14
|
+
data: srlSchema,
|
|
15
|
+
audio: srlSchema,
|
|
19
16
|
});
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
tutorialData: srl_1.srlSchema,
|
|
25
|
-
rom: typebox_1.Type.Optional(srl_1.srlSchema),
|
|
26
|
-
configuration: srl_1.srlSchema,
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databaseEngineItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(13),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
subtitle: localizationTextSchema,
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
skin: Type.String(),
|
|
14
|
+
background: Type.String(),
|
|
15
|
+
effect: Type.String(),
|
|
16
|
+
particle: Type.String(),
|
|
17
|
+
thumbnail: srlSchema,
|
|
18
|
+
playData: srlSchema,
|
|
19
|
+
watchData: srlSchema,
|
|
20
|
+
previewData: srlSchema,
|
|
21
|
+
tutorialData: srlSchema,
|
|
22
|
+
rom: Type.Optional(srlSchema),
|
|
23
|
+
configuration: srlSchema,
|
|
27
24
|
});
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const databaseUseItemSchema = typebox_1.Type.Union([
|
|
9
|
-
typebox_1.Type.Object({ useDefault: typebox_1.Type.Literal(true) }),
|
|
10
|
-
typebox_1.Type.Object({ useDefault: typebox_1.Type.Literal(false), item: typebox_1.Type.String() }),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
const databaseUseItemSchema = Type.Union([
|
|
6
|
+
Type.Object({ useDefault: Type.Literal(true) }),
|
|
7
|
+
Type.Object({ useDefault: Type.Literal(false), item: Type.String() }),
|
|
11
8
|
]);
|
|
12
|
-
|
|
13
|
-
name:
|
|
14
|
-
version:
|
|
15
|
-
rating:
|
|
16
|
-
title:
|
|
17
|
-
artists:
|
|
18
|
-
author:
|
|
19
|
-
tags:
|
|
20
|
-
description:
|
|
21
|
-
engine:
|
|
9
|
+
export const databaseLevelItemSchema = Type.Object({
|
|
10
|
+
name: Type.String(),
|
|
11
|
+
version: Type.Literal(1),
|
|
12
|
+
rating: Type.Number(),
|
|
13
|
+
title: localizationTextSchema,
|
|
14
|
+
artists: localizationTextSchema,
|
|
15
|
+
author: localizationTextSchema,
|
|
16
|
+
tags: Type.Array(databaseTagSchema),
|
|
17
|
+
description: Type.Optional(localizationTextSchema),
|
|
18
|
+
engine: Type.String(),
|
|
22
19
|
useSkin: databaseUseItemSchema,
|
|
23
20
|
useBackground: databaseUseItemSchema,
|
|
24
21
|
useEffect: databaseUseItemSchema,
|
|
25
22
|
useParticle: databaseUseItemSchema,
|
|
26
|
-
cover:
|
|
27
|
-
bgm:
|
|
28
|
-
preview:
|
|
29
|
-
data:
|
|
23
|
+
cover: srlSchema,
|
|
24
|
+
bgm: srlSchema,
|
|
25
|
+
preview: Type.Optional(srlSchema),
|
|
26
|
+
data: srlSchema,
|
|
30
27
|
});
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
thumbnail: srl_1.srlSchema,
|
|
17
|
-
data: srl_1.srlSchema,
|
|
18
|
-
texture: srl_1.srlSchema,
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databaseParticleItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(3),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
subtitle: localizationTextSchema,
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
thumbnail: srlSchema,
|
|
14
|
+
data: srlSchema,
|
|
15
|
+
texture: srlSchema,
|
|
19
16
|
});
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
description: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
|
|
16
|
-
levels: typebox_1.Type.Array(typebox_1.Type.String()),
|
|
17
|
-
thumbnail: typebox_1.Type.Optional(srl_1.srlSchema),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databasePlaylistItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(1),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
subtitle: localizationTextSchema,
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
levels: Type.Array(Type.String()),
|
|
14
|
+
thumbnail: Type.Optional(srlSchema),
|
|
18
15
|
});
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
|
|
15
|
-
description: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
|
|
16
|
-
thumbnail: typebox_1.Type.Optional(srl_1.srlSchema),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databasePostItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(1),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
time: Type.Number(),
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
thumbnail: Type.Optional(srlSchema),
|
|
17
14
|
});
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
level: typebox_1.Type.String(),
|
|
17
|
-
data: srl_1.srlSchema,
|
|
18
|
-
configuration: srl_1.srlSchema,
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databaseReplayItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(1),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
subtitle: localizationTextSchema,
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
level: Type.String(),
|
|
14
|
+
data: srlSchema,
|
|
15
|
+
configuration: srlSchema,
|
|
19
16
|
});
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
thumbnail: srl_1.srlSchema,
|
|
17
|
-
data: srl_1.srlSchema,
|
|
18
|
-
texture: srl_1.srlSchema,
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from '../localizationText.js';
|
|
3
|
+
import { srlSchema } from '../srl.js';
|
|
4
|
+
import { databaseTagSchema } from '../tag.js';
|
|
5
|
+
export const databaseSkinItemSchema = Type.Object({
|
|
6
|
+
name: Type.String(),
|
|
7
|
+
version: Type.Literal(4),
|
|
8
|
+
title: localizationTextSchema,
|
|
9
|
+
subtitle: localizationTextSchema,
|
|
10
|
+
author: localizationTextSchema,
|
|
11
|
+
tags: Type.Array(databaseTagSchema),
|
|
12
|
+
description: Type.Optional(localizationTextSchema),
|
|
13
|
+
thumbnail: srlSchema,
|
|
14
|
+
data: srlSchema,
|
|
15
|
+
texture: srlSchema,
|
|
19
16
|
});
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.localizationTextSchema = void 0;
|
|
4
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
-
exports.localizationTextSchema = typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.String());
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
export const localizationTextSchema = Type.Record(Type.String(), Type.String());
|
package/dist/schemas/ordering.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
particles: typebox_1.Type.Array(typebox_1.Type.String()),
|
|
13
|
-
engines: typebox_1.Type.Array(typebox_1.Type.String()),
|
|
14
|
-
replays: typebox_1.Type.Array(typebox_1.Type.String()),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
export const orderingSchema = Type.Partial(Type.Object({
|
|
3
|
+
posts: Type.Array(Type.String()),
|
|
4
|
+
playlists: Type.Array(Type.String()),
|
|
5
|
+
levels: Type.Array(Type.String()),
|
|
6
|
+
skins: Type.Array(Type.String()),
|
|
7
|
+
backgrounds: Type.Array(Type.String()),
|
|
8
|
+
effects: Type.Array(Type.String()),
|
|
9
|
+
particles: Type.Array(Type.String()),
|
|
10
|
+
engines: Type.Array(Type.String()),
|
|
11
|
+
replays: Type.Array(Type.String()),
|
|
15
12
|
}));
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
title: localizationText_1.localizationTextSchema,
|
|
9
|
-
description: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
|
|
10
|
-
banner: typebox_1.Type.Optional(srl_1.srlSchema),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from './localizationText.js';
|
|
3
|
+
import { srlSchema } from './srl.js';
|
|
4
|
+
export const databaseServerInfoSchema = Type.Object({
|
|
5
|
+
title: localizationTextSchema,
|
|
6
|
+
description: Type.Optional(localizationTextSchema),
|
|
7
|
+
banner: Type.Optional(srlSchema),
|
|
11
8
|
});
|
package/dist/schemas/srl.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.srlSchema = typebox_1.Type.Object({
|
|
6
|
-
hash: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])),
|
|
7
|
-
url: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
export const srlSchema = Type.Object({
|
|
3
|
+
hash: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
4
|
+
url: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
8
5
|
});
|
package/dist/schemas/tag.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.databaseTagSchema = typebox_1.Type.Object({
|
|
7
|
-
title: localizationText_1.localizationTextSchema,
|
|
8
|
-
icon: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { localizationTextSchema } from './localizationText.js';
|
|
3
|
+
export const databaseTagSchema = Type.Object({
|
|
4
|
+
title: localizationTextSchema,
|
|
5
|
+
icon: Type.Optional(Type.String()),
|
|
9
6
|
});
|
package/dist/schemas/test.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/server/database.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getByName = void 0;
|
|
4
|
-
const getByName = (items, name, parent, path) => {
|
|
1
|
+
export const getByName = (items, name, parent, path) => {
|
|
5
2
|
const item = items.find((item) => item.name === name);
|
|
6
3
|
if (!item)
|
|
7
4
|
throw new Error(`${parent}: ${name} not found (${path})`);
|
|
8
5
|
return item;
|
|
9
6
|
};
|
|
10
|
-
exports.getByName = getByName;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.toBackgroundItem = void 0;
|
|
4
|
-
const tag_1 = require("../tag");
|
|
5
|
-
const toBackgroundItem = (sonolus, item) => ({
|
|
1
|
+
import { toTags } from '../tag.js';
|
|
2
|
+
export const toBackgroundItem = (sonolus, item) => ({
|
|
6
3
|
name: item.name,
|
|
7
4
|
source: sonolus.address,
|
|
8
5
|
version: item.version,
|
|
9
6
|
title: sonolus.localize(item.title),
|
|
10
7
|
subtitle: sonolus.localize(item.subtitle),
|
|
11
8
|
author: sonolus.localize(item.author),
|
|
12
|
-
tags:
|
|
9
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
13
10
|
thumbnail: item.thumbnail,
|
|
14
11
|
data: item.data,
|
|
15
12
|
image: item.image,
|
|
16
13
|
configuration: item.configuration,
|
|
17
14
|
});
|
|
18
|
-
exports.toBackgroundItem = toBackgroundItem;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.toEffectItem = void 0;
|
|
4
|
-
const tag_1 = require("../tag");
|
|
5
|
-
const toEffectItem = (sonolus, item) => ({
|
|
1
|
+
import { toTags } from '../tag.js';
|
|
2
|
+
export const toEffectItem = (sonolus, item) => ({
|
|
6
3
|
name: item.name,
|
|
7
4
|
source: sonolus.address,
|
|
8
5
|
version: item.version,
|
|
9
6
|
title: sonolus.localize(item.title),
|
|
10
7
|
subtitle: sonolus.localize(item.subtitle),
|
|
11
8
|
author: sonolus.localize(item.author),
|
|
12
|
-
tags:
|
|
9
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
13
10
|
thumbnail: item.thumbnail,
|
|
14
11
|
data: item.data,
|
|
15
12
|
audio: item.audio,
|
|
16
13
|
});
|
|
17
|
-
exports.toEffectItem = toEffectItem;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const particle_1 = require("./particle");
|
|
9
|
-
const skin_1 = require("./skin");
|
|
10
|
-
const toEngineItem = (sonolus, item) => ({
|
|
1
|
+
import { getByName } from '../database.js';
|
|
2
|
+
import { toTags } from '../tag.js';
|
|
3
|
+
import { toBackgroundItem } from './background.js';
|
|
4
|
+
import { toEffectItem } from './effect.js';
|
|
5
|
+
import { toParticleItem } from './particle.js';
|
|
6
|
+
import { toSkinItem } from './skin.js';
|
|
7
|
+
export const toEngineItem = (sonolus, item) => ({
|
|
11
8
|
name: item.name,
|
|
12
9
|
source: sonolus.address,
|
|
13
10
|
version: item.version,
|
|
14
11
|
title: sonolus.localize(item.title),
|
|
15
12
|
subtitle: sonolus.localize(item.subtitle),
|
|
16
13
|
author: sonolus.localize(item.author),
|
|
17
|
-
tags:
|
|
18
|
-
skin:
|
|
19
|
-
background:
|
|
20
|
-
effect:
|
|
21
|
-
particle:
|
|
14
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
15
|
+
skin: toSkinItem(sonolus, getByName(sonolus.db.skins, item.skin, `Engine/${item.name}`, '/skin')),
|
|
16
|
+
background: toBackgroundItem(sonolus, getByName(sonolus.db.backgrounds, item.background, `Engine/${item.name}`, '/background')),
|
|
17
|
+
effect: toEffectItem(sonolus, getByName(sonolus.db.effects, item.effect, `Engine/${item.name}`, '/effect')),
|
|
18
|
+
particle: toParticleItem(sonolus, getByName(sonolus.db.particles, item.particle, `Engine/${item.name}`, '/particle')),
|
|
22
19
|
thumbnail: item.thumbnail,
|
|
23
20
|
playData: item.playData,
|
|
24
21
|
watchData: item.watchData,
|
|
@@ -27,4 +24,3 @@ const toEngineItem = (sonolus, item) => ({
|
|
|
27
24
|
rom: item.rom,
|
|
28
25
|
configuration: item.configuration,
|
|
29
26
|
});
|
|
30
|
-
exports.toEngineItem = toEngineItem;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const particle_1 = require("./particle");
|
|
10
|
-
const skin_1 = require("./skin");
|
|
11
|
-
const toLevelItem = (sonolus, item) => ({
|
|
1
|
+
import { getByName } from '../database.js';
|
|
2
|
+
import { toTags } from '../tag.js';
|
|
3
|
+
import { toBackgroundItem } from './background.js';
|
|
4
|
+
import { toEffectItem } from './effect.js';
|
|
5
|
+
import { toEngineItem } from './engine.js';
|
|
6
|
+
import { toParticleItem } from './particle.js';
|
|
7
|
+
import { toSkinItem } from './skin.js';
|
|
8
|
+
export const toLevelItem = (sonolus, item) => ({
|
|
12
9
|
name: item.name,
|
|
13
10
|
source: sonolus.address,
|
|
14
11
|
version: item.version,
|
|
15
12
|
rating: item.rating,
|
|
16
|
-
engine:
|
|
17
|
-
useSkin: toUseItem(sonolus,
|
|
18
|
-
useBackground: toUseItem(sonolus,
|
|
19
|
-
useEffect: toUseItem(sonolus,
|
|
20
|
-
useParticle: toUseItem(sonolus,
|
|
13
|
+
engine: toEngineItem(sonolus, getByName(sonolus.db.engines, item.engine, `Level/${item.name}`, '/engine')),
|
|
14
|
+
useSkin: toUseItem(sonolus, toSkinItem, item.useSkin, sonolus.db.skins, `Level/${item.name}`, '/useSkin/item'),
|
|
15
|
+
useBackground: toUseItem(sonolus, toBackgroundItem, item.useBackground, sonolus.db.backgrounds, `Level/${item.name}`, '/useBackground/item'),
|
|
16
|
+
useEffect: toUseItem(sonolus, toEffectItem, item.useEffect, sonolus.db.effects, `Level/${item.name}`, '/useEffect/item'),
|
|
17
|
+
useParticle: toUseItem(sonolus, toParticleItem, item.useParticle, sonolus.db.particles, `Level/${item.name}`, '/useParticle/item'),
|
|
21
18
|
title: sonolus.localize(item.title),
|
|
22
19
|
artists: sonolus.localize(item.artists),
|
|
23
20
|
author: sonolus.localize(item.author),
|
|
24
|
-
tags:
|
|
21
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
25
22
|
cover: item.cover,
|
|
26
23
|
bgm: item.bgm,
|
|
27
24
|
preview: item.preview,
|
|
28
25
|
data: item.data,
|
|
29
26
|
});
|
|
30
|
-
exports.toLevelItem = toLevelItem;
|
|
31
27
|
const toUseItem = (sonolus, toItem, useItem, items, parent, path) => useItem.useDefault
|
|
32
28
|
? {
|
|
33
29
|
useDefault: true,
|
|
34
30
|
}
|
|
35
31
|
: {
|
|
36
32
|
useDefault: false,
|
|
37
|
-
item: toItem(sonolus,
|
|
33
|
+
item: toItem(sonolus, getByName(items, useItem.item, parent, path)),
|
|
38
34
|
};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.toParticleItem = void 0;
|
|
4
|
-
const tag_1 = require("../tag");
|
|
5
|
-
const toParticleItem = (sonolus, item) => ({
|
|
1
|
+
import { toTags } from '../tag.js';
|
|
2
|
+
export const toParticleItem = (sonolus, item) => ({
|
|
6
3
|
name: item.name,
|
|
7
4
|
source: sonolus.address,
|
|
8
5
|
version: item.version,
|
|
9
6
|
title: sonolus.localize(item.title),
|
|
10
7
|
subtitle: sonolus.localize(item.subtitle),
|
|
11
8
|
author: sonolus.localize(item.author),
|
|
12
|
-
tags:
|
|
9
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
13
10
|
thumbnail: item.thumbnail,
|
|
14
11
|
data: item.data,
|
|
15
12
|
texture: item.texture,
|
|
16
13
|
});
|
|
17
|
-
exports.toParticleItem = toParticleItem;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const tag_1 = require("../tag");
|
|
6
|
-
const level_1 = require("./level");
|
|
7
|
-
const toPlaylistItem = (sonolus, item) => ({
|
|
1
|
+
import { getByName } from '../database.js';
|
|
2
|
+
import { toTags } from '../tag.js';
|
|
3
|
+
import { toLevelItem } from './level.js';
|
|
4
|
+
export const toPlaylistItem = (sonolus, item) => ({
|
|
8
5
|
name: item.name,
|
|
9
6
|
source: sonolus.address,
|
|
10
7
|
version: item.version,
|
|
11
8
|
title: sonolus.localize(item.title),
|
|
12
9
|
subtitle: sonolus.localize(item.subtitle),
|
|
13
10
|
author: sonolus.localize(item.author),
|
|
14
|
-
tags:
|
|
15
|
-
levels: item.levels.map((level, index) =>
|
|
11
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
12
|
+
levels: item.levels.map((level, index) => toLevelItem(sonolus, getByName(sonolus.db.levels, level, `Playlist/${item.name}`, `/levels/${index}`))),
|
|
16
13
|
thumbnail: item.thumbnail,
|
|
17
14
|
});
|
|
18
|
-
exports.toPlaylistItem = toPlaylistItem;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { toTags } from '../tag.js';
|
|
2
|
+
export const toPostItem = (sonolus, item) => ({
|
|
3
|
+
name: item.name,
|
|
4
|
+
source: sonolus.address,
|
|
5
|
+
version: item.version,
|
|
6
|
+
title: sonolus.localize(item.title),
|
|
7
|
+
time: item.time,
|
|
8
|
+
author: sonolus.localize(item.author),
|
|
9
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
10
|
+
thumbnail: item.thumbnail,
|
|
11
|
+
});
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const tag_1 = require("../tag");
|
|
6
|
-
const level_1 = require("./level");
|
|
7
|
-
const toReplayItem = (sonolus, item) => ({
|
|
1
|
+
import { getByName } from '../database.js';
|
|
2
|
+
import { toTags } from '../tag.js';
|
|
3
|
+
import { toLevelItem } from './level.js';
|
|
4
|
+
export const toReplayItem = (sonolus, item) => ({
|
|
8
5
|
name: item.name,
|
|
9
6
|
source: sonolus.address,
|
|
10
7
|
version: item.version,
|
|
11
8
|
title: sonolus.localize(item.title),
|
|
12
9
|
subtitle: sonolus.localize(item.subtitle),
|
|
13
10
|
author: sonolus.localize(item.author),
|
|
14
|
-
tags:
|
|
15
|
-
level:
|
|
11
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
12
|
+
level: toLevelItem(sonolus, getByName(sonolus.db.levels, item.level, `Replay/${item.name}`, '/level')),
|
|
16
13
|
data: item.data,
|
|
17
14
|
configuration: item.configuration,
|
|
18
15
|
});
|
|
19
|
-
exports.toReplayItem = toReplayItem;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.toSkinItem = void 0;
|
|
4
|
-
const tag_1 = require("../tag");
|
|
5
|
-
const toSkinItem = (sonolus, item) => ({
|
|
1
|
+
import { toTags } from '../tag.js';
|
|
2
|
+
export const toSkinItem = (sonolus, item) => ({
|
|
6
3
|
name: item.name,
|
|
7
4
|
source: sonolus.address,
|
|
8
5
|
version: item.version,
|
|
9
6
|
title: sonolus.localize(item.title),
|
|
10
7
|
subtitle: sonolus.localize(item.subtitle),
|
|
11
8
|
author: sonolus.localize(item.author),
|
|
12
|
-
tags:
|
|
9
|
+
tags: toTags(sonolus.localize, item.tags),
|
|
13
10
|
thumbnail: item.thumbnail,
|
|
14
11
|
data: item.data,
|
|
15
12
|
texture: item.texture,
|
|
16
13
|
});
|
|
17
|
-
exports.toSkinItem = toSkinItem;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/server/sonolus.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/server/tag.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toTags = void 0;
|
|
4
|
-
const toTags = (localize, tags) => tags.map((tag) => toTag(localize, tag));
|
|
5
|
-
exports.toTags = toTags;
|
|
1
|
+
export const toTags = (localize, tags) => tags.map((tag) => toTag(localize, tag));
|
|
6
2
|
const toTag = (localize, tag) => ({
|
|
7
3
|
title: localize(tag.title),
|
|
8
4
|
icon: tag.icon,
|
package/dist/utils/json.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const data = (0, fs_extra_1.readJsonSync)(path);
|
|
8
|
-
if (!value_1.Value.Check(schema, data)) {
|
|
9
|
-
for (const error of value_1.Value.Errors(schema, data)) {
|
|
1
|
+
import { Value } from '@sinclair/typebox/value';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
export const parse = (path, schema) => {
|
|
4
|
+
const data = fs.readJsonSync(path);
|
|
5
|
+
if (!Value.Check(schema, data)) {
|
|
6
|
+
for (const error of Value.Errors(schema, data)) {
|
|
10
7
|
console.error('[ERROR]', `${path}: ${error.message}, got ${JSON.stringify(error.value)} (${error.path})`);
|
|
11
8
|
}
|
|
12
9
|
throw new Error(`Invalid data: ${path}`);
|
|
13
10
|
}
|
|
14
|
-
|
|
11
|
+
Value.Clean(schema, data);
|
|
15
12
|
return data;
|
|
16
13
|
};
|
|
17
|
-
exports.parse = parse;
|
package/dist/utils/test.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonolus/generate-static",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "CLI tool to generate static Sonolus server from repository and database",
|
|
5
5
|
"author": "NonSpicyBurrito",
|
|
6
6
|
"repository": "github:Sonolus/sonolus-generate-static",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"keywords": [
|
|
9
9
|
"Sonolus"
|
|
10
10
|
],
|
|
11
|
+
"type": "module",
|
|
11
12
|
"bin": {
|
|
12
13
|
"sonolus-generate-static": "dist/index.js"
|
|
13
14
|
},
|
|
@@ -21,19 +22,19 @@
|
|
|
21
22
|
"build": "tsc -p ."
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^9.
|
|
25
|
+
"@eslint/js": "^9.31.0",
|
|
25
26
|
"@types/fs-extra": "^11.0.4",
|
|
26
|
-
"eslint": "^9.
|
|
27
|
-
"eslint-config-prettier": "^10.1.
|
|
28
|
-
"prettier": "^3.
|
|
29
|
-
"prettier-plugin-organize-imports": "^4.
|
|
30
|
-
"typescript": "~5.8.
|
|
31
|
-
"typescript-eslint": "^8.
|
|
27
|
+
"eslint": "^9.31.0",
|
|
28
|
+
"eslint-config-prettier": "^10.1.8",
|
|
29
|
+
"prettier": "^3.6.2",
|
|
30
|
+
"prettier-plugin-organize-imports": "^4.2.0",
|
|
31
|
+
"typescript": "~5.8.3",
|
|
32
|
+
"typescript-eslint": "^8.38.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@sinclair/typebox": "^0.34.
|
|
35
|
-
"@sonolus/core": "~7.
|
|
36
|
-
"commander": "^
|
|
35
|
+
"@sinclair/typebox": "^0.34.38",
|
|
36
|
+
"@sonolus/core": "~7.14.0",
|
|
37
|
+
"commander": "^14.0.0",
|
|
37
38
|
"fs-extra": "^11.3.0"
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toPostItem = void 0;
|
|
4
|
-
const tag_1 = require("../tag");
|
|
5
|
-
const toPostItem = (sonolus, item) => ({
|
|
6
|
-
name: item.name,
|
|
7
|
-
source: sonolus.address,
|
|
8
|
-
version: item.version,
|
|
9
|
-
title: sonolus.localize(item.title),
|
|
10
|
-
time: item.time,
|
|
11
|
-
author: sonolus.localize(item.author),
|
|
12
|
-
tags: (0, tag_1.toTags)(sonolus.localize, item.tags),
|
|
13
|
-
thumbnail: item.thumbnail,
|
|
14
|
-
});
|
|
15
|
-
exports.toPostItem = toPostItem;
|