Skip to content

Conversation

tomast1337
Copy link
Member

@tomast1337 tomast1337 commented Jul 25, 2025

This pull request introduces several structural and configuration changes to the whole project, primarily focused on spiting the project server, web and shared packages into separate @nbw/backend, @nbw/frontend, @nbw/database, @nbw/song, @nbw/thumbnail, @nbw/sounds and @nbw/config.

The following diagram shows the new structure of the project:

graph TD
    subgraph "Applications"
        Backend["@nbw/backend<br/>(Backend App)"]
        Frontend["@nbw/frontend<br/>(Frontend App)"]
    end
    
    subgraph "Workspace Packages"
        Config["@nbw/config<br/>(Configuration)"]
        Database["@nbw/database<br/>(Database Entities & DTOs)"]
        Song["@nbw/song<br/>(Song Processing)"]
        Sounds["@nbw/sounds<br/>(Sound Management)"]
        Thumbnail["@nbw/thumbnail<br/>(Thumbnail Generation)"]
    end
    
    %% Workspace package dependencies
    Database --> Config
    Song --> Database
    Thumbnail --> Song
    
    %% Backend dependencies
    Backend --> Database
    Backend --> Song
    Backend --> Thumbnail
    Backend --> Sounds
    
    %% Frontend dependencies (through workspace)
    Frontend -.-> Config
    Frontend -.-> Database
    Frontend -.-> Song
    Frontend -.-> Thumbnail
    
    %% Styling
    classDef appStyle fill:#e1f5fe,stroke:#0277bd,stroke-width:2px
    classDef pkgStyle fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
    classDef leafStyle fill:#e8f5e8,stroke:#388e3c,stroke-width:2px
    
    class Backend,Frontend appStyle
    class Database,Song,Thumbnail pkgStyle
    class Config,Sounds leafStyle
Loading

Bun and Testing Improvements

  • Refined test scripts in package.json to run tests specifically on src/**/*.spec.ts and e2e/**/*.spec.ts, improving test targeting and coverage.

  • Added .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc to document and enforce the use of Bun over Node.js, npm, pnpm, or vite, including recommendations for APIs, testing, and frontend workflows.

The https://github.com/OpenNBS/NoteBlockWorld/blob/feature/node-workspace-setup/.github/workflows/tests.yml file will need to be updated to this:

name: Run Tests

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

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4
      
      - name: Install bun
        uses: oven-sh/setup-bun@v2
      
      - name: Install dependencies # (assuming your project has dependencies)
        run: bun install # You can use npm/yarn/pnpm instead if you prefer

      - name: Run tests
        run: bun run test

And our https://github.com/OpenNBS/NoteBlockWorld/blob/main/.github/workflows/lint.yml file is broken; it doesn't commit the linted files. I think this solves it:

name: Lint Code

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

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

    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          fetch-depth: 0

      - name: Set up Bun
        run: |
          curl -fsSL https://bun.sh/install | bash
          echo "${HOME}/.bun/bin" >> $GITHUB_PATH

      - name: Install dependencies
        run: bun install

      - name: Run linter
        run: bun run lint

      - name: Check for changes
        id: verify-changed-files
        run: |
          if [ -n "$(git status --porcelain)" ]; then
            echo "changed=true" >> $GITHUB_OUTPUT
          else
            echo "changed=false" >> $GITHUB_OUTPUT
          fi

      - name: Commit linter changes
        if: steps.verify-changed-files.outputs.changed == 'true'
        run: |
          git config --local user.email "[email protected]"
          git config --local user.name "GitHub Action"
          git add .
          git commit -m "🔧 Auto-fix: ESLint formatting and fixes"
          git push

@tomast1337 tomast1337 self-assigned this Jul 25, 2025
@tomast1337 tomast1337 added enhancement New feature or request help wanted Extra attention is needed labels Jul 25, 2025
Copy link
Member

@Bentroen Bentroen left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you for working on these changes =)

Some extra things (besides the review comments) we gotta make sure are working before merging:

  • Update VSCode workspace file, test running etc. to reflect the new project structure
  • Update GitHub Actions to reflect the new project structure

@Bentroen Bentroen mentioned this pull request Aug 13, 2025
21 tasks
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR restructures the monorepo by splitting the original server, web, and shared packages into focused workspace packages and applications. It creates a more modular architecture with separate packages for configuration, database entities, song processing, thumbnail generation, and sound management, while establishing clear dependency relationships between components.

  • Splits the monolithic structure into focused packages (@nbw/config, @nbw/database, @nbw/song, @nbw/thumbnail, @nbw/sounds)
  • Creates dedicated application packages (@nbw/backend, @nbw/frontend)
  • Updates all import paths throughout the codebase to use the new package structure

Reviewed Changes

Copilot reviewed 124 out of 398 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/configs/ New configuration package with shared constants and types
packages/database/ New database package setup with gitignore and eslint config
apps/frontend/ Updated frontend with new import paths and package structure
apps/backend/ Updated backend with new import paths and dependency references
package.json Root package updated with new workspace structure and exports
build.ts Updated build script to use new package imports

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

tomast1337 and others added 10 commits August 14, 2025 12:23
…s, moving frontend to apps/frontend and adding components package
Co-authored-by: Copilot <[email protected]>
…eBlockWorld into feature/node-workspace-setup
…and grayscale note block image to thumbnail assets, and clean up utils.spec.ts by removing mock canvasFactory
…le asset file locations and ensure path existence check
@tomast1337 tomast1337 requested a review from Copilot September 9, 2025 21:11
@tomast1337 tomast1337 marked this pull request as ready for review September 9, 2025 21:11
@tomast1337 tomast1337 changed the base branch from main to develop September 9, 2025 21:12
…moving obsolete entries and adding new patterns for improved dependency and build management
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

…gs, streamline project structure, and improve compatibility across packages
…introducing backend and frontend specific configurations, and updating dependencies for improved linting consistency across the project
…ting scripts for backend and frontend applications, enhancing consistency and maintainability across the project
…ackend/scripts/build.ts, enhancing project structure and maintainability
@tomast1337 tomast1337 requested a review from Copilot September 10, 2025 21:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

…nd change global prefix from '/api/v1' to '/v1' for improved clarity and consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project structure refactor
2 participants