Skip to content

Commit

Permalink
[MIRROR] Check node version in CBT (#3946)
Browse files Browse the repository at this point in the history
* Check node version in CBT (#57461)

* Check node version in CBT

Co-authored-by: Aleksej Komarov <[email protected]>
  • Loading branch information
SkyratBot and stylemistake authored Mar 6, 2021
1 parent cc4bf10 commit b6fe246
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/RUNNING_A_SERVER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BYOND installed. You can get it from https://www.byond.com/download. Once you've
that, extract the game files to wherever you want to keep them. This is a
sourcecode-only release, so the next step is to compile the server files.

Double-click `Build.bat` in the root directory of the source code. This'll take
Double-click `BUILD.bat` in the root directory of the source code. This'll take
a little while, and if everything's done right you'll get a message like this:

```
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ Space Station 13 is a paranoia-laden round-based roleplaying game set against th

[Maps and Away Missions](.github/MAPS_AND_AWAY_MISSIONS.md)

## :exclamation: How to compile :exclamation:

On **2021-01-04** we have changed the way to compile the codebase.

Find `BUILD.bat` here in the root folder of tgstation, and double click it to initiate the build. It consists of multiple steps and might take around 1-5 minutes to compile.

After it finishes, you can then [setup the server](.github/RUNNING_A_SERVER.md) normally by opening `tgstation.dmb` in DreamDaemon.

**Building tgstation in DreamMaker directly is now deprecated and might produce errors**, such as `'tgui.bundle.js': cannot find file`.

**[How to compile in VSCode and other build options](tools/build/README.md).**

## Requirements for contributors
[Guidelines for Contributors](.github/CONTRIBUTING.md)

Expand Down
2 changes: 1 addition & 1 deletion tools/bootstrap/node_.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Download-Node {
if (Test-Path $NodeTarget -PathType Leaf) {
return
}
Write-Output "Downloading Node v$NodeVersion"
Write-Output "Downloading Node v$NodeVersion (may take a while)"
New-Item $NodeTargetDir -ItemType Directory -ErrorAction silentlyContinue | Out-Null
$WebClient = New-Object Net.WebClient
$WebClient.DownloadFile($NodeSource, $NodeTarget)
Expand Down
16 changes: 9 additions & 7 deletions tools/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

This build script is the recommended way to compile the game, including not only the DM code but also the JavaScript and any other dependencies.

- VSCode: use `Ctrl+Shift+B` to build or `F5` to build and run.

- Windows: double-click `Build.bat` in the repository root to build.

- Linux: run `tools/build/build` from the repository root.
- VSCode:
a) Press `Ctrl+Shift+B` to build.
b) Press `F5` to build and run with debugger attached.
- Windows:
a) Double-click `BUILD.bat` in the repository root to build (will wait for a key press before it closes).
b) Double-click `tools/build/build.bat` to build (will exit as soon as it finishes building).
- Linux:
a) Run `tools/build/build` from the repository root.

The script will skip build steps whose inputs have not changed since the last run.

## Dependencies

- On Windows, `Build.bat` will automatically install a private 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/>.

## Why?
Expand Down
23 changes: 19 additions & 4 deletions tools/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,30 @@
* @license MIT
*/

const { resolve: resolvePath } = require('path');
// Change working directory to project root
process.chdir(require('path').resolve(__dirname, '../../'));

// Validate NodeJS version
const NODE_VERSION = parseInt(process.versions.node.match(/(\d+)/)[1]);
const NODE_VERSION_TARGET = parseInt(require('fs')
.readFileSync('dependencies.sh', 'utf-8')
.match(/NODE_VERSION=(\d+)/)[1]);
if (NODE_VERSION < NODE_VERSION_TARGET) {
console.error('Your current Node.js version is out of date.');
console.error('You have two options:');
console.error(' a) Go to https://nodejs.org/ and install the latest LTS release of Node.js');
console.error(' b) Uninstall Node.js (our build system automatically downloads one)');
process.exit(1);
}

// Main
// --------------------------------------------------------

const { resolveGlob, stat } = require('./cbt/fs');
const { exec } = require('./cbt/process');
const { Task, runTasks } = require('./cbt/task');
const { regQuery } = require('./cbt/winreg');

// Change working directory to project root
process.chdir(resolvePath(__dirname, '../../'));

const taskTgui = new Task('tgui')
.depends('tgui/.yarn/releases/*')
.depends('tgui/.yarn/install-state.gz')
Expand Down

0 comments on commit b6fe246

Please sign in to comment.