Skip to content

Commit

Permalink
Clean all code. (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed May 19, 2023
1 parent 98ddb2f commit fe3f02f
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 127 deletions.
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
preset: psr12
risky: true

version: 8.1
version: 8.2

finder:
exclude:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ composer require yii-tools/flowbite-asset

## Usage

[Check the documentation docs](/docs/install.md) to learn about usage.
[Check the documentation docs](/docs/README.md) to learn about usage.

## Testing

Expand Down
8 changes: 6 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
Change Log
==========
Flowbite Asset Change Log
=========================

## 1.0.0 May 19, 2023

- Initial release.
16 changes: 6 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,26 @@
"require": {
"php": "^8.1",
"foxy/foxy": "^1.2",
"yii-tools/tailwind-asset": "^1.0@dev",
"yii-tools/tailwind-asset": "^1.0",
"yiisoft/assets": "^4.0",
"yiisoft/files": "^2.0"
},
"require-dev": {
"infection/infection": "^0.27",
"maglnet/composer-require-checker": "^4.3",
"phpunit/phpunit": "^10.0",
"roave/infection-static-analysis-plugin": "^1.28",
"phpunit/phpunit": "^10.1",
"roave/infection-static-analysis-plugin": "^1.31",
"vimeo/psalm": "^5.8",
"yii-tools/support": "^1.0@dev"
},
"autoload": {
"psr-4": {
"Yii\\Flowbite\\Asset\\": "src"
"Yii\\Assets\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Yii\\Flowbite\\Asset\\Tests\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-main": "1.0.x-dev"
"Yii\\Assets\\Tests\\": "tests"
}
},
"config": {
Expand Down
13 changes: 7 additions & 6 deletions docs/install.md → docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Using assets
# Using assets

Assets are files that are not processed by Webpack. They are copied directly to the output folder. This includes images, fonts, and any other files that you want to use in your project.

Expand All @@ -13,14 +13,14 @@ file: ./resources/views/layout/main.php

declare(strict_types=1);

use Yii\Flowbite\Asset\FlowbiteDevAsset;
use Yii\Assets\FlowbiteDev;

/**
* @var \Yiisoft\Assets\AssetManager $assetManager
*/

// Register the asset bundle with a asset manager component.
$assetManager->register(FlowbiteDevAsset::class);
$assetManager->register(FlowbiteDev::class);

// Set parameters for the registered asset bundle a view component.
$this->addCssFiles($assetManager->getCssFiles());
Expand All @@ -39,13 +39,13 @@ file: ./config/params.php

declare(strict_types=1);

use Yii\Flowbite\Asset\FlowbiteCdnAsset;
use Yii\Assets\FlowbiteCdn;

return [
'yiisoft/assets' => [
'assetManager' => [
'register' => [
FlowbiteCdnAsset::class,
FlowbiteCdn::class,
],
],
],
Expand All @@ -54,4 +54,5 @@ return [

## Using npm packages

[npm](https://www.npmjs.com/) packages are installed via [fxpio/foxy](https://github.com/fxpio/foxy) and are available in the `node_modules` directory.
You can install [npm](https://www.npmjs.com/) packages [fxpio/foxy](https://github.com/fxpio/foxy),
and they will be available in the `node_modules` directory.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "flowbite-asset",
"version": "1.0.0",
"dependencies": {
"flowbite": "^1.6.4"
"flowbite": "^1.6.5"
},
"license": "mit"
}
16 changes: 8 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache">
<php>
<ini name="error_reporting" value="-1"/>
</php>
<coverage>
<testsuites>
<testsuite name="Flowbite-Asset">
<directory>./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src</directory>
</include>
<exclude>
<directory>./vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Template">
<directory>./tests</directory>
</testsuite>
</testsuites>
</source>
</phpunit>
7 changes: 3 additions & 4 deletions src/FlowbiteCdnAsset.php → src/FlowbiteCdn.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset;
namespace Yii\Assets;

use Yiisoft\Assets\AssetBundle;
use Yii\Tailwind\Asset\TailwindCdnAsset;

final class FlowbiteCdnAsset extends AssetBundle
final class FlowbiteCdn extends AssetBundle
{
public bool $cdn = true;
public array $css = ['https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.4/flowbite.min.css'];
public array $js = ['https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.4/flowbite.min.js'];
public array $depends = [TailwindCdnAsset::class];
public array $depends = [TailwindCdn::class];
}
28 changes: 0 additions & 28 deletions src/FlowbiteDarkDevAsset.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/FlowbiteDarkProdAsset.php

This file was deleted.

7 changes: 3 additions & 4 deletions src/FlowbiteDevAsset.php → src/FlowbiteDev.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset;
namespace Yii\Assets;

use Yii\Tailwind\Asset\TailwindDevAsset;
use Yiisoft\Assets\AssetBundle;
use Yiisoft\Files\PathMatcher\PathMatcher;

final class FlowbiteDevAsset extends AssetBundle
final class FlowbiteDev extends AssetBundle
{
public string|null $basePath = '@assets';
public string|null $baseUrl = '@assetsUrl';
public string|null $sourcePath = '@npm/flowbite';
public array $css = ['dist/flowbite.css'];
public array $js = ['dist/flowbite.js'];
public array $depends = [TailwindDevAsset::class];
public array $depends = [TailwindDev::class];

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/FlowbiteJsCdnAsset.php → src/FlowbiteJsCdn.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset;
namespace Yii\Assets;

use Yiisoft\Assets\AssetBundle;

final class FlowbiteJsCdnAsset extends AssetBundle
final class FlowbiteJsCdn extends AssetBundle
{
public bool $cdn = true;
public array $js = ['https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.4/flowbite.min.js'];
Expand Down
4 changes: 2 additions & 2 deletions src/FlowbiteJsDevAsset.php → src/FlowbiteJsDev.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset;
namespace Yii\Assets;

use Yiisoft\Assets\AssetBundle;
use Yiisoft\Files\PathMatcher\PathMatcher;

final class FlowbiteJsDevAsset extends AssetBundle
final class FlowbiteJsDev extends AssetBundle
{
public string|null $basePath = '@assets';
public string|null $baseUrl = '@assetsUrl';
Expand Down
4 changes: 2 additions & 2 deletions src/FlowbiteJsProdAsset.php → src/FlowbiteJsProd.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset;
namespace Yii\Assets;

use Yiisoft\Assets\AssetBundle;
use Yiisoft\Files\PathMatcher\PathMatcher;

final class FlowbiteJsProdAsset extends AssetBundle
final class FlowbiteJsProd extends AssetBundle
{
public string|null $basePath = '@assets';
public string|null $baseUrl = '@assetsUrl';
Expand Down
7 changes: 3 additions & 4 deletions src/FlowbiteProdAsset.php → src/FlowbiteProd.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset;
namespace Yii\Assets;

use Yii\Tailwind\Asset\TailwindProdAsset;
use Yiisoft\Assets\AssetBundle;
use Yiisoft\Files\PathMatcher\PathMatcher;

final class FlowbiteProdAsset extends AssetBundle
final class FlowbiteProd extends AssetBundle
{
public string|null $basePath = '@assets';
public string|null $baseUrl = '@assetsUrl';
public string|null $sourcePath = '@npm/flowbite';
public array $css = ['dist/flowbite.min.css'];
public array $js = ['dist/flowbite.min.js'];
public array $depends = [TailwindProdAsset::class];
public array $depends = [TailwindProd::class];

public function __construct()
{
Expand Down
6 changes: 3 additions & 3 deletions tests/CdnAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset\Tests;
namespace Yii\Assets\Tests;

use PHPUnit\Framework\TestCase;
use Yii\Flowbite\Asset\Tests\Support\TestTrait;
use Yii\Assets\Tests\Support\TestTrait;
use Yiisoft\Assets\Exception\InvalidConfigException;

/**
Expand All @@ -16,7 +16,7 @@ final class CdnAssetTest extends TestCase
use TestTrait;

/**
* @dataProvider \Yii\Flowbite\Asset\Tests\Provider\CdnAssetProvider::assetBundles
* @dataProvider \Yii\Assets\Tests\Provider\CdnAssetProvider::assetBundles
*
* @psalm-suppress InvalidStringClass
* @psalm-suppress MixedArrayOffset
Expand Down
6 changes: 3 additions & 3 deletions tests/NpmAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset\Tests;
namespace Yii\Assets\Tests;

use PHPUnit\Framework\TestCase;
use Yii\Flowbite\Asset\Tests\Support\TestTrait;
use Yii\Assets\Tests\Support\TestTrait;
use Yiisoft\Assets\Exception\InvalidConfigException;
use Yiisoft\Files\PathMatcher\PathMatcher;

Expand All @@ -17,7 +17,7 @@ final class NpmAssetTest extends TestCase
use TestTrait;

/**
* @dataProvider \Yii\Flowbite\Asset\Tests\Provider\NpmAssetProvider::assetBundles
* @dataProvider \Yii\Assets\Tests\Provider\NpmAssetProvider::assetBundles
*
* @throws InvalidConfigException
*
Expand Down
10 changes: 5 additions & 5 deletions tests/Provider/CdnAssetProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Yii\Flowbite\Asset\Tests\Provider;
namespace Yii\Assets\Tests\Provider;

use Yii\Flowbite\Asset;
use Yii\Assets;

final class CdnAssetProvider
{
Expand All @@ -14,9 +14,9 @@ final class CdnAssetProvider
public static function assetBundles(): array
{
return [
['Css', Asset\FlowbiteCdnAsset::class],
['Js', Asset\FlowbiteCdnAsset::class],
['Js', Asset\FlowbiteJsCdnAsset::class],
['Css', Assets\FlowbiteCdn::class],
['Js', Assets\FlowbiteCdn::class],
['Js', Assets\FlowbiteJsCdn::class],
];
}
}

0 comments on commit fe3f02f

Please sign in to comment.