Skip to content

Commit b9c6ccf

Browse files
committed
wip: bundle cached services?
1 parent 3535d22 commit b9c6ccf

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/Commands/BundleCommand.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public function handle(): int
103103
intro('Pruning vendor directory');
104104
$this->pruneVendorDirectory();
105105

106+
$this->cleanEnvFile();
107+
106108
// Check composer.json for symlinked or private packages
107109
if (! $this->checkComposerJson()) {
108110
return static::FAILURE;
@@ -145,8 +147,6 @@ private function zipApplication(): bool
145147
return false;
146148
}
147149

148-
$this->cleanEnvFile();
149-
150150
$this->addFilesToZip($zip);
151151

152152
$zip->close();
@@ -184,11 +184,13 @@ private function checkComposerJson(): bool
184184
$this->newLine();
185185
intro('Patching composer.json in development mode…');
186186

187-
$filteredRepo = array_filter($composerJson['repositories'], fn ($repository) => $repository['type'] !== 'path');
187+
$filteredRepo = array_filter($composerJson['repositories'],
188+
fn ($repository) => $repository['type'] !== 'path');
188189

189190
if (count($filteredRepo) !== count($composerJson['repositories'])) {
190191
$composerJson['repositories'] = $filteredRepo;
191-
file_put_contents($this->buildPath('composer.json'), json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
192+
file_put_contents($this->buildPath('composer.json'),
193+
json_encode($composerJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
192194

193195
Process::path($this->buildPath())
194196
->run('composer update --no-dev', function (string $type, string $output) {
@@ -218,7 +220,7 @@ private function addFilesToZip(ZipArchive $zip): void
218220
$this->newLine();
219221
intro('Creating zip archive…');
220222

221-
$app = (new Finder)->files()
223+
$finder = (new Finder)->files()
222224
->followLinks()
223225
->ignoreVCSIgnored(true)
224226
->in($this->buildPath())
@@ -232,16 +234,15 @@ private function addFilesToZip(ZipArchive $zip): void
232234
'build', // Compiled box assets
233235
'temp', // Temp files
234236
'tests', // Tests
237+
])
238+
->exclude(config('nativephp.cleanup_exclude_files', []));
235239

236-
// TODO: include everything in the .gitignore file
237-
238-
...config('nativephp.cleanup_exclude_files', []), // User defined
239-
]);
240-
241-
$this->finderToZip($app, $zip);
240+
$this->finderToZip($finder, $zip);
242241

243-
// Add .env file manually because Finder ignores hidden files
242+
// Add .env file manually because Finder ignores VSC ignored files
244243
$zip->addFile($this->buildPath('.env'), '.env');
244+
$zip->addFile($this->buildPath('bootstrap/cache/services.php'), 'bootstrap/cache/services.php');
245+
$zip->addFile($this->buildPath('bootstrap/cache/packages.php'), 'bootstrap/cache/packages.php');
245246

246247
// Add auth.json file to support private packages
247248
// WARNING: Only for testing purposes, don't uncomment this

0 commit comments

Comments
 (0)