From b1e1ab63c4cc8e30988ef859ae1d92306d0afa17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lourseau?= Date: Sat, 9 Mar 2024 10:10:44 +0100 Subject: [PATCH] Repack - Add local box.json support --- .gitignore | 1 + src/Console/Command/RepackCommand.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 5a685f78..1570f015 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /.castor.stub.php /.php-cs-fixer.cache /.phpunit.cache +/box.json /castor.* /my-app.* /var/ diff --git a/src/Console/Command/RepackCommand.php b/src/Console/Command/RepackCommand.php index 9018ee29..52a19aad 100644 --- a/src/Console/Command/RepackCommand.php +++ b/src/Console/Command/RepackCommand.php @@ -74,6 +74,14 @@ class RepackedApplication extends Application PHP; $boxConfig = json_decode((string) file_get_contents($boxConfigFile), true, 512, \JSON_THROW_ON_ERROR); + + if (file_exists($localBoxConfigFile = $castorSourceDir . '/box.json')) { + $boxConfig = array_merge_recursive( + json_decode((string) file_get_contents($localBoxConfigFile), true, 512, \JSON_THROW_ON_ERROR), + $boxConfig, + ); + } + $boxConfig['base-path'] = '.'; $boxConfig['main'] = '.main.php'; $boxConfig['alias'] = $alias;