@sonolus/generate-static 5.4.2 → 5.4.3

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.
Files changed (45) hide show
  1. package/dist/index.js +33 -23
  2. package/dist/schemas/database.js +23 -32
  3. package/dist/schemas/items/background.js +20 -0
  4. package/dist/schemas/items/effect.js +19 -0
  5. package/dist/schemas/items/engine.js +27 -0
  6. package/dist/schemas/items/level.js +30 -0
  7. package/dist/schemas/items/particle.js +19 -0
  8. package/dist/schemas/items/playlist.js +18 -0
  9. package/dist/schemas/items/post.js +17 -0
  10. package/dist/schemas/items/replay.js +19 -0
  11. package/dist/schemas/items/skin.js +19 -0
  12. package/dist/schemas/localizationText.js +5 -0
  13. package/dist/schemas/ordering.js +13 -17
  14. package/dist/schemas/serverInfo.js +11 -0
  15. package/dist/schemas/srl.js +4 -4
  16. package/dist/schemas/tag.js +5 -8
  17. package/dist/server/database.js +10 -0
  18. package/dist/server/{background-item.js → items/background.js} +1 -1
  19. package/dist/server/{effect-item.js → items/effect.js} +1 -1
  20. package/dist/server/items/engine.js +30 -0
  21. package/dist/server/items/item.js +2 -0
  22. package/dist/server/items/level.js +38 -0
  23. package/dist/server/{particle-item.js → items/particle.js} +1 -1
  24. package/dist/server/{playlist-item.js → items/playlist.js} +4 -4
  25. package/dist/server/{post-item.js → items/post-item.js} +1 -1
  26. package/dist/server/{replay-item.js → items/replay.js} +4 -4
  27. package/dist/server/{skin-item.js → items/skin.js} +1 -1
  28. package/dist/utils/json.js +17 -0
  29. package/dist/utils/test.js +2 -0
  30. package/package.json +8 -8
  31. package/dist/schemas/background-item.js +0 -20
  32. package/dist/schemas/effect-item.js +0 -19
  33. package/dist/schemas/engine-item.js +0 -27
  34. package/dist/schemas/level-item.js +0 -30
  35. package/dist/schemas/localization-text.js +0 -5
  36. package/dist/schemas/parser.js +0 -17
  37. package/dist/schemas/particle-item.js +0 -19
  38. package/dist/schemas/playlist-item.js +0 -18
  39. package/dist/schemas/post-item.js +0 -17
  40. package/dist/schemas/replay-item.js +0 -19
  41. package/dist/schemas/server-info.js +0 -11
  42. package/dist/schemas/skin-item.js +0 -19
  43. package/dist/server/engine-item.js +0 -30
  44. package/dist/server/level-item.js +0 -38
  45. /package/dist/{server/item.js → schemas/test.js} +0 -0
package/dist/index.js CHANGED
@@ -6,18 +6,19 @@ const commander_1 = require("commander");
6
6
  const fs_extra_1 = require("fs-extra");
7
7
  const database_1 = require("./schemas/database");
8
8
  const ordering_1 = require("./schemas/ordering");
9
- const background_item_1 = require("./server/background-item");
10
- const effect_item_1 = require("./server/effect-item");
11
- const engine_item_1 = require("./server/engine-item");
12
- const level_item_1 = require("./server/level-item");
13
- const particle_item_1 = require("./server/particle-item");
14
- const playlist_item_1 = require("./server/playlist-item");
15
- const post_item_1 = require("./server/post-item");
16
- const replay_item_1 = require("./server/replay-item");
17
- const skin_item_1 = require("./server/skin-item");
9
+ const background_1 = require("./server/items/background");
10
+ const effect_1 = require("./server/items/effect");
11
+ const engine_1 = require("./server/items/engine");
12
+ const level_1 = require("./server/items/level");
13
+ const particle_1 = require("./server/items/particle");
14
+ const playlist_1 = require("./server/items/playlist");
15
+ const post_item_1 = require("./server/items/post-item");
16
+ const replay_1 = require("./server/items/replay");
17
+ const skin_1 = require("./server/items/skin");
18
+ const json_1 = require("./utils/json");
18
19
  const options = new commander_1.Command()
19
20
  .name('sonolus-generate-static')
20
- .version('5.4.2')
21
+ .version('5.4.3')
21
22
  .option('-i, --input <value>', 'input directory', 'pack')
22
23
  .option('-o, --output <value>', 'output directory', 'static')
23
24
  .option('-a, --address [value]', 'address')
@@ -30,7 +31,6 @@ const pathOutput = options.output;
30
31
  const address = options.address;
31
32
  const targetLocale = options.locale;
32
33
  const fallbackLocale = options.fallback;
33
- const parse = (parser, path) => parser((0, fs_extra_1.readJsonSync)(path), path);
34
34
  const orderDb = (db, ordering) => {
35
35
  orderItems(db.posts, ordering.posts);
36
36
  orderItems(db.playlists, ordering.playlists);
@@ -56,6 +56,7 @@ const outputItems = (dirname, sonolus, items, toItem) => {
56
56
  item: toItem(sonolus, item),
57
57
  description: sonolus.localize(item.description),
58
58
  hasCommunity: false,
59
+ leaderboards: [],
59
60
  sections: [
60
61
  {
61
62
  title: core_1.Text.Recommended,
@@ -89,20 +90,29 @@ try {
89
90
  console.log();
90
91
  (0, fs_extra_1.emptyDirSync)(pathOutput);
91
92
  const sonolus = {
92
- db: parse(database_1.databaseParser, `${pathInput}/db.json`),
93
+ db: (0, json_1.parse)(`${pathInput}/db.json`, database_1.databaseSchema),
93
94
  address,
94
95
  localize: (text) => (0, core_1.localize)(text, targetLocale, fallbackLocale),
95
96
  };
96
97
  const ordering = (0, fs_extra_1.existsSync)(`${pathInput}/ordering.json`)
97
- ? parse(ordering_1.orderingParser, `${pathInput}/ordering.json`)
98
+ ? (0, json_1.parse)(`${pathInput}/ordering.json`, ordering_1.orderingSchema)
98
99
  : {};
99
100
  orderDb(sonolus.db, ordering);
100
101
  console.log('[INFO]', `${pathOutput}/sonolus/info`);
101
102
  const serverInfo = {
102
103
  title: sonolus.localize(sonolus.db.info.title),
103
104
  description: sonolus.db.info.description && sonolus.localize(sonolus.db.info.description),
104
- hasAuthentication: false,
105
- hasMultiplayer: false,
105
+ buttons: [
106
+ { type: 'post' },
107
+ { type: 'playlist' },
108
+ { type: 'level' },
109
+ { type: 'replay' },
110
+ { type: 'skin' },
111
+ { type: 'background' },
112
+ { type: 'effect' },
113
+ { type: 'particle' },
114
+ { type: 'engine' },
115
+ ],
106
116
  banner: sonolus.db.info.banner,
107
117
  };
108
118
  (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/info`, serverInfo);
@@ -112,14 +122,14 @@ try {
112
122
  };
113
123
  (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/package`, packageInfo);
114
124
  outputItems('posts', sonolus, sonolus.db.posts, post_item_1.toPostItem);
115
- outputItems('playlists', sonolus, sonolus.db.playlists, playlist_item_1.toPlaylistItem);
116
- outputItems('levels', sonolus, sonolus.db.levels, level_item_1.toLevelItem);
117
- outputItems('skins', sonolus, sonolus.db.skins, skin_item_1.toSkinItem);
118
- outputItems('backgrounds', sonolus, sonolus.db.backgrounds, background_item_1.toBackgroundItem);
119
- outputItems('effects', sonolus, sonolus.db.effects, effect_item_1.toEffectItem);
120
- outputItems('particles', sonolus, sonolus.db.particles, particle_item_1.toParticleItem);
121
- outputItems('engines', sonolus, sonolus.db.engines, engine_item_1.toEngineItem);
122
- outputItems('replays', sonolus, sonolus.db.replays, replay_item_1.toReplayItem);
125
+ outputItems('playlists', sonolus, sonolus.db.playlists, playlist_1.toPlaylistItem);
126
+ outputItems('levels', sonolus, sonolus.db.levels, level_1.toLevelItem);
127
+ outputItems('skins', sonolus, sonolus.db.skins, skin_1.toSkinItem);
128
+ outputItems('backgrounds', sonolus, sonolus.db.backgrounds, background_1.toBackgroundItem);
129
+ outputItems('effects', sonolus, sonolus.db.effects, effect_1.toEffectItem);
130
+ outputItems('particles', sonolus, sonolus.db.particles, particle_1.toParticleItem);
131
+ outputItems('engines', sonolus, sonolus.db.engines, engine_1.toEngineItem);
132
+ outputItems('replays', sonolus, sonolus.db.replays, replay_1.toReplayItem);
123
133
  console.log('[INFO]', `${pathOutput}/sonolus/repository`);
124
134
  (0, fs_extra_1.copySync)(`${pathInput}/repository`, `${pathOutput}/sonolus/repository`);
125
135
  console.log();
@@ -1,35 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getByName = exports.databaseParser = void 0;
4
- const zod_1 = require("zod");
5
- const background_item_1 = require("./background-item");
6
- const effect_item_1 = require("./effect-item");
7
- const engine_item_1 = require("./engine-item");
8
- const level_item_1 = require("./level-item");
9
- const parser_1 = require("./parser");
10
- const particle_item_1 = require("./particle-item");
11
- const playlist_item_1 = require("./playlist-item");
12
- const post_item_1 = require("./post-item");
13
- const replay_item_1 = require("./replay-item");
14
- const server_info_1 = require("./server-info");
15
- const skin_item_1 = require("./skin-item");
16
- const databaseSchema = zod_1.z.object({
17
- info: server_info_1.databaseServerInfoSchema,
18
- posts: zod_1.z.array(post_item_1.databasePostItemSchema),
19
- playlists: zod_1.z.array(playlist_item_1.databasePlaylistItemSchema),
20
- levels: zod_1.z.array(level_item_1.databaseLevelItemSchema),
21
- skins: zod_1.z.array(skin_item_1.databaseSkinItemSchema),
22
- backgrounds: zod_1.z.array(background_item_1.databaseBackgroundItemSchema),
23
- effects: zod_1.z.array(effect_item_1.databaseEffectItemSchema),
24
- particles: zod_1.z.array(particle_item_1.databaseParticleItemSchema),
25
- engines: zod_1.z.array(engine_item_1.databaseEngineItemSchema),
26
- replays: zod_1.z.array(replay_item_1.databaseReplayItemSchema),
3
+ exports.databaseSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const background_1 = require("./items/background");
6
+ const effect_1 = require("./items/effect");
7
+ const engine_1 = require("./items/engine");
8
+ const level_1 = require("./items/level");
9
+ const particle_1 = require("./items/particle");
10
+ const playlist_1 = require("./items/playlist");
11
+ const post_1 = require("./items/post");
12
+ const replay_1 = require("./items/replay");
13
+ const skin_1 = require("./items/skin");
14
+ const serverInfo_1 = require("./serverInfo");
15
+ exports.databaseSchema = typebox_1.Type.Object({
16
+ info: serverInfo_1.databaseServerInfoSchema,
17
+ posts: typebox_1.Type.Array(post_1.databasePostItemSchema),
18
+ playlists: typebox_1.Type.Array(playlist_1.databasePlaylistItemSchema),
19
+ levels: typebox_1.Type.Array(level_1.databaseLevelItemSchema),
20
+ skins: typebox_1.Type.Array(skin_1.databaseSkinItemSchema),
21
+ backgrounds: typebox_1.Type.Array(background_1.databaseBackgroundItemSchema),
22
+ effects: typebox_1.Type.Array(effect_1.databaseEffectItemSchema),
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),
27
26
  });
28
- exports.databaseParser = (0, parser_1.getParser)(databaseSchema);
29
- const getByName = (items, name, parent, path) => {
30
- const item = items.find((item) => item.name === name);
31
- if (!item)
32
- throw new Error(`${parent}: ${name} not found (${path})`);
33
- return item;
34
- };
35
- exports.getByName = getByName;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseBackgroundItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databaseBackgroundItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(2),
11
+ title: localizationText_1.localizationTextSchema,
12
+ subtitle: localizationText_1.localizationTextSchema,
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ thumbnail: srl_1.srlSchema,
17
+ data: srl_1.srlSchema,
18
+ image: srl_1.srlSchema,
19
+ configuration: srl_1.srlSchema,
20
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseEffectItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databaseEffectItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(5),
11
+ title: localizationText_1.localizationTextSchema,
12
+ subtitle: localizationText_1.localizationTextSchema,
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ thumbnail: srl_1.srlSchema,
17
+ data: srl_1.srlSchema,
18
+ audio: srl_1.srlSchema,
19
+ });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseEngineItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databaseEngineItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(12),
11
+ title: localizationText_1.localizationTextSchema,
12
+ subtitle: localizationText_1.localizationTextSchema,
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ skin: typebox_1.Type.String(),
17
+ background: typebox_1.Type.String(),
18
+ effect: typebox_1.Type.String(),
19
+ particle: typebox_1.Type.String(),
20
+ thumbnail: srl_1.srlSchema,
21
+ playData: srl_1.srlSchema,
22
+ watchData: srl_1.srlSchema,
23
+ previewData: srl_1.srlSchema,
24
+ tutorialData: srl_1.srlSchema,
25
+ rom: typebox_1.Type.Optional(srl_1.srlSchema),
26
+ configuration: srl_1.srlSchema,
27
+ });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseLevelItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
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() }),
11
+ ]);
12
+ exports.databaseLevelItemSchema = typebox_1.Type.Object({
13
+ name: typebox_1.Type.String(),
14
+ version: typebox_1.Type.Literal(1),
15
+ rating: typebox_1.Type.Number(),
16
+ title: localizationText_1.localizationTextSchema,
17
+ artists: localizationText_1.localizationTextSchema,
18
+ author: localizationText_1.localizationTextSchema,
19
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
20
+ description: localizationText_1.localizationTextSchema,
21
+ engine: typebox_1.Type.String(),
22
+ useSkin: databaseUseItemSchema,
23
+ useBackground: databaseUseItemSchema,
24
+ useEffect: databaseUseItemSchema,
25
+ useParticle: databaseUseItemSchema,
26
+ cover: srl_1.srlSchema,
27
+ bgm: srl_1.srlSchema,
28
+ preview: typebox_1.Type.Optional(srl_1.srlSchema),
29
+ data: srl_1.srlSchema,
30
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseParticleItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databaseParticleItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(3),
11
+ title: localizationText_1.localizationTextSchema,
12
+ subtitle: localizationText_1.localizationTextSchema,
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ thumbnail: srl_1.srlSchema,
17
+ data: srl_1.srlSchema,
18
+ texture: srl_1.srlSchema,
19
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databasePlaylistItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databasePlaylistItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(1),
11
+ title: localizationText_1.localizationTextSchema,
12
+ subtitle: localizationText_1.localizationTextSchema,
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ levels: typebox_1.Type.Array(typebox_1.Type.String()),
17
+ thumbnail: typebox_1.Type.Optional(srl_1.srlSchema),
18
+ });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databasePostItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databasePostItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(1),
11
+ title: localizationText_1.localizationTextSchema,
12
+ time: typebox_1.Type.Number(),
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ thumbnail: typebox_1.Type.Optional(srl_1.srlSchema),
17
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseReplayItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databaseReplayItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(1),
11
+ title: localizationText_1.localizationTextSchema,
12
+ subtitle: localizationText_1.localizationTextSchema,
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ level: typebox_1.Type.String(),
17
+ data: srl_1.srlSchema,
18
+ configuration: srl_1.srlSchema,
19
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseSkinItemSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("../localizationText");
6
+ const srl_1 = require("../srl");
7
+ const tag_1 = require("../tag");
8
+ exports.databaseSkinItemSchema = typebox_1.Type.Object({
9
+ name: typebox_1.Type.String(),
10
+ version: typebox_1.Type.Literal(4),
11
+ title: localizationText_1.localizationTextSchema,
12
+ subtitle: localizationText_1.localizationTextSchema,
13
+ author: localizationText_1.localizationTextSchema,
14
+ tags: typebox_1.Type.Array(tag_1.databaseTagSchema),
15
+ description: localizationText_1.localizationTextSchema,
16
+ thumbnail: srl_1.srlSchema,
17
+ data: srl_1.srlSchema,
18
+ texture: srl_1.srlSchema,
19
+ });
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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,19 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.orderingParser = void 0;
4
- const zod_1 = require("zod");
5
- const parser_1 = require("./parser");
6
- const orderingSchema = zod_1.z
7
- .object({
8
- posts: zod_1.z.array(zod_1.z.string()),
9
- playlists: zod_1.z.array(zod_1.z.string()),
10
- levels: zod_1.z.array(zod_1.z.string()),
11
- skins: zod_1.z.array(zod_1.z.string()),
12
- backgrounds: zod_1.z.array(zod_1.z.string()),
13
- effects: zod_1.z.array(zod_1.z.string()),
14
- particles: zod_1.z.array(zod_1.z.string()),
15
- engines: zod_1.z.array(zod_1.z.string()),
16
- replays: zod_1.z.array(zod_1.z.string()),
17
- })
18
- .partial();
19
- exports.orderingParser = (0, parser_1.getParser)(orderingSchema);
3
+ exports.orderingSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ exports.orderingSchema = typebox_1.Type.Partial(typebox_1.Type.Object({
6
+ posts: typebox_1.Type.Array(typebox_1.Type.String()),
7
+ playlists: typebox_1.Type.Array(typebox_1.Type.String()),
8
+ levels: typebox_1.Type.Array(typebox_1.Type.String()),
9
+ skins: typebox_1.Type.Array(typebox_1.Type.String()),
10
+ backgrounds: typebox_1.Type.Array(typebox_1.Type.String()),
11
+ effects: typebox_1.Type.Array(typebox_1.Type.String()),
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()),
15
+ }));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.databaseServerInfoSchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("./localizationText");
6
+ const srl_1 = require("./srl");
7
+ exports.databaseServerInfoSchema = typebox_1.Type.Object({
8
+ title: localizationText_1.localizationTextSchema,
9
+ description: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
10
+ banner: typebox_1.Type.Optional(srl_1.srlSchema),
11
+ });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.srlSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.srlSchema = zod_1.z.object({
6
- hash: zod_1.z.string(),
7
- url: zod_1.z.string(),
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ exports.srlSchema = typebox_1.Type.Object({
6
+ hash: typebox_1.Type.String(),
7
+ url: typebox_1.Type.String(),
8
8
  });
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.databaseTagSchema = void 0;
4
- const core_1 = require("@sonolus/core");
5
- const zod_1 = require("zod");
6
- const localization_text_1 = require("./localization-text");
7
- exports.databaseTagSchema = zod_1.z.object({
8
- title: localization_text_1.localizationTextSchema,
9
- icon: zod_1.z
10
- .union([zod_1.z.never(), zod_1.z.never(), ...Object.values(core_1.Icon).map((icon) => zod_1.z.literal(icon))])
11
- .optional(),
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const localizationText_1 = require("./localizationText");
6
+ exports.databaseTagSchema = typebox_1.Type.Object({
7
+ title: localizationText_1.localizationTextSchema,
8
+ icon: typebox_1.Type.Optional(typebox_1.Type.String()),
12
9
  });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getByName = void 0;
4
+ const getByName = (items, name, parent, path) => {
5
+ const item = items.find((item) => item.name === name);
6
+ if (!item)
7
+ throw new Error(`${parent}: ${name} not found (${path})`);
8
+ return item;
9
+ };
10
+ exports.getByName = getByName;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toBackgroundItem = void 0;
4
- const tag_1 = require("./tag");
4
+ const tag_1 = require("../tag");
5
5
  const toBackgroundItem = (sonolus, item) => ({
6
6
  name: item.name,
7
7
  source: sonolus.address,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toEffectItem = void 0;
4
- const tag_1 = require("./tag");
4
+ const tag_1 = require("../tag");
5
5
  const toEffectItem = (sonolus, item) => ({
6
6
  name: item.name,
7
7
  source: sonolus.address,
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toEngineItem = void 0;
4
+ const database_1 = require("../database");
5
+ const tag_1 = require("../tag");
6
+ const background_1 = require("./background");
7
+ const effect_1 = require("./effect");
8
+ const particle_1 = require("./particle");
9
+ const skin_1 = require("./skin");
10
+ const toEngineItem = (sonolus, item) => ({
11
+ name: item.name,
12
+ source: sonolus.address,
13
+ version: item.version,
14
+ title: sonolus.localize(item.title),
15
+ subtitle: sonolus.localize(item.subtitle),
16
+ author: sonolus.localize(item.author),
17
+ tags: (0, tag_1.toTags)(sonolus.localize, item.tags),
18
+ skin: (0, skin_1.toSkinItem)(sonolus, (0, database_1.getByName)(sonolus.db.skins, item.skin, `Engine/${item.name}`, '/skin')),
19
+ background: (0, background_1.toBackgroundItem)(sonolus, (0, database_1.getByName)(sonolus.db.backgrounds, item.background, `Engine/${item.name}`, '/background')),
20
+ effect: (0, effect_1.toEffectItem)(sonolus, (0, database_1.getByName)(sonolus.db.effects, item.effect, `Engine/${item.name}`, '/effect')),
21
+ particle: (0, particle_1.toParticleItem)(sonolus, (0, database_1.getByName)(sonolus.db.particles, item.particle, `Engine/${item.name}`, '/particle')),
22
+ thumbnail: item.thumbnail,
23
+ playData: item.playData,
24
+ watchData: item.watchData,
25
+ previewData: item.previewData,
26
+ tutorialData: item.tutorialData,
27
+ rom: item.rom,
28
+ configuration: item.configuration,
29
+ });
30
+ exports.toEngineItem = toEngineItem;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toLevelItem = void 0;
4
+ const database_1 = require("../database");
5
+ const tag_1 = require("../tag");
6
+ const background_1 = require("./background");
7
+ const effect_1 = require("./effect");
8
+ const engine_1 = require("./engine");
9
+ const particle_1 = require("./particle");
10
+ const skin_1 = require("./skin");
11
+ const toLevelItem = (sonolus, item) => ({
12
+ name: item.name,
13
+ source: sonolus.address,
14
+ version: item.version,
15
+ rating: item.rating,
16
+ engine: (0, engine_1.toEngineItem)(sonolus, (0, database_1.getByName)(sonolus.db.engines, item.engine, `Level/${item.name}`, '/engine')),
17
+ useSkin: toUseItem(sonolus, skin_1.toSkinItem, item.useSkin, sonolus.db.skins, `Level/${item.name}`, '/useSkin/item'),
18
+ useBackground: toUseItem(sonolus, background_1.toBackgroundItem, item.useBackground, sonolus.db.backgrounds, `Level/${item.name}`, '/useBackground/item'),
19
+ useEffect: toUseItem(sonolus, effect_1.toEffectItem, item.useEffect, sonolus.db.effects, `Level/${item.name}`, '/useEffect/item'),
20
+ useParticle: toUseItem(sonolus, particle_1.toParticleItem, item.useParticle, sonolus.db.particles, `Level/${item.name}`, '/useParticle/item'),
21
+ title: sonolus.localize(item.title),
22
+ artists: sonolus.localize(item.artists),
23
+ author: sonolus.localize(item.author),
24
+ tags: (0, tag_1.toTags)(sonolus.localize, item.tags),
25
+ cover: item.cover,
26
+ bgm: item.bgm,
27
+ preview: item.preview,
28
+ data: item.data,
29
+ });
30
+ exports.toLevelItem = toLevelItem;
31
+ const toUseItem = (sonolus, toItem, useItem, items, parent, path) => useItem.useDefault
32
+ ? {
33
+ useDefault: true,
34
+ }
35
+ : {
36
+ useDefault: false,
37
+ item: toItem(sonolus, (0, database_1.getByName)(items, useItem.item, parent, path)),
38
+ };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toParticleItem = void 0;
4
- const tag_1 = require("./tag");
4
+ const tag_1 = require("../tag");
5
5
  const toParticleItem = (sonolus, item) => ({
6
6
  name: item.name,
7
7
  source: sonolus.address,
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toPlaylistItem = void 0;
4
- const database_1 = require("../schemas/database");
5
- const level_item_1 = require("./level-item");
6
- const tag_1 = require("./tag");
4
+ const database_1 = require("../database");
5
+ const tag_1 = require("../tag");
6
+ const level_1 = require("./level");
7
7
  const toPlaylistItem = (sonolus, item) => ({
8
8
  name: item.name,
9
9
  source: sonolus.address,
@@ -12,7 +12,7 @@ const toPlaylistItem = (sonolus, item) => ({
12
12
  subtitle: sonolus.localize(item.subtitle),
13
13
  author: sonolus.localize(item.author),
14
14
  tags: (0, tag_1.toTags)(sonolus.localize, item.tags),
15
- levels: item.levels.map((level, index) => (0, level_item_1.toLevelItem)(sonolus, (0, database_1.getByName)(sonolus.db.levels, level, `Playlist/${item.name}`, `.levels[${index}]`))),
15
+ levels: item.levels.map((level, index) => (0, level_1.toLevelItem)(sonolus, (0, database_1.getByName)(sonolus.db.levels, level, `Playlist/${item.name}`, `/levels/${index}`))),
16
16
  thumbnail: item.thumbnail,
17
17
  });
18
18
  exports.toPlaylistItem = toPlaylistItem;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toPostItem = void 0;
4
- const tag_1 = require("./tag");
4
+ const tag_1 = require("../tag");
5
5
  const toPostItem = (sonolus, item) => ({
6
6
  name: item.name,
7
7
  source: sonolus.address,
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toReplayItem = void 0;
4
- const database_1 = require("../schemas/database");
5
- const level_item_1 = require("./level-item");
6
- const tag_1 = require("./tag");
4
+ const database_1 = require("../database");
5
+ const tag_1 = require("../tag");
6
+ const level_1 = require("./level");
7
7
  const toReplayItem = (sonolus, item) => ({
8
8
  name: item.name,
9
9
  source: sonolus.address,
@@ -12,7 +12,7 @@ const toReplayItem = (sonolus, item) => ({
12
12
  subtitle: sonolus.localize(item.subtitle),
13
13
  author: sonolus.localize(item.author),
14
14
  tags: (0, tag_1.toTags)(sonolus.localize, item.tags),
15
- level: (0, level_item_1.toLevelItem)(sonolus, (0, database_1.getByName)(sonolus.db.levels, item.level, `Replay/${item.name}`, '.level')),
15
+ level: (0, level_1.toLevelItem)(sonolus, (0, database_1.getByName)(sonolus.db.levels, item.level, `Replay/${item.name}`, '/level')),
16
16
  data: item.data,
17
17
  configuration: item.configuration,
18
18
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toSkinItem = void 0;
4
- const tag_1 = require("./tag");
4
+ const tag_1 = require("../tag");
5
5
  const toSkinItem = (sonolus, item) => ({
6
6
  name: item.name,
7
7
  source: sonolus.address,
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parse = void 0;
4
+ const value_1 = require("@sinclair/typebox/value");
5
+ const fs_extra_1 = require("fs-extra");
6
+ const parse = (path, schema) => {
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)) {
10
+ console.error('[ERROR]', `${path}: ${error.message}, got ${JSON.stringify(error.value)} (${error.path})`);
11
+ }
12
+ throw new Error(`Invalid data: ${path}`);
13
+ }
14
+ value_1.Value.Clean(schema, data);
15
+ return data;
16
+ };
17
+ exports.parse = parse;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonolus/generate-static",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
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",
@@ -23,15 +23,15 @@
23
23
  "@types/fs-extra": "^11.0.4",
24
24
  "eslint": "^8.57.0",
25
25
  "eslint-config-prettier": "^9.1.0",
26
- "prettier": "^3.2.5",
26
+ "prettier": "^3.3.2",
27
27
  "prettier-plugin-organize-imports": "^3.2.4",
28
- "typescript": "~5.4.4",
29
- "typescript-eslint": "^7.6.0"
28
+ "typescript": "~5.4.5",
29
+ "typescript-eslint": "^7.13.0"
30
30
  },
31
31
  "dependencies": {
32
- "@sonolus/core": "~7.6.0",
33
- "commander": "^12.0.0",
34
- "fs-extra": "^11.2.0",
35
- "zod": "^3.22.4"
32
+ "@sinclair/typebox": "^0.32.33",
33
+ "@sonolus/core": "~7.7.0",
34
+ "commander": "^12.1.0",
35
+ "fs-extra": "^11.2.0"
36
36
  }
37
37
  }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseBackgroundItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databaseBackgroundItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(2),
11
- title: localization_text_1.localizationTextSchema,
12
- subtitle: localization_text_1.localizationTextSchema,
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- thumbnail: srl_1.srlSchema,
17
- data: srl_1.srlSchema,
18
- image: srl_1.srlSchema,
19
- configuration: srl_1.srlSchema,
20
- });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseEffectItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databaseEffectItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(5),
11
- title: localization_text_1.localizationTextSchema,
12
- subtitle: localization_text_1.localizationTextSchema,
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- thumbnail: srl_1.srlSchema,
17
- data: srl_1.srlSchema,
18
- audio: srl_1.srlSchema,
19
- });
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseEngineItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databaseEngineItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(12),
11
- title: localization_text_1.localizationTextSchema,
12
- subtitle: localization_text_1.localizationTextSchema,
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- skin: zod_1.z.string(),
17
- background: zod_1.z.string(),
18
- effect: zod_1.z.string(),
19
- particle: zod_1.z.string(),
20
- thumbnail: srl_1.srlSchema,
21
- playData: srl_1.srlSchema,
22
- watchData: srl_1.srlSchema,
23
- previewData: srl_1.srlSchema,
24
- tutorialData: srl_1.srlSchema,
25
- rom: srl_1.srlSchema.optional(),
26
- configuration: srl_1.srlSchema,
27
- });
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseLevelItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- const databaseUseItemSchema = zod_1.z.discriminatedUnion('useDefault', [
9
- zod_1.z.object({ useDefault: zod_1.z.literal(true) }),
10
- zod_1.z.object({ useDefault: zod_1.z.literal(false), item: zod_1.z.string() }),
11
- ]);
12
- exports.databaseLevelItemSchema = zod_1.z.object({
13
- name: zod_1.z.string(),
14
- version: zod_1.z.literal(1),
15
- rating: zod_1.z.number(),
16
- title: localization_text_1.localizationTextSchema,
17
- artists: localization_text_1.localizationTextSchema,
18
- author: localization_text_1.localizationTextSchema,
19
- tags: zod_1.z.array(tag_1.databaseTagSchema),
20
- description: localization_text_1.localizationTextSchema,
21
- engine: zod_1.z.string(),
22
- useSkin: databaseUseItemSchema,
23
- useBackground: databaseUseItemSchema,
24
- useEffect: databaseUseItemSchema,
25
- useParticle: databaseUseItemSchema,
26
- cover: srl_1.srlSchema,
27
- bgm: srl_1.srlSchema,
28
- preview: srl_1.srlSchema.optional(),
29
- data: srl_1.srlSchema,
30
- });
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.localizationTextSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.localizationTextSchema = zod_1.z.record(zod_1.z.string());
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getParser = void 0;
4
- const zod_1 = require("zod");
5
- const getParser = (schema) => (data, logPath) => {
6
- try {
7
- return schema.parse(data);
8
- }
9
- catch (error) {
10
- if (!(error instanceof zod_1.ZodError))
11
- throw new Error(`${logPath}: ${error}`);
12
- const messages = error.issues.map(({ message, path }) => path.length > 0 ? `${message} (${formatPath(path)})` : message);
13
- throw new Error([`${logPath}:`, ...messages].join(messages.length > 1 ? '\n' : ' '));
14
- }
15
- };
16
- exports.getParser = getParser;
17
- const formatPath = (path) => path.map((segment) => (typeof segment === 'number' ? `[${segment}]` : `.${segment}`)).join('');
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseParticleItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databaseParticleItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(3),
11
- title: localization_text_1.localizationTextSchema,
12
- subtitle: localization_text_1.localizationTextSchema,
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- thumbnail: srl_1.srlSchema,
17
- data: srl_1.srlSchema,
18
- texture: srl_1.srlSchema,
19
- });
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databasePlaylistItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databasePlaylistItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(1),
11
- title: localization_text_1.localizationTextSchema,
12
- subtitle: localization_text_1.localizationTextSchema,
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- levels: zod_1.z.array(zod_1.z.string()),
17
- thumbnail: srl_1.srlSchema.optional(),
18
- });
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databasePostItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databasePostItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(1),
11
- title: localization_text_1.localizationTextSchema,
12
- time: zod_1.z.number(),
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- thumbnail: srl_1.srlSchema.optional(),
17
- });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseReplayItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databaseReplayItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(1),
11
- title: localization_text_1.localizationTextSchema,
12
- subtitle: localization_text_1.localizationTextSchema,
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- level: zod_1.z.string(),
17
- data: srl_1.srlSchema,
18
- configuration: srl_1.srlSchema,
19
- });
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseServerInfoSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- exports.databaseServerInfoSchema = zod_1.z.object({
8
- title: localization_text_1.localizationTextSchema,
9
- description: localization_text_1.localizationTextSchema.optional(),
10
- banner: srl_1.srlSchema.optional(),
11
- });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseSkinItemSchema = void 0;
4
- const zod_1 = require("zod");
5
- const localization_text_1 = require("./localization-text");
6
- const srl_1 = require("./srl");
7
- const tag_1 = require("./tag");
8
- exports.databaseSkinItemSchema = zod_1.z.object({
9
- name: zod_1.z.string(),
10
- version: zod_1.z.literal(4),
11
- title: localization_text_1.localizationTextSchema,
12
- subtitle: localization_text_1.localizationTextSchema,
13
- author: localization_text_1.localizationTextSchema,
14
- tags: zod_1.z.array(tag_1.databaseTagSchema),
15
- description: localization_text_1.localizationTextSchema,
16
- thumbnail: srl_1.srlSchema,
17
- data: srl_1.srlSchema,
18
- texture: srl_1.srlSchema,
19
- });
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toEngineItem = void 0;
4
- const database_1 = require("../schemas/database");
5
- const background_item_1 = require("./background-item");
6
- const effect_item_1 = require("./effect-item");
7
- const particle_item_1 = require("./particle-item");
8
- const skin_item_1 = require("./skin-item");
9
- const tag_1 = require("./tag");
10
- const toEngineItem = (sonolus, item) => ({
11
- name: item.name,
12
- source: sonolus.address,
13
- version: item.version,
14
- title: sonolus.localize(item.title),
15
- subtitle: sonolus.localize(item.subtitle),
16
- author: sonolus.localize(item.author),
17
- tags: (0, tag_1.toTags)(sonolus.localize, item.tags),
18
- skin: (0, skin_item_1.toSkinItem)(sonolus, (0, database_1.getByName)(sonolus.db.skins, item.skin, `Engine/${item.name}`, '.skin')),
19
- background: (0, background_item_1.toBackgroundItem)(sonolus, (0, database_1.getByName)(sonolus.db.backgrounds, item.background, `Engine/${item.name}`, '.background')),
20
- effect: (0, effect_item_1.toEffectItem)(sonolus, (0, database_1.getByName)(sonolus.db.effects, item.effect, `Engine/${item.name}`, '.effect')),
21
- particle: (0, particle_item_1.toParticleItem)(sonolus, (0, database_1.getByName)(sonolus.db.particles, item.particle, `Engine/${item.name}`, '.particle')),
22
- thumbnail: item.thumbnail,
23
- playData: item.playData,
24
- watchData: item.watchData,
25
- previewData: item.previewData,
26
- tutorialData: item.tutorialData,
27
- rom: item.rom,
28
- configuration: item.configuration,
29
- });
30
- exports.toEngineItem = toEngineItem;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toLevelItem = void 0;
4
- const database_1 = require("../schemas/database");
5
- const background_item_1 = require("./background-item");
6
- const effect_item_1 = require("./effect-item");
7
- const engine_item_1 = require("./engine-item");
8
- const particle_item_1 = require("./particle-item");
9
- const skin_item_1 = require("./skin-item");
10
- const tag_1 = require("./tag");
11
- const toLevelItem = (sonolus, item) => ({
12
- name: item.name,
13
- source: sonolus.address,
14
- version: item.version,
15
- rating: item.rating,
16
- engine: (0, engine_item_1.toEngineItem)(sonolus, (0, database_1.getByName)(sonolus.db.engines, item.engine, `Level/${item.name}`, '.engine')),
17
- useSkin: toUseItem(sonolus, skin_item_1.toSkinItem, item.useSkin, sonolus.db.skins, `Level/${item.name}`, '.useSkin.item'),
18
- useBackground: toUseItem(sonolus, background_item_1.toBackgroundItem, item.useBackground, sonolus.db.backgrounds, `Level/${item.name}`, '.useBackground.item'),
19
- useEffect: toUseItem(sonolus, effect_item_1.toEffectItem, item.useEffect, sonolus.db.effects, `Level/${item.name}`, '.useEffect.item'),
20
- useParticle: toUseItem(sonolus, particle_item_1.toParticleItem, item.useParticle, sonolus.db.particles, `Level/${item.name}`, '.useParticle.item'),
21
- title: sonolus.localize(item.title),
22
- artists: sonolus.localize(item.artists),
23
- author: sonolus.localize(item.author),
24
- tags: (0, tag_1.toTags)(sonolus.localize, item.tags),
25
- cover: item.cover,
26
- bgm: item.bgm,
27
- preview: item.preview,
28
- data: item.data,
29
- });
30
- exports.toLevelItem = toLevelItem;
31
- const toUseItem = (sonolus, toItem, useItem, items, parent, path) => useItem.useDefault
32
- ? {
33
- useDefault: true,
34
- }
35
- : {
36
- useDefault: false,
37
- item: toItem(sonolus, (0, database_1.getByName)(items, useItem.item, parent, path)),
38
- };
File without changes