Skip to content

Commit

Permalink
Merge pull request #35 from tattersoftware/bugfix
Browse files Browse the repository at this point in the history
Bugfix: Fix missing file in bundle
  • Loading branch information
MGatner authored Mar 2, 2024
2 parents ef460a0 + 0c6072e commit ca9e3b1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
14 changes: 12 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
Expand All @@ -14,12 +15,12 @@
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
Expand All @@ -35,7 +36,10 @@
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
Expand Down Expand Up @@ -112,10 +116,16 @@
$rectorConfig->rule(FuncGetArgsToVariadicParamRector::class);
$rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
$rectorConfig->rule(SimplifyEmptyCheckOnEmptyArrayRector::class);
$rectorConfig->rule(TernaryEmptyArrayArrayDimFetchToCoalesceRector::class);
$rectorConfig->rule(EmptyOnNullableObjectToInstanceOfRector::class);
$rectorConfig->rule(DisallowedEmptyRuleFixerRector::class);
$rectorConfig
->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [
/**
* The INLINE_PUBLIC value is default to false to avoid BC break, if you use for libraries and want to preserve BC break, you don't need to configure it, as it included in LevelSetList::UP_TO_PHP_74
* The INLINE_PUBLIC value is default to false to avoid BC break,
* if you use for libraries and want to preserve BC break, you don't
* need to configure it, as it included in LevelSetList::UP_TO_PHP_74
* Set to true for projects that allow BC break
*/
TypedPropertyFromAssignsRector::INLINE_PUBLIC => true,
Expand Down
8 changes: 7 additions & 1 deletion src/Bundles/DataTablesBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tatter\Frontend\Bundles;

use CodeIgniter\Files\Exceptions\FileNotFoundException;
use Tatter\Frontend\FrontendBundle;

class DataTablesBundle extends FrontendBundle
Expand All @@ -11,8 +12,13 @@ class DataTablesBundle extends FrontendBundle
*/
protected function define(): void
{
try {
$this->addPath('datatables/js/jquery.dataTables.min.js');
} catch (FileNotFoundException) {
// this seems to have been removed in some DataTables release
}

$this
->addPath('datatables/js/jquery.dataTables.min.js')
->addPath('datatables/js/dataTables.bootstrap4.min.js')
->addPath('datatables/css/dataTables.bootstrap4.min.css')
->merge(new BootstrapBundle());
Expand Down
2 changes: 1 addition & 1 deletion src/Publishers/DataTablesStylePublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public function publish(): bool
{
return $this
->addPath('css')
->addPath('images')
->addPath('js')
->addPath('types')
->removePattern('*.ts')
->removePattern('*.mjs')
->merge(true);
}
}
2 changes: 1 addition & 1 deletion src/Test/PublishersTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class PublishersTestCase extends CIUnitTestCase
* @dataProvider publisherProvider
*
* @param class-string<FrontendPublisher> $class
* @param string[] $expected
* @param list<string> $expected
*/
public function testPublishesFiles(string $class, array $expected): void
{
Expand Down
1 change: 0 additions & 1 deletion tests/BundlesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function bundleProvider(): array
[
'bootstrap.bundle.min.js',
'dataTables.bootstrap4.min.js',
'jquery.dataTables.min.js',
],
],
[
Expand Down
3 changes: 1 addition & 2 deletions tests/PublishersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ public function publisherProvider(): array
[
DataTablesPublisher::class,
[
'datatables/js/jquery.dataTables.js',
'datatables/js/dataTables.min.js',
],
],
[
DataTablesStylePublisher::class,
[
'datatables/css/dataTables.bootstrap4.min.css',
'datatables/images/sort_asc_disabled.png',
'datatables/js/dataTables.bootstrap4.js',
],
],
Expand Down

0 comments on commit ca9e3b1

Please sign in to comment.