Skip to content

refactor: split shared into packages #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
9697ca9
refactor: split shared into packages
tomast1337 Jul 25, 2025
b4ecf42
refactor: moved backend to packages
tomast1337 Jul 25, 2025
f79dc4e
refactor: moved frontend to apps/frontend
tomast1337 Jul 25, 2025
ff0be9d
refactor: restructure project to use workspaces for apps and packages
tomast1337 Jul 25, 2025
f350b50
refactor: clean up database module by removing unused index file and …
tomast1337 Jul 25, 2025
a2f54b6
refactor: update imports to use centralized database module and remov…
tomast1337 Jul 25, 2025
bee7b71
feat: implement offscreen drawing of notes and canvas swapping functi…
tomast1337 Jul 25, 2025
baa803c
refactor: update imports to use centralized module paths and clean up…
tomast1337 Jul 25, 2025
e6834bc
refactor: tidy up tsconfig.json formatting for improved readability
tomast1337 Jul 25, 2025
91b480b
refactor: update imports to use centralized database module and clean…
tomast1337 Jul 26, 2025
f8697f6
refactor: update build and start scripts to reflect new package struc…
tomast1337 Jul 26, 2025
4e44766
refactor: update ESLint configuration paths to reflect new directory …
tomast1337 Jul 26, 2025
7928d51
refactor: update imports to use new package structure for sounds and …
tomast1337 Jul 26, 2025
4d29bce
refactor: add test script to package.json and update imports for cons…
tomast1337 Jul 26, 2025
0785bd5
refactor: standardize import statements across multiple files and cle…
tomast1337 Jul 26, 2025
e76df8f
refactor: add lint and test scripts to package.json for database, son…
tomast1337 Jul 26, 2025
52520ec
refactor: update test scripts in package.json for backend, database, …
tomast1337 Jul 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
2 changes: 1 addition & 1 deletion web/.eslintrc.js → apps/frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
'plugin:mdx/recommended',
'next',
'next/core-web-vitals',
'../.eslintrc.js',
'../../.eslintrc.js',
],
settings: {
'mdx/code-blocks': true,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
p,
pre,
ul,
} from '@web/src/modules/shared/components/CustomMarkdown';
} from '@web/modules/shared/components/CustomMarkdown';

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions web/package.json → apps/frontend/package.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the app packages are now prefixed with @nbw/, it could be a good idea to rename them to just @nbw/frontend and @nbw/backend in package.json?

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "noteblockworld-web",
"name": "@nbw/noteblockworld-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint --fix"
"lint": "next lint --fix",
"test": "jest"
},
"dependencies": {
"@fortawesome/free-brands-svg-icons": "^6.4.2",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Image from 'next/image';
import {
Team,
TeamMemberCard,
} from '@web/src/modules/shared/components/TeamMemberCard';
} from '@web/modules/shared/components/TeamMemberCard';

**Note Block World** is the largest public community centered around Minecraft note blocks, developed by the same folks who brought you [Note Block Studio](https://noteblock.studio/). It lets you discover, share and listen to note block music more easily than ever!

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Metadata } from 'next';

import BackButton from '@web/src/modules/shared/components/client/BackButton';
import { NoteBlockWorldLogo } from '@web/src/modules/shared/components/NoteBlockWorldLogo';
import BackButton from '@web/modules/shared/components/client/BackButton';
import { NoteBlockWorldLogo } from '@web/modules/shared/components/NoteBlockWorldLogo';

import About from './about.mdx';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Image from 'next/image';
import Link from 'next/link';
import { notFound } from 'next/navigation';

import { PostType, getPostData } from '@web/src/lib/posts';
import { CustomMarkdown } from '@web/src/modules/shared/components/CustomMarkdown';
import { PostType, getPostData } from '@web/lib/posts';
import { CustomMarkdown } from '@web/modules/shared/components/CustomMarkdown';

type BlogPageProps = {
params: { id: string };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Metadata } from 'next';
import Image from 'next/image';
import Link from 'next/link';

import { getSortedPostsData } from '@web/src/lib/posts';
import type { PostType } from '@web/src/lib/posts';
import { getSortedPostsData } from '@web/lib/posts';
import type { PostType } from '@web/lib/posts';

export const metadata: Metadata = {
title: 'Blog',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Metadata } from 'next';

import BackButton from '@web/src/modules/shared/components/client/BackButton';
import BackButton from '@web/modules/shared/components/client/BackButton';

import Contact from './contact.mdx';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Image from 'next/image';
import Link from 'next/link';
import { notFound } from 'next/navigation';

import { PostType, getPostData } from '@web/src/lib/posts';
import { CustomMarkdown } from '@web/src/modules/shared/components/CustomMarkdown';
import { PostType, getPostData } from '@web/lib/posts';
import { CustomMarkdown } from '@web/modules/shared/components/CustomMarkdown';

type HelpPageProps = {
params: { id: string };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Metadata } from 'next';
import Image from 'next/image';
import Link from 'next/link';

import { getSortedPostsData } from '@web/src/lib/posts';
import type { PostType } from '@web/src/lib/posts';
import { getSortedPostsData } from '@web/lib/posts';
import type { PostType } from '@web/lib/posts';

export const metadata: Metadata = {
title: 'Help Center',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@web/src/app/globals.css';
import NavbarLayout from '@web/src/modules/shared/components/layout/NavbarLayout';
import '@web/app/globals.css';
import NavbarLayout from '@web/modules/shared/components/layout/NavbarLayout';

export default async function ContentLayout({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Metadata } from 'next';
import { redirect } from 'next/navigation';

import { checkLogin } from '@web/src/modules/auth/features/auth.utils';
import Page from '@web/src/modules/my-songs/components/MySongsPage';
import { checkLogin } from '@web/modules/auth/features/auth.utils';
import Page from '@web/modules/my-songs/components/MySongsPage';

export const metadata: Metadata = {
title: 'My songs',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
FeaturedSongsDtoType,
SongPreviewDtoType,
} from '@shared/validation/song/dto/types';
import { FeaturedSongsDtoType, SongPreviewDtoType } from '@nbw/database';
import { Metadata } from 'next';

import axiosInstance from '@web/src/lib/axios';
import { HomePageProvider } from '@web/src/modules/browse/components/client/context/HomePage.context';
import { HomePageComponent } from '@web/src/modules/browse/components/HomePageComponent';
import axiosInstance from '@web/lib/axios';
import { HomePageProvider } from '@web/modules/browse/components/client/context/HomePage.context';
import { HomePageComponent } from '@web/modules/browse/components/HomePageComponent';

async function fetchRecentSongs() {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { redirect } from 'next/navigation';

import { checkLogin } from '@web/src/modules/auth/features/auth.utils';
import { EditSongPage } from '@web/src/modules/song-edit/components/client/EditSongPage';
import { checkLogin } from '@web/modules/auth/features/auth.utils';
import { EditSongPage } from '@web/modules/song-edit/components/client/EditSongPage';

async function Page({ params }: { params: { id: string } }) {
const isLogged = await checkLogin();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SongViewDtoType } from '@shared/validation/song/dto/types';
import { SongViewDtoType } from '@nbw/database';
import type { Metadata } from 'next';
import { cookies } from 'next/headers';

import axios from '@web/src/lib/axios';
import { SongPage } from '@web/src/modules/song/components/SongPage';
import axios from '@web/lib/axios';
import { SongPage } from '@web/modules/song/components/SongPage';

interface SongPage {
params: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@web/src/app/enableRecaptchaBadge.css';
import '@web/app/enableRecaptchaBadge.css';

export default async function UploadLayout({
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { Metadata } from 'next';
import { redirect } from 'next/navigation';

import {
checkLogin,
getUserData,
} from '@web/src/modules/auth/features/auth.utils';
import { UploadSongPage } from '@web/src/modules/song-upload/components/client/UploadSongPage';
import { checkLogin, getUserData } from '@web/modules/auth/features/auth.utils';
import { UploadSongPage } from '@web/modules/song-upload/components/client/UploadSongPage';

export const metadata: Metadata = {
title: 'Upload song',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UserProfile from '@web/src/modules/user/components/UserProfile';
import { getUserProfileData } from '@web/src/modules/user/features/user.util';
import UserProfile from '@web/modules/user/components/UserProfile';
import { getUserProfileData } from '@web/modules/user/features/user.util';

import Layout from '../../layout';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Metadata } from 'next';
import { redirect } from 'next/navigation';

import { LoginWithEmailPage } from '@web/src/modules/auth/components/loginWithEmailPage';
import { checkLogin } from '@web/src/modules/auth/features/auth.utils';
import { LoginWithEmailPage } from '@web/modules/auth/components/loginWithEmailPage';
import { checkLogin } from '@web/modules/auth/features/auth.utils';

export const metadata: Metadata = {
title: 'Sign in',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Metadata } from 'next';
import { redirect } from 'next/navigation';

import { LoginPage } from '@web/src/modules/auth/components/loginPage';
import { checkLogin } from '@web/src/modules/auth/features/auth.utils';
import { LoginPage } from '@web/modules/auth/components/loginPage';
import { checkLogin } from '@web/modules/auth/features/auth.utils';

export const metadata: Metadata = {
title: 'Sign in',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { toast } from 'react-hot-toast';

import { useSignOut } from '@web/src/modules/auth/components/client/login.util';
import { useSignOut } from '@web/modules/auth/components/client/login.util';

function Page() {
useSignOut();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';

import { Metadata } from 'next';

import { CustomMarkdown } from '@web/src/modules/shared/components/CustomMarkdown';
import { CustomMarkdown } from '@web/modules/shared/components/CustomMarkdown';

export const metadata: Metadata = {
title: 'Community Guidelines',
Expand Down
3 changes: 3 additions & 0 deletions apps/frontend/src/app/(external)/(legal)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import DocumentLayout from '@web/modules/shared/components/layout/DocumentLayout';

export default DocumentLayout;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';

import { Metadata } from 'next';

import { CustomMarkdown } from '@web/src/modules/shared/components/CustomMarkdown';
import { CustomMarkdown } from '@web/modules/shared/components/CustomMarkdown';

export const metadata: Metadata = {
title: 'Privacy Policy',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';

import { Metadata } from 'next';

import { CustomMarkdown } from '@web/src/modules/shared/components/CustomMarkdown';
import { CustomMarkdown } from '@web/modules/shared/components/CustomMarkdown';

export const metadata: Metadata = {
title: 'Terms of Service',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@web/src/app/globals.css';
import '@web/src/app/enableRecaptchaBadge.css';
import '@web/src/app/hideScrollbar.css';
import '@web/app/globals.css';
import '@web/app/enableRecaptchaBadge.css';
import '@web/app/hideScrollbar.css';

export default async function LoginLayout({
children,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion web/src/global.d.ts → apps/frontend/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://stackoverflow.com/a/56984941/9045426
// https://stackoverflow.com/a/43523944/9045426

import type { SoundListType } from '@shared/features/sounds';
import type { SoundListType } from '@nbw/database';

interface Window {
latestVersionSoundList: SoundListType;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FC, useState } from 'react';
import { useForm } from 'react-hook-form';
import { toast } from 'react-hot-toast';

import ClientAxios from '@web/src/lib/axios/ClientAxios';
import ClientAxios from '@web/lib/axios/ClientAxios';

import {
Input,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Link from 'next/link';

import { baseApiURL } from '@web/src/lib/axios';
import { baseApiURL } from '@web/lib/axios';

import { CopyrightFooter } from '../../shared/components/layout/CopyrightFooter';
import { NoteBlockWorldLogo } from '../../shared/components/NoteBlockWorldLogo';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

import { faPlay } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { SongPreviewDtoType } from '@shared/validation/song/dto/types';
import { SongPreviewDtoType } from '@nbw/database';
import Link from 'next/link';
import Skeleton from 'react-loading-skeleton';

import {
formatDuration,
formatTimeAgo,
} from '@web/src/modules/shared/util/format';
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
@@ -1,15 +1,13 @@
'use client';

import { UploadConst } from '@shared/validation/song/constants';
import { CategoryType } from '@shared/validation/song/dto/types';
import { CategoryType, UploadConst } from '@nbw/database';

import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNextSmall,
CarouselPreviousSmall,
} from '@web/src/modules/shared/components/client/Carousel';
} from '@web/modules/shared/components/client/Carousel';

import { useRecentSongsProvider } from './context/RecentSongs.context';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from '@web/src/modules/shared/components/tooltip';
} from '@web/modules/shared/components/tooltip';

import { useFeaturedSongsProvider } from './context/FeaturedSongs.context';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
FeaturedSongsDtoType,
SongPreviewDtoType,
TimespanType,
} from '@shared/validation/song/dto/types';
} from '@nbw/database';
import { createContext, useContext, useEffect, useState } from 'react';

type FeaturedSongsContextType = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
'use client';

import {
FeaturedSongsDtoType,
SongPreviewDtoType,
} from '@shared/validation/song/dto/types';
import { FeaturedSongsDtoType, SongPreviewDtoType } from '@nbw/database';
import { createContext, useContext } from 'react';

import { FeaturedSongsProvider } from './FeaturedSongs.context';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { SongPreviewDtoType } from '@shared/validation/song/dto/types';
import { SongPreviewDtoType } from '@nbw/database';
import {
createContext,
useCallback,
Expand All @@ -9,7 +9,7 @@ import {
useState,
} from 'react';

import axiosInstance from '@web/src/lib/axios';
import axiosInstance from '@web/lib/axios';

type RecentSongsContextType = {
recentSongs: (SongPreviewDtoType | null)[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { MY_SONGS } from '@shared/validation/song/constants';
import {
SongPageDtoType,
SongsFolder,
} from '@shared/validation/song/dto/types';
import { MY_SONGS, SongPageDtoType, SongsFolder } from '@nbw/database';

import axiosInstance from '@web/src/lib/axios';
import axiosInstance from '@web/lib/axios';

import { MySongProvider } from './client/context/MySongs.context';
import { MySongsPageComponent } from './client/MySongsTable';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GenericModal from '@web/src/modules/shared/components/client/GenericModal';
import GenericModal from '@web/modules/shared/components/client/GenericModal';

export default function DeleteConfirmDialog({
isOpen,
Expand Down
Loading
Loading