Skip to content

Commit e8cdbc9

Browse files
authored
Merge pull request #15 from filamentphp/use-default-pint-config
Use default Pint config
2 parents 25f00bf + 0c5ad47 commit e8cdbc9

4 files changed

Lines changed: 27 additions & 38 deletions

File tree

configure.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
writeln("Class name : {$className}");
4141
writeln('---');
4242
writeln('Packages & Utilities');
43-
writeln('Use Larastan/PhpStan : ' . ($usePhpStan ? 'yes' : 'no'));
44-
writeln('Use Pint : ' . ($usePint ? 'yes' : 'no'));
45-
writeln('Use Auto-Changelog : ' . ($useUpdateChangelogWorkflow ? 'yes' : 'no'));
43+
writeln('Use Larastan/PhpStan : '.($usePhpStan ? 'yes' : 'no'));
44+
writeln('Use Pint : '.($usePint ? 'yes' : 'no'));
45+
writeln('Use Auto-Changelog : '.($useUpdateChangelogWorkflow ? 'yes' : 'no'));
4646
writeln('------');
4747

4848
writeln('This script will replace the above values in all relevant files in the project directory.');
@@ -70,20 +70,20 @@
7070
]);
7171

7272
match (true) {
73-
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/' . $className . '.php')),
74-
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/' . $className . 'ServiceProvider.php')),
75-
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/' . $className . '.php')),
76-
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/' . $className . 'Command.php')),
77-
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_' . $packageSlugWithoutPrefix . '_table.php.stub')),
78-
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/' . $packageSlugWithoutPrefix . '.php')),
73+
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/'.$className.'.php')),
74+
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')),
75+
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/'.$className.'.php')),
76+
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/'.$className.'Command.php')),
77+
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.$packageSlugWithoutPrefix.'_table.php.stub')),
78+
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/'.$packageSlugWithoutPrefix.'.php')),
7979
str_contains($file, 'README.md') => remove_readme_paragraphs($file),
8080
default => [],
8181
};
8282
}
8383

8484
if (! $usePint) {
85-
safeUnlink(__DIR__ . '/pint.json');
86-
safeUnlink(__DIR__ . '/.github/workflows/pint.yml');
85+
safeUnlink(__DIR__.'/pint.json');
86+
safeUnlink(__DIR__.'/.github/workflows/pint.yml');
8787

8888
remove_composer_deps([
8989
'laravel/pint',
@@ -93,9 +93,9 @@
9393
}
9494

9595
if (! $usePhpStan) {
96-
safeUnlink(__DIR__ . '/phpstan.neon.dist');
97-
safeUnlink(__DIR__ . '/phpstan-baseline.neon');
98-
safeUnlink(__DIR__ . '/.github/workflows/phpstan.yml');
96+
safeUnlink(__DIR__.'/phpstan.neon.dist');
97+
safeUnlink(__DIR__.'/phpstan-baseline.neon');
98+
safeUnlink(__DIR__.'/.github/workflows/phpstan.yml');
9999

100100
remove_composer_deps([
101101
'phpstan/extension-installer',
@@ -111,7 +111,7 @@
111111
}
112112

113113
if (! $useUpdateChangelogWorkflow) {
114-
safeUnlink(__DIR__ . '/.github/workflows/update-changelog.yml');
114+
safeUnlink(__DIR__.'/.github/workflows/update-changelog.yml');
115115
}
116116

117117
confirm('Execute `composer install` and run tests?') && run('composer install && composer test');
@@ -122,7 +122,7 @@ function ask(string $question, string $default = ''): string
122122
{
123123
$consoleColor = new ConsoleColor();
124124
$def = $default ? $consoleColor->apply('yellow', " ({$default})") : null;
125-
$answer = readline($consoleColor->apply('green', $question . $def . ': '));
125+
$answer = readline($consoleColor->apply('green', $question.$def.': '));
126126

127127
if (! $answer) {
128128
return $default;
@@ -146,7 +146,7 @@ function confirm(string $question, bool $default = false): bool
146146

147147
function writeln(string $line): void
148148
{
149-
echo $line . PHP_EOL;
149+
echo $line.PHP_EOL;
150150
}
151151

152152
function run(string $command): string
@@ -200,20 +200,20 @@ function remove_prefix(string $prefix, string $content): string
200200

201201
function remove_composer_deps(array $names)
202202
{
203-
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
203+
$data = json_decode(file_get_contents(__DIR__.'/composer.json'), true);
204204

205205
foreach ($data['require-dev'] as $name => $version) {
206206
if (in_array($name, $names, true)) {
207207
unset($data['require-dev'][$name]);
208208
}
209209
}
210210

211-
file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
211+
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
212212
}
213213

214214
function remove_composer_script(array $scriptNames)
215215
{
216-
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
216+
$data = json_decode(file_get_contents(__DIR__.'/composer.json'), true);
217217

218218
foreach ($data['scripts'] as $name => $script) {
219219
if (is_array($script)) {
@@ -231,7 +231,7 @@ function remove_composer_script(array $scriptNames)
231231
}
232232
}
233233

234-
file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
234+
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
235235
}
236236

237237
function remove_readme_paragraphs(string $file): void
@@ -258,12 +258,12 @@ function determineSeparator(string $path): string
258258

259259
function replaceForWindows(): array
260260
{
261-
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i ' . basename(__FILE__) . ' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton vendor_name vendor_slug author@domain.com"'));
261+
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton vendor_name vendor_slug author@domain.com"'));
262262
}
263263

264264
function replaceForAllOtherOSes(): array
265265
{
266-
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|author@domain.com" --exclude-dir=vendor ./* ./.github/* | grep -v ' . basename(__FILE__)));
266+
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|author@domain.com" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__)));
267267
}
268268

269269
class ConsoleColor
@@ -381,7 +381,7 @@ public function apply($style, $text)
381381
return $text;
382382
}
383383

384-
return $this->escSequence(implode(';', $sequences)) . $text . $this->escSequence(self::RESET_STYLE);
384+
return $this->escSequence(implode(';', $sequences)).$text.$this->escSequence(self::RESET_STYLE);
385385
}
386386

387387
/**

pint.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/SkeletonServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class SkeletonServiceProvider extends PluginServiceProvider
2222
];
2323

2424
protected array $styles = [
25-
'plugin-skeleton' => __DIR__ . '/../resources/dist/skeleton.css',
25+
'plugin-skeleton' => __DIR__.'/../resources/dist/skeleton.css',
2626
];
2727

2828
protected array $scripts = [
29-
'plugin-skeleton' => __DIR__ . '/../resources/dist/skeleton.js',
29+
'plugin-skeleton' => __DIR__.'/../resources/dist/skeleton.js',
3030
];
3131

3232
// protected array $beforeCoreScripts = [

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected function setUp(): void
1515
parent::setUp();
1616

1717
Factory::guessFactoryNamesUsing(
18-
fn (string $modelName) => 'VendorName\\Skeleton\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
18+
fn (string $modelName) => 'VendorName\\Skeleton\\Database\\Factories\\'.class_basename($modelName).'Factory'
1919
);
2020
}
2121

0 commit comments

Comments
 (0)