Skip to content

Commit c7f60db

Browse files
authored
Merge pull request #57 from OpenNBS/feature/fix-typescript-typing-issues
2 parents 7042299 + 7a96e6d commit c7f60db

File tree

21 files changed

+659
-1039
lines changed

21 files changed

+659
-1039
lines changed

NoteBlockWorld.code-workspace

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22
"folders": [
33
{
44
"path": ".",
5-
"name": "Root",
5+
"name": "Root"
66
},
77
{
88
"path": "./apps/backend",
9-
"name": "Backend",
9+
"name": "Backend"
1010
},
1111
{
1212
"path": "./apps/frontend",
13-
"name": "Frontend",
13+
"name": "Frontend"
1414
},
1515
{
1616
"path": "./packages/configs",
17-
"name": "configs",
17+
"name": "configs"
1818
},
1919
{
2020
"path": "./packages/database",
21-
"name": "database",
21+
"name": "database"
2222
},
2323
{
2424
"path": "./packages/song",
25-
"name": "song",
25+
"name": "song"
2626
},
2727
{
2828
"path": "./packages/sounds",
29-
"name": "sounds",
29+
"name": "sounds"
3030
},
3131
{
3232
"path": "./packages/thumbnail",
33-
"name": "thumbnail",
34-
},
33+
"name": "thumbnail"
34+
}
3535
],
3636
"settings": {
3737
"window.title": "${dirty}${rootName}${separator}${profileName}${separator}${appName}",
@@ -41,12 +41,12 @@
4141
"eslint.format.enable": true,
4242
"mdx.server.enable": true,
4343
"editor.codeActionsOnSave": {
44-
"source.fixAll": "explicit",
44+
"source.fixAll": "explicit"
4545
},
4646
"search.exclude": {
4747
"**/.git": true,
4848
"**/node_modules": true,
49-
"**/dist": true,
49+
"**/dist": true
5050
},
5151
"workbench.colorCustomizations": {
5252
"activityBar.activeBackground": "#fac977",
@@ -65,8 +65,8 @@
6565
"titleBar.activeBackground": "#f8b646",
6666
"titleBar.activeForeground": "#15202b",
6767
"titleBar.inactiveBackground": "#f8b64699",
68-
"titleBar.inactiveForeground": "#15202b99",
68+
"titleBar.inactiveForeground": "#15202b99"
6969
},
70-
"peacock.color": "#f8b646",
71-
},
70+
"peacock.color": "#f8b646"
71+
}
7272
}

apps/backend/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"@nbw/database": "workspace:*",
6161
"@nbw/song": "workspace:*",
6262
"@nbw/thumbnail": "workspace:*",
63-
"@nbw/sounds": "workspace:*"
63+
"@nbw/sounds": "workspace:*",
64+
"@nbw/config": "workspace:*"
6465
},
6566
"devDependencies": {
6667
"@faker-js/faker": "^9.3.0",
@@ -70,6 +71,7 @@
7071
"@types/bcryptjs": "^2.4.6",
7172
"@types/bun": "^1.2.10",
7273
"@types/express": "^4.17.21",
74+
"@types/jest": "^29.5.12",
7375
"@types/multer": "^1.4.12",
7476
"@types/node": "^20.17.10",
7577
"@types/passport": "^1.0.17",
@@ -79,8 +81,10 @@
7981
"@types/passport-local": "^1.0.38",
8082
"@types/passport-oauth2": "^1.4.17",
8183
"@types/supertest": "^2.0.16",
84+
"jest": "^29.7.0",
8285
"source-map-support": "^0.5.21",
8386
"supertest": "^6.3.4",
87+
"ts-jest": "^29.1.2",
8488
"ts-loader": "^9.5.1",
8589
"ts-node": "^10.9.2",
8690
"tsc-watch": "^6.2.1",

apps/backend/src/song-browser/song-browser.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ export class SongBrowserService {
5050
) {
5151
const missing = BROWSER_SONGS.paddedFeaturedPageSize - songPage.length;
5252

53-
const additionalSongs =
54-
await this.songService.getSongsBeforeTimespan(time);
53+
const additionalSongs = await this.songService.getSongsBeforeTimespan(
54+
time,
55+
);
5556

5657
songPage.push(...additionalSongs.slice(0, missing));
5758
}

apps/backend/src/song/song.service.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ export class SongService {
7373
'username profileImage -_id',
7474
)) as unknown as SongWithUser;
7575

76-
const webhookMessageId =
77-
await this.songWebhookService.syncSongWebhook(populatedSong);
76+
const webhookMessageId = await this.songWebhookService.syncSongWebhook(
77+
populatedSong,
78+
);
7879

7980
songDocument.webhookMessageId = webhookMessageId;
8081

@@ -170,8 +171,9 @@ export class SongService {
170171
'username profileImage -_id',
171172
)) as unknown as SongWithUser;
172173

173-
const webhookMessageId =
174-
await this.songWebhookService.syncSongWebhook(populatedSong);
174+
const webhookMessageId = await this.songWebhookService.syncSongWebhook(
175+
populatedSong,
176+
);
175177

176178
foundSong.webhookMessageId = webhookMessageId;
177179

@@ -418,16 +420,13 @@ export class SongService {
418420
])) as unknown as { _id: string; count: number }[];
419421

420422
// Return object with category names as keys and counts as values
421-
return categories.reduce(
422-
(acc, category) => {
423-
if (category._id) {
424-
acc[category._id] = category.count;
425-
}
423+
return categories.reduce((acc, category) => {
424+
if (category._id) {
425+
acc[category._id] = category.count;
426+
}
426427

427-
return acc;
428-
},
429-
{} as Record<string, number>,
430-
);
428+
return acc;
429+
}, {} as Record<string, number>);
431430
}
432431

433432
public async getSongsByCategory(

apps/backend/tsconfig.json

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
{
2-
"extends": "../../tsconfig.base.json",
3-
"compilerOptions": {
4-
// NestJS specific settings
5-
"module": "commonjs",
6-
"target": "ES2021",
7-
"declaration": true,
8-
"removeComments": true,
9-
"allowSyntheticDefaultImports": true,
10-
"sourceMap": true,
11-
"outDir": "./dist",
12-
"baseUrl": "./",
13-
// Relaxed strict settings for backend
14-
"strictNullChecks": false,
15-
"noImplicitAny": false,
16-
"strictBindCallApply": false,
17-
"forceConsistentCasingInFileNames": false,
18-
"noFallthroughCasesInSwitch": false,
19-
// Path mapping
20-
"paths": {
21-
"@server/*": ["src/*"]
22-
}
23-
},
24-
"include": ["src/**/*.ts"],
25-
"exclude": [
26-
"node_modules",
27-
"dist",
28-
"**/*.spec.ts",
29-
"**/*.test.ts",
30-
"e2e/**/*",
31-
"test/**/*"
32-
]
33-
}
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
// NestJS specific settings
5+
"module": "commonjs",
6+
"target": "ES2021",
7+
"declaration": true,
8+
"removeComments": true,
9+
"allowSyntheticDefaultImports": true,
10+
"sourceMap": true,
11+
"outDir": "./dist",
12+
"baseUrl": "./",
13+
// Relaxed strict settings for backend
14+
"strictNullChecks": false,
15+
"noImplicitAny": false,
16+
"strictBindCallApply": false,
17+
"forceConsistentCasingInFileNames": false,
18+
"noFallthroughCasesInSwitch": false,
19+
// Path mapping
20+
"paths": {
21+
"@server/*": [
22+
"src/*"
23+
]
24+
}
25+
},
26+
"include": [
27+
"src/**/*.ts",
28+
"src/**/*.d.ts"
29+
],
30+
"exclude": [
31+
"node_modules",
32+
"dist",
33+
"e2e/**/*",
34+
"test/**/*"
35+
]
36+
}

apps/frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@hookform/resolvers": "^3.3.4",
1818
"@mdx-js/loader": "^3.0.1",
1919
"@mdx-js/react": "^3.0.1",
20+
"@nbw/database": "workspace:*",
2021
"@next/mdx": "^14.2.6",
2122
"@next/third-parties": "^14.2.5",
2223
"@radix-ui/react-dialog": "^1.0.5",

apps/frontend/posts/blog/2024-10-07_changelog-october-2024.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Here's what we've been up to since the last update:
2121
- The idea is to host guest writers from the community once in a while, so stay tuned!
2222
- Added the _About_ page! We're proud of our history and want to share it with you. We also want to acknowledge all the great people that have made this website possible, and everyone who's helped us along the way. Make sure to drop by and read about how Note Block World came to be!
2323
- The navigation bar at the top has been redesigned:
24+
2425
- Now features _Songs_, _Help_, _Blog_, and _About_ tabs.
2526
- The _Upload_ icon is no longer shown on mobile devices.
2627
- The external links (_GitHub_, _Changelog_, and _Donate_) have been moved from inside your user menu into a 'Settings' menu, so they're now accessible even if you aren't logged in.
@@ -31,6 +32,7 @@ Here's what we've been up to since the last update:
3132
### Bugfixes and improvements
3233

3334
- Added more mob sounds to the available custom instruments:
35+
3436
- Polar Bear
3537
- Phantom
3638
- Evoker

apps/frontend/posts/help/1_creating-song.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Once you've made a selection, you can:
6464
Selecting notes also lets you change them in other ways, all of which are available in the context menu that appears when you right-click the workspace, or by using the keyboard shortcuts below:
6565

6666
- **Transpose**: You can transpose the selected notes up or down by a certain number of semitones. This is useful for changing the key of a section of the song, or for creating harmonies.
67+
6768
- **Transpose up** (`Ctrl+R`): Transpose the selected notes up by one semitone.
6869
- **Transpose down** (`Ctrl+F`): Transpose the selected notes down by one semitone.
6970
- **Transpose one octave up**: Transpose the selected notes up by one octave (12 semitones).

apps/frontend/posts/help/5_custom-instruments.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ You've added a custom instrument to your song! You can now use it just like any
3838
There are a few limitations to keep in mind when working with custom instruments in Note Block Studio:
3939

4040
- **Custom instruments are not saved with the song file**: Song files only store the custom instrument settings, not the sound files themselves. This means that if you share your song with someone else, they won't have access to your custom instruments unless you also share the sound files you used. There are two ways to work around this limitation:
41+
4142
- **Share the sound files** along with the song file, so others can use the custom instruments in your song. You can save the song in a ZIP file that includes the sound files you used by going to _File_ > _Save song with custom sounds..._. Alternatively, you can save only the instruments to a ZIP file by going to _Settings_ > _Instrument settings..._ and clicking _Export sounds_.
4243
- **Use the same sound files** for custom instruments in all your songs, so you don't have to share them every time you share a song. In the section _Downloading songs that use custom instruments_ further down this article, you'll learn how to obtain Minecraft sound files that you can use to standardize the reference to your custom sound files.
4344

apps/frontend/src/app/(content)/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Metadata } from 'next';
22

3-
import { FeaturedSongsDtoType, SongPreviewDtoType } from '@nbw/database';
3+
import type { FeaturedSongsDto, SongPreviewDto } from '@nbw/database';
44
import axiosInstance from '@web/lib/axios';
55
import { HomePageProvider } from '@web/modules/browse/components/client/context/HomePage.context';
66
import { HomePageComponent } from '@web/modules/browse/components/HomePageComponent';
77

88
async function fetchRecentSongs() {
99
try {
10-
const response = await axiosInstance.get<SongPreviewDtoType[]>(
10+
const response = await axiosInstance.get<SongPreviewDto[]>(
1111
'/song-browser/recent',
1212
{
1313
params: {
@@ -25,9 +25,9 @@ async function fetchRecentSongs() {
2525
}
2626
}
2727

28-
async function fetchFeaturedSongs(): Promise<FeaturedSongsDtoType> {
28+
async function fetchFeaturedSongs(): Promise<FeaturedSongsDto> {
2929
try {
30-
const response = await axiosInstance.get<FeaturedSongsDtoType>(
30+
const response = await axiosInstance.get<FeaturedSongsDto>(
3131
'/song-browser/featured',
3232
);
3333

0 commit comments

Comments
 (0)