Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Update packages (#7)
Browse files Browse the repository at this point in the history
* update packages

* fix pre-commit hook
  • Loading branch information
pktharindu authored Oct 3, 2021
1 parent 02af183 commit 498d7b2
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
composer.phar
composer.lock
.DS_Store
.php_cs.cache
.php-cs-fixer.cache
56 changes: 36 additions & 20 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null]
'operators' => ['=>' => null],
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => ['return']
'statements' => ['return'],
],
'braces' => true,
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => ['method']
'elements' => [
'const' => 'one',
'method' => 'one',
'property' => 'one',
],
],
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
],
'class_definition' => true,
'concat_space' => [
'spacing' => 'none'
'spacing' => 'none',
],
'declare_equal_normalize' => true,
'elseif' => true,
Expand All @@ -30,14 +38,15 @@
'fully_qualified_strict_types' => true, // added by Shift
'function_declaration' => true,
'function_typehint_space' => true,
'general_phpdoc_tag_rename' => true,
'heredoc_to_nowdoc' => true,
'include' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'linebreak_after_opening_tag' => true,
'line_ending' => true,
'lowercase_cast' => true,
'lowercase_constants' => true,
'constant_case' => ['case' => 'lower'],
'lowercase_keywords' => true,
'lowercase_static_reference' => true, // added from Symfony
'magic_method_casing' => true, // added from Symfony
Expand All @@ -51,7 +60,7 @@
'throw',
'use',
'use_trait',
]
],
],
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
Expand All @@ -61,49 +70,56 @@
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [
'use' => 'echo'
'use' => 'echo',
],
'no_multiline_whitespace_around_double_arrow' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line'
'strategy' => 'no_multi_line',
],
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_around_offset' => [
'positions' => ['inside', 'outside'],
],
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_control_parentheses' => [
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'],
],
'no_unreachable_default_argument_value' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_scalar' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => true,
'phpdoc_tag_type' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'psr4' => true,
'psr_autoloading' => true,
'self_accessor' => true,
'short_scalar_cast' => true,
'simplified_null_return' => true,
'simplified_null_return' => false, // disabled by Shift
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_class_element_per_statement' => true, // here
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_line_comment_style' => [
Expand All @@ -115,11 +131,11 @@
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => ['method', 'property']
'elements' => ['property', 'method', 'const'],
],
'whitespace_after_comma_in_array' => true,
];
Expand All @@ -134,8 +150,8 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

return Config::create()
return (new Config())
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)
->setUsingCache(true);
->setUsingCache(true);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"friendsofphp/php-cs-fixer": "^2.16"
},
"scripts": {
"format": "php-cs-fixer fix --path-mode=intersection --config=.php_cs ./",
"format": "php-cs-fixer fix --path-mode=intersection --config=.php-cs-fixer.php ./",
"analyse": "phpstan analyse"
},
"autoload": {
Expand Down
10 changes: 5 additions & 5 deletions src/HandlesCodeHelperScaffolding.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ protected static function updateCodeHelperComposerPackageArray(array $composer,
{
if ($dev == 'require-dev') {
return array_merge([
'barryvdh/laravel-debugbar' => '^3.4',
'barryvdh/laravel-ide-helper' => '^2.8',
'barryvdh/laravel-debugbar' => '^3.6',
'barryvdh/laravel-ide-helper' => '^2.10',
'brainmaestro/composer-git-hooks' => '^2.8',
'friendsofphp/php-cs-fixer' => '^2.16',
'friendsofphp/php-cs-fixer' => '^3.0',
'nunomaduro/larastan' => '^0.6.2',
], $composer);
} else {
Expand Down Expand Up @@ -98,7 +98,7 @@ protected static function updateCodeHelperComposerScriptsArray(array $composer):
'@php artisan ide-helper:generate',
'cghooks update',
],
'format' => 'php-cs-fixer fix --path-mode=intersection --config=.php_cs ./',
'format' => 'php-cs-fixer fix --path-mode=intersection --config=.php-cs-fixer.php ./',
'test' => '@php artisan test',
'analyse' => 'phpstan analyse',
], $composer);
Expand Down Expand Up @@ -129,7 +129,7 @@ protected static function updateCodeHelperComposerExtraHooksArray(array $compose
return array_merge([
'pre-commit' => [
"STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.php')",
'php-cs-fixer fix',
'./vendor/bin/php-cs-fixer fix',
'git add $STAGED_FILES',
],
], $composer);
Expand Down
6 changes: 3 additions & 3 deletions src/HandlesGeneralScaffolding.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ protected static function updateComposerPackageArray(array $composer, string $de

return array_merge([
'laravel/ui' => '^3.0',
'livewire/livewire' => '^2.0',
'livewire/livewire' => '^2.6',
], $composer);
}

protected static function updatePackagesScripts(): void
{
if (!file_exists(base_path('package.json'))) {
if (! file_exists(base_path('package.json'))) {
return;
}

Expand All @@ -53,7 +53,7 @@ protected static function updatePackagesScripts(): void

file_put_contents(
base_path('package.json'),
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) . PHP_EOL
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL
);
}

Expand Down
12 changes: 6 additions & 6 deletions src/TtallPreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ class TtallPreset extends Preset
use HandlesGeneralScaffolding;
use HandlesCodeHelperScaffolding;

const NPM_PACKAGES_TO_ADD = [
'autoprefixer' => '^10.1.0',
'alpinejs' => '^2.8',
public const NPM_PACKAGES_TO_ADD = [
'autoprefixer' => '^10.3.4',
'alpinejs' => '^3.3.5',
'postcss' => '^8.2.1',
'postcss-import' => '^12.0.1',
'tailwindcss' => '^2.0.2',
'tailwindcss' => '^2.2.15',
'turbolinks' => '^5.2.0',
];

const DEV_NPM_PACKAGES_TO_ADD = [
public const DEV_NPM_PACKAGES_TO_ADD = [
'eslint' => '^7.7.0',
'eslint-config-airbnb' => '^18.2.0',
'eslint-config-prettier' => '^6.11.0',
Expand All @@ -32,7 +32,7 @@ class TtallPreset extends Preset
'laravel-mix' => '^6.0.0',
];

const NPM_PACKAGES_TO_REMOVE = [
public const NPM_PACKAGES_TO_REMOVE = [
'axios',
'laravel-mix',
'lodash',
Expand Down
12 changes: 10 additions & 2 deletions src/stubs/default/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.vscode
auth.json
.php_cs.cache
_ide_helper*
.php-cs-fixer.cache
_ide_helper.php
_ide_helper_actions.php
_ide_helper_models.php
.phpstorm.meta.php
draft.yaml
.blueprint
cghooks.lock
Loading

0 comments on commit 498d7b2

Please sign in to comment.