Skip to content

Commit 761f855

Browse files
Prepare for first release. (#13)
1 parent ed47673 commit 761f855

20 files changed

+301
-132
lines changed

.github/workflows/ecs.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
on:
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'infection.json.dist'
10+
- 'phpunit.xml.dist'
11+
12+
push:
13+
branches: ['main']
14+
paths-ignore:
15+
- 'docs/**'
16+
- 'README.md'
17+
- 'CHANGELOG.md'
18+
- '.gitignore'
19+
- '.gitattributes'
20+
- 'infection.json.dist'
21+
- 'phpunit.xml.dist'
22+
23+
name: ecs
24+
25+
jobs:
26+
easy-coding-standard:
27+
uses: php-forge/actions/.github/workflows/ecs.yml@main
28+
secrets:
29+
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
30+
with:
31+
os: >-
32+
['ubuntu-latest']
33+
php: >-
34+
['8.1']

.styleci.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ enabled:
1717
- combine_nested_dirname
1818
- declare_strict_types
1919
- dir_constant
20+
- empty_loop_body_braces
2021
- fully_qualified_strict_types
2122
- function_to_constant
2223
- hash_to_slash_comment
24+
- integer_literal_case
2325
- is_null
2426
- logical_operators
2527
- magic_constant_casing
@@ -56,7 +58,6 @@ enabled:
5658
- phpdoc_order
5759
- phpdoc_property
5860
- phpdoc_scalar
59-
- phpdoc_separation
6061
- phpdoc_singular_inheritdoc
6162
- phpdoc_trim
6263
- phpdoc_trim_consecutive_blank_line_separation
@@ -78,9 +79,9 @@ enabled:
7879
- trailing_comma_in_multiline_array
7980
- unalign_double_arrow
8081
- unalign_equals
81-
- empty_loop_body_braces
82-
- integer_literal_case
8382
- union_type_without_spaces
8483

8584
disabled:
8685
- function_declaration
86+
- psr12_braces
87+
- psr12_class_definition

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Change Log
2+
3+
## 0.1.0 February 28, 2024

LICENSE

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
MIT License
22

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

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

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
10+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11+
Software.
1412

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ The preferred way to install this extension is through [composer](https://getcom
3636

3737
Either run
3838

39-
```
40-
composer require --dev --prefer-dist yii2-extensions/datetime-picker
39+
```shell
40+
composer require --dev --prefer-dist yii2-extensions/datetime-picker:^0.1
4141
```
4242

4343
or add
4444

45-
```
46-
"yii2-extensions/datetime-picker": "dev-main"
45+
```json
46+
"yii2-extensions/datetime-picker": "^0.1"
4747
```
4848

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

5151
## Usage
5252

@@ -158,12 +158,12 @@ for default the extension supports the following languages.
158158

159159
## Testing
160160

161-
[Check the documentation testing](/docs/testing.md) to learn about testing.
161+
[Check the documentation testing](docs/testing.md) to learn about testing.
162162

163163
## Our social networks
164164

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

167167
## License
168168

169-
The MIT License. Please see [License File](LICENSE.md) for more information.
169+
The MIT License. Please see [License File](LICENSE) for more information.

changelog.md

-2
This file was deleted.

composer.json

+15-24
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,20 @@
99
"picker"
1010
],
1111
"license": "mit",
12-
"minimum-stability": "dev",
13-
"prefer-stable": true,
1412
"require": {
1513
"php": ">=8.1",
16-
"npm-asset/eonasdan--tempus-dominus": "^6.7",
17-
"oomphinc/composer-installers-extender": "^2.0",
18-
"php-forge/html": "dev-main",
19-
"yii2-extensions/asset-popper": "dev-main",
20-
"yiisoft/yii2": "^2.2"
14+
"npm-asset/eonasdan--tempus-dominus": "^6.9",
15+
"php-forge/html": "^0.2",
16+
"yii2-extensions/asset-popper": "^0.1",
17+
"yiisoft/yii2": "^2.0.49 || ^2.2"
2118
},
2219
"require-dev": {
23-
"maglnet/composer-require-checker": "^4.6",
24-
"php-forge/support": "dev-main",
25-
"phpunit/phpunit": "10.5.3",
20+
"maglnet/composer-require-checker": "^4.7",
21+
"php-forge/support": "^0.1",
22+
"phpunit/phpunit": "^10.5",
2623
"roave/infection-static-analysis-plugin": "^1.34",
27-
"yii2-extensions/phpstan": "dev-main"
24+
"symplify/easy-coding-standard": "^12.1",
25+
"yii2-extensions/phpstan": "^0.1"
2826
},
2927
"autoload": {
3028
"psr-4": {
@@ -38,38 +36,31 @@
3836
},
3937
"extra": {
4038
"branch-alias": {
41-
"dev-main": "1.0.x-dev"
39+
"dev-main": "0.1-dev"
4240
},
4341
"config-plugin": {
4442
"params": "params.php",
4543
"yii2-datetime-picker": "extension.php"
4644
},
4745
"config-plugin-options": {
4846
"source-directory": "config"
49-
},
50-
"installer-types": [
51-
"bower-asset",
52-
"npm-asset"
53-
],
54-
"installer-paths": {
55-
"./node_modules/{$name}": [
56-
"type:bower-asset",
57-
"type:npm-asset"
58-
]
5947
}
6048
},
6149
"config": {
6250
"sort-packages": true,
6351
"allow-plugins": {
6452
"yiisoft/yii2-composer": true,
6553
"composer/installers": true,
66-
"oomphinc/composer-installers-extender": true,
6754
"infection/extension-installer": true
6855
}
6956
},
7057
"scripts": {
7158
"check-dependencies": "composer-require-checker",
72-
"mutation": "roave-infection-static-analysis-plugin",
59+
"easy-coding-standard": "ecs check",
60+
"mutation": [
61+
"Composer\\Config::disableProcessTimeout",
62+
"roave-infection-static-analysis-plugin"
63+
],
7364
"phpstan": "phpstan",
7465
"test": "phpunit"
7566
},

docs/test.html

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<html>
2+
<head>
3+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.6/umd/popper.min.js"></script>
4+
5+
<!-- jquery is not required for the picker to work-->
6+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js"></script>
7+
<!-- Bootstrap is not required for the picker to work-->
8+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.min.js"></script>
9+
10+
<link
11+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css"
12+
rel="stylesheet"
13+
/>
14+
<!-- end bootstrap-->
15+
16+
<link
17+
rel="stylesheet"
18+
href="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.7.16/dist/css/tempus-dominus.css"
19+
/>
20+
</head>
21+
22+
<body>
23+
<div class="form-floating mt-3 input-group" id="datetimepicker1" data-td-target-input="nearest" data-td-target-toggle="nearest">
24+
<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">
25+
<span class="input-group-text" data-td-target="#datetimepicker1" data-td-toggle="datetimepicker">
26+
<svg class="me-2 fa-solid svg-inline--fa" style="aspect-ratio: 0.875;">
27+
<use href="#i-solid-calendar"></use>
28+
</svg>
29+
</span>
30+
<label class="form-label">Fecha</label>
31+
<div class="invalid-feedback">El formato de Date es inválido.</div>
32+
</div>
33+
34+
<!-- Font awesome is not required provided you change the icon options -->
35+
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/solid.min.js"></script>
36+
37+
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/js/fontawesome.min.js"></script>
38+
<!-- end FA -->
39+
40+
<script src="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.7.16/dist/js/tempus-dominus.js"></script>
41+
42+
<script src="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.7.16/dist/js/jQuery-provider.js"></script>
43+
<script>
44+
$('#datetimepicker1').tempusDominus({});
45+
</script>
46+
</body>
47+
</html>

docs/testing.md

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ To run the checker, execute the following command:
1010
composer run check-dependencies
1111
```
1212

13+
## Easy coding standard
14+
15+
The code is checked with [Easy Coding Standard](https://github.com/easy-coding-standard/easy-coding-standard) and
16+
[PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer). To run it:
17+
18+
```shell
19+
composer run ecs
20+
```
21+
22+
## Mutation testing
23+
24+
Mutation testing is checked with [Infection](https://infection.github.io/). To run it:
25+
26+
```shell
27+
composer run mutation
28+
```
29+
1330
## Static analysis
1431

1532
The code is statically analyzed with [Phpstan](https://phpstan.org/). To run static analysis:

ecs.php

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer;
6+
use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer;
7+
use PhpCsFixer\Fixer\ClassNotation\OrderedTraitsFixer;
8+
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
9+
use Symplify\EasyCodingStandard\Config\ECSConfig;
10+
11+
return ECSConfig::configure()
12+
->withConfiguredRule(
13+
ClassDefinitionFixer::class,
14+
[
15+
'space_before_parenthesis' => true,
16+
],
17+
)
18+
->withFileExtensions(['php'])
19+
->withPaths(
20+
[
21+
__DIR__ . '/src',
22+
__DIR__ . '/tests',
23+
],
24+
)
25+
->withPhpCsFixerSets(perCS20: true)
26+
->withPreparedSets(
27+
cleanCode: true,
28+
comments:true,
29+
docblocks: true,
30+
namespaces: true,
31+
psr12: true
32+
)
33+
->withRules(
34+
[
35+
NoUnusedImportsFixer::class,
36+
OrderedClassElementsFixer::class,
37+
OrderedTraitsFixer::class,
38+
]
39+
);

infection.log

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Escaped mutants:
2+
================
3+
4+
Timed Out mutants:
5+
==================
6+
7+
Skipped mutants:
8+
================
9+
10+
Not Covered mutants:
11+
====================
File renamed without changes.

phpstan.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ parameters:
1717
- vendor/yiisoft/yii2/Yii.php
1818

1919
yii2:
20-
config_path: %currentWorkingDirectory%/phpstan-yii-config.php
20+
config_path: %currentWorkingDirectory%/phpstan-config.php
2121

phpunit.xml.dist

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
5-
bootstrap="tests/Support/bootstrap.php"
6-
cacheDirectory=".phpunit.cache"
7-
colors="true"
8-
executionOrder="depends,defects"
9-
failOnRisky="true"
10-
failOnWarning="true"
11-
stopOnFailure="false"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
5+
bootstrap="tests/Support/bootstrap.php"
6+
cacheDirectory=".phpunit.cache"
7+
colors="true"
8+
executionOrder="depends,defects"
9+
failOnRisky="true"
10+
failOnWarning="true"
11+
stopOnFailure="false"
1212
>
13-
<testsuites>
14-
<testsuite name="Yii2-DateTimePicker">
15-
<directory>tests</directory>
16-
</testsuite>
17-
</testsuites>
13+
<testsuites>
14+
<testsuite name="DateTime-Picker">
15+
<directory>tests</directory>
16+
</testsuite>
17+
</testsuites>
1818

19-
<source>
20-
<include>
21-
<directory suffix=".php">./src</directory>
22-
</include>
23-
</source>
19+
<source>
20+
<include>
21+
<directory suffix=".php">./src</directory>
22+
</include>
23+
</source>
2424
</phpunit>

0 commit comments

Comments
 (0)