-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tweak(ext/system-resources): improve artifact-based system reso…
…urces handling (mr-186) - 1ec451a tweak(ext/system-resources): improve artifact-based system resources handling
- Loading branch information
Showing
5 changed files
with
348 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
# `system-resources` | ||
|
||
Build scripts for bundled system resources. | ||
Build scripts for bundled system resources. | ||
|
||
## Index of resources | ||
|
||
1. Chat - basic chat functionality | ||
- Source-code-based | ||
2. Monitor - server manager, txAdmin | ||
- Artifact-based | ||
- Source code: https://github.com/tabarra/txAdmin | ||
- Using ready-built artifacts from the source code repository | ||
|
||
## Updating artifact-based resources | ||
|
||
Update artifact URL, version and SHA256 hash using this command: | ||
|
||
``` | ||
$ node manager.js update --name=%RESOURCE_NAME% --url=%RESOURCE_ARTIFACT_URL% --version=%RESOURCE_VERSION% | ||
``` | ||
|
||
## Adding artifact-based resource | ||
|
||
``` | ||
$ node manager.js add --name=%RESOURCE_NAME% --url=%RESOURCE_ARTIFACT_URL% --version=%RESOURCE_VERSION% | ||
``` | ||
|
||
> Requires adding extra build steps to `build.cmd` and `build.sh` scripts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,76 @@ | ||
@echo off | ||
|
||
where /q node | ||
|
||
if errorlevel 1 ( | ||
exit /B 1 | ||
goto :error | ||
) | ||
|
||
if "%1" == "chat" goto chat | ||
if "%1" == "chat" ( | ||
goto :chat | ||
) | ||
|
||
set SRRoot=%~dp0\data | ||
pushd %~dp0 | ||
|
||
|
||
:: txAdmin | ||
set MonitorArtifactURL="https://github.com/tabarra/txAdmin/releases/download/v7.0.0/monitor.zip" | ||
echo Adding monitor | ||
|
||
set MonitorPath=%SRRoot%\monitor | ||
set MonitorArtifactPath=%SRRoot%\monitor.zip | ||
|
||
rmdir /s /q %MonitorPath% | ||
mkdir %MonitorPath% | ||
|
||
curl -Lo %MonitorArtifactPath% %MonitorArtifactURL% | ||
tar -C %MonitorPath%\ -xf %MonitorArtifactPath% | ||
node manager.js download --name=monitor --file=%MonitorArtifactPath% || goto :error | ||
|
||
tar -C %MonitorPath%\ -xf %MonitorArtifactPath% || goto :error | ||
del %MonitorArtifactPath% | ||
|
||
echo Done adding monitor | ||
:: /txAdmin | ||
|
||
|
||
:: chat | ||
:chat | ||
echo Adding chat | ||
|
||
pushd resources\chat | ||
rmdir /s /q dist | ||
|
||
node %~dp0\..\native-doc-gen\yarn_cli.js | ||
node %~dp0\..\native-doc-gen\yarn_cli.js || goto :error | ||
|
||
set NODE_OPTIONS="" | ||
FOR /F %%g IN ('node -v') do (set NODE_VERSION_STRING=%%g) | ||
set /a NODE_VERSION="%NODE_VERSION_STRING:~1,2%" | ||
IF %NODE_VERSION% GEQ 18 (set NODE_OPTIONS=--openssl-legacy-provider) | ||
|
||
call node_modules\.bin\webpack.cmd | ||
call node_modules\.bin\webpack.cmd || goto :error | ||
popd | ||
|
||
rmdir /s /q %SRRoot%\chat\ | ||
|
||
rmdir /s /q resources\chat\node_modules\ | ||
|
||
xcopy /y /e resources\chat\ %SRRoot%\chat\ | ||
xcopy /y /e resources\chat\ %SRRoot%\chat\ || goto :error | ||
del %SRRoot%\chat\yarn.lock | ||
del %SRRoot%\chat\package.json | ||
|
||
rmdir /s /q %SRRoot%\chat\html\ | ||
mkdir %SRRoot%\chat\html\vendor\ | ||
|
||
xcopy /y /e resources\chat\html\vendor %SRRoot%\chat\html\vendor | ||
xcopy /y /e resources\chat\html\vendor %SRRoot%\chat\html\vendor || goto :error | ||
popd | ||
|
||
:: done! | ||
exit /B 0 | ||
echo Done adding chat | ||
goto :success | ||
:: /chat | ||
|
||
|
||
:error | ||
echo Failed to build system resources | ||
exit /b %errorlevel% | ||
|
||
|
||
:success | ||
exit /b 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,14 @@ npm install -g [email protected] | |
mkdir -p data | ||
|
||
# txAdmin | ||
MONITOR_ARTIFACT_URL="https://github.com/tabarra/txAdmin/releases/download/v7.0.0/monitor.zip" | ||
|
||
MONITOR_PATH=data/monitor | ||
MONITOR_ARTIFACT_PATH=data/monitor.zip | ||
|
||
rm -rf $MONITOR_PATH | ||
mkdir -p $MONITOR_PATH | ||
|
||
curl -Lo $MONITOR_ARTIFACT_PATH $MONITOR_ARTIFACT_URL | ||
node manager.js download --name=monitor --file=$MONITOR_ARTIFACT_PATH | ||
|
||
unzip $MONITOR_ARTIFACT_PATH -d $MONITOR_PATH | ||
rm $MONITOR_ARTIFACT_PATH | ||
|
||
|
Oops, something went wrong.