Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c451be0
chore: add setting to use project's TypeScript version instead of bun…
Bentroen Jan 4, 2026
757b729
chore: replace root `tsconfig.json` with `references` field
Bentroen Jan 4, 2026
2720e25
chore: enable `composite` in package-inherited root TS config
Bentroen Jan 4, 2026
16d85c8
chore: rename `tsconfig.build.json` to `tsconfig.json`
Bentroen Jan 4, 2026
b5216a0
chore: review base TS settings in global `tsconfig.base.json`
Bentroen Jan 4, 2026
3c8beda
chore: review base TS settings for packages in `tsconfig.package.json`
Bentroen Jan 4, 2026
01e0984
chore: merge `tsconfig.build.json` into `tsconfig.json` for packages
Bentroen Jan 4, 2026
d5f531d
fix: remove `@database` path alias in database package
Bentroen Jan 4, 2026
2186717
chore: remove `build:types` script from packages and replace with `ts…
Bentroen Jan 4, 2026
bcf7af3
chore: add `typecheck` command to workspace root
Bentroen Jan 4, 2026
2b0eeff
chore: make backend and frontend TS projects `composite` (following r…
Bentroen Jan 4, 2026
67daa09
chore: clean up frontend's `tsconfig.json`
Bentroen Jan 4, 2026
dc7f599
chore: clean up backend's `tsconfig.json`
Bentroen Jan 4, 2026
710d79e
style: add comments and line breaks to frontend/backend tsconfig
Bentroen Jan 4, 2026
b5e6023
style: fully comment settings in base and package `tsconfig.json`
Bentroen Jan 4, 2026
f508b89
chore: add type checking workflow on push and pull request
Bentroen Jan 4, 2026
a011504
chore: add `eslint-import-resolver-typescript` dependency
Bentroen Jan 5, 2026
06dbb5c
chore: add separate TS config for ESLint
Bentroen Jan 5, 2026
2b3c4a7
chore: add `baseUrl` and `@nbw` path alias to root TS config
Bentroen Jan 5, 2026
9faf154
chore: ensure that orchestrator TS config doesn't emit types
Bentroen Jan 5, 2026
79f2bf9
chore: remove `outDir` from base TS config
Bentroen Jan 6, 2026
8498c2f
fix: add `baseUrl` to app TS configs
Bentroen Jan 5, 2026
f85b959
fix: ensure types are emitted in `configs` package through `rootDir` …
Bentroen Jan 5, 2026
ab269fc
fix: enforce `src -> dist` output structure for all packages
Bentroen Jan 5, 2026
4eab8c9
build: re-introduce separate `js` and `types` steps in database build
Bentroen Jan 6, 2026
774326d
chore: ensure TS build cache files are output to `dist`
Bentroen Jan 6, 2026
d148680
chore: let TS infer build cache output location as `dist/`
Bentroen Jan 6, 2026
3dbd11f
fix: incorrect import alias in `database` package
Bentroen Jan 6, 2026
0ca8c47
fix: `thumbnail` package using removed `build:types` script
Bentroen Jan 6, 2026
5d94120
chore: remove `composite` from frontend and backend packages
Bentroen Jan 6, 2026
5e5bf4a
chore: re-add `rootDir` and `tsInfoBuildFile` on package projects
Bentroen Jan 10, 2026
3914f6a
chore: refactor build scripts and improve TypeScript configuration
tomast1337 Jan 10, 2026
8581179
Merge branch 'refactor/tsconfig-cleanup' of github.com:OpenNBS/NoteBl…
tomast1337 Jan 10, 2026
9c75b72
refactor: update imports to use 'type' for TypeScript types in variou…
tomast1337 Jan 10, 2026
b323da5
fix: BlogPageProps and HelpPageProps to use Promise for params
tomast1337 Jan 10, 2026
6b28ef6
Merge branch 'develop' of github.com:OpenNBS/NoteBlockWorld into refa…
tomast1337 Jan 10, 2026
7536bd7
Fix: update build script to use webpack
tomast1337 Jan 10, 2026
8206099
Merge branch 'develop' of github.com:OpenNBS/NoteBlockWorld into refa…
tomast1337 Jan 10, 2026
8a18083
fix: HelpPost component to handle async params
tomast1337 Jan 10, 2026
696f3f9
fix: update form types and default values in Thumbnail components
tomast1337 Jan 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Type Check

on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main

jobs:
typecheck:
runs-on: ubuntu-latest
env:
THUMBNAIL_URL: ${{ vars.THUMBNAIL_URL }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Type check (project references)
run: bun run typecheck
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"files.associations": {
".css": "tailwindcss",
"*.scss": "tailwindcss"
}
},
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
22 changes: 14 additions & 8 deletions apps/backend/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,20 @@ const build = async () => {
target: 'bun',
minify: false,
sourcemap: 'linked',
external: optionalRequirePackages.filter((pkg) => {
try {
require(pkg);
return false;
} catch (_) {
return true;
}
}),
external: [
...optionalRequirePackages.filter((pkg) => {
try {
require(pkg);
return false;
} catch (_) {
return true;
}
}),
'@nbw/config',
'@nbw/database',
'@nbw/song',
'@nbw/sounds',
],
splitting: true,
});

Expand Down
4 changes: 0 additions & 4 deletions apps/backend/tsconfig.build.json

This file was deleted.

13 changes: 3 additions & 10 deletions apps/backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@
"removeComments": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"emitDecoratorMetadata": true,
// Relaxed strict settings for backend
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,

// Path mapping
"baseUrl": ".",
"paths": {
"@server/*": ["src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts"],
"exclude": ["node_modules", "dist", "e2e/**/*", "test/**/*"]
"include": ["src", "scripts"]
}
5 changes: 4 additions & 1 deletion apps/frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import createMDX from '@next/mdx';

const nextConfig = {
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
// Externalize packages that use Node.js built-in modules for server components
serverExternalPackages: ['@nbw/database', '@nbw/config'],
// See: https://github.com/Automattic/node-canvas/issues/867#issuecomment-1925284985
webpack: (config, { isServer }) => {
config.externals.push({
Expand All @@ -12,8 +14,9 @@ const nextConfig = {

// Prevent @nbw/thumbnail from being bundled on the server
// It uses HTMLCanvasElement which is not available in Node.js
// Also externalize backend packages that use Node.js modules
if (isServer) {
config.externals.push('@nbw/thumbnail');
config.externals.push('@nbw/thumbnail', '@nbw/database');
}

return config;
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "next build --webpack",
"start": "next start",
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
"test": "jest"
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/app/(content)/(info)/blog/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PostType, getPostData } from '@web/lib/posts';
import { CustomMarkdown } from '@web/modules/shared/components/CustomMarkdown';

type BlogPageProps = {
params: { id: string };
params: Promise<{ id: string }>;
};

export async function generateMetadata({
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/app/(content)/(info)/help/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PostType, getPostData } from '@web/lib/posts';
import { CustomMarkdown } from '@web/modules/shared/components/CustomMarkdown';

type HelpPageProps = {
params: { id: string };
params: Promise<{ id: string }>;
};

export async function generateMetadata({
Expand All @@ -34,8 +34,8 @@ export async function generateMetadata({
};
}

const HelpPost = ({ params }: HelpPageProps) => {
const { id } = params;
const HelpPost = async ({ params }: HelpPageProps) => {
const { id } = await params;
let post: PostType;

try {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/app/(content)/song/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Metadata } from 'next';
import { cookies } from 'next/headers';

import { SongViewDtoType } from '@nbw/database';
import type { SongViewDtoType } from '@nbw/database';
import axios from '@web/lib/axios';
import { SongPage } from '@web/modules/song/components/SongPage';

Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/modules/browse/components/SongCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Link from 'next/link';
import Skeleton from 'react-loading-skeleton';

import { SongPreviewDtoType } from '@nbw/database';
import type { SongPreviewDtoType } from '@nbw/database';
import { formatDuration, formatTimeAgo } from '@web/modules/shared/util/format';

import SongThumbnail from '../../shared/components/layout/SongThumbnail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect } from 'react';
import { create } from 'zustand';

import { TIMESPANS } from '@nbw/config';
import { type FeaturedSongsDto, type SongPreviewDto } from '@nbw/database';
import type { FeaturedSongsDto, SongPreviewDto } from '@nbw/database';

type TimespanType = (typeof TIMESPANS)[number];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { FeaturedSongsDtoType, SongPreviewDtoType } from '@nbw/database';
import type { FeaturedSongsDtoType, SongPreviewDtoType } from '@nbw/database';

import {
FeaturedSongsProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useEffect } from 'react';
import { create } from 'zustand';

import { PageDto, SongPreviewDtoType } from '@nbw/database';
import type { PageDto, SongPreviewDtoType } from '@nbw/database';
import axiosInstance from '@web/lib/axios';

interface RecentSongsState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Link from 'next/link';
import Skeleton from 'react-loading-skeleton';

import { SongPreviewDtoType } from '@nbw/database';
import type { SongPreviewDtoType } from '@nbw/database';
import SongThumbnail from '@web/modules/shared/components/layout/SongThumbnail';
import { formatDuration } from '@web/modules/shared/util/format';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { faDice } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useRouter } from 'next/navigation';

import { PageDto, SongPreviewDto } from '@nbw/database';
import type { PageDto, SongPreviewDto } from '@nbw/database';
import axios from '@web/lib/axios';

import { MusicalNote } from './MusicalNote';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UploadSongDtoType } from '@nbw/database';
import type { UploadSongDtoType } from '@nbw/database';
import axiosInstance from '@web/lib/axios';
import {
getTokenServer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState } from 'react';

import { SongViewDtoType } from '@nbw/database';
import type { SongViewDtoType } from '@nbw/database';
import { DownloadPopupAdSlot } from '@web/modules/shared/components/client/ads/AdSlots';
import GenericModal from '@web/modules/shared/components/client/GenericModal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useEffect, useRef } from 'react';

import { SongViewDtoType } from '@nbw/database';
import type { SongViewDtoType } from '@nbw/database';
import axios from '@web/lib/axios';

export const SongCanvas = ({ song }: { song: SongViewDtoType }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { Slider } from '@web/modules/shared/components/ui/slider';

import { useSongProvider } from './context/Song.context';
import { EditSongForm, UploadSongForm } from './SongForm.zod';
import { EditSongFormInput, UploadSongFormInput } from './SongForm.zod';
import { ThumbnailRendererCanvas } from './ThumbnailRenderer';

const formatZoomLevel = (zoomLevel: number) => {
Expand All @@ -20,7 +20,8 @@ const formatZoomLevel = (zoomLevel: number) => {
};

type ThumbnailSlidersProps = {
formMethods: UseFormReturn<UploadSongForm> & UseFormReturn<EditSongForm>;
formMethods: UseFormReturn<UploadSongFormInput> &
UseFormReturn<EditSongFormInput>;
isLocked: boolean;
maxTick: number;
maxLayer: number;
Expand Down Expand Up @@ -48,7 +49,7 @@ const ThumbnailSliders: React.FC<ThumbnailSlidersProps> = ({
<div>
<Slider
id='zoom-level'
value={[zoomLevel]}
value={[zoomLevel ?? THUMBNAIL_CONSTANTS.zoomLevel.default]}
onValueChange={(value) => {
setValue('thumbnailData.zoomLevel', value[0], {
shouldValidate: true,
Expand All @@ -60,14 +61,16 @@ const ThumbnailSliders: React.FC<ThumbnailSlidersProps> = ({
max={THUMBNAIL_CONSTANTS.zoomLevel.max}
/>
</div>
<div>{formatZoomLevel(zoomLevel)}</div>
<div>
{formatZoomLevel(zoomLevel ?? THUMBNAIL_CONSTANTS.zoomLevel.default)}
</div>
<div>
<label htmlFor='start-tick'>Start Tick</label>
</div>
<div className='w-full'>
<Slider
id='start-tick'
value={[startTick]}
value={[startTick ?? THUMBNAIL_CONSTANTS.startTick.default]}
onValueChange={(value) => {
setValue('thumbnailData.startTick', value[0], {
shouldValidate: true,
Expand All @@ -86,7 +89,7 @@ const ThumbnailSliders: React.FC<ThumbnailSlidersProps> = ({
<div className='w-full'>
<Slider
id='start-layer'
value={[startLayer]}
value={[startLayer ?? THUMBNAIL_CONSTANTS.startLayer.default]}
onValueChange={(value) => {
setValue('thumbnailData.startLayer', value[0], {
shouldValidate: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import { useEffect, useRef, useState } from 'react';
import { UseFormReturn } from 'react-hook-form';

import { THUMBNAIL_CONSTANTS } from '@nbw/config';
import { NoteQuadTree } from '@nbw/song';
import { drawNotesOffscreen, swap } from '@nbw/thumbnail/browser';

import { UploadSongForm } from './SongForm.zod';
import { UploadSongFormInput } from './SongForm.zod';

type ThumbnailRendererCanvasProps = {
notes: NoteQuadTree;
formMethods: UseFormReturn<UploadSongForm>;
formMethods: UseFormReturn<UploadSongFormInput>;
};

export const ThumbnailRendererCanvas = ({
Expand Down Expand Up @@ -60,10 +61,11 @@ export const ThumbnailRendererCanvas = ({
try {
const output = (await drawNotesOffscreen({
notes,
startTick,
startLayer,
zoomLevel,
backgroundColor,
startTick: startTick ?? THUMBNAIL_CONSTANTS.startTick.default,
startLayer: startLayer ?? THUMBNAIL_CONSTANTS.startLayer.default,
zoomLevel: zoomLevel ?? THUMBNAIL_CONSTANTS.zoomLevel.default,
backgroundColor:
backgroundColor ?? THUMBNAIL_CONSTANTS.backgroundColor.default,
canvasWidth: canvas.width,
imgWidth: 1280,
imgHeight: 768,
Expand Down
16 changes: 6 additions & 10 deletions apps/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true,

// Override base strict settings for Next.js compatibility
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true,
"strictBindCallApply": true,
"strictPropertyInitialization": false,

// Next.js plugins and types
"plugins": [
{
"name": "next"
}
],
"types": ["mdx"],

// Path mapping
"baseUrl": ".",
"paths": {
"@web/*": ["./src/*"]
"@web/*": ["src/*"]
}
},
"include": [
Expand All @@ -37,10 +38,5 @@
"**/*.tsx",
"**/*.mdx",
".next/types/**/*.ts"
],
"types": ["mdx"],
// Path mapping
"paths": {
"@web/*": ["./src/*"]
}
]
}
Loading
Loading