Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
zepfietje authored and github-actions[bot] committed Oct 16, 2022
1 parent fb2bfe4 commit 0c5ad47
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
48 changes: 24 additions & 24 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
writeln("Class name : {$className}");
writeln('---');
writeln('Packages & Utilities');
writeln('Use Larastan/PhpStan : ' . ($usePhpStan ? 'yes' : 'no'));
writeln('Use Pint : ' . ($usePint ? 'yes' : 'no'));
writeln('Use Auto-Changelog : ' . ($useUpdateChangelogWorkflow ? 'yes' : 'no'));
writeln('Use Larastan/PhpStan : '.($usePhpStan ? 'yes' : 'no'));
writeln('Use Pint : '.($usePint ? 'yes' : 'no'));
writeln('Use Auto-Changelog : '.($useUpdateChangelogWorkflow ? 'yes' : 'no'));
writeln('------');

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

match (true) {
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/' . $className . '.php')),
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/' . $className . 'ServiceProvider.php')),
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/' . $className . '.php')),
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/' . $className . 'Command.php')),
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_' . $packageSlugWithoutPrefix . '_table.php.stub')),
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/' . $packageSlugWithoutPrefix . '.php')),
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/'.$className.'.php')),
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')),
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/'.$className.'.php')),
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/'.$className.'Command.php')),
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.$packageSlugWithoutPrefix.'_table.php.stub')),
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/'.$packageSlugWithoutPrefix.'.php')),
str_contains($file, 'README.md') => remove_readme_paragraphs($file),
default => [],
};
}

if (! $usePint) {
safeUnlink(__DIR__ . '/pint.json');
safeUnlink(__DIR__ . '/.github/workflows/pint.yml');
safeUnlink(__DIR__.'/pint.json');
safeUnlink(__DIR__.'/.github/workflows/pint.yml');

remove_composer_deps([
'laravel/pint',
Expand All @@ -93,9 +93,9 @@
}

if (! $usePhpStan) {
safeUnlink(__DIR__ . '/phpstan.neon.dist');
safeUnlink(__DIR__ . '/phpstan-baseline.neon');
safeUnlink(__DIR__ . '/.github/workflows/phpstan.yml');
safeUnlink(__DIR__.'/phpstan.neon.dist');
safeUnlink(__DIR__.'/phpstan-baseline.neon');
safeUnlink(__DIR__.'/.github/workflows/phpstan.yml');

remove_composer_deps([
'phpstan/extension-installer',
Expand All @@ -111,7 +111,7 @@
}

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

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

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

function writeln(string $line): void
{
echo $line . PHP_EOL;
echo $line.PHP_EOL;
}

function run(string $command): string
Expand Down Expand Up @@ -200,20 +200,20 @@ function remove_prefix(string $prefix, string $content): string

function remove_composer_deps(array $names)
{
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
$data = json_decode(file_get_contents(__DIR__.'/composer.json'), true);

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

file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
}

function remove_composer_script(array $scriptNames)
{
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
$data = json_decode(file_get_contents(__DIR__.'/composer.json'), true);

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

file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
}

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

function replaceForWindows(): array
{
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 [email protected]"'));
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 [email protected]"'));
}

function replaceForAllOtherOSes(): array
{
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|[email protected]" --exclude-dir=vendor ./* ./.github/* | grep -v ' . basename(__FILE__)));
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|vendor_name|vendor_slug|[email protected]" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__)));
}

class ConsoleColor
Expand Down Expand Up @@ -381,7 +381,7 @@ public function apply($style, $text)
return $text;
}

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

/**
Expand Down
4 changes: 2 additions & 2 deletions src/SkeletonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class SkeletonServiceProvider extends PluginServiceProvider
];

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

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

// protected array $beforeCoreScripts = [
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function setUp(): void
parent::setUp();

Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'VendorName\\Skeleton\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
fn (string $modelName) => 'VendorName\\Skeleton\\Database\\Factories\\'.class_basename($modelName).'Factory'
);
}

Expand Down

0 comments on commit 0c5ad47

Please sign in to comment.