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

TGUI maintenance chores and juke upgrades #6247

Merged
merged 17 commits into from Jan 28, 2022

Conversation

Crossedfall
Copy link
Member

@Crossedfall Crossedfall commented Jan 25, 2022

About The Pull Request

Ports several juke/tgs changes to resolve some of our technical debt and to get the TGUI dev server working again.

Ported the following:

Why It's Good For The Game

General TGUI improvements and QoL changes for development.

⚠️ IMPORTANT CHANGES ⚠️

Interacting with TGUI has changed drastically. There is no longer a bin/tgui script to interact with. Instead, developers will need to use either the windows scripts found in the bin/ root directory, via Juke, or via yarn. Excerpt from the updated tgui/README.md below.

TGUI usage

Via provided cmd scripts (Windows):

  • bin/tgui-build - Build tgui in production mode and run a full suite of code checks.
  • bin/tgui-dev - Launch a development server.
    • bin/tgui-dev --reload - Reload byond cache once.
    • bin/tgui-dev --debug - Run server with debug logging enabled.
    • bin/tgui-dev --no-hot - Disable hot module replacement (helps when doing development on IE8).
  • bin/tgui-sonar - Analyze code with SonarQube.
  • bin/tgui-bench - Run benchmarks.

To open a CMD or PowerShell window in any open folder, right click while holding Shift on any free space in the folder, then click on either Open command window here or Open PowerShell window here.

Via Juke Build (cross-platform):

  • tools/build/build tgui - Build tgui in production mode.
  • tools/build/build tgui-dev - Build tgui in production mode.
    • tools/build/build tgui-dev --reload - Reload byond cache once.
    • tools/build/build tgui-dev --debug - Run server with debug logging enabled.
    • tools/build/build tgui-dev --no-hot - Disable hot module replacement (helps when doing development on IE8).
  • tools/build/build tgui-lint - Show (and auto-fix) problems with the code.
  • tools/build/build tgui-sonar - Analyze code with SonarQube.
  • tools/build/build tgui-test - Run unit and integration tests.
  • tools/build/build tgui-analyze - Run a bundle analyzer.
  • tools/build/build tgui-bench - Run benchmarks.
  • tools/build/build tgui-clean - Clean up tgui folder.

With Juke Build, you can run multiple targets together, e.g.:

tools/build/build tgui tgui-lint tgui-tsc tgui-test

Via Yarn (cross-platform):

Run yarn install once to install tgui dependencies.

  • yarn tgui:build - Build tgui in production mode.
    • yarn tgui:build [options] - Build tgui with custom webpack options.
  • yarn tgui:dev - Launch a development server.
    • yarn tgui:dev --reload - Reload byond cache once.
    • yarn tgui:dev --debug - Run server with debug logging enabled.
    • yarn tgui:dev --no-hot - Disable hot module replacement (helps when doing development on IE8).
  • yarn tgui:lint - Show (and auto-fix) problems with the code.
  • yarn tgui:sonar - Analyze code with SonarQube.
  • yarn tgui:tsc - Check code with TypeScript compiler.
  • yarn tgui:test - Run unit and integration tests.
  • yarn tgui:analyze - Run a bundle analyzer.
  • yarn tgui:bench - Run benchmarks.

Testing Photographs and Procedure

  • Built the base using the default VSC command (Ctrl+Shift+B)
  • Built the base using the debug function (F5)
  • Built the base using BUILD.bat
  • Built the base using tools/build/build
  • Used all of the bin/*.cmd scripts
  • Verified that the TGUI-dev server worked (see screenshots)
  • Tested basic TGUI elements and windows
Screenshots&Videos

image

image

image

Changelog

🆑stylemistake,SplinterGP,mokulus
code: Treat DreamMaker warnings as errors in CI
refactor: Performance of core tgui components was improved (Button, Icon, Flex, Stack). UI should feel a tiny bit faster.
/:cl:

stylemistake and others added 9 commits January 24, 2022 22:59
**Upgrades:**

- Yarn 3.0
- TypeScript 4.3
- Sass 1.37
  - Required some refactoring of `/` into `math.div()` in CSS

**Dependency removals:**

- Removed ESM package, see: standard-things/esm#902

I initially thought it was impossible to stop relying on this package, but fortunately, ES module support in Node 12+ now comes standard and I only had to convert the very few external module imports to `require()` (because Yarn PnP).

I also moved `logging.js` directly into `tgui-dev-server` package, because that's where it is used. One less internal dependency.

**Sidegrades:**

- Removed creation of a common tgui chunk, because in practice it creates unnecessary complexity (devs sometimes get a white screen due to this chunk being invalid) and doesn't really save that much data on CDN, and **definitely** doesn't make tgui load faster.

I think that is all. I tested it a bit and everything seemingly works.
Added an option to tools/build/build to treat DreamMaker warnings as errors. Enabled this option only for Windows Build (tools/ci/build.ps1).

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
* Juke Build 0.9.0

* Fix a small bug with build.js

* Distill cmds

* Return sonar

* Revert those build.cmd changes

* Some improvements

* Treat all sonar warnings as errors because they should fail the sonar target

* Do not clean up bootstrap cache because it locks up on removing it
Added a package that allows precisely benchmarking tgui components on IE11 without having the game launched.

It has a convenient syntax for writing tests, just create a file packages/tgui-bench/tests/*.test.tsx, and export a function which you want to benchmark

Performance improvements
As part of this PR, I have also improved the raw performance of some tgui components:

Button component - 1.8x faster
Flex component - 1.1x faster
Stack component - 1.3x faster
This improves performance of heavy UIs by a tiny bit.
A light version of the revert to help builds work on TGS3.

(TGS3 builds were locking up on live, causing servers to be unable to testmerge or update things because of something to do with the recent juke build. I don't into the build tool, otherwise I'd be more clear)
* tgui tasks

* solve linter?
@github-actions github-actions bot added TGUI-Changes Contains changes to TGUI. Make sure its up to date with TGUI 4.0 Tools labels Jan 25, 2022
@Crossedfall Crossedfall changed the title Tgui dev TGUI maintenance chores and juke upgrades Jan 25, 2022
@Crossedfall Crossedfall marked this pull request as ready for review January 25, 2022 13:52
@Crossedfall Crossedfall added Test Merged This PR is currently in rotation and removed Needs Testmerge labels Jan 25, 2022
@Crossedfall
Copy link
Member Author

Crossedfall commented Jan 25, 2022

Passed bare-minimum testing on Staging. Queued for an extended TM on Sage.

Copy link
Member

@KubeRoot KubeRoot left a comment

Choose a reason for hiding this comment

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

Looks good, at least the stuff that doesn't go over my head, except for one nitpick.

tgui/packages/tgui/interfaces/TechFab.js Show resolved Hide resolved
@KubeRoot KubeRoot merged commit 95060e4 into BeeStation:master Jan 28, 2022
@Crossedfall Crossedfall deleted the tgui-dev branch January 28, 2022 19:05
@Crossedfall Crossedfall removed the Test Merged This PR is currently in rotation label Jan 28, 2022
nednaZ pushed a commit to Monkestation/MonkeStation that referenced this pull request Feb 1, 2022
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
Co-authored-by: mokulus <36231852+mokulus@users.noreply.github.com>
Co-authored-by: SplinterGP <isseisanloverias@gmail.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
nednaZ pushed a commit to Monkestation/MonkeStation that referenced this pull request Feb 1, 2022
nednaZ pushed a commit to Monkestation/MonkeStation that referenced this pull request Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Improvement GitHub Refactor TGUI-Changes Contains changes to TGUI. Make sure its up to date with TGUI 4.0 Tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants