[MIRROR] Check node version in CBT (#3946)

* Check node version in CBT (#57461)

* Check node version in CBT

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
SkyratBot
2021-03-07 00:09:29 +01:00
committed by GitHub
parent cc4bf10a66
commit b6fe2467d5
6 changed files with 42 additions and 13 deletions

View File

@@ -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:
```

View File

@@ -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)

View File

@@ -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)

View File

@@ -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?

View File

@@ -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')