Skip to content

Commit

Permalink
Add support for php-forge/foxy manager package. (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Jan 21, 2024
1 parent 463d141 commit 2944c55
Show file tree
Hide file tree
Showing 25 changed files with 147 additions and 126 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,6 +1,6 @@
Change Log
==========

## 0.1.0 January 19, 2023
## 0.1.0 January 21, 2024

- Initial release.
27 changes: 11 additions & 16 deletions LICENSE
@@ -1,21 +1,16 @@
MIT License

Copyright (c) 2023 yii3-extensions
Copyright (c) 2024 by Wilmer Arámbula (https://github.com/terabytesoftw) All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 10 additions & 2 deletions README.md
Expand Up @@ -32,18 +32,21 @@

## Installation

This package requires [npm](https://www.npmjs.com/) for [php-forge/foxy](https://www.github.com/php-forge/foxy), which
manages the installation of npm packages and resource compilation.

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run

```shell
composer require --prefer-dist yii3-extensions/asset-fontawesome-free
composer require --prefer-dist yii3-extensions/asset-fontawesome-free:"^0.1"
```

or add

```json
"yii3-extensions/asset-fontawesome-free": "^0.1"
"yii3-extensions/asset-fontawesome-free":"^0.1"
```

## Directory structure
Expand Down Expand Up @@ -82,6 +85,11 @@ root

[Check the documentation testing](/docs/testing.md) to learn about testing.

## Support versions

[![PHP81](https://img.shields.io/badge/PHP-%3E%3D8.1-787CB5)](https://www.php.net/releases/8.1/en.php)
[![Yii30](https://img.shields.io/badge/Yii%20version-3.0-blue)](https://yiiframework.com)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
Expand Down
23 changes: 3 additions & 20 deletions composer.json
Expand Up @@ -11,8 +11,7 @@
"license": "mit",
"require": {
"php": "^8.1",
"npm-asset/fortawesome--fontawesome-free": "^6.5",
"oomphinc/composer-installers-extender": "^2.0",
"php-forge/foxy":"^0.1",
"yiisoft/assets": "^4.0",
"yiisoft/files": "^2.0"
},
Expand All @@ -22,7 +21,7 @@
"phpunit/phpunit": "^10.5",
"roave/infection-static-analysis-plugin": "^1.34",
"symplify/easy-coding-standard": "^12.1",
"vimeo/psalm": "^5.19",
"vimeo/psalm": "^5.20",
"yiisoft/aliases":"^3.0"
},
"autoload": {
Expand All @@ -36,7 +35,7 @@
"allow-plugins": {
"infection/extension-installer": true,
"composer/installers": true,
"oomphinc/composer-installers-extender": true
"php-forge/foxy": true
}
},
"extra": {
Expand All @@ -45,24 +44,8 @@
},
"config-plugin": {
"params": "yiisoft-aliases.php"
},
"installer-types": [
"bower-asset",
"npm-asset"
],
"installer-paths": {
"./node_modules/{$name}": [
"type:bower-asset",
"type:npm-asset"
]
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"scripts": {
"check-dependencies": "composer-require-checker",
"easy-coding-standard": "ecs check",
Expand Down
2 changes: 1 addition & 1 deletion config/yiisoft-aliases.php
Expand Up @@ -5,7 +5,7 @@
return [
'yiisoft/aliases' => [
'aliases' => [
'@fontawesome-free' => '@npm/fortawesome--fontawesome-free',
'@fontawesome-free' => '@npm/@fortawesome/fontawesome-free',
],
],
];
5 changes: 0 additions & 5 deletions docs/README.md
Expand Up @@ -53,8 +53,3 @@ return [
],
];
```

## Using npm packages

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.
52 changes: 23 additions & 29 deletions ecs.php
Expand Up @@ -7,41 +7,35 @@
use PhpCsFixer\Fixer\ClassNotation\OrderedTraitsFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return function (ECSConfig $ecsConfig): void {
$ecsConfig->paths(
return ECSConfig::configure()
->withConfiguredRule(
ClassDefinitionFixer::class,
[
'space_before_parenthesis' => true,
],
)
->withFileExtensions(['php'])
->withPaths(
[
__DIR__ . '/src',
__DIR__ . '/tests',
]
);

// this way you add a single rule
$ecsConfig->rules(
],
)
->withPhpCsFixerSets(perCS20: true)
->withPreparedSets(
arrays: true,
cleanCode: true,
comments:true,
docblocks: true,
namespaces: true,
psr12: true,
strict: true
)
->withRules(
[
NoUnusedImportsFixer::class,
OrderedClassElementsFixer::class,
OrderedTraitsFixer::class,
NoUnusedImportsFixer::class,
]
);

// this way you can add sets - group of rules
$ecsConfig->sets(
[
// run and fix, one by one
SetList::DOCBLOCK,
SetList::NAMESPACES,
SetList::COMMENTS,
SetList::PSR_12,
]
);

// this way configures a rule
$ecsConfig->ruleWithConfiguration(
ClassDefinitionFixer::class,
[
'space_before_parenthesis' => true,
],
);
};
14 changes: 14 additions & 0 deletions package.json
@@ -0,0 +1,14 @@
{
"name": "yii3-asset-fontawesome-free",
"version": "0.1.0",
"description": "The free and open source icon set from FortAwesome (fontawesome.com)",
"keywords": [
"yii3",
"fontawesome"
],
"author": "Wilmer Arambula <terabytesoftw@gmail.com>",
"license": "MIT",
"dependencies": {
"@fortawesome/fontawesome-free": "^6.5.0"
}
}
4 changes: 2 additions & 2 deletions tests/Css/FontAwesomeBrandCdnTest.php
Expand Up @@ -6,12 +6,12 @@

use Yii\Asset\Css\Depend\DependCdn;
use Yii\Asset\Css\FontAwesomeBrandCdn;
use Yii\Asset\Tests\Support\TestTrait;
use Yii\Asset\Tests\Support\TestSupport;
use Yiisoft\Assets\AssetBundle;

final class FontAwesomeBrandCdnTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;
use TestSupport;

public function testRegister(): void
{
Expand Down
12 changes: 8 additions & 4 deletions tests/Css/FontAwesomeBrandTest.php
Expand Up @@ -6,14 +6,14 @@

use PHPUnit\Framework\Attributes\RequiresPhp;
use Yii\Asset\Css\FontAwesomeBrand;
use Yii\Asset\Tests\Support\TestTrait;
use Yii\Asset\Tests\Support\TestSupport;
use Yiisoft\Assets\AssetBundle;

use function runkit_constant_redefine;

final class FontAwesomeBrandTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;
use TestSupport;

public function testRegister(): void
{
Expand All @@ -23,7 +23,9 @@ public function testRegister(): void

$this->assertInstanceOf(AssetBundle::class, $this->assetManager->getBundle(FontAwesomeBrand::class));
$this->assertSame(
['/55145ba9/brands.css' => ['/55145ba9/brands.css']],
[
'/55145ba9/brands.css' => ['/55145ba9/brands.css'],
],
$this->assetManager->getCssFiles()
);
$this->assertFileExists(dirname(__DIR__) . '/Support/runtime/55145ba9/brands.css');
Expand All @@ -43,7 +45,9 @@ public function testRegisterWithEnvironmentProd(): void

$this->assertInstanceOf(AssetBundle::class, $this->assetManager->getBundle(FontAwesomeBrand::class));
$this->assertSame(
['/55145ba9/brands.min.css' => ['/55145ba9/brands.min.css']],
[
'/55145ba9/brands.min.css' => ['/55145ba9/brands.min.css'],
],
$this->assetManager->getCssFiles()
);
$this->assertFileExists(dirname(__DIR__) . '/Support/runtime/55145ba9/brands.min.css');
Expand Down
4 changes: 2 additions & 2 deletions tests/Css/FontAwesomeCdnTest.php
Expand Up @@ -5,12 +5,12 @@
namespace Yii\Asset\Tests\Css;

use Yii\Asset\Css\FontAwesomeCdn;
use Yii\Asset\Tests\Support\TestTrait;
use Yii\Asset\Tests\Support\TestSupport;
use Yiisoft\Assets\AssetBundle;

final class FontAwesomeCdnTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;
use TestSupport;

public function testRegister(): void
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Css/FontAwesomeRegularCdnTest.php
Expand Up @@ -6,12 +6,12 @@

use Yii\Asset\Css\Depend\DependCdn;
use Yii\Asset\Css\FontAwesomeRegularCdn;
use Yii\Asset\Tests\Support\TestTrait;
use Yii\Asset\Tests\Support\TestSupport;
use Yiisoft\Assets\AssetBundle;

final class FontAwesomeRegularCdnTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;
use TestSupport;

public function testRegister(): void
{
Expand Down
12 changes: 8 additions & 4 deletions tests/Css/FontAwesomeRegularTest.php
Expand Up @@ -6,14 +6,14 @@

use PHPUnit\Framework\Attributes\RequiresPhp;
use Yii\Asset\Css\FontAwesomeRegular;
use Yii\Asset\Tests\Support\TestTrait;
use Yii\Asset\Tests\Support\TestSupport;
use Yiisoft\Assets\AssetBundle;

use function runkit_constant_redefine;

final class FontAwesomeRegularTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;
use TestSupport;

public function testRegister(): void
{
Expand All @@ -23,7 +23,9 @@ public function testRegister(): void

$this->assertInstanceOf(AssetBundle::class, $this->assetManager->getBundle(FontAwesomeRegular::class));
$this->assertSame(
['/55145ba9/regular.css' => ['/55145ba9/regular.css']],
[
'/55145ba9/regular.css' => ['/55145ba9/regular.css'],
],
$this->assetManager->getCssFiles()
);
$this->assertFileExists(dirname(__DIR__) . '/Support/runtime/55145ba9/regular.css');
Expand All @@ -43,7 +45,9 @@ public function testRegisterWithEnvironmentProd(): void

$this->assertInstanceOf(AssetBundle::class, $this->assetManager->getBundle(FontAwesomeRegular::class));
$this->assertSame(
['/55145ba9/regular.min.css' => ['/55145ba9/regular.min.css']],
[
'/55145ba9/regular.min.css' => ['/55145ba9/regular.min.css'],
],
$this->assetManager->getCssFiles()
);
$this->assertFileExists(dirname(__DIR__) . '/Support/runtime/55145ba9/regular.min.css');
Expand Down
4 changes: 2 additions & 2 deletions tests/Css/FontAwesomeSolidCdnTest.php
Expand Up @@ -6,12 +6,12 @@

use Yii\Asset\Css\Depend\DependCdn;
use Yii\Asset\Css\FontAwesomeSolidCdn;
use Yii\Asset\Tests\Support\TestTrait;
use Yii\Asset\Tests\Support\TestSupport;
use Yiisoft\Assets\AssetBundle;

final class FontAwesomeSolidCdnTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;
use TestSupport;

public function testRegister(): void
{
Expand Down

0 comments on commit 2944c55

Please sign in to comment.