Skip to content

Commit a74ee11

Browse files
committed
Refactored the package description and fixed some typos in the README.md file. Updated the composer.json file to correct the package description. Modified the TailwindCssCommand.php file to add an option to force overwrite existing files without prompting for confirmation.
1 parent 2ba4b89 commit a74ee11

File tree

4 files changed

+47
-24
lines changed

4 files changed

+47
-24
lines changed

.gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,25 @@ phpstan.neon
99
testbench.yaml
1010
vendor
1111
node_modules
12+
/.phpunit.cache
13+
/node_modules
14+
/public/hot
15+
/public/storage
16+
/storage/*.key
17+
/vendor
18+
.env
19+
.env.backup
20+
.env.production
21+
.phpunit.result.cache
22+
Homestead.json
23+
Homestead.yaml
24+
auth.json
25+
npm-debug.log
26+
yarn-error.log
27+
/.fleet
28+
/.idea
29+
/.vscode
30+
.user.ini
31+
php.ini
32+
error_log
33+
.DS_Store

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/fuelviews/laravel-tailwindcss.svg?style=flat-square)](https://packagist.org/packages/fuelviews/laravel-tailwindcss)
44
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/fuelviews/laravel-tailwindcss/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/fuelviews/laravel-tailwindcss/actions?query=workflow%3Arun-tests+branch%3Amain)
5-
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/fuelviews/laravel-tailwindcss/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/fuelviews/laravel-tailwindcss/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
5+
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/fuelviews/laravel-tailwindcss/fix-php-code-style-issues.yml?label=code%20style&style=flat-square)](https://github.com/fuelviews/laravel-tailwindcss/actions?query=workflow%3A"Fix+PHP+code+style+issues")
66
[![Total Downloads](https://img.shields.io/packagist/dt/fuelviews/laravel-tailwindcss.svg?style=flat-square)](https://packagist.org/packages/fuelviews/laravel-tailwindcss)
77

8-
Laravel TailwindCSS package offers an effortless solution for integrating the TailwindCSS framework into Laravel projects, enhancing front-end development with its utility-first CSS approach.
8+
Laravel tailwindcss package offers an effortless solution for integrating the tailwindcss css framework into Laravel projects.
99

1010
## Installation
1111

@@ -43,7 +43,7 @@ Please review [our security policy](../../security/policy) on how to report secu
4343

4444
- [Thejmitchener](https://github.com/thejmitchener)
4545
- [Fuelviews](https://github.com/fuelviews)
46-
- [Tailwind](https://github.com/tailwindlabs/tailwindcss)
46+
- [Tailwindcss](https://github.com/tailwindlabs/tailwindcss)
4747
- [All Contributors](../../contributors)
4848

4949
## Support us

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fuelviews/laravel-tailwindcss",
3-
"description": "Fuelviews laravel tailwindcss package",
3+
"description": "Laravel tailwindcss package",
44
"keywords": [
55
"fuelviews",
66
"laravel",
@@ -16,13 +16,13 @@
1616
{
1717
"name": "Joshua Mitchener",
1818
"email": "[email protected]",
19+
"homepage": "https://fuelviews.com",
1920
"role": "Developer"
2021
}
2122
],
2223
"require": {
2324
"php": "^8.2",
24-
"spatie/laravel-package-tools": "^1.16",
25-
"laravel/prompts": "^0.1.16"
25+
"spatie/laravel-package-tools": "^1.16"
2626
},
2727
"require-dev": {
2828
"laravel/pint": "^1.14",

src/Commands/TailwindCssCommand.php

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
/** @noinspection ALL */
4-
53
namespace Fuelviews\Tailwindcss\Commands;
64

75
use Illuminate\Console\Command;
@@ -10,11 +8,9 @@
108
use Symfony\Component\Process\Exception\ProcessFailedException;
119
use Symfony\Component\Process\Process;
1210

13-
use function Laravel\Prompts\confirm;
14-
1511
class TailwindCssCommand extends Command
1612
{
17-
public $signature = 'tailwindcss:install';
13+
public $signature = 'tailwindcss:install {--force : Overwrite existing files without prompting for confirmation}';
1814

1915
public $description = 'Install tailwindcss, postcss, and dependencies';
2016

@@ -30,9 +26,11 @@ class TailwindCssCommand extends Command
3026
*/
3127
public function handle(): int
3228
{
33-
$this->publishConfig('tailwind.config.js');
34-
$this->publishConfig('postcss.config.js');
35-
$this->publishAppCss();
29+
$force = $this->option('force');
30+
31+
$this->publishConfig('tailwind.config.js', $force);
32+
$this->publishConfig('postcss.config.js', $force);
33+
$this->publishAppCss($force);
3634

3735
$devDependencies = [
3836
'@tailwindcss/forms',
@@ -49,33 +47,36 @@ public function handle(): int
4947

5048
/**
5149
* Publishes a configuration file from the package's stubs to the project base path.
52-
* If the file already exists, it prompts the user for permission to overwrite.
50+
* If the file already exists, it checks for the --force flag to overwrite.
5351
*
5452
* @param string $configFileName The name of the config file to publish.
53+
* @param bool $force Whether to force overwrite existing files.
5554
*/
56-
protected function publishConfig(string $configFileName): void
55+
protected function publishConfig(string $configFileName, bool $force): void
5756
{
5857
$stubPath = __DIR__."/../../resources/$configFileName.stub";
5958
$destinationPath = base_path($configFileName);
6059

6160
if (File::exists($destinationPath)) {
62-
if (confirm("$configFileName already exists. Do you want to overwrite it?", false)) {
61+
if ($force) {
6362
File::copy($stubPath, $destinationPath);
6463
$this->info("$configFileName has been overwritten successfully.");
6564
} else {
66-
$this->warn("Skipping $configFileName installation.");
65+
$this->warn("Skipping $configFileName installation because it already exists.");
6766
}
68-
} elseif (confirm("$configFileName does not exist. Would you like to install it now?", true)) {
67+
} else {
6968
File::copy($stubPath, $destinationPath);
7069
$this->info("$configFileName has been installed successfully.");
7170
}
7271
}
7372

7473
/**
7574
* Publishes the application's main CSS file from the package's stubs to the Laravel resource path.
76-
* If the CSS file already exists, it prompts the user for permission to overwrite.
75+
* If the CSS file already exists, it checks for the --force flag to overwrite.
76+
*
77+
* @param bool $force Whether to force overwrite existing files.
7778
*/
78-
protected function publishAppCss(): void
79+
protected function publishAppCss(bool $force): void
7980
{
8081
$stubPath = __DIR__.'/../../resources/css/app.css.stub';
8182
$destinationPath = resource_path('css/app.css');
@@ -85,13 +86,13 @@ protected function publishAppCss(): void
8586
}
8687

8788
if (File::exists($destinationPath)) {
88-
if (confirm('css/app.css file already exists. Do you want to overwrite it?', false)) {
89+
if ($force) {
8990
File::copy($stubPath, $destinationPath);
9091
$this->info('css/app.css file has been overwritten successfully.');
9192
} else {
92-
$this->warn('Skipping css/app.css installation.');
93+
$this->warn('Skipping css/app.css installation because it already exists.');
9394
}
94-
} elseif (confirm('css/app.css file does not exist. Would you like to install it now?', true)) {
95+
} else {
9596
File::copy($stubPath, $destinationPath);
9697
$this->info('css/app.css file has been installed successfully.');
9798
}

0 commit comments

Comments
 (0)