Skip to content

Commit

Permalink
Prepare for first release. (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Feb 28, 2024
1 parent ed47673 commit 761f855
Show file tree
Hide file tree
Showing 20 changed files with 301 additions and 132 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Change Log

## 0.1.0 February 28, 2024
27 changes: 11 additions & 16 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
MIT License

Copyright (c) 2023 yii2-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.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ The preferred way to install this extension is through [composer](https://getcom

Either run

```
composer require --dev --prefer-dist yii2-extensions/datetime-picker
```shell
composer require --dev --prefer-dist yii2-extensions/datetime-picker:^0.1
```

or add

```
"yii2-extensions/datetime-picker": "dev-main"
```json
"yii2-extensions/datetime-picker": "^0.1"
```

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

## Usage

Expand Down Expand Up @@ -158,12 +158,12 @@ for default the extension supports the following languages.

## 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.

39 changes: 15 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@
"picker"
],
"license": "mit",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"npm-asset/eonasdan--tempus-dominus": "^6.7",
"oomphinc/composer-installers-extender": "^2.0",
"php-forge/html": "dev-main",
"yii2-extensions/asset-popper": "dev-main",
"yiisoft/yii2": "^2.2"
"npm-asset/eonasdan--tempus-dominus": "^6.9",
"php-forge/html": "^0.2",
"yii2-extensions/asset-popper": "^0.1",
"yiisoft/yii2": "^2.0.49 || ^2.2"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.6",
"php-forge/support": "dev-main",
"phpunit/phpunit": "10.5.3",
"maglnet/composer-require-checker": "^4.7",
"php-forge/support": "^0.1",
"phpunit/phpunit": "^10.5",
"roave/infection-static-analysis-plugin": "^1.34",
"yii2-extensions/phpstan": "dev-main"
"symplify/easy-coding-standard": "^12.1",
"yii2-extensions/phpstan": "^0.1"
},
"autoload": {
"psr-4": {
Expand All @@ -38,38 +36,31 @@
},
"extra": {
"branch-alias": {
"dev-main": "1.0.x-dev"
"dev-main": "0.1-dev"
},
"config-plugin": {
"params": "params.php",
"yii2-datetime-picker": "extension.php"
},
"config-plugin-options": {
"source-directory": "config"
},
"installer-types": [
"bower-asset",
"npm-asset"
],
"installer-paths": {
"./node_modules/{$name}": [
"type:bower-asset",
"type:npm-asset"
]
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"yiisoft/yii2-composer": true,
"composer/installers": true,
"oomphinc/composer-installers-extender": true,
"infection/extension-installer": true
}
},
"scripts": {
"check-dependencies": "composer-require-checker",
"mutation": "roave-infection-static-analysis-plugin",
"easy-coding-standard": "ecs check",
"mutation": [
"Composer\\Config::disableProcessTimeout",
"roave-infection-static-analysis-plugin"
],
"phpstan": "phpstan",
"test": "phpunit"
},
Expand Down
47 changes: 47 additions & 0 deletions docs/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js"></script>

<!-- jquery is not required for the picker to work-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js"></script>
<!-- Bootstrap is not required for the picker to work-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.min.js"></script>

<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<!-- end bootstrap-->

<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.7.16/dist/css/tempus-dominus.css"
/>
</head>

<body>
<div class="form-floating mt-3 input-group" id="datetimepicker1" data-td-target-input="nearest" data-td-target-toggle="nearest">
<input class="form-control is-invalid" id="postform-date" name="PostForm[date]" type="text" placeholder="" aria-required="true" data-td-target="#datetimepicker1" aria-invalid="true">
<span class="input-group-text" data-td-target="#datetimepicker1" data-td-toggle="datetimepicker">
<svg class="me-2 fa-solid svg-inline--fa" style="aspect-ratio: 0.875;">
<use href="#i-solid-calendar"></use>
</svg>
</span>
<label class="form-label">Fecha</label>
<div class="invalid-feedback">El formato de Date es inválido.</div>
</div>

<!-- Font awesome is not required provided you change the icon options -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/solid.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/fontawesome.min.js"></script>
<!-- end FA -->

<script src="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.7.16/dist/js/tempus-dominus.js"></script>

<script src="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.7.16/dist/js/jQuery-provider.js"></script>
<script>
$('#datetimepicker1').tempusDominus({});
</script>
</body>
</html>
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,
]
);
11 changes: 11 additions & 0 deletions infection.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Escaped mutants:
================

Timed Out mutants:
==================

Skipped mutants:
================

Not Covered mutants:
====================
File renamed without changes.
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

38 changes: 19 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
bootstrap="tests/Support/bootstrap.php"
cacheDirectory=".phpunit.cache"
colors="true"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true"
stopOnFailure="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="tests/Support/bootstrap.php"
cacheDirectory=".phpunit.cache"
colors="true"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Yii2-DateTimePicker">
<directory>tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="DateTime-Picker">
<directory>tests</directory>
</testsuite>
</testsuites>

<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
Loading

0 comments on commit 761f855

Please sign in to comment.