refactor: move Windows build scripts into tools/build, drop CI4 migration scripts (#4729)

Also clarify in build.ps1, build-steps.ps1 and build-package.ps1 that the
'.\tools\Build\...' example is a repository-root command and that callers in
other directories must provide a valid path to the scripts

Remove the one-off CI3->CI4 migration tooling that is no longer needed:
tools/ci4-lang-migration/ and tools/ci4-upgrade-language-interpolation/.

Docker is kept at the repository root rather than under tools/, per
review feedback. The Windows build scripts remain in tools/build/.
Root-relative docker paths are restored in .gitignore, BUILD.md,
INSTALL.md, gulpfile.js, and the build-release workflow.

---------

Co-authored-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
This commit is contained in:
jekkosandobjecttothis authored and GitHub committed 2026-10-14 09:22:56 +02:00
1 parent 87c720c9ef
commit fdbeb0e9b1
19 files changed
+25 -190

No files matched your search

+1
View File
@@ -57,6 +57,7 @@ $RECYCLE.BIN/
# Other
build/
!tools/build/
generate_languages.php
dist
docs
+1 -1
View File
@@ -42,7 +42,7 @@ Using an `.env` file is a convenient approach to store OSPOS configuration.
I've added the following Powershell scripts to make my life a bit easier, which I share with you.
* `build.ps1` - Which runs the build but also restores the .env from a backup I make of it in a specifically placed folder. I place a copy of the configured .env file in a folder that has the following path from the working folder: `../env/<working-folder-name>/.env`
* `tools/build/build.ps1` - Which runs the build but also restores the .env from a backup I make of it in a specifically placed folder. I place a copy of the configured .env file in a folder that has the following path from the working folder: `../env/<working-folder-name>/.env`
### Containerized setup
Development using docker has the advantage that all the application's dependencies are contained within the docker environment. During development we want to have a live version of the code in the container when we edit it. This is accomplished by mounting the application folder within the /app of the docker container.
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
cd docker
cd "$(dirname "$0")"
# load local environment variables
if [ ! -e ".env" ]; then
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
cd docker
cd "$(dirname "$0")"
. ./.env
@@ -1,8 +1,9 @@
# ------------------------------------------------------
# Run this Powershell script to "build" OSPOS.
# Execute this script from a terminal starting
# with the project root as the working directory.
# Use ".\build.ps1"
# The script moves to the repository root itself, so it can
# be invoked from any working directory.
# Use ".\tools\build\build-package.ps1" from the repository root (if you are in
# another directory, provide a valid path to this script)
# The leading ".\" tells Powershell that you trust it.
# ------------------------------------------------------
# Tested with:
@@ -11,6 +12,9 @@
# npm version 9.4.2
# ------------------------------------------------------
# Run from the repository root (two levels up from tools/build/)
Set-Location -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
Write-Output "============================================================================="
Write-Output "Before continuing, delete the package-lock.json and clear the dependencies"
Write-Output "from package.json"
@@ -1,11 +1,15 @@
# ----------------------------------------------------------------
# Run this Powershell script to "build" OSPOS (one step at a time).
# Execute this script from a terminal starting
# with the project root as the working directory.
# Use ".\build-steps.ps1"
# The script moves to the repository root itself, so it can be
# invoked from any working directory.
# Use ".\tools\build\build-steps.ps1" from the repository root (if you are in
# another directory, provide a valid path to this script)
# The leading ".\" tells Powershell that you trust it.
# ----------------------------------------------------------------
# Run from the repository root (two levels up from tools/build/)
Set-Location -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
Write-Output "============================================================================="
Write-Output "1. Run Composer Install and npm install"
Write-Output "============================================================================="
+7 -3
View File
@@ -1,11 +1,15 @@
# ------------------------------------------------------
# Run this Powershell script to "build" OSPOS.
# Execute this script from a terminal starting
# with the project root as the working directory.
# Use ".\build.ps1"
# The script moves to the repository root itself, so it can
# be invoked from any working directory.
# Use ".\tools\build\build.ps1" from the repository root (if you are in
# another directory, provide a valid path to this script)
# The leading ".\" tells Powershell that you trust it.
# ------------------------------------------------------
# Run from the repository root (two levels up from tools/build/)
Set-Location -Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
Write-Output "============================================================================="
Write-Output "Run Composer Install"
Write-Output "============================================================================="
-10
View File
@@ -1,10 +0,0 @@
<?php
include($argv[1]);
echo "<?php\n";
echo "return [\n";
foreach ($lang as $key=>$value) {
echo "\t\"$key\" => \"".addcslashes($value, '"')."\",\n";
}
echo "];";
-18
View File
@@ -1,18 +0,0 @@
#!/bin/bash
projectdir=$(pwd)/../../
git checkout master $projectdir/application/language
for file in $projectdir/application/language/**/*.php; do
f=$(basename $file)
name=${f^}
output=$(dirname $file)/${name%_lang.php}.php
output=${output/application/app}
output=${output/language/Language}
path=${file/$projectdir\//}
docker run -v "$projectdir:/root" php:cli-alpine -c php /root/tools/ci4-lang-migration/convert.php /root/$path > $output;
prefix=$(basename ${output,,} .php);
[ "$prefix" = "bootstrap_tables" ] && prefix="tables"
sed -i "s/\(\s*\)\"${prefix}_/\1\"/g" $output
done
rm -rf "$projectdir/application"
git add $projectdir/application/language
@@ -1,21 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
echo -n "Counting ..."
BASEURL="../../"
DONE=`find ${BASEURL}app/Language -name "*.php" -exec grep -oP "{[0-9]}" {} \; | wc -l`
TODO=`find ${BASEURL}app/Language -name "*.php" -exec grep -oP "%[0-9]|٪[0-9]|[0-9]٪|[0-9]%|% [0-9]|٪ [0-9]|{[a-z].*?}" {} \; | wc -l`
echo " $DONE placeholders are converted and $TODO yet to do"
FILES="sed_*.sh"
for f in $FILES
do
echo -n "Processing $f file..."
bash "$f" "$BASEURL"
echo "completed."
done
echo -n "Counting ..."
COMPLETE=`find ${BASEURL}app/Language -name "*.php" -exec grep -oP "{[0-9]}" {} \; | wc -l`
MISSED=`find ${BASEURL}app/Language -name "*.php" -exec grep -oP "%[0-9]|٪[0-9]|[0-9]٪|[0-9]%|% [0-9]|٪ [0-9]|{[a-z].*?}" {} \; | wc -l`
echo " $COMPLETE placeholders are converted and $MISSED were missed"
echo "All done"
@@ -1,13 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Attributes.php -exec sed -i -E -e 's/("definition_error_adding_updating")(.*?)(\{definition_name\})(.*?)/\1\2{0}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Attributes.php -exec sed -i -E -e 's/("definition_error_adding_updating")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
@@ -1,14 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {name} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Bootstrap_tables.php -exec sed -i -E -e 's/("tables_page_from_to")(.*?)(\{pageFrom\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Bootstrap_tables.php -exec sed -i -E -e 's/("tables_page_from_to")(.*?)(\{pageTo\})(.*)/\1\2{1}\4/;' {} \;
find ${1}app/Language -type f -name Bootstrap_tables.php -exec sed -i -E -e 's/("tables_page_from_to")(.*?)(\{totalRows\})(.*)/\1\2{2}\4/;' {} \;
find ${1}app/Language -type f -name Bootstrap_tables.php -exec sed -i -E -e 's/("tables_rows_per_page")(.*?)(\{pageNumber\})(.*)/\1\2{0}\4/;' {} \;
@@ -1,15 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("copyrights")(.*?)(\{current_year\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("migration_needed")(.*?)(\{version\})(.*)/\1\2{0}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("copyrights")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("migration_needed")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
@@ -1,17 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Giftcards.php -exec sed -i -E -e 's/("cannot_use")(.*?)(\{giftcard_num\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Giftcards.php -exec sed -i -E -e 's/("remaining_balance")(.*?)(\{giftcard_num\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Giftcards.php -exec sed -i -E -e 's/("remaining_balance")(.*?)(\{balance\})(.*)/\1\2{1}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Giftcards.php -exec sed -i -E -e 's/("cannot_use")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Giftcards.php -exec sed -i -E -e 's/("remaining_balance")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0\}\4/;' {} \;
find ${1}app/Language -type f -name Giftcards.php -exec sed -i -E -e 's/("remaining_balance")(.*?)(%2|٪2|2٪|2%|% 2|٪ 2)(.*)/\1\2{1}\4/;' {} \;
@@ -1,18 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#This script handles an R to L typo which had the parameters entered as
#1% and 2% instead of %1 and %2 in two languages.
#The %1 rendered on screen as %1, but copied and pasted as 1% which was very confusing
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(\{count\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(\{failures\})(.*)/\1\2{1}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(%2|٪2|2٪|2%|% 2|٪ 2)(.*)/\1\2{1}\4/;' {} \;
@@ -1,15 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Login.php -exec sed -i -E -e 's/("migration_needed")(.*?)(\{version\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Login.php -exec sed -i -E -e 's/("welcome")(.*?)(\{install_name\})(.*)/\1\2{0}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Login.php -exec sed -i -E -e 's/("migration_needed")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Login.php -exec sed -i -E -e 's/("welcome")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
@@ -1,18 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#This script handles an R to L typo which had the parameters entered as
#1% instead of %1 in two languages.
#The %1 rendered on screen as %1, but copied and pasted as 1% which was very confusing
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Sales.php -exec sed -i -E -e 's/("invoice_number_duplicate")(.*?)(\{invoice_number\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Sales.php -exec sed -i -E -e 's/("quantity_of_items")(.*?)(\{quantity\})(.*)/\1\2{0}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Sales.php -exec sed -i -E -e 's/("invoice_number_duplicate")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Sales.php -exec sed -i -E -e 's/("quantity_of_items")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
@@ -1,13 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Taxes.php -exec sed -i -E -e 's/("tax_group_not_unique")(.*?)(\{group\})(.*)/\1\2{0}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Taxes.php -exec sed -i -E -e 's/("tax_group_not_unique")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
@@ -1,6 +0,0 @@
#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#This script fixes a typo in the target file: {} was used instead of [].
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("none_selected_text")(.*?)(\{Inget valt\})(.*)/\1\2[Inget valt]\4/g' {} \;