From 73a5c7fae9ffbe9ada721148c8c454a643aceebe Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sun, 20 Feb 2022 16:11:50 +0100 Subject: chore!: restructure repo I separated public files from the config/dev files. It improves repo readability. I also moved dotenv helper to public/inc directory and extract the Matomo tracker in the same directory. --- config/build.sh | 30 ++++++++++++++++++------------ config/dotenv.php | 20 -------------------- config/webpack/paths.js | 4 ++-- 3 files changed, 20 insertions(+), 34 deletions(-) delete mode 100644 config/dotenv.php (limited to 'config') diff --git a/config/build.sh b/config/build.sh index 4277143..60f4ccb 100755 --- a/config/build.sh +++ b/config/build.sh @@ -4,7 +4,13 @@ # Build all Angular & React projects. ############################################################################### -# 1.0. Helpers +# 1.0. Config +############################################################################### +_ANGULAR_PROJECTS="projects/angular-small-apps" +_REACT_PROJECTS="projects/react-small-apps" + +############################################################################### +# 2.0. Helpers ############################################################################### _COLOR_RESET=$(printf '\e[0m') _COLOR_BLUE=$(printf '\e[34m') @@ -45,17 +51,17 @@ error_unexpected() { } ############################################################################### -# 2.0. Angular +# 3.0. Angular ############################################################################### install_angular_dependencies() { - if [ ! -d "./projects/angular-small-apps" ]; then + if [ ! -d "./public/${_ANGULAR_PROJECTS}" ]; then error "Angular projects are missing." printf "Exit.\n" exit 1 fi - cd "./projects/angular-small-apps" || exit + cd "./public/${_ANGULAR_PROJECTS}" || exit yarn cd "$OLDPWD" || exit } @@ -63,8 +69,8 @@ install_angular_dependencies() { build_angular_app() { [ $# -ne 1 ] && error_unexpected - cd "./projects/angular-small-apps/" || exit - yarn --cwd "apps/${1}" run build --base-href="/projects/angular-small-apps/apps/${1}/dist/${1}/" + cd "./public/${_ANGULAR_PROJECTS}" || exit + yarn --cwd "apps/${1}" run build --base-href="/${_ANGULAR_PROJECTS}/apps/${1}/dist/${1}/" info "${1} built." cd "$OLDPWD" || exit } @@ -76,17 +82,17 @@ setup_angular_projects() { } ############################################################################### -# 3.0. React +# 4.0. React ############################################################################### install_react_dependencies() { - if [ ! -d "./projects/react-small-apps" ]; then + if [ ! -d "./public/${_REACT_PROJECTS}" ]; then error "React projects are missing." printf "Exit.\n" exit 1 fi - cd "./projects/react-small-apps" || exit + cd "./public/${_REACT_PROJECTS}" || exit yarn cd "$OLDPWD" || exit } @@ -94,8 +100,8 @@ install_react_dependencies() { build_react_app() { [ $# -ne 1 ] && error_unexpected - cd "./projects/react-small-apps/" || exit - PUBLIC_URL="/projects/react-small-apps/apps/${1}/build/" yarn --cwd "apps/${1}" run build + cd "./public/${_REACT_PROJECTS}" || exit + PUBLIC_URL="/${_REACT_PROJECTS}/apps/${1}/build/" yarn --cwd "apps/${1}" run build info "${1} built." cd "$OLDPWD" || exit } @@ -109,7 +115,7 @@ setup_react_projects() { } ############################################################################### -# 4.0. Main +# 5.0. Main ############################################################################### # Check if Yarn is installed. diff --git a/config/dotenv.php b/config/dotenv.php deleted file mode 100644 index cb462d9..0000000 --- a/config/dotenv.php +++ /dev/null @@ -1,20 +0,0 @@ -safeLoad(); - $current_env = $_ENV['CURRENT_ENV']; - return $current_env; - } else { - return ''; - } -} diff --git a/config/webpack/paths.js b/config/webpack/paths.js index fd4c73f..6b85154 100644 --- a/config/webpack/paths.js +++ b/config/webpack/paths.js @@ -9,7 +9,7 @@ module.exports = { scripts: path.resolve(devFolder, './js/app.js'), style: path.resolve(devFolder, './scss/style.scss'), }, - dist: path.resolve(devFolder, '../assets/'), - files: [path.resolve(devFolder, '../**/*.php')], + dist: path.resolve(devFolder, '../public/assets/'), + files: [path.resolve(devFolder, '../public/**/*.php')], sassPaths: [path.resolve(devFolder, '../node_modules/modern-normalize/')], }; -- cgit v1.2.3