Skip to content

Commit eec087d

Browse files
committed
Add support for Windows systems in the download command
1 parent 2f1bdcd commit eec087d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

config/tailwindcss.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
| Use the `tailwindcss:download` Artisan command to ensure the binary is there.
2828
|
2929
*/
30-
'bin_path' => base_path('tailwindcss'),
30+
'bin_path' => PHP_OS === 'WINNT' ? base_path('tailwindcss.exe') : base_path('tailwindcss'),
3131

3232
/*
3333
|---------------------------------------------------------------------

src/Commands/DownloadCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88

99
class DownloadCommand extends Command
1010
{
11-
protected $signature = 'tailwindcss:download {--force : If the file already exists, we will not touch it. Use this flag if you want to replace it with a new version.}';
11+
protected $signature = 'tailwindcss:download
12+
{--force : If the file already exists, we will not touch it. Use this flag if you want to replace it with a new version.}
13+
{--timeout=600 : Timeout in seconds. Defaults to 5 mins (600s).}
14+
';
15+
1216
protected $description = 'Downloads the Tailwind CSS binary for the version specified in your config/tailwindcss.php.';
1317

1418
public function handle()
@@ -21,6 +25,7 @@ public function handle()
2125
'Linux-aarch64' => 'tailwindcss-linux-arm64',
2226
'Darwin-arm64' => 'tailwindcss-macos-arm64',
2327
'Darwin-x86_64' => 'tailwindcss-macos-x64',
28+
'Windows NT-AMD64' => 'tailwindcss-windows-x64.exe',
2429
];
2530

2631
if (! $targetArchitecture = ($architectureToBinary["{$os}-{$cpu}"] ?? false)) {
@@ -40,7 +45,8 @@ public function handle()
4045

4146
$this->info(sprintf('Downloading the Tailwind CSS binary (%s/%s/%s)...', $os, $cpu, $targetVersion));
4247

43-
$contents = Http::get($this->downloadUrl($targetArchitecture, $targetVersion))
48+
$contents = Http::timeout($this->option('timeout'))
49+
->get($this->downloadUrl($targetArchitecture, $targetVersion))
4450
->throw()
4551
->body();
4652

0 commit comments

Comments
 (0)