Moved build scripts into "scripts/", Updated readme

Update .gitignore, compile-clean.cmd, and 38 more files...
This commit is contained in:
2024-04-18 18:00:28 +02:00
parent e544271ffa
commit c8bf68fa2d
22 changed files with 73 additions and 25 deletions

2
.gitignore vendored
View File

@@ -4,6 +4,8 @@
# Node.JS # Node.JS
node_modules/ node_modules/
package-lock.json package-lock.json
scripts/node_modules/
scripts/package-lock.json
# Static resources # Static resources
resources/DecimalJs/ resources/DecimalJs/

View File

@@ -37,7 +37,7 @@ in a single file that can be used by the [L10N PHP utility](commons/langs.php).
It works by listing all subfolders in a location as language keys and assigning the content of each `.json` It works by listing all subfolders in a location as language keys and assigning the content of each `.json`
file to that language key. file to that language key.
See [compile_strings.py](compile_strings.py) and [compile.bat](compile.bat). See [compile_strings.py](scripts/compile_strings.py) and [compile.cmd](scripts/compile.cmd).
### TypeScript Perineal Care ### TypeScript Perineal Care
This utility simply fixes the munted import paths that Typescript produces by replacing a given import name by This utility simply fixes the munted import paths that Typescript produces by replacing a given import name by
@@ -46,7 +46,7 @@ another one with the proper extensions.
While not perfect, it works.<br> While not perfect, it works.<br>
That's still better than Typescript could ever do with a maintainable *tsconfig* file... That's still better than Typescript could ever do with a maintainable *tsconfig* file...
See [fix-import-path.js](fix-import-path.js) and [compile.bat](compile.bat). See [fix-import-path.js](scripts/legacy/fix-import-path.js) and [compile.bat](scripts/compile.cmd).
### Minified PHP Import Fixer ### Minified PHP Import Fixer
Unfinished utility that will be used to change import paths in minified PHP files. Unfinished utility that will be used to change import paths in minified PHP files.
@@ -54,7 +54,7 @@ Unfinished utility that will be used to change import paths in minified PHP file
The main goal here is to fix some weird and unfixable text-spacing issues with line returns in the The main goal here is to fix some weird and unfixable text-spacing issues with line returns in the
generated HTML document. generated HTML document.
See [php-relinker.js](php-relinker.js). See [php-relinker.js](scripts/legacy/php-relinker.js).
## Requirements ## Requirements

View File

@@ -1,8 +1,8 @@
@echo off @echo off
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
:: Going into the script's directory :: Going into the project's root directory
cd /D "%~dp0" cd /D "%~dp0\..\"
:clean :clean

View File

@@ -12,11 +12,11 @@ echo ------------------------------
:content-compile-index :content-compile-index
echo Compiling index files... echo Compiling index files...
python content_index_maker.py ./content/raw_index/ ./content/index.json python content_index_maker.py ../content/raw_index/ ../content/index.json
:content-compile-items :content-compile-items
echo Compiling content item files... echo Compiling content item files...
python content_item_converter.py ./content/raw_items/ ./content/items/ python content_item_converter.py ../content/raw_items/ ../content/items/
:content-end :content-end

View File

@@ -13,10 +13,10 @@ echo ---------------------------
:js-external-decimaljs-minify :js-external-decimaljs-minify
echo Minifying Decimal.JS echo Minifying Decimal.JS
pushd %CD% pushd %CD%
cd %~dp0\resources\DecimalJs\10.4.3\ cd %~dp0\..\resources\DecimalJs\10.4.3\
echo ^> resources\DecimalJs\10.4.3\decimal.mjs echo ^> resources\DecimalJs\10.4.3\decimal.mjs
call "%~dp0node_modules\.bin\terser" decimal.mjs -c -m --toplevel -o decimal.min.mjs call "%~dp0node_modules\.bin\terser" decimal.mjs -c -m --toplevel -o decimal.min.mjs
cd %~dp0\resources\DecimalJsLight\2.5.1\ cd %~dp0\..\resources\DecimalJsLight\2.5.1\
echo ^> resources\DecimalJsLight\2.5.1\decimal.mjs echo ^> resources\DecimalJsLight\2.5.1\decimal.mjs
call "%~dp0node_modules\.bin\terser" decimal.mjs -c -m --toplevel -o decimal.min.mjs call "%~dp0node_modules\.bin\terser" decimal.mjs -c -m --toplevel -o decimal.min.mjs
popd popd
@@ -24,7 +24,7 @@ popd
:js-external-highlightjs :js-external-highlightjs
echo Handling HighlightJS echo Handling HighlightJS
pushd %CD% pushd %CD%
cd %~dp0\resources\HighlightJS\ cd %~dp0\..\resources\HighlightJS\
echo ^> Clearing old files echo ^> Clearing old files
del /Q /S /F highlight.js 2> nul 1> nul del /Q /S /F highlight.js 2> nul 1> nul
del /Q /S /F highlight.min.js 2> nul 1> nul del /Q /S /F highlight.min.js 2> nul 1> nul

View File

@@ -13,7 +13,7 @@ echo --------------------------------
:js-nibblepoker-minify :js-nibblepoker-minify
echo Minifying nibblepoker.js echo Minifying nibblepoker.js
pushd %CD% pushd %CD%
cd %~dp0\resources\NibblePoker\js\ cd %~dp0\..\resources\NibblePoker\js\
echo ^> resources\NibblePoker\js\nibblepoker.js echo ^> resources\NibblePoker\js\nibblepoker.js
call "%~dp0node_modules\.bin\terser" nibblepoker.js -c -m -o nibblepoker.min.js call "%~dp0node_modules\.bin\terser" nibblepoker.js -c -m -o nibblepoker.min.js
echo ^> resources\NibblePoker\js\nibblepoker-code.js echo ^> resources\NibblePoker\js\nibblepoker-code.js

View File

@@ -13,7 +13,7 @@ echo -----------------------
:sass-compile :sass-compile
echo Compiling SASS files... echo Compiling SASS files...
pushd %CD% pushd %CD%
cd %~dp0\resources\NibblePoker\scss\ cd %~dp0\..\resources\NibblePoker\scss\
call "%~dp0node_modules\.bin\sass" nibblepoker.scss:../css/nibblepoker.css -q call "%~dp0node_modules\.bin\sass" nibblepoker.scss:../css/nibblepoker.css -q
call "%~dp0node_modules\.bin\sass" nibblepoker.scss:../css/nibblepoker.min.css -q --style compressed call "%~dp0node_modules\.bin\sass" nibblepoker.scss:../css/nibblepoker.min.css -q --style compressed
call "%~dp0node_modules\.bin\sass" snowflakes.scss:../css/snowflakes.css -q call "%~dp0node_modules\.bin\sass" snowflakes.scss:../css/snowflakes.css -q
@@ -21,11 +21,6 @@ call "%~dp0node_modules\.bin\sass" snowflakes.scss:../css/snowflakes.min.css -q
call "%~dp0node_modules\.bin\sass" debugger.scss:../css/debugger.css -q call "%~dp0node_modules\.bin\sass" debugger.scss:../css/debugger.css -q
call "%~dp0node_modules\.bin\sass" debugger.scss:../css/debugger.min.css -q --style compressed call "%~dp0node_modules\.bin\sass" debugger.scss:../css/debugger.min.css -q --style compressed
popd popd
pushd %CD%
cd %~dp0\wiki\scss\
call "%~dp0node_modules\.bin\sass" nibblepoker-wiki.scss:../css/nibblepoker-wiki.css -q
call "%~dp0node_modules\.bin\sass" nibblepoker-wiki.scss:../css/nibblepoker-wiki.min.css -q --style compressed
popd
:sass-end :sass-end

View File

@@ -12,8 +12,7 @@ echo ----------------------
:lang-compile :lang-compile
echo Compiling lang files... echo Compiling lang files...
python compile_strings.py ./commons/strings/ ./commons/strings.json python compile_strings.py ../commons/strings/ ../commons/strings.json
python compile_strings.py ./wiki/strings/ ./wiki/strings.json
:lang-end :lang-end

View File

@@ -1,12 +1,13 @@
@echo off @echo off
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
:: Going into the script's directory
cd /D "%~dp0"
:compile :compile
call "%~dp0compile.bat" call "%~dp0compile.cmd"
:compile-path-fix
:: Going into the project's root directory
cd /D "%~dp0\..\"
:compile-end :compile-end
@@ -25,7 +26,10 @@ echo ^> %NP_ZIP_NAME%
echo Preparing environment variable... echo Preparing environment variable...
set NP_ZIP_CONTENT= set NP_ZIP_CONTENT=
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "about/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "about/"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "commons/*.php" "commons/strings.json" "commons/DOM/" "commons/content/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "commons/*.php"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "commons/strings.json"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "commons/DOM/"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "commons/content/"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "contact/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "contact/"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "content/*.*" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "content/*.*"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "content/items/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "content/items/"
@@ -64,6 +68,9 @@ set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "resources/NibblePoker/js/*.js"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "resources/NibblePoker/sounds/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "resources/NibblePoker/sounds/"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "resources/Quantum/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "resources/Quantum/"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "resources/SplideJs/dist/" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "resources/SplideJs/dist/"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "tools/*"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "tools/items/*.json"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "tools/items/*/*"
set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "./.htaccess" "./*.php" "./favicon.*" "./.env" set NP_ZIP_CONTENT=%NP_ZIP_CONTENT% "./.htaccess" "./*.php" "./favicon.*" "./.env"
::echo ^>%NP_ZIP_CONTENT% ::echo ^>%NP_ZIP_CONTENT%

23
scripts/nodejs-setup.cmd Normal file
View File

@@ -0,0 +1,23 @@
@echo off
setlocal enabledelayedexpansion
:: Going into the script's directory
cd /D "%~dp0"
:nodejs
echo.
echo Setting up NodeJS...
echo --------------------
:nodejs-install
echo Installing packages...
pushd %CD%
call npm install
popd
:nodejs-end
:end

22
scripts/python-setup.cmd Normal file
View File

@@ -0,0 +1,22 @@
@echo off
setlocal enabledelayedexpansion
:: Going into the script's directory
cd /D "%~dp0"
:python
echo.
echo Setting up Python...
echo --------------------
:python-install
echo Installing packages...
pushd %CD%
call pip install -r requirements.txt
popd
:python-end
:end