[MIRROR] Fix a number of build issues (#3716)

* Fix a number of build issues

* Update babel.config.js

* Update package.json

* Update package.json

* Update dreamseeker.js

* Update package.json

* Update webpack.config.js

* Update yarn.lock

* a

* a

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-02-28 16:28:03 +01:00
committed by GitHub
parent 4bad355c11
commit 5ea469fcf0
17 changed files with 4135 additions and 1626 deletions

View File

@@ -6,7 +6,7 @@
*/
const { resolve: resolvePath } = require('path');
const { resolveGlob } = require('./cbt/fs');
const { resolveGlob, stat } = require('./cbt/fs');
const { exec } = require('./cbt/process');
const { Task, runTasks } = require('./cbt/task');
const { regQuery } = require('./cbt/winreg');
@@ -16,11 +16,11 @@ process.chdir(resolvePath(__dirname, '../../'));
const taskTgui = new Task('tgui')
.depends('tgui/.yarn/releases/*')
.depends('tgui/.yarn/install-state.gz')
.depends('tgui/yarn.lock')
.depends('tgui/webpack.config.js')
.depends('tgui/**/package.json')
.depends('tgui/packages/**/*.js')
.depends('tgui/packages/**/*.jsx')
.depends('tgui/packages/**/*.+(js|jsx|ts|tsx|cjs|mjs|scss)')
.provides('tgui/public/tgui.bundle.css')
.provides('tgui/public/tgui.bundle.js')
.provides('tgui/public/tgui-common.bundle.js')
@@ -29,9 +29,9 @@ const taskTgui = new Task('tgui')
.build(async () => {
// Instead of calling `tgui/bin/tgui`, we reproduce the whole pipeline
// here for maximum compilation speed.
const yarnRelease = resolveGlob('./tgui/.yarn/releases/yarn-*.cjs')[0]
const yarnPath = resolveGlob('./tgui/.yarn/releases/yarn-*.cjs')[0]
.replace('/tgui/', '/');
const yarn = args => exec('node', [yarnRelease, ...args], {
const yarn = args => exec('node', [yarnPath, ...args], {
cwd: './tgui',
});
await yarn(['install']);
@@ -48,29 +48,54 @@ const taskDm = new Task('dm')
.depends('modular_skyrat/**') // SKYRAT EDIT ADDITION -- check modular_skyrat too pls, build.js
.depends('tgui/public/tgui.html')
.depends('tgui/public/*.bundle.*')
.depends('tgui/public/*.chunk.*')
.depends('tgstation.dme')
.provides('tgstation.dmb')
.provides('tgstation.rsc')
.build(async () => {
let compiler = 'dm';
// Let's do some registry queries on Windows, because dm is not in PATH.
if (process.platform === 'win32') {
const installPath = (
await regQuery(
'HKLM\\Software\\Dantom\\BYOND',
'installpath')
|| await regQuery(
'HKLM\\SOFTWARE\\WOW6432Node\\Dantom\\BYOND',
'installpath')
);
if (installPath) {
compiler = resolvePath(installPath, 'bin/dm.exe');
const dmPath = await (async () => {
// Search in array of paths
const paths = [
...(process.env.DM_EXE && process.env.DM_EXE.split(',')),
'C:\\Program Files\\BYOND\\bin\\dm.exe',
'C:\\Program Files (x86)\\BYOND\\bin\\dm.exe',
['reg', 'HKLM\\Software\\Dantom\\BYOND', 'installpath'],
['reg', 'HKLM\\SOFTWARE\\WOW6432Node\\Dantom\\BYOND', 'installpath'],
];
const isFile = path => {
try {
const fstat = stat(path);
return fstat && fstat.isFile();
}
catch (err) {}
return false;
};
for (let path of paths) {
// Resolve a registry key
if (Array.isArray(path)) {
const [type, ...args] = path;
path = await regQuery(...args);
}
if (!path) {
continue;
}
// Check if path exists
if (isFile(path)) {
return path;
}
if (isFile(path + '/dm.exe')) {
return path + '/dm.exe';
}
if (isFile(path + '/bin/dm.exe')) {
return path + '/bin/dm.exe';
}
}
} else {
compiler = 'DreamMaker';
}
await exec(compiler, ['tgstation.dme']);
// Default paths
return (
process.platform === 'win32' && 'dm.exe'
|| 'DreamMaker'
);
})();
await exec(dmPath, ['tgstation.dme']);
});
// Frontend
@@ -79,8 +104,8 @@ const tasksToRun = [
taskDm,
];
if (process.env['TG_BUILD_TGS_MODE']) {
if (process.env.TG_BUILD_TGS_MODE) {
tasksToRun.pop();
}
runTasks(tasksToRun);
runTasks(tasksToRun);