Skip to content

Commit

Permalink
Prepare first release.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Feb 28, 2024
1 parent f0d11f0 commit 437ecc0
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 45 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'

push:
branches: ['main']
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'

name: ecs

jobs:
easy-coding-standard:
uses: php-forge/actions/.github/workflows/ecs.yml@main
secrets:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
7 changes: 4 additions & 3 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ enabled:
- combine_nested_dirname
- declare_strict_types
- dir_constant
- empty_loop_body_braces
- fully_qualified_strict_types
- function_to_constant
- hash_to_slash_comment
- integer_literal_case
- is_null
- logical_operators
- magic_constant_casing
Expand Down Expand Up @@ -56,7 +58,6 @@ enabled:
- phpdoc_order
- phpdoc_property
- phpdoc_scalar
- phpdoc_separation
- phpdoc_singular_inheritdoc
- phpdoc_trim
- phpdoc_trim_consecutive_blank_line_separation
Expand All @@ -78,9 +79,9 @@ enabled:
- trailing_comma_in_multiline_array
- unalign_double_arrow
- unalign_equals
- empty_loop_body_braces
- integer_literal_case
- union_type_without_spaces

disabled:
- function_declaration
- psr12_braces
- psr12_class_definition
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log

## 0.1.0 February 28, 2024

- Initial release
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ The preferred way to install this extension is through [composer](https://getcom

Either run

```
composer require --dev --prefer-dist yii2-extensions/asset-popper
```shell
composer require --prefer-dist yii2-extensions/asset-popper:^0.1
```

or add

```
"yii2-extensions/asset-popper": "dev-main"
```json
"yii2-extensions/asset-popper": "^0.1"
```

to the require-dev section of your `composer.json` file.
to the require section of your `composer.json` file.

## Basic usage

Expand Down Expand Up @@ -79,12 +79,12 @@ PopperCdnAsset::register($this);

## Testing

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

## Our social networks

[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/Terabytesoftw)

## License

The MIT License. Please see [License File](LICENSE.md) for more information.
The MIT License. Please see [License File](LICENSE) for more information.
2 changes: 0 additions & 2 deletions changelog.md

This file was deleted.

34 changes: 12 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
"popper"
],
"license": "mit",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"npm-asset/popperjs--core": "^2.11",
"oomphinc/composer-installers-extender": "^2.0",
"yiisoft/yii2": "*"
"yiisoft/yii2": "^2.0.49 || ^2.2"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.6",
"php-forge/support": "dev-main",
"phpunit/phpunit": "^10.2",
"roave/infection-static-analysis-plugin": "^1.32",
"yii2-extensions/phpstan": "dev-main"
"maglnet/composer-require-checker": "^4.7",
"php-forge/support": "^0.1",
"phpunit/phpunit": "^10.5",
"roave/infection-static-analysis-plugin": "^1.34",
"symplify/easy-coding-standard": "^12.1",
"yii2-extensions/phpstan": "^0.1"
},
"autoload": {
"psr-4": {
Expand All @@ -35,30 +33,22 @@
},
"extra": {
"branch-alias": {
"dev-main": "1.0.x-dev"
},
"installer-types": [
"bower-asset",
"npm-asset"
],
"installer-paths": {
"./node_modules/{$name}": [
"type:bower-asset",
"type:npm-asset"
]
"dev-main": "0.1-dev"
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"composer/installers": true,
"yiisoft/yii2-composer": true,
"infection/extension-installer": true,
"composer/installers": true,
"oomphinc/composer-installers-extender": true
"oomphinc/composer-installers-extender": false
}
},
"scripts": {

"check-dependencies": "composer-require-checker",
"ecs": "ecs check",
"mutation": "roave-infection-static-analysis-plugin",
"phpstan": "phpstan",
"test": "phpunit"
Expand Down
17 changes: 17 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ To run the checker, execute the following command:
composer run check-dependencies
```

## Easy coding standard

The code is checked with [Easy Coding Standard](https://github.com/easy-coding-standard/easy-coding-standard) and
[PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer). To run it:

```shell
composer run ecs
```

## Mutation testing

Mutation testing is checked with [Infection](https://infection.github.io/). To run it:

```shell
composer run mutation
```

## Static analysis

The code is statically analyzed with [Phpstan](https://phpstan.org/). To run static analysis:
Expand Down
39 changes: 39 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer;
use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer;
use PhpCsFixer\Fixer\ClassNotation\OrderedTraitsFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withConfiguredRule(
ClassDefinitionFixer::class,
[
'space_before_parenthesis' => true,
],
)
->withFileExtensions(['php'])
->withPaths(
[
__DIR__ . '/src',
__DIR__ . '/tests',
],
)
->withPhpCsFixerSets(perCS20: true)
->withPreparedSets(
cleanCode: true,
comments:true,
docblocks: true,
namespaces: true,
psr12: true
)
->withRules(
[
NoUnusedImportsFixer::class,
OrderedClassElementsFixer::class,
OrderedTraitsFixer::class,
]
);
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ parameters:
- vendor/yiisoft/yii2/Yii.php

yii2:
config_path: %currentWorkingDirectory%/phpstan-yii-config.php
config_path: %currentWorkingDirectory%/phpstan-config.php

File renamed without changes.
3 changes: 0 additions & 3 deletions src/PopperAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
*/
final class PopperAsset extends AssetBundle
{
/**
* @inheritDoc
*/
public $sourcePath = '@npm/popperjs--core/dist/umd';

public function init(): void
Expand Down
4 changes: 0 additions & 4 deletions src/PopperCdnAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@
final class PopperCdnAsset extends AssetBundle
{
/**
* @inheritDoc
*
* @phpstan-var array<array-key, mixed>
*/
public $js = [
'https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js',
];

/**
* @inheritDoc
*
* @phpstan-var array<array-key, mixed>
*/
public $jsOptions = [
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/main.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
/* @var $this \yii\web\View */
/** @var \yii\web\View $this */
?>
<?php $this->beginPage();?>1<?php $this->head();?>2<?php $this->beginBody();?>3<?php $this->endBody();?>4<?php $this->endPage();
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ protected function mockWebApplication(): void
'id' => 'testapp',
'aliases' => [
'@app' => dirname(__DIR__),
'@bower' => '@app/node_modules',
'@npm' => '@app/node_modules',
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
'@public' => '@app/public',
'@vendor' => '@app/vendor',
'@web' => __DIR__ . '/Support/runtime',
Expand Down

0 comments on commit 437ecc0

Please sign in to comment.