box-project / box

📦🚀 Fast, zero config application bundler with PHARs.
https://box-project.github.io/box
MIT License
1.12k stars 101 forks source link

How to include root `composer.json`? #1399

Closed simonhamp closed 1 month ago

simonhamp commented 1 month ago

Bug report

Question Answer
Box version 4.6.2@29c3585
PHP version 8.3.9
Platform with version MacOS 14.5 (23F79)
Github Repo -

I have tried various methods to make the composer.json file be included in the final output, but it's never being copied into the PHAR. Here's the different configs I've tried, both individually and in concert with each other:

"files": ["composer.json"],

"files-bin": ["composer.json"],

"finder": [
    {
        "name": "composer.json",
        "in": ".",
        "depth": "== 0"
    },
]
box.json.dist ```json { "chmod": "0700", "shebang": false, "check-requirements": false, "main": "public/index.php", "intercept": true, "directories": ["app", "bootstrap", "config", "database", "resources/views", "routes"], "directories-bin": ["public", "resources/css", "resources/images", "resources/js"], "files": ["composer.json", "composer.lock"], "files-bin": ["artisan", ".env", "composer.json", "composer.lock"], "finder": [ { "name": "composer.json", "in": ".", "depth": "== 0" }, { "notName": ["LICENSE","*.md","*.dist", "Makefile"], "exclude": [ "doc", "docs", "test", "test_old", "tests", "Tests", "bin", "nativephp/php-bin", "nativephp/electron/resources" ], "in": "vendor" }, { "notName": "*.sqlite", "in": "database" } ], "git-version": "package_version", "output": "build/nativephp.phar", "compression": "GZ", "compactors": [ "KevinGH\\Box\\Compactor\\Php", "KevinGH\\Box\\Compactor\\Json", "KevinGH\\Box\\Compactor\\RealPathMod" ], "exclude-dev-files": false } ```
Output ```bash $ box compile > [warning] Restarted (68 ms). The Xdebug extension is loaded (3.3.1) xdebug.mode=coverage,debug ____ / __ )____ _ __ / __ / __ \| |/_/ / /_/ / /_/ /> < /_____/\____/_/|_| Box version 4.6.2@29c3585 // Loading the configuration file "/Users/simonhamp/Projects/cronikl/box.json". 🔨 Building the PHAR "/Users/simonhamp/Projects/cronikl/build/nativephp.phar" ? Removing the existing PHAR "/Users/simonhamp/Projects/cronikl/build/nativephp.phar" ? Checking Composer compatibility > Supported version detected ? Setting replacement values + @package_version@: 1.0.0-12-g0338f99 ? Registering compactors + KevinGH\Box\Compactor\Php + KevinGH\Box\Compactor\Json + KevinGH\Box\Compactor\RealPathMod ? Adding main file: /Users/simonhamp/Projects/cronikl/public/index.php ? Skip requirements checker ? Adding binary files > 18 file(s) ? Auto-discover files? No ? Exclude dev files? No ? Adding files > 8033 file(s) ? Generating new stub - No shebang line - Using banner: > Generated by Humbug Box 4.6.2@29c3585. > > @link https://github.com/humbug/box ? Dumping the Composer autoloader ? Removing the Composer dump artefacts ? Compressing with the algorithm "GZ" > Warning: the extension "zlib" will now be required to execute the PHAR ? Setting file permissions to 0700 * Done. No recommendation found. No warning found. // PHAR: 8048 files (25.00MB) // You can inspect the generated PHAR with the "info" command. // Memory usage: 74.90MB (peak: 77.30MB), time: 20secs ```
simonhamp commented 1 month ago

Sorry, answered my own question... I just found the exclude-composer-files defaults to true.