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_modules/
package-lock.json
scripts/node_modules/
scripts/package-lock.json
# Static resources
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`
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
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>
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
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
generated HTML document.
See [php-relinker.js](php-relinker.js).
See [php-relinker.js](scripts/legacy/php-relinker.js).
## Requirements

View File

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

View File

@@ -12,11 +12,11 @@ echo ------------------------------
:content-compile-index
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
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

View File

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

View File

@@ -13,7 +13,7 @@ echo -----------------------
:sass-compile
echo Compiling SASS files...
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.min.css -q --style compressed
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.min.css -q --style compressed
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

View File

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

View File

@@ -1,12 +1,13 @@
@echo off
setlocal enabledelayedexpansion
:: Going into the script's directory
cd /D "%~dp0"
:compile
call "%~dp0compile.bat"
call "%~dp0compile.cmd"
:compile-path-fix
:: Going into the project's root directory
cd /D "%~dp0\..\"
:compile-end
@@ -25,7 +26,10 @@ echo ^> %NP_ZIP_NAME%
echo Preparing environment variable...
set NP_ZIP_CONTENT=
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% "content/*.*"
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/Quantum/"
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"
::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