mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
[MIRROR] Exit on DreamMaker warnings in CI Windows build + Tools reset (#7784)
* Exit on DreamMaker warnings in CI Windows build * a * AAAAAAAAAAAAAAAAA * AAAAAA * F * a * Update .github/gbp.toml * Update .github/gbp.toml * Update .github/gbp.toml * Update .github/gbp.toml Co-authored-by: mokulus <36231852+mokulus@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -41,3 +41,4 @@
|
||||
|
||||
## Force tab indents on dm files
|
||||
*.dm whitespace=indent-with-non-tab
|
||||
|
||||
|
||||
23
.github/workflows/ci_suite.yml
vendored
23
.github/workflows/ci_suite.yml
vendored
@@ -22,7 +22,11 @@ jobs:
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: tgui/.yarn/cache
|
||||
key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}
|
||||
key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}-${{ hashFiles('tgui/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ secrets.CACHE_PURGE_KEY }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install Tools
|
||||
run: |
|
||||
pip3 install setuptools
|
||||
@@ -35,7 +39,7 @@ jobs:
|
||||
bash tools/ci/check_changelogs.sh
|
||||
bash tools/ci/check_grep.sh
|
||||
bash tools/ci/check_misc.sh
|
||||
tools/build/build --ci lint
|
||||
tools/build/build --ci lint tgui-test
|
||||
tools/bootstrap/python -m dmi.test
|
||||
tools/bootstrap/python -m mapmerge2.dmm_test
|
||||
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
|
||||
@@ -81,11 +85,6 @@ jobs:
|
||||
with:
|
||||
path: ~/BYOND
|
||||
key: ${{ runner.os }}-byond-${{ secrets.CACHE_PURGE_KEY }}
|
||||
- name: Restore Yarn Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: tgui/.yarn/cache
|
||||
key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}
|
||||
- name: Setup database
|
||||
run: |
|
||||
sudo systemctl start mysql
|
||||
@@ -103,7 +102,7 @@ jobs:
|
||||
run: |
|
||||
bash tools/ci/install_byond.sh
|
||||
source $HOME/BYOND/byond/bin/byondsetup
|
||||
tools/build/build --ci -DCIBUILDING
|
||||
tools/build/build --ci dm -DCIBUILDING
|
||||
bash tools/ci/run_server.sh
|
||||
|
||||
test_windows:
|
||||
@@ -112,11 +111,15 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Restore Yarn Cache
|
||||
- name: Restore Yarn cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: tgui/.yarn/cache
|
||||
key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}
|
||||
key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }}-${{ hashFiles('tgui/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ secrets.CACHE_PURGE_KEY }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Compile
|
||||
run: pwsh tools/ci/build.ps1
|
||||
env:
|
||||
|
||||
20
.github/workflows/compile_changelogs.yml
vendored
20
.github/workflows/compile_changelogs.yml
vendored
@@ -9,36 +9,36 @@ jobs:
|
||||
name: "Compile changelogs"
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: "Check for CHANGELOG_ENABLER secret and pass true to output if it exists to be checked by later steps"
|
||||
- name: "Check for ACTION_ENABLER secret and pass true to output if it exists to be checked by later steps"
|
||||
id: value_holder
|
||||
env:
|
||||
CHANGELOG_ENABLER: ${{ secrets.CHANGELOG_ENABLER }}
|
||||
ENABLER_SECRET: ${{ secrets.ACTION_ENABLER }}
|
||||
run: |
|
||||
unset SECRET_EXISTS
|
||||
if [ -n $CHANGELOG_ENABLER ]; then SECRET_EXISTS='true' ; fi
|
||||
echo ::set-output name=CL_ENABLED::${SECRET_EXISTS}
|
||||
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi
|
||||
echo "::set-output name=ACTIONS_ENABLED::$SECRET_EXISTS"
|
||||
- name: "Setup python"
|
||||
if: steps.value_holder.outputs.CL_ENABLED
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: "Install deps"
|
||||
if: steps.value_holder.outputs.CL_ENABLED
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install pyyaml
|
||||
sudo apt-get install dos2unix
|
||||
- name: "Checkout"
|
||||
if: steps.value_holder.outputs.CL_ENABLED
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 25
|
||||
- name: "Compile"
|
||||
if: steps.value_holder.outputs.CL_ENABLED
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
run: |
|
||||
python tools/ss13_genchangelog.py html/changelogs
|
||||
- name: Commit
|
||||
if: steps.value_holder.outputs.CL_ENABLED
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "Changelogs"
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
git add html/changelogs
|
||||
git commit -m "Automatic changelog compile [ci skip]" -a || true
|
||||
- name: "Push"
|
||||
if: steps.value_holder.outputs.CL_ENABLED
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
13
.github/workflows/gbp.yml
vendored
13
.github/workflows/gbp.yml
vendored
@@ -6,13 +6,24 @@ jobs:
|
||||
gbp:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Check for ACTION_ENABLER secret and pass true to output if it exists to be checked by later steps"
|
||||
id: value_holder
|
||||
env:
|
||||
ENABLER_SECRET: ${{ secrets.ACTION_ENABLER }}
|
||||
run: |
|
||||
unset SECRET_EXISTS
|
||||
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi
|
||||
echo "::set-output name=ACTIONS_ENABLED::$SECRET_EXISTS"
|
||||
- name: Checkout
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup git
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
run: |
|
||||
git config --global user.name "gbp-action"
|
||||
git config --global user.email "<>"
|
||||
- name: Checkout alternate branch
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "gbp-balances" # The branch name
|
||||
@@ -20,8 +31,10 @@ jobs:
|
||||
# This is to ensure we keep the gbp.toml from master
|
||||
# without having to update our separate branch.
|
||||
- name: Copy configuration
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
run: cp ./.github/gbp.toml ./gbp-balances/.github/gbp.toml
|
||||
- name: GBP action
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: tgstation/gbp-action@master
|
||||
with:
|
||||
branch: "gbp-balances"
|
||||
|
||||
13
.github/workflows/gbp_collect.yml
vendored
13
.github/workflows/gbp_collect.yml
vendored
@@ -8,13 +8,24 @@ jobs:
|
||||
gbp_collection:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Check for ACTION_ENABLER secret and pass true to output if it exists to be checked by later steps"
|
||||
id: value_holder
|
||||
env:
|
||||
ENABLER_SECRET: ${{ secrets.ACTION_ENABLER }}
|
||||
run: |
|
||||
unset SECRET_EXISTS
|
||||
if [ -n "$ENABLER_SECRET" ]; then SECRET_EXISTS=true ; fi
|
||||
echo "::set-output name=ACTIONS_ENABLED::$SECRET_EXISTS"
|
||||
- name: Checkout
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup git
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
- name: Checkout alternate branch
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "gbp-balances" # The branch name
|
||||
@@ -22,8 +33,10 @@ jobs:
|
||||
# This is to ensure we keep the gbp.toml from master
|
||||
# without having to update our separate branch.
|
||||
- name: Copy configuration
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
run: cp ./.github/gbp.toml ./gbp-balances/.github/gbp.toml
|
||||
- name: GBP action
|
||||
if: steps.value_holder.outputs.ACTIONS_ENABLED
|
||||
uses: Mothblocks/gbp-action@collate-changes
|
||||
with:
|
||||
collect: "true"
|
||||
|
||||
4
.github/workflows/generate_documentation.yml
vendored
4
.github/workflows/generate_documentation.yml
vendored
@@ -12,8 +12,8 @@ jobs:
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: $HOME/SpacemanDMM
|
||||
key: ${{ runner.os }}-spacemandmm
|
||||
path: ~/SpacemanDMM
|
||||
key: ${{ runner.os }}-spacemandmm-${{ secrets.CACHE_PURGE_KEY }}
|
||||
- name: Install SpacemanDMM
|
||||
run: bash tools/ci/install_spaceman_dmm.sh dmdoc
|
||||
- name: Generate documentation
|
||||
|
||||
19
.github/workflows/pr_emoji.yml
vendored
Normal file
19
.github/workflows/pr_emoji.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: PR emoji stripper
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
title_and_changelog:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: Wayland-Smithy/emoji-stripper-action@8f4c2fe9748bb9b02f105be4e72a1a42b0f34d84
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
title: true
|
||||
body: true
|
||||
body-after: ":cl:"
|
||||
body-before: "/:cl:"
|
||||
2
BUILD.cmd
Normal file
2
BUILD.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\tools\build\build.bat" --wait-on-error build %*
|
||||
@@ -82,4 +82,4 @@ COPY --from=rust_g /rust_g/target/i686-unknown-linux-gnu/release/librust_g.so ./
|
||||
|
||||
VOLUME [ "/tgstation/config", "/tgstation/data" ]
|
||||
ENTRYPOINT [ "DreamDaemon", "tgstation.dmb", "-port", "1337", "-trusted", "-close", "-verbose" ]
|
||||
EXPOSE 1337
|
||||
EXPOSE 1337
|
||||
|
||||
2
bin/build.cmd
Normal file
2
bin/build.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\..\tools\build\build.bat" --wait-on-error build %*
|
||||
2
bin/clean.cmd
Normal file
2
bin/clean.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\..\tools\build\build.bat" --wait-on-error clean-all %*
|
||||
2
bin/server.cmd
Normal file
2
bin/server.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\..\tools\build\build.bat" --wait-on-error server %*
|
||||
2
bin/test.cmd
Normal file
2
bin/test.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\..\tools\build\build.bat" --wait-on-error dm-test %*
|
||||
2
bin/tgui-build.cmd
Normal file
2
bin/tgui-build.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\..\tools\build\build.bat" --wait-on-error tgui tgui-lint tgui-test %*
|
||||
2
bin/tgui-dev.cmd
Normal file
2
bin/tgui-dev.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\..\tools\build\build.bat" --wait-on-error tgui-dev %*
|
||||
2
bin/tgui-sonar.cmd
Normal file
2
bin/tgui-sonar.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
call "%~dp0\..\tools\build\build.bat" --wait-on-error tgui-sonar %*
|
||||
@@ -8,6 +8,3 @@ end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = 80
|
||||
|
||||
7
tgui/.gitattributes
vendored
7
tgui/.gitattributes
vendored
@@ -13,10 +13,9 @@
|
||||
*.md text eol=lf
|
||||
*.bat text eol=lf
|
||||
yarn.lock text eol=lf
|
||||
bin/tgui text eol=lf
|
||||
|
||||
## Treat bundles as binary and ignore them during conflicts
|
||||
*.bundle.* binary merge=tgui-merge-bundle
|
||||
*.chunk.* binary merge=tgui-merge-bundle
|
||||
## Treat bundles as binary
|
||||
*.bundle.* binary
|
||||
*.chunk.* binary
|
||||
.yarn/releases/**/* binary
|
||||
.yarn/plugins/**/* binary
|
||||
|
||||
1
tgui/.gitignore
vendored
1
tgui/.gitignore
vendored
@@ -16,6 +16,7 @@ package-lock.json
|
||||
/public/.tmp/**/*
|
||||
/public/**/*
|
||||
!/public/*.html
|
||||
/coverage
|
||||
|
||||
## Previously ignored locations that are kept to avoid confusing git
|
||||
## while transitioning to a new project structure.
|
||||
|
||||
192
tgui/README.md
192
tgui/README.md
@@ -4,124 +4,98 @@
|
||||
|
||||
tgui is a robust user interface framework of /tg/station.
|
||||
|
||||
tgui is very different from most UIs you will encounter in BYOND programming.
|
||||
It is heavily reliant on Javascript and web technologies as opposed to DM.
|
||||
If you are familiar with NanoUI (a library which can be found on almost
|
||||
every other SS13 codebase), tgui should be fairly easy to pick up.
|
||||
tgui is very different from most UIs you will encounter in BYOND programming. It is heavily reliant on Javascript and web technologies as opposed to DM. If you are familiar with NanoUI (a library which can be found on almost every other SS13 codebase), tgui should be fairly easy to pick up.
|
||||
|
||||
## Learn tgui
|
||||
|
||||
People come to tgui from different backgrounds and with different
|
||||
learning styles. Whether you prefer a more theoretical or a practical
|
||||
approach, we hope you’ll find this section helpful.
|
||||
People come to tgui from different backgrounds and with different learning styles. Whether you prefer a more theoretical or a practical approach, we hope you’ll find this section helpful.
|
||||
|
||||
### Practical Tutorial
|
||||
|
||||
If you are completely new to frontend and prefer to **learn by doing**,
|
||||
start with our [practical tutorial](docs/tutorial-and-examples.md).
|
||||
If you are completely new to frontend and prefer to **learn by doing**, start with our [practical tutorial](docs/tutorial-and-examples.md).
|
||||
|
||||
### Guides
|
||||
|
||||
This project uses **Inferno** - a very fast UI rendering engine with a similar
|
||||
API to React. Take your time to read these guides:
|
||||
This project uses **Inferno** - a very fast UI rendering engine with a similar API to React. Take your time to read these guides:
|
||||
|
||||
- [React guide](https://reactjs.org/docs/hello-world.html)
|
||||
- [Inferno documentation](https://infernojs.org/docs/guides/components) -
|
||||
highlights differences with React.
|
||||
- [Inferno documentation](https://infernojs.org/docs/guides/components) - highlights differences with React.
|
||||
|
||||
If you were already familiar with an older, Ractive-based tgui, and want
|
||||
to translate concepts between old and new tgui, read this
|
||||
[interface conversion guide](docs/converting-old-tgui-interfaces.md).
|
||||
If you were already familiar with an older, Ractive-based tgui, and want to translate concepts between old and new tgui, read this [interface conversion guide](docs/converting-old-tgui-interfaces.md).
|
||||
|
||||
## Pre-requisites
|
||||
|
||||
You will need these programs to start developing in tgui:
|
||||
If you are using the tooling provided in this repo, everything is included! Feel free to skip this step.
|
||||
|
||||
- [Node v12.18.3+](https://nodejs.org/en/download/)
|
||||
- [Yarn v1.22.4+](https://yarnpkg.com/getting-started/install) (optional)
|
||||
- [Git Bash](https://git-scm.com/downloads)
|
||||
or [MSys2](https://www.msys2.org/) (optional)
|
||||
However, if you want finer control over the installation or build process, you will need these:
|
||||
|
||||
**DO NOT install Chocolatey if Node installer asks you to!**
|
||||
- [Node v12.20+](https://nodejs.org/en/download/)
|
||||
- **DO NOT install Chocolatey if Node installer asks you to!**
|
||||
- [Yarn v1.22.4+](https://yarnpkg.com/getting-started/install)
|
||||
- You only need to run `npm install -g yarn`.
|
||||
|
||||
## Usage
|
||||
|
||||
**For Git Bash, MSys2, WSL, Linux or macOS users:**
|
||||
**Via provided cmd scripts (Windows)**:
|
||||
|
||||
Change your directory to `tgui`.
|
||||
- `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.
|
||||
|
||||
Run `bin/tgui --install-git-hooks` to install merge drivers which will
|
||||
assist you in conflict resolution when rebasing your branches. Only has
|
||||
to be done once.
|
||||
> 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`.
|
||||
|
||||
Run `bin/tgui` with any of the options listed below.
|
||||
**Via Juke Build (cross-platform)**:
|
||||
|
||||
**For Windows CMD or PowerShell users:**
|
||||
- `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-clean` - Clean up tgui folder.
|
||||
|
||||
If you haven't opened the console already, you can do that by holding
|
||||
Shift and right clicking on the `tgui` folder, then pressing
|
||||
either `Open command window here` or `Open PowerShell window here`.
|
||||
> With Juke Build, you can run multiple targets together, e.g.:
|
||||
> ```
|
||||
> tools/build/build tgui tgui-lint tgui-tsc tgui-test
|
||||
> ```
|
||||
|
||||
Run `.\bin\tgui.bat` with any of the options listed below.
|
||||
**Via Yarn (cross-platform)**:
|
||||
|
||||
> If using PowerShell, you will receive errors if trying to run
|
||||
> `.\bin\tgui.ps1`, because default Windows policy does not allow direct
|
||||
> execution of PS1 scripts. Run `.\bin\tgui.bat` instead.
|
||||
Run `yarn install` once to install tgui dependencies.
|
||||
|
||||
**Available commands:**
|
||||
- `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.
|
||||
|
||||
- `bin/tgui` - Build the project in production mode.
|
||||
- `bin/tgui --dev` - Launch a development server.
|
||||
- tgui development server provides you with incremental compilation,
|
||||
hot module replacement and logging facilities in all running instances
|
||||
of tgui. In short, this means that you will instantly see changes in the
|
||||
game as you code it. Very useful, highly recommended.
|
||||
- In order to use it, you should start the game server first, connect to it
|
||||
and wait until the world has been properly loaded and you are no longer
|
||||
in the lobby. Start tgui dev server, and once it has finished building,
|
||||
press F5 on any tgui window. You'll know that it's hooked correctly if
|
||||
you see a green bug icon in titlebar and data gets dumped to the console.
|
||||
- `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 --lint` - Show problems with the code.
|
||||
- `bin/tgui --fix` - Auto-fix problems with the code.
|
||||
- `bin/tgui --test` - Run tests.
|
||||
- `bin/tgui --analyze` - Run a bundle analyzer.
|
||||
- `bin/tgui --clean` - Clean up project repo.
|
||||
- `bin/tgui [webpack options]` - Build the project with custom webpack
|
||||
options.
|
||||
## Important memo
|
||||
|
||||
**For virgins:**
|
||||
|
||||
You can double-click these batch files to achieve the same thing:
|
||||
|
||||
- `bin\tgui.bat` - Build the project in production mode.
|
||||
- `bin\tgui-dev-server.bat` - Launch a development server.
|
||||
|
||||
> Remember to always run a full build before submitting a PR. It creates
|
||||
> a compressed javascript bundle which is then referenced from DM code.
|
||||
> We prefer to keep it version controlled, so that people could build the
|
||||
> game just by using Dream Maker.
|
||||
Remember to always run a full build of tgui before submitting a PR, because it comes with the full suite of CI checks, and runs much faster on your computer than on GitHub servers. It will save you some time and possibly a few broken commits! Address the issues that are reported by the tooling as much as possible, because maintainers will beat you with a ruler and force you to address them anyway (unless it's a false positive or something unfixable).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Development server is crashing**
|
||||
|
||||
Make sure path to your working directory does not contain spaces or special
|
||||
unicode characters. If so, move codebase to a location which does not contain
|
||||
spaces or unicode characters.
|
||||
Make sure path to your working directory does not contain spaces, special unicode characters, exclamation marks or any other special symbols. If so, move codebase to a location which does not contain these characters.
|
||||
|
||||
This is a known issue with Yarn Berry, and fix is going to happen someday.
|
||||
This is a known issue with Yarn (and some other tools, like Webpack), and fix is going to happen eventually.
|
||||
|
||||
**Development server doesn't find my BYOND cache!**
|
||||
|
||||
This happens if your Documents folder in Windows has a custom location, for
|
||||
example in `E:\Libraries\Documents`. Development server tries its best to find
|
||||
this non-standard location (searches for a Windows Registry key), but it can
|
||||
fail. You have to run the dev server with an additional environmental
|
||||
variable, with a full path to BYOND cache.
|
||||
This happens if your Documents folder in Windows has a custom location, for example in `E:\Libraries\Documents`. Development server tries its best to find this non-standard location (searches for a Windows Registry key), but it can fail. You have to run the dev server with an additional environmental variable, with a full path to BYOND cache.
|
||||
|
||||
```
|
||||
BYOND_CACHE="E:/Libraries/Documents/BYOND/cache"
|
||||
@@ -131,63 +105,36 @@ BYOND_CACHE="E:/Libraries/Documents/BYOND/cache"
|
||||
|
||||
> Example: `No template for dependency: PureExpressionDependency`
|
||||
|
||||
Webpack stores its cache on disk since tgui 4.3, and it is very sensitive
|
||||
to build configuration. So if you update webpack, or share the same cache
|
||||
directory between development and production build, it will start
|
||||
hallucinating.
|
||||
Webpack stores its cache on disk since tgui 4.3, and it is very sensitive to build configuration. So if you update webpack, or share the same cache directory between development and production build, it will start hallucinating.
|
||||
|
||||
To fix this kind of problem, run `bin/tgui --clean` and try again.
|
||||
|
||||
## Developer Tools
|
||||
|
||||
When developing with `tgui-dev-server`, you will have access to certain
|
||||
development only features.
|
||||
When developing with `tgui-dev-server`, you will have access to certain development only features.
|
||||
|
||||
**Debug Logs.**
|
||||
When running server via `bin/tgui --dev --debug`, server will print debug
|
||||
logs and time spent on rendering. Use this information to optimize your
|
||||
code, and try to keep re-renders below 16ms.
|
||||
**Debug Logs**. When running server via `bin/tgui --dev --debug`, server will print debug logs and time spent on rendering. Use this information to optimize your code, and try to keep re-renders below 16ms.
|
||||
|
||||
**Kitchen Sink.**
|
||||
Press `F12` to open the KitchenSink interface. This interface is a
|
||||
playground to test various tgui components.
|
||||
**Kitchen Sink**. Press `F12` to open the KitchenSink interface. This interface is a playground to test various tgui components.
|
||||
|
||||
**Layout Debugger.**
|
||||
Press `F11` to toggle the *layout debugger*. It will show outlines of
|
||||
all tgui elements, which makes it easy to understand how everything comes
|
||||
together, and can reveal certain layout bugs which are not normally visible.
|
||||
**Layout Debugger**. Press `F11` to toggle the *layout debugger*. It will show outlines of all tgui elements, which makes it easy to understand how everything comes together, and can reveal certain layout bugs which are not normally visible.
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `/packages` - Each folder here represents a self-contained Node module.
|
||||
- `/packages/common` - Helper functions
|
||||
- `/packages/common` - Helper functions that are used throughout all packages.
|
||||
- `/packages/tgui/index.js` - Application entry point.
|
||||
- `/packages/tgui/components` - Basic UI building blocks.
|
||||
- `/packages/tgui/interfaces` - Actual in-game interfaces.
|
||||
Interface takes data via the `state` prop and outputs an html-like stucture,
|
||||
which you can build using existing UI components.
|
||||
- `/packages/tgui/layouts` - Root level UI components, that affect the final
|
||||
look and feel of the browser window. They usually hold various window
|
||||
elements, like the titlebar and resize handlers, and control the UI theme.
|
||||
- `/packages/tgui/routes.js` - This is where tgui decides which interface to
|
||||
pull and render.
|
||||
- `/packages/tgui/layout.js` - A root-level component, holding the
|
||||
window elements, like the titlebar, buttons, resize handlers. Calls
|
||||
`routes.js` to decide which component to render.
|
||||
- `/packages/tgui/layouts` - Root level UI components, that affect the final look and feel of the browser window. These hold various window elements, like the titlebar and resize handlers, and control the UI theme.
|
||||
- `/packages/tgui/routes.js` - This is where tgui decides which interface to pull and render.
|
||||
- `/packages/tgui/styles/main.scss` - CSS entry point.
|
||||
- `/packages/tgui/styles/functions.scss` - Useful SASS functions.
|
||||
Stuff like `lighten`, `darken`, `luminance` are defined here.
|
||||
- `/packages/tgui/styles/atomic` - Atomic CSS classes.
|
||||
These are very simple, tiny, reusable CSS classes which you can use and
|
||||
combine to change appearance of your elements. Keep them small.
|
||||
- `/packages/tgui/styles/components` - CSS classes which are used
|
||||
in UI components. These stylesheets closely follow the
|
||||
[BEM](https://en.bem.info/methodology/) methodology.
|
||||
- `/packages/tgui/styles/interfaces` - Custom stylesheets for your interfaces.
|
||||
Add stylesheets here if you really need a fine control over your UI styles.
|
||||
- `/packages/tgui/styles/functions.scss` - Useful SASS functions. Stuff like `lighten`, `darken`, `luminance` are defined here.
|
||||
- `/packages/tgui/styles/atomic` - Atomic CSS classes. These are very simple, tiny, reusable CSS classes which you can use and combine to change appearance of your elements. Keep them small.
|
||||
- `/packages/tgui/styles/components` - CSS classes which are used in UI components. These stylesheets closely follow the [BEM](https://en.bem.info/methodology/) methodology.
|
||||
- `/packages/tgui/styles/interfaces` - Custom stylesheets for your interfaces. Add stylesheets here if you really need a fine control over your UI styles.
|
||||
- `/packages/tgui/styles/layouts` - Layout-related styles.
|
||||
- `/packages/tgui/styles/themes` - Contains all the various themes you can
|
||||
use in tgui. Each theme must be registered in `webpack.config.js` file.
|
||||
- `/packages/tgui/styles/themes` - Contains themes that you can use in tgui. Each theme must be registered in `/packages/tgui/index.js` file.
|
||||
|
||||
## Component Reference
|
||||
|
||||
@@ -195,11 +142,8 @@ See: [Component Reference](docs/component-reference.md).
|
||||
|
||||
## License
|
||||
|
||||
Source code is covered by /tg/station's parent license - **AGPL-3.0**
|
||||
(see the main [README](../README.md)), unless otherwise indicated.
|
||||
Source code is covered by /tg/station's parent license - **AGPL-3.0** (see the main [README](../README.md)), unless otherwise indicated.
|
||||
|
||||
Some files are annotated with a copyright header, which explicitly states
|
||||
the copyright holder and license of the file. Most of the core tgui
|
||||
source code is available under the **MIT** license.
|
||||
Some files are annotated with a copyright header, which explicitly states the copyright holder and license of the file. Most of the core tgui source code is available under the **MIT** license.
|
||||
|
||||
The Authors retain all copyright to their respective work here submitted.
|
||||
|
||||
@@ -5,6 +5,17 @@
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"tgui:build": "webpack",
|
||||
"tgui:analyze": "webpack --analyze",
|
||||
"tgui:dev": "node --experimental-modules packages/tgui-dev-server/index.js",
|
||||
"tgui:lint": "eslint packages --ext .js,.cjs,.ts,.tsx",
|
||||
"tgui:sonar": "eslint packages --ext .js,.cjs,.ts,.tsx -c .eslintrc-sonar.yml",
|
||||
"tgui:tsc": "tsc",
|
||||
"tgui:test": "jest --watch",
|
||||
"tgui:test-simple": "CI=true jest --color",
|
||||
"tgui:test-ci": "CI=true jest --color --collect-coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.15.0",
|
||||
"@babel/eslint-parser": "^7.15.0",
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
"private": true,
|
||||
"name": "tgfont",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"tgfont:build": "node mkdist.cjs && fantasticon --config config.cjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"fantasticon": "^1.2.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node mkdist.cjs && fantasticon --config config.cjs"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ const TOOLS = [
|
||||
name: 'Destroy',
|
||||
bitmask: 4,
|
||||
},
|
||||
{
|
||||
name: 'Reprogram',
|
||||
bitmask: 8,
|
||||
},
|
||||
];
|
||||
|
||||
const SelectionSection = (props, context) => {
|
||||
|
||||
@@ -25,9 +25,9 @@ const createStats = verbose => ({
|
||||
});
|
||||
|
||||
module.exports = (env = {}, argv) => {
|
||||
const mode = argv.mode === 'production' ? 'production' : 'development';
|
||||
const mode = argv.mode || 'production';
|
||||
const config = {
|
||||
mode,
|
||||
mode: mode === 'production' ? 'production' : 'development',
|
||||
context: path.resolve(__dirname),
|
||||
target: ['web', 'es3', 'browserslist:ie 8'],
|
||||
entry: {
|
||||
@@ -113,7 +113,7 @@ module.exports = (env = {}, argv) => {
|
||||
stats: createStats(true),
|
||||
plugins: [
|
||||
new webpack.EnvironmentPlugin({
|
||||
NODE_ENV: env.NODE_ENV || argv.mode || 'development',
|
||||
NODE_ENV: env.NODE_ENV || mode,
|
||||
WEBPACK_HMR_ENABLED: env.WEBPACK_HMR_ENABLED || argv.hot || false,
|
||||
DEV_SERVER_IP: env.DEV_SERVER_IP || null,
|
||||
}),
|
||||
@@ -134,7 +134,7 @@ module.exports = (env = {}, argv) => {
|
||||
}
|
||||
|
||||
// Production build specific options
|
||||
if (argv.mode === 'production') {
|
||||
if (mode === 'production') {
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
config.optimization.minimizer = [
|
||||
new TerserPlugin({
|
||||
@@ -151,7 +151,7 @@ module.exports = (env = {}, argv) => {
|
||||
}
|
||||
|
||||
// Development build specific options
|
||||
if (argv.mode !== 'production') {
|
||||
if (mode !== 'production') {
|
||||
config.devtool = 'cheap-module-source-map';
|
||||
}
|
||||
|
||||
|
||||
38
tools/UpdatePaths/toxins_to_plasma.txt
Normal file
38
tools/UpdatePaths/toxins_to_plasma.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
/obj/machinery/airlock_sensor/incinerator_toxmix : /obj/machinery/airlock_sensor/incinerator_ordmix
|
||||
/obj/machinery/button/door/incinerator_vent_toxmix : /obj/machinery/button/door/incinerator_vent_ordmix
|
||||
/obj/machinery/button/ignition/incinerator/toxmix : /obj/machinery/button/ignition/incinerator/ordmix
|
||||
/obj/machinery/camera/preset/toxins : /obj/machinery/camera/preset/ordnance
|
||||
/obj/machinery/air_sensor/atmos/toxins_mixing_tank : /obj/machinery/air_sensor/atmos/ordnance_mixing_tank
|
||||
/obj/machinery/computer/atmos_control/toxinsmix : /obj/machinery/computer/atmos_control/ordnancemix
|
||||
/obj/machinery/computer/security/telescreen/toxins : /obj/machinery/computer/security/telescreen/ordnance
|
||||
/obj/machinery/computer/pod/old/mass_driver_controller/toxinsdriver : /obj/machinery/computer/pod/old/mass_driver_controller/ordnancedriver
|
||||
/obj/machinery/computer/pod/old/mass_driver_controller/toxinsdriver/longrange : /obj/machinery/computer/pod/old/mass_driver_controller/ordnancedriver/longrange
|
||||
/obj/machinery/door/airlock/research/glass/incinerator/toxmix_interior : /obj/machinery/door/airlock/research/glass/incinerator/ordmix_interior
|
||||
/obj/machinery/door/airlock/research/glass/incinerator/toxmix_exterior : /obj/machinery/door/airlock/research/glass/incinerator/ordmix_exterior
|
||||
/obj/machinery/door/poddoor/incinerator_toxmix : /obj/machinery/door/poddoor/incinerator_ordmix
|
||||
/obj/machinery/door/poddoor/massdriver_toxins : /obj/machinery/door/poddoor/massdriver_ordnance
|
||||
/obj/machinery/embedded_controller/radio/airlock_controller/incinerator_toxmix : /obj/machinery/embedded_controller/radio/airlock_controller/incinerator_ordmix
|
||||
/obj/machinery/igniter/incinerator_toxmix : /obj/machinery/igniter/incinerator_ordmix
|
||||
/obj/machinery/sparker/toxmix : /obj/machinery/sparker/ordmix
|
||||
/obj/machinery/mass_driver/toxins : /obj/machinery/mass_driver/ordnance
|
||||
/obj/item/circuitboard/computer/atmos_control/toxinsmix : /obj/item/circuitboard/computer/atmos_control/ordnancemix
|
||||
/obj/item/circuitboard/computer/atmos_control/tank/toxin_tank : /obj/item/circuitboard/computer/atmos_control/tank/plasma_tank
|
||||
/obj/machinery/computer/atmos_control/tank/toxin_tank : /obj/machinery/computer/atmos_control/tank/plasma_tank
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_toxmix : /obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_ordmix
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/atmos/toxins_mixing_input : /obj/machinery/atmospherics/components/unary/outlet_injector/atmos/ordnance_mixing_input
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/siphon/atmos/toxins_mixing_output : /obj/machinery/atmospherics/components/unary/vent_pump/siphon/atmos/ordnance_mixing_output
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/toxins : /obj/machinery/portable_atmospherics/canister/plasma
|
||||
/obj/machinery/air_sensor/atmos/toxin_tank : /obj/machinery/air_sensor/atmos/plasma_tank
|
||||
/obj/machinery/computer/atmos_control/tank/toxin_tank : /obj/machinery/computer/atmos_control/tank/plasma_tank
|
||||
/obj/machinery/atmospherics/components/tank/toxins : /obj/machinery/atmospherics/components/tank/plasma
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/atmos/toxin_input : /obj/machinery/atmospherics/components/unary/outlet_injector/atmos/plasma_input
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/siphon/atmos/toxin_output : /obj/machinery/atmospherics/components/unary/vent_pump/siphon/atmos/plasma_output
|
||||
/obj/machinery/atmospherics/miner/toxins : /obj/machinery/atmospherics/miner/plasma
|
||||
|
||||
/obj/item/storage/backpack/satchel/tox : /obj/item/storage/backpack/satchel/science
|
||||
/obj/item/cartridge/signal/toxins : /obj/item/cartridge/signal/ordnance
|
||||
/obj/item/pda/toxins : /obj/item/pda/science
|
||||
/obj/item/book/manual/wiki/toxins : /obj/item/book/manual/wiki/ordnance
|
||||
/obj/item/storage/backpack/duffelbag/toxins : /obj/item/storage/backpack/duffelbag/science
|
||||
/obj/item/paper/fluff/jobs/toxins/chemical_info : /obj/item/paper/fluff/jobs/ordnance/chemical_info
|
||||
@@ -19,7 +19,7 @@ if %errorlevel% == 0 (
|
||||
call node.exe %*
|
||||
goto exit_with_last_error_level
|
||||
)
|
||||
echo "build.bat: Failed to bootstrap Node!"
|
||||
echo "node.bat: Failed to bootstrap Node!"
|
||||
%COMSPEC% /c exit 1
|
||||
|
||||
:exit_with_last_error_level
|
||||
|
||||
@@ -8,6 +8,3 @@ end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = 80
|
||||
|
||||
@@ -23,12 +23,12 @@ tools/build/build --help
|
||||
|
||||
## Dependencies
|
||||
|
||||
- On Windows, `BUILD.bat` will automatically install a private (vendored) copy of Node.
|
||||
- On Windows, `build.bat` will automatically install a private (vendored) copy of Node.
|
||||
- On Linux, install Node using your package manager or from <https://nodejs.org/en/download/>.
|
||||
- On Linux , unless using tgs4 or later you will need to compile rust-g on the server and obtain a .so file, for instructions see https://github.com/tgstation/rust-g
|
||||
- On Linux, unless using tgs4 or later you will need to compile rust-g on the server and obtain a .so file, for instructions see https://github.com/tgstation/rust-g
|
||||
|
||||
## Why?
|
||||
|
||||
We used to include compiled versions of the tgui JavaScript code in the Git repository so that the project could be compiled using BYOND only. These pre-compiled files tended to have merge conflicts for no good reason. Using a build script lets us avoid this problem, while keeping builds convenient for people who are not modifying tgui.
|
||||
|
||||
This build script is based on [Juke Build](https://github.com/stylemistake/juke-build) - please follow the link and read the documentation for the project to understand how it works and how to contribute to this build script.
|
||||
This build script is based on [Juke Build](https://github.com/stylemistake/juke-build) - follow the link to read the documentation for the project and understand how it works and how to contribute.
|
||||
|
||||
@@ -4,19 +4,23 @@
|
||||
*
|
||||
* This script uses Juke Build, read the docs here:
|
||||
* https://github.com/stylemistake/juke-build
|
||||
*
|
||||
* @file
|
||||
* @copyright 2021 Aleksej Komarov
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import Juke from './juke/index.js';
|
||||
import { DreamDaemon, DreamMaker } from './lib/byond.js';
|
||||
import { yarn } from './lib/yarn.js';
|
||||
import Juke from './juke/index.js';
|
||||
|
||||
Juke.chdir('../..', import.meta.url);
|
||||
Juke.setup({ file: import.meta.url }).then((code) => process.exit(code));
|
||||
Juke.setup({ file: import.meta.url }).then((code) => {
|
||||
// We're using the currently available quirk in Juke Build, which
|
||||
// prevents it from exiting on Windows, to wait on errors.
|
||||
if (code !== 0 && process.argv.includes('--wait-on-error')) {
|
||||
Juke.logger.error('Please inspect the error and close the window.');
|
||||
return;
|
||||
}
|
||||
process.exit(code);
|
||||
});
|
||||
|
||||
const DME_NAME = 'tgstation';
|
||||
|
||||
@@ -30,8 +34,11 @@ export const PortParameter = new Juke.Parameter({
|
||||
alias: 'p',
|
||||
});
|
||||
|
||||
export const CiParameter = new Juke.Parameter({
|
||||
type: 'boolean',
|
||||
export const CiParameter = new Juke.Parameter({ type: 'boolean' });
|
||||
|
||||
export const WarningParameter = new Juke.Parameter({
|
||||
type: 'string[]',
|
||||
alias: 'W',
|
||||
});
|
||||
|
||||
export const DmMapsIncludeTarget = new Juke.Target({
|
||||
@@ -51,6 +58,7 @@ export const DmMapsIncludeTarget = new Juke.Target({
|
||||
});
|
||||
|
||||
export const DmTarget = new Juke.Target({
|
||||
parameters: [DefineParameter],
|
||||
dependsOn: ({ get }) => [
|
||||
get(DefineParameter).includes('ALL_MAPS') && DmMapsIncludeTarget,
|
||||
],
|
||||
@@ -68,30 +76,24 @@ export const DmTarget = new Juke.Target({
|
||||
`${DME_NAME}.dmb`,
|
||||
`${DME_NAME}.rsc`,
|
||||
],
|
||||
parameters: [DefineParameter],
|
||||
executes: async ({ get }) => {
|
||||
const defines = get(DefineParameter);
|
||||
if (defines.length > 0) {
|
||||
Juke.logger.info('Using defines:', defines.join(', '));
|
||||
}
|
||||
await DreamMaker(`${DME_NAME}.dme`, {
|
||||
defines: ['CBT', ...defines],
|
||||
defines: ['CBT', ...get(DefineParameter)],
|
||||
warningsAsErrors: get(WarningParameter).includes('error'),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const DmTestTarget = new Juke.Target({
|
||||
parameters: [DefineParameter],
|
||||
dependsOn: ({ get }) => [
|
||||
get(DefineParameter).includes('ALL_MAPS') && DmMapsIncludeTarget,
|
||||
],
|
||||
executes: async ({ get }) => {
|
||||
const defines = get(DefineParameter);
|
||||
if (defines.length > 0) {
|
||||
Juke.logger.info('Using defines:', defines.join(', '));
|
||||
}
|
||||
fs.copyFileSync(`${DME_NAME}.dme`, `${DME_NAME}.test.dme`);
|
||||
await DreamMaker(`${DME_NAME}.test.dme`, {
|
||||
defines: ['CBT', 'CIBUILDING', ...defines],
|
||||
defines: ['CBT', 'CIBUILDING', ...get(DefineParameter)],
|
||||
warningsAsErrors: get(WarningParameter).includes('error'),
|
||||
});
|
||||
Juke.rm('data/logs/ci', { recursive: true });
|
||||
await DreamDaemon(
|
||||
@@ -112,6 +114,7 @@ export const DmTestTarget = new Juke.Target({
|
||||
});
|
||||
|
||||
export const YarnTarget = new Juke.Target({
|
||||
parameters: [CiParameter],
|
||||
inputs: [
|
||||
'tgui/.yarn/+(cache|releases|plugins|sdks)/**/*',
|
||||
'tgui/**/package.json',
|
||||
@@ -120,9 +123,7 @@ export const YarnTarget = new Juke.Target({
|
||||
outputs: [
|
||||
'tgui/.yarn/install-target',
|
||||
],
|
||||
executes: async () => {
|
||||
await yarn('install');
|
||||
},
|
||||
executes: ({ get }) => yarn('install', get(CiParameter) && '--immutable'),
|
||||
});
|
||||
|
||||
export const TgFontTarget = new Juke.Target({
|
||||
@@ -137,9 +138,7 @@ export const TgFontTarget = new Juke.Target({
|
||||
'tgui/packages/tgfont/dist/tgfont.eot',
|
||||
'tgui/packages/tgfont/dist/tgfont.woff2',
|
||||
],
|
||||
executes: async () => {
|
||||
await yarn('workspace', 'tgfont', 'build');
|
||||
},
|
||||
executes: () => yarn('tgfont:build'),
|
||||
});
|
||||
|
||||
export const TguiTarget = new Juke.Target({
|
||||
@@ -156,52 +155,43 @@ export const TguiTarget = new Juke.Target({
|
||||
'tgui/public/tgui-panel.bundle.css',
|
||||
'tgui/public/tgui-panel.bundle.js',
|
||||
],
|
||||
executes: async () => {
|
||||
await yarn('webpack-cli', '--mode=production');
|
||||
},
|
||||
executes: () => yarn('tgui:build'),
|
||||
});
|
||||
|
||||
export const TguiEslintTarget = new Juke.Target({
|
||||
parameters: [CiParameter],
|
||||
dependsOn: [YarnTarget],
|
||||
executes: async ({ args }) => {
|
||||
await yarn(
|
||||
'eslint', 'packages',
|
||||
'--fix', '--ext', '.js,.cjs,.ts,.tsx',
|
||||
...args
|
||||
);
|
||||
},
|
||||
executes: ({ get }) => yarn('tgui:lint', !get(CiParameter) && '--fix'),
|
||||
});
|
||||
|
||||
export const TguiSonarTarget = new Juke.Target({
|
||||
dependsOn: [YarnTarget],
|
||||
executes: () => yarn('tgui:sonar'),
|
||||
});
|
||||
|
||||
export const TguiTscTarget = new Juke.Target({
|
||||
dependsOn: [YarnTarget],
|
||||
executes: async () => {
|
||||
await yarn('tsc');
|
||||
},
|
||||
executes: () => yarn('tgui:tsc'),
|
||||
});
|
||||
|
||||
export const TguiTestTarget = new Juke.Target({
|
||||
parameters: [CiParameter],
|
||||
dependsOn: [YarnTarget],
|
||||
executes: async ({ args }) => {
|
||||
await yarn('jest', ...args);
|
||||
},
|
||||
executes: ({ get }) => yarn(`tgui:test-${get(CiParameter) ? 'ci' : 'simple'}`),
|
||||
});
|
||||
|
||||
export const TguiLintTarget = new Juke.Target({
|
||||
dependsOn: [YarnTarget, TguiEslintTarget, TguiTscTarget, TguiTestTarget],
|
||||
dependsOn: [YarnTarget, TguiEslintTarget, TguiTscTarget],
|
||||
});
|
||||
|
||||
export const TguiDevTarget = new Juke.Target({
|
||||
dependsOn: [YarnTarget],
|
||||
executes: async ({ args }) => {
|
||||
await yarn('node', 'packages/tgui-dev-server/index.esm.js', ...args);
|
||||
},
|
||||
executes: ({ args }) => yarn('tgui:dev', ...args),
|
||||
});
|
||||
|
||||
export const TguiAnalyzeTarget = new Juke.Target({
|
||||
dependsOn: [YarnTarget],
|
||||
executes: async () => {
|
||||
await yarn('webpack-cli', '--mode=production', '--analyze');
|
||||
},
|
||||
executes: () => yarn('tgui:analyze'),
|
||||
});
|
||||
|
||||
export const TestTarget = new Juke.Target({
|
||||
@@ -228,26 +218,13 @@ export const AllTarget = new Juke.Target({
|
||||
dependsOn: [TestTarget, LintTarget, BuildTarget],
|
||||
});
|
||||
|
||||
/**
|
||||
* Removes the immediate build junk to produce clean builds.
|
||||
*/
|
||||
export const CleanTarget = new Juke.Target({
|
||||
export const TguiCleanTarget = new Juke.Target({
|
||||
executes: async () => {
|
||||
Juke.rm('*.dmb');
|
||||
Juke.rm('*.rsc');
|
||||
Juke.rm('*.mdme');
|
||||
Juke.rm('*.mdme*');
|
||||
Juke.rm('*.m.*');
|
||||
Juke.rm('_maps/templates.dm');
|
||||
Juke.rm('tgui/public/.tmp', { recursive: true });
|
||||
Juke.rm('tgui/public/*.map');
|
||||
Juke.rm('tgui/public/*.chunk.*');
|
||||
Juke.rm('tgui/public/*.bundle.*');
|
||||
Juke.rm('tgui/public/*.hot-update.*');
|
||||
Juke.rm('tgui/public/*.{chunk,bundle,hot-update}.*');
|
||||
Juke.rm('tgui/packages/tgfont/dist', { recursive: true });
|
||||
Juke.rm('tgui/.yarn/cache', { recursive: true });
|
||||
Juke.rm('tgui/.yarn/unplugged', { recursive: true });
|
||||
Juke.rm('tgui/.yarn/webpack', { recursive: true });
|
||||
Juke.rm('tgui/.yarn/{cache,unplugged,webpack}', { recursive: true });
|
||||
Juke.rm('tgui/.yarn/build-state.yml');
|
||||
Juke.rm('tgui/.yarn/install-state.gz');
|
||||
Juke.rm('tgui/.yarn/install-target');
|
||||
@@ -255,16 +232,24 @@ export const CleanTarget = new Juke.Target({
|
||||
},
|
||||
});
|
||||
|
||||
export const CleanTarget = new Juke.Target({
|
||||
dependsOn: [TguiCleanTarget],
|
||||
executes: async () => {
|
||||
Juke.rm('*.{dmb,rsc}');
|
||||
Juke.rm('*.mdme*');
|
||||
Juke.rm('*.m.*');
|
||||
Juke.rm('_maps/templates.dm');
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Removes more junk at expense of much slower initial builds.
|
||||
* Removes more junk at the expense of much slower initial builds.
|
||||
*/
|
||||
export const DistCleanTarget = new Juke.Target({
|
||||
export const CleanAllTarget = new Juke.Target({
|
||||
dependsOn: [CleanTarget],
|
||||
executes: async () => {
|
||||
Juke.logger.info('Cleaning up data/logs');
|
||||
Juke.rm('data/logs', { recursive: true });
|
||||
Juke.logger.info('Cleaning up bootstrap cache');
|
||||
Juke.rm('tools/bootstrap/.cache', { recursive: true });
|
||||
Juke.logger.info('Cleaning up global yarn cache');
|
||||
await yarn('cache', 'clean', '--all');
|
||||
},
|
||||
|
||||
@@ -60,7 +60,10 @@ const getDmPath = async () => {
|
||||
|
||||
/**
|
||||
* @param {string} dmeFile
|
||||
* @param {{ defines?: string[] }} options
|
||||
* @param {{
|
||||
* defines?: string[];
|
||||
* warningsAsErrors?: boolean;
|
||||
* }} options
|
||||
*/
|
||||
export const DreamMaker = async (dmeFile, options = {}) => {
|
||||
const dmPath = await getDmPath();
|
||||
@@ -85,31 +88,42 @@ export const DreamMaker = async (dmeFile, options = {}) => {
|
||||
};
|
||||
testOutputFile(`${dmeBaseName}.dmb`);
|
||||
testOutputFile(`${dmeBaseName}.rsc`);
|
||||
const runWithWarningChecks = async (dmeFile, args) => {
|
||||
const execReturn = await Juke.exec(dmeFile, args);
|
||||
if (options.warningsAsErrors && execReturn.combined.match(/\d+:warning: /)) {
|
||||
Juke.logger.error(`Compile warnings treated as errors`);
|
||||
throw new Juke.ExitCode(2);
|
||||
}
|
||||
return execReturn;
|
||||
}
|
||||
// Compile
|
||||
const { defines } = options;
|
||||
if (defines && defines.length > 0) {
|
||||
const injectedContent = defines
|
||||
.map(x => `#define ${x}\n`)
|
||||
.join('');
|
||||
fs.writeFileSync(`${dmeBaseName}.m.dme`, injectedContent);
|
||||
const dmeContent = fs.readFileSync(`${dmeBaseName}.dme`);
|
||||
fs.appendFileSync(`${dmeBaseName}.m.dme`, dmeContent);
|
||||
await Juke.exec(dmPath, [`${dmeBaseName}.m.dme`]);
|
||||
fs.writeFileSync(`${dmeBaseName}.dmb`, fs.readFileSync(`${dmeBaseName}.m.dmb`));
|
||||
fs.writeFileSync(`${dmeBaseName}.rsc`, fs.readFileSync(`${dmeBaseName}.m.rsc`));
|
||||
fs.unlinkSync(`${dmeBaseName}.m.dmb`);
|
||||
fs.unlinkSync(`${dmeBaseName}.m.rsc`);
|
||||
fs.unlinkSync(`${dmeBaseName}.m.dme`);
|
||||
Juke.logger.info('Using defines:', defines.join(', '));
|
||||
try {
|
||||
const injectedContent = defines
|
||||
.map(x => `#define ${x}\n`)
|
||||
.join('');
|
||||
fs.writeFileSync(`${dmeBaseName}.m.dme`, injectedContent);
|
||||
const dmeContent = fs.readFileSync(`${dmeBaseName}.dme`);
|
||||
fs.appendFileSync(`${dmeBaseName}.m.dme`, dmeContent);
|
||||
await runWithWarningChecks(dmPath, [`${dmeBaseName}.m.dme`]);
|
||||
fs.writeFileSync(`${dmeBaseName}.dmb`, fs.readFileSync(`${dmeBaseName}.m.dmb`));
|
||||
fs.writeFileSync(`${dmeBaseName}.rsc`, fs.readFileSync(`${dmeBaseName}.m.rsc`));
|
||||
}
|
||||
finally {
|
||||
Juke.rm(`${dmeBaseName}.m.*`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
await Juke.exec(dmPath, [dmeFile]);
|
||||
await runWithWarningChecks(dmPath, [dmeFile]);
|
||||
}
|
||||
};
|
||||
|
||||
export const DreamDaemon = async (dmbFile, ...args) => {
|
||||
const dmPath = await getDmPath();
|
||||
const baseDir = path.dirname(dmPath);
|
||||
const ddExeName = process.platform === 'win32' ? 'dd.exe' : 'DreamDaemon';
|
||||
const ddExeName = process.platform === 'win32' ? 'dreamdaemon.exe' : 'DreamDaemon';
|
||||
const ddExePath = baseDir === '.' ? ddExeName : path.join(baseDir, ddExeName);
|
||||
return Juke.exec(ddExePath, [dmbFile, ...args]);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,10 @@ export const yarn = (...args) => {
|
||||
yarnPath = Juke.glob('./tgui/.yarn/releases/*.cjs')[0]
|
||||
.replace('/tgui/', '/');
|
||||
}
|
||||
return Juke.exec('node', [yarnPath, ...args], {
|
||||
return Juke.exec('node', [
|
||||
yarnPath,
|
||||
...args.filter((arg) => typeof arg === 'string'),
|
||||
], {
|
||||
cwd: './tgui',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -5,6 +5,6 @@ if(!(Test-Path -Path "C:/byond")){
|
||||
}
|
||||
|
||||
bash tools/ci/install_node.sh
|
||||
bash tools/build/build
|
||||
bash tools/build/build -Werror
|
||||
|
||||
exit $LASTEXITCODE
|
||||
|
||||
Reference in New Issue
Block a user