@sonolus/generate-static 5.4.9 → 5.5.1

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 CHANGED
@@ -1,24 +1,22 @@
1
1
  #! /usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const core_1 = require("@sonolus/core");
5
- const commander_1 = require("commander");
6
- const fs_extra_1 = require("fs-extra");
7
- const database_1 = require("./schemas/database");
8
- const ordering_1 = require("./schemas/ordering");
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");
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.4.9')
19
+ .version('5.5.1')
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: core_1.Text.Recommended,
64
- icon: core_1.Icon.Star,
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
- (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/${dirname}/${item.name}`, itemDetails);
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
- (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/${dirname}/list`, list);
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: core_1.Text.Newest,
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
- (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/${dirname}/info`, itemInfo);
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
- (0, fs_extra_1.emptyDirSync)(pathOutput);
94
+ fs.emptyDirSync(pathOutput);
97
95
  const sonolus = {
98
- db: (0, json_1.parse)(`${pathInput}/db.json`, database_1.databaseSchema),
96
+ db: parse(`${pathInput}/db.json`, databaseSchema),
99
97
  address,
100
- localize: (text) => (0, core_1.localize)(text, targetLocale, fallbackLocale),
98
+ localize: (text) => sonolusLocalize(text, targetLocale, fallbackLocale),
101
99
  };
102
- const ordering = (0, fs_extra_1.existsSync)(`${pathInput}/ordering.json`)
103
- ? (0, json_1.parse)(`${pathInput}/ordering.json`, ordering_1.orderingSchema)
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
- (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/info`, serverInfo);
126
+ fs.outputJsonSync(`${pathOutput}/sonolus/info`, serverInfo);
129
127
  console.log('[INFO]', `${pathOutput}/sonolus/package`);
130
128
  const packageInfo = {};
131
- (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/package`, packageInfo);
132
- outputItems('posts', sonolus, sonolus.db.posts, 'post', post_item_1.toPostItem);
133
- outputItems('playlists', sonolus, sonolus.db.playlists, 'playlist', playlist_1.toPlaylistItem);
134
- outputItems('levels', sonolus, sonolus.db.levels, 'level', level_1.toLevelItem);
135
- outputItems('skins', sonolus, sonolus.db.skins, 'skin', skin_1.toSkinItem);
136
- outputItems('backgrounds', sonolus, sonolus.db.backgrounds, 'background', background_1.toBackgroundItem);
137
- outputItems('effects', sonolus, sonolus.db.effects, 'effect', effect_1.toEffectItem);
138
- outputItems('particles', sonolus, sonolus.db.particles, 'particle', particle_1.toParticleItem);
139
- outputItems('engines', sonolus, sonolus.db.engines, 'engine', engine_1.toEngineItem);
140
- outputItems('replays', sonolus, sonolus.db.replays, 'replay', replay_1.toReplayItem);
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
- (0, fs_extra_1.outputJsonSync)(`${pathOutput}/sonolus/levels/result/info`, levelResultInfo);
141
+ fs.outputJsonSync(`${pathOutput}/sonolus/levels/result/info`, levelResultInfo);
144
142
  console.log('[INFO]', `${pathOutput}/sonolus/repository`);
145
- (0, fs_extra_1.copySync)(`${pathInput}/repository`, `${pathOutput}/sonolus/repository`);
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
- (0, fs_extra_1.removeSync)(pathOutput);
150
+ fs.removeSync(pathOutput);
153
151
  }
@@ -1,26 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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),
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
- "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: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
16
- thumbnail: srl_1.srlSchema,
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
- "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: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
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
- "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(13),
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: typebox_1.Type.Optional(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,
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
- "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() }),
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
- 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: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
21
- engine: typebox_1.Type.String(),
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: srl_1.srlSchema,
27
- bgm: srl_1.srlSchema,
28
- preview: typebox_1.Type.Optional(srl_1.srlSchema),
29
- data: srl_1.srlSchema,
23
+ cover: srlSchema,
24
+ bgm: srlSchema,
25
+ preview: Type.Optional(srlSchema),
26
+ data: srlSchema,
30
27
  });
@@ -1,19 +1,16 @@
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: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
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
- "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: 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
- "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: 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
- "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: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
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
- "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: typebox_1.Type.Optional(localizationText_1.localizationTextSchema),
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
- "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
+ import { Type } from '@sinclair/typebox';
2
+ export const localizationTextSchema = Type.Record(Type.String(), Type.String());
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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()),
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
- "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),
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
  });
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.srlSchema = void 0;
4
- const typebox_1 = require("@sinclair/typebox");
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
  });
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.databaseTagSchema = void 0;
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()),
1
+ import { Type } from '@sinclair/typebox';
2
+ import { localizationTextSchema } from './localizationText.js';
3
+ export const databaseTagSchema = Type.Object({
4
+ title: Type.Optional(localizationTextSchema),
5
+ icon: Type.Optional(Type.String()),
9
6
  });
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,10 +1,6 @@
1
- "use strict";
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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: (0, tag_1.toTags)(sonolus.localize, item.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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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: (0, tag_1.toTags)(sonolus.localize, item.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
- "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) => ({
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: (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')),
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,38 +1,34 @@
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) => ({
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: (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'),
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: (0, tag_1.toTags)(sonolus.localize, item.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, (0, database_1.getByName)(items, useItem.item, parent, path)),
33
+ item: toItem(sonolus, getByName(items, useItem.item, parent, path)),
38
34
  };
@@ -1,17 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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: (0, tag_1.toTags)(sonolus.localize, item.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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toPlaylistItem = void 0;
4
- const database_1 = require("../database");
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: (0, tag_1.toTags)(sonolus.localize, item.tags),
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}`))),
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toReplayItem = void 0;
4
- const database_1 = require("../database");
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: (0, tag_1.toTags)(sonolus.localize, item.tags),
15
- level: (0, level_1.toLevelItem)(sonolus, (0, database_1.getByName)(sonolus.db.levels, item.level, `Replay/${item.name}`, '/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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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: (0, tag_1.toTags)(sonolus.localize, item.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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,9 +1,5 @@
1
- "use strict";
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
- title: localize(tag.title),
3
+ title: tag.title && localize(tag.title),
8
4
  icon: tag.icon,
9
5
  });
@@ -1,17 +1,13 @@
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)) {
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
- value_1.Value.Clean(schema, data);
11
+ Value.Clean(schema, data);
15
12
  return data;
16
13
  };
17
- exports.parse = parse;
@@ -1,2 +1 @@
1
- "use strict";
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.4.9",
3
+ "version": "5.5.1",
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.23.0",
25
+ "@eslint/js": "^9.39.2",
25
26
  "@types/fs-extra": "^11.0.4",
26
- "eslint": "^9.23.0",
27
- "eslint-config-prettier": "^10.1.1",
28
- "prettier": "^3.5.3",
29
- "prettier-plugin-organize-imports": "^4.1.0",
30
- "typescript": "~5.8.2",
31
- "typescript-eslint": "^8.28.0"
27
+ "eslint": "^9.39.2",
28
+ "eslint-config-prettier": "^10.1.8",
29
+ "prettier": "^3.8.1",
30
+ "prettier-plugin-organize-imports": "^4.3.0",
31
+ "typescript": "~5.9.3",
32
+ "typescript-eslint": "^8.53.1"
32
33
  },
33
34
  "dependencies": {
34
- "@sinclair/typebox": "^0.34.31",
35
- "@sonolus/core": "~7.13.0",
36
- "commander": "^13.1.0",
37
- "fs-extra": "^11.3.0"
35
+ "@sinclair/typebox": "^0.34.47",
36
+ "@sonolus/core": "~7.15.0",
37
+ "commander": "^14.0.2",
38
+ "fs-extra": "^11.3.3"
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;