mirror of
https://github.com/filamentphp/plugin-skeleton.git
synced 2025-12-06 13:38:53 +08:00
Fix styling
This commit is contained in:
committed by
github-actions[bot]
parent
fb2bfe41e7
commit
0c5ad475b9
@@ -40,9 +40,9 @@ writeln("Namespace : {$vendorNamespace}\\{$className}");
|
||||
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.');
|
||||
@@ -70,20 +70,20 @@ foreach ($files as $file) {
|
||||
]);
|
||||
|
||||
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',
|
||||
@@ -93,9 +93,9 @@ if (! $usePint) {
|
||||
}
|
||||
|
||||
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',
|
||||
@@ -111,7 +111,7 @@ if (! $usePhpStan) {
|
||||
}
|
||||
|
||||
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');
|
||||
@@ -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;
|
||||
@@ -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
|
||||
@@ -200,7 +200,7 @@ 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)) {
|
||||
@@ -208,12 +208,12 @@ function remove_composer_deps(array $names)
|
||||
}
|
||||
}
|
||||
|
||||
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)) {
|
||||
@@ -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
|
||||
@@ -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 author@domain.com"'));
|
||||
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"'));
|
||||
}
|
||||
|
||||
function replaceForAllOtherOSes(): array
|
||||
{
|
||||
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__)));
|
||||
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__)));
|
||||
}
|
||||
|
||||
class ConsoleColor
|
||||
@@ -381,7 +381,7 @@ class ConsoleColor
|
||||
return $text;
|
||||
}
|
||||
|
||||
return $this->escSequence(implode(';', $sequences)) . $text . $this->escSequence(self::RESET_STYLE);
|
||||
return $this->escSequence(implode(';', $sequences)).$text.$this->escSequence(self::RESET_STYLE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -15,7 +15,7 @@ class TestCase extends Orchestra
|
||||
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'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user