Skip to content

Commit 68453ed

Browse files
committed
wip it
1 parent 6318975 commit 68453ed

File tree

5 files changed

+47
-47
lines changed

5 files changed

+47
-47
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"spatie/laravel-package-tools": "^1.9.2"
2222
},
2323
"require-dev": {
24-
"laravel/pint": "^1.24",
24+
"laravel/pint": "^1.25",
2525
"orchestra/testbench": "^9.0|^10",
2626
"pestphp/pest": "^2.0",
2727
"spatie/laravel-ray": "^1.26"

config/skeleton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
| going to use the obligatory Otwell comment indentation style.
1212
*/
1313

14-
// 'item' => [],
14+
// 'item' => [],
1515

1616
];

configure.php

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
function ask(string $question, string $default = ''): string
77
{
8-
$answer = readline($question.($default ? " ({$default})" : null).': ');
8+
$answer = readline($question . ($default ? " ({$default})" : null) . ': ');
99

1010
if (! $answer) {
1111
return $default;
@@ -16,7 +16,7 @@ function ask(string $question, string $default = ''): string
1616

1717
function confirm(string $question, bool $default = false): bool
1818
{
19-
$answer = ask($question.' ('.($default ? 'Y/n' : 'y/N').')');
19+
$answer = ask($question . ' (' . ($default ? 'Y/n' : 'y/N') . ')');
2020

2121
if (! $answer) {
2222
return $default;
@@ -27,7 +27,7 @@ function confirm(string $question, bool $default = false): bool
2727

2828
function writeln(string $line): void
2929
{
30-
echo $line.PHP_EOL;
30+
echo $line . PHP_EOL;
3131
}
3232

3333
function run(string $command): string
@@ -86,20 +86,20 @@ function remove_prefix(string $prefix, string $content): string
8686

8787
function remove_composer_deps(array $names)
8888
{
89-
$data = json_decode(file_get_contents(__DIR__.'/composer.json'), true);
89+
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
9090

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

97-
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
97+
file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
9898
}
9999

100100
function remove_composer_script($scriptName)
101101
{
102-
$data = json_decode(file_get_contents(__DIR__.'/composer.json'), true);
102+
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
103103

104104
foreach ($data['scripts'] as $name => $script) {
105105
if ($scriptName === $name) {
@@ -108,7 +108,7 @@ function remove_composer_script($scriptName)
108108
}
109109
}
110110

111-
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
111+
file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
112112
}
113113

114114
function remove_readme_paragraphs(string $file): void
@@ -135,12 +135,12 @@ function determineSeparator(string $path): string
135135

136136
function replaceForWindows(): array
137137
{
138-
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 migration_table_name vendor_name vendor_slug author@domain.com"'));
138+
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 migration_table_name vendor_name vendor_slug author@domain.com"'));
139139
}
140140

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

146146
$gitName = run('git config user.name');
@@ -171,11 +171,11 @@ function replaceForAllOtherOSes(): array
171171
$variableName = lcfirst($className);
172172
$description = ask('Package description', "This is my package {$packageSlug}");
173173

174-
//$usePhpStan = confirm('Enable PhpStan?', true);
175-
//$useLaravelPint = confirm('Enable Laravel Pint?', true);
176-
//$useDependabot = confirm('Enable Dependabot?', true);
177-
//$useLaravelRay = confirm('Use Ray for debugging?', true);
178-
//$useUpdateChangelogWorkflow = confirm('Use automatic changelog updater workflow?', true);
174+
// $usePhpStan = confirm('Enable PhpStan?', true);
175+
// $useLaravelPint = confirm('Enable Laravel Pint?', true);
176+
// $useDependabot = confirm('Enable Dependabot?', true);
177+
// $useLaravelRay = confirm('Use Ray for debugging?', true);
178+
// $useUpdateChangelogWorkflow = confirm('Use automatic changelog updater workflow?', true);
179179

180180
writeln('------');
181181
writeln("Author : {$authorName} ({$authorUsername}, {$authorEmail})");
@@ -184,13 +184,13 @@ function replaceForAllOtherOSes(): array
184184
writeln("Namespace : {$vendorNamespace}\\{$className}");
185185
writeln("Class name : {$className}");
186186
writeln('---');
187-
//writeln('Packages & Utilities');
188-
//writeln('Use Laravel/Pint : '.($useLaravelPint ? 'yes' : 'no'));
189-
//writeln('Use Larastan/PhpStan : '.($usePhpStan ? 'yes' : 'no'));
190-
//writeln('Use Dependabot : '.($useDependabot ? 'yes' : 'no'));
191-
//writeln('Use Ray App : '.($useLaravelRay ? 'yes' : 'no'));
192-
//writeln('Use Auto-Changelog : '.($useUpdateChangelogWorkflow ? 'yes' : 'no'));
193-
//writeln('------');
187+
// writeln('Packages & Utilities');
188+
// writeln('Use Laravel/Pint : '.($useLaravelPint ? 'yes' : 'no'));
189+
// writeln('Use Larastan/PhpStan : '.($usePhpStan ? 'yes' : 'no'));
190+
// writeln('Use Dependabot : '.($useDependabot ? 'yes' : 'no'));
191+
// writeln('Use Ray App : '.($useLaravelRay ? 'yes' : 'no'));
192+
// writeln('Use Auto-Changelog : '.($useUpdateChangelogWorkflow ? 'yes' : 'no'));
193+
// writeln('------');
194194

195195
writeln('This script will replace the above values in all relevant files in the project directory.');
196196

@@ -219,23 +219,23 @@ function replaceForAllOtherOSes(): array
219219
]);
220220

221221
match (true) {
222-
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/'.$className.'.php')),
223-
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')),
224-
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/'.$className.'.php')),
225-
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/'.$className.'Command.php')),
226-
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.title_snake($packageSlugWithoutPrefix).'_table.php.stub')),
227-
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/'.$packageSlugWithoutPrefix.'.php')),
222+
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/' . $className . '.php')),
223+
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/' . $className . 'ServiceProvider.php')),
224+
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/' . $className . '.php')),
225+
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/' . $className . 'Command.php')),
226+
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_' . title_snake($packageSlugWithoutPrefix) . '_table.php.stub')),
227+
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/' . $packageSlugWithoutPrefix . '.php')),
228228
str_contains($file, 'README.md') => remove_readme_paragraphs($file),
229229
default => [],
230230
};
231231
}
232232

233-
//if (! $useLaravelPint) {
233+
// if (! $useLaravelPint) {
234234
// safeUnlink(__DIR__.'/.github/workflows/fix-php-code-style-issues.yml');
235235
// safeUnlink(__DIR__.'/pint.json');
236-
//}
236+
// }
237237
//
238-
//if (! $usePhpStan) {
238+
// if (! $usePhpStan) {
239239
// safeUnlink(__DIR__.'/phpstan.neon.dist');
240240
// safeUnlink(__DIR__.'/phpstan-baseline.neon');
241241
// safeUnlink(__DIR__.'/.github/workflows/phpstan.yml');
@@ -248,20 +248,20 @@ function replaceForAllOtherOSes(): array
248248
// ]);
249249
//
250250
// remove_composer_script('phpstan');
251-
//}
251+
// }
252252

253-
//if (! $useDependabot) {
253+
// if (! $useDependabot) {
254254
// safeUnlink(__DIR__.'/.github/dependabot.yml');
255255
// safeUnlink(__DIR__.'/.github/workflows/dependabot-auto-merge.yml');
256-
//}
256+
// }
257257
//
258-
//if (! $useLaravelRay) {
258+
// if (! $useLaravelRay) {
259259
// remove_composer_deps(['spatie/laravel-ray']);
260-
//}
260+
// }
261261
//
262-
//if (! $useUpdateChangelogWorkflow) {
262+
// if (! $useUpdateChangelogWorkflow) {
263263
// safeUnlink(__DIR__.'/.github/workflows/update-changelog.yml');
264-
//}
264+
// }
265265

266266
confirm('Execute `composer install` and run tests?') && run('composer install && composer test');
267267

database/factories/ModelFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
use Illuminate\Database\Eloquent\Factories\Factory;
66

7-
//class ModelFactory extends Factory
8-
//{
7+
// class ModelFactory extends Factory
8+
// {
99
// protected $model = Feature::class;
1010
//
1111
// public function definition()
1212
// {
1313
// return [];
1414
// }
15-
//}
15+
// }

tests/TestCase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ protected function setUp(): void
1313
parent::setUp();
1414

1515
Factory::guessFactoryNamesUsing(
16-
fn (string $modelName) => 'Codinglabs\\Skeleton\\Database\\Factories\\'.class_basename($modelName).'Factory'
16+
fn (string $modelName) => 'Codinglabs\\Skeleton\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
1717
);
1818

19-
// $this->artisan('vendor:publish', ['--tag' => 'roles-migrations'])->run();
20-
// $this->artisan('migrate', ['--database' => 'testbench'])->run();
21-
// $this->loadLaravelMigrations(['--database' => 'testbench']);
19+
// $this->artisan('vendor:publish', ['--tag' => 'roles-migrations'])->run();
20+
// $this->artisan('migrate', ['--database' => 'testbench'])->run();
21+
// $this->loadLaravelMigrations(['--database' => 'testbench']);
2222
}
2323

2424
protected function getPackageProviders($app)
2525
{
2626
return [
27-
SkeletonServiceProvider::class
27+
SkeletonServiceProvider::class,
2828
];
2929
}
3030

0 commit comments

Comments
 (0)