Skip to content
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

Simplify Server Import Paths for Common Code #361

Closed
wants to merge 6 commits into from

Conversation

dedl0x
Copy link
Contributor

@dedl0x dedl0x commented Jul 14, 2024

What does this change do?

This change adds index.ts files to some directories in the common and server projects, allowing for many classes and types to be represented as exports from the directory path itself. This allows several import statements to be consolidated into a single statement, which this change also addresses.

This change also leverages the paths feature in the TypeScript configuration file to alias the ../common/src/ path as @common. This shortens the target path for the import statements while not obfuscating the desired import target. To yield runnable Javascript output files, the tsc-alias package was added as a developer dependency. All build commands were updated to use tsc-alias to convert the path aliases back to relative paths in the resulting distributables.

tsc-alias

The [email protected] dependency introduces transitive dependencies:

How was this change regression tested?

  • The server code was rebuilt using npm run build, which did not report any errors.
  • The built server was started using node ./dist/server/src/server.js. The following output was observed.
    • Server Output
         _____ _   _______ _____ _____
        /  ___| | | | ___ \  _  |_   _|
        \ `--.| | | | |_/ / | | | | |
         `--. \ | | |    /| | | | | |
        /\__/ / |_| | |\ \\ \_/ /_| |_
        \____/ \___/\_| \_|\___/ \___/
      

      [7/14/2024 6:44:42 PM] Suroi Server v0.18.2
      [7/14/2024 6:44:42 PM] Listening on 127.0.0.1:8000
      [7/14/2024 6:44:42 PM] Press Ctrl+C to exit.
      [7/14/2024 6:44:42 PM] Game 0 | Creating...
      [7/14/2024 6:44:42 PM] Game 0 | Listening on 127.0.0.1:8001
      [7/14/2024 6:44:42 PM] Game 0 | Map seed: 1341368699
      [7/14/2024 6:44:42 PM] Game 0 | Created in 63 ms

  • The tests code was rebuilt using npm run build, which did not report any errors.
  • The validateDefinitions test was run using npm run validateDefinitions, which did not report any errors.

@dedl0x dedl0x requested a review from hsanger as a code owner July 14, 2024 19:44
@DamienVesper
Copy link
Collaborator

Merged into dev repository.

@Compositr
Copy link
Collaborator

did anyone actually do any REAL tests on this?
how did this get merged 💀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants