Skip to content

Commit 2d4a27b

Browse files
committed
alternative way to support private packages
1 parent 26477cd commit 2d4a27b

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/Commands/BundleCommand.php

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,30 @@ private function checkComposerJson(): bool
121121
$this->error('Symlinked packages are not supported. Please remove them from your composer.json.');
122122

123123
return false;
124-
} elseif ($repository['type'] === 'composer') {
125-
if (! $this->checkComposerPackageAuth($repository['url'])) {
126-
$this->error('Cannot authenticate with '.$repository['url'].'.');
127-
$this->error('Go to '.$this->baseUrl().' and add your credentials for '.$repository['url'].'.');
128-
129-
return false;
130-
}
131124
}
125+
// elseif ($repository['type'] === 'composer') {
126+
// if (! $this->checkComposerPackageAuth($repository['url'])) {
127+
// $this->error('Cannot authenticate with '.$repository['url'].'.');
128+
// $this->error('Go to '.$this->baseUrl().' and add your composer package credentials.');
129+
//
130+
// return false;
131+
// }
132+
// }
132133
}
133134

134135
return true;
135136
}
136137

137-
private function checkComposerPackageAuth(string $repositoryUrl): bool
138-
{
139-
$host = parse_url($repositoryUrl, PHP_URL_HOST);
140-
$this->line('Checking '.$host.' authentication…');
141-
142-
return Http::acceptJson()
143-
->withToken(config('nativephp-internal.zephpyr.token'))
144-
->get($this->baseUrl().'api/v1/project/'.$this->key.'/composer/auth/'.$host)
145-
->successful();
146-
}
138+
// private function checkComposerPackageAuth(string $repositoryUrl): bool
139+
// {
140+
// $host = parse_url($repositoryUrl, PHP_URL_HOST);
141+
// $this->line('Checking '.$host.' authentication…');
142+
//
143+
// return Http::acceptJson()
144+
// ->withToken(config('nativephp-internal.zephpyr.token'))
145+
// ->get($this->baseUrl().'api/v1/project/'.$this->key.'/composer/auth/'.$host)
146+
// ->successful();
147+
// }
147148

148149
private function addFilesToZip(ZipArchive $zip): void
149150
{
@@ -165,9 +166,12 @@ private function addFilesToZip(ZipArchive $zip): void
165166

166167
$this->finderToZip($app, $zip);
167168

168-
// Add .env file
169+
// Add .env file manually because Finder ignores hidden files
169170
$zip->addFile(base_path('.env'), '.env');
170171

172+
// Add auth.json file to support private packages
173+
$zip->addFile(base_path('auth.json'), 'auth.json');
174+
171175
// Custom binaries
172176
$binaryPath = Str::replaceStart(base_path('vendor'), '', config('nativephp.binary_path'));
173177

0 commit comments

Comments
 (0)