Skip to content

Commit

Permalink
fix v3
Browse files Browse the repository at this point in the history
  • Loading branch information
husam-tariq committed May 23, 2024
1 parent a6d48fc commit 7922d60
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to `filament3-timepicker` will be documented in this file.
All notable changes to `filament-timepicker` will be documented in this file.

## 1.0.0 - 202X-XX-XX

Expand Down
2 changes: 1 addition & 1 deletion bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ const defaultOptions = {
compile({
...defaultOptions,
entryPoints: ['./resources/js/index.js'],
outfile: './resources/dist/filament3-timepicker.js',
outfile: './resources/dist/filament-timepicker.js',
})
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"require": {
"php": "^8.1",
"filament/filament": "^3.0.5",
"spatie/laravel-package-tools": "^1.15.0",
"illuminate/contracts": "^10.0"
"spatie/laravel-package-tools": "^1.15.0"
},
"require-dev": {
"nunomaduro/collision": "^7.9",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"private": true,
"type": "module",
"scripts": {
"dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament3-timepicker.css --postcss --watch",
"dev:scripts": "esbuild resources/js/index.js --bundle --sourcemap=inline --outfile=resources/dist/filament3-timepicker.js --watch",
"build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament3-timepicker.css --postcss --minify && npm run purge",
"dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament-timepicker.css --postcss --watch",
"dev:scripts": "esbuild resources/js/index.js --bundle --sourcemap=inline --outfile=resources/dist/filament-timepicker.js --watch",
"build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament-timepicker.css --postcss --minify && npm run purge",
"build:scripts": "node bin/build.js",
"purge": "filament-purge -i resources/dist/filament3-timepicker.css -o resources/dist/filament3-timepicker.css -v 3.x",
"purge": "filament-purge -i resources/dist/filament-timepicker.css -o resources/dist/filament-timepicker.css -v 3.x",
"dev": "npm-run-all --parallel dev:*",
"build": "npm-run-all build:*"
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Commands/FilamentTimePickerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class FilamentTimePickerCommand extends Command
{
public $signature = 'filament3-timepicker';
public $signature = 'filament-timepicker';

public $description = 'My command';

Expand Down
37 changes: 20 additions & 17 deletions src/FilamentTimePickerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace HusamTariq\FilamentTimePicker;

use Composer\InstalledVersions;
use Filament\Support\Assets\AlpineComponent;
use Filament\Support\Assets\Asset;
use Filament\Support\Assets\Css;
Expand All @@ -18,9 +19,11 @@

class FilamentTimePickerServiceProvider extends PackageServiceProvider
{
public static string $name = 'filament3-timepicker';
public static string $name = 'filament-timepicker';
private static string $version = 'dev';

public static string $viewNamespace = 'filament3-timepicker';

public static string $viewNamespace = 'filament-timepicker';

public function configurePackage(Package $package): void
{
Expand All @@ -33,20 +36,20 @@ public function configurePackage(Package $package): void
->hasCommands($this->getCommands())
->hasInstallCommand(function (InstallCommand $command) {
$command
->publishConfigFile()
->askToStarRepoOnGitHub('husam-tariq/filament3-timepicker');
// ->publishConfigFile()
->askToStarRepoOnGitHub('husam-tariq/filament-timepicker');
});

$configFileName = $package->shortName();

if (file_exists($package->basePath("/../config/{$configFileName}.php"))) {
/* if (file_exists($package->basePath("/../config/{$configFileName}.php"))) {
$package->hasConfigFile();
}
if (file_exists($package->basePath('/../database/migrations'))) {
$package->hasMigrations($this->getMigrations());
}

*/
if (file_exists($package->basePath('/../resources/lang'))) {
$package->hasTranslations();
}
Expand Down Expand Up @@ -77,32 +80,34 @@ public function packageBooted(): void
FilamentIcon::register($this->getIcons());

// Handle Stubs
if (app()->runningInConsole()) {
/* if (app()->runningInConsole()) {
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
$this->publishes([
$file->getRealPath() => base_path("stubs/filament3-timepicker/{$file->getFilename()}"),
], 'filament3-timepicker-stubs');
$file->getRealPath() => base_path("stubs/filament-timepicker/{$file->getFilename()}"),
], 'filament-timepicker-stubs');
}
}

*/
// Testing
Testable::mixin(new TestsFilamentTimePicker());
}

protected function getAssetPackageName(): ?string
{
return 'husam-tariq/filament3-timepicker';
return 'husam-tariq/filament-timepicker';
}

/**
* @return array<Asset>
*/
protected function getAssets(): array
{
static::$version = InstalledVersions::getVersion('husam-tariq/filament-timepicker');
$assetId = $this->getAssetPackageName() . static::$version;
return [
// AlpineComponent::make('filament3-timepicker', __DIR__ . '/../resources/dist/components/filament3-timepicker.js'),
Css::make('filament3-timepicker-styles', __DIR__ . '/../resources/dist/filament3-timepicker.css'),
Js::make('filament3-timepicker-scripts', __DIR__ . '/../resources/dist/filament3-timepicker.js'),
// AlpineComponent::make('filament-timepicker', __DIR__ . '/../resources/dist/components/filament-timepicker.js'),
Css::make($assetId, __DIR__ . '/../resources/dist/filament-timepicker.css'),
Js::make($assetId, __DIR__ . '/../resources/dist/filament-timepicker.js'),
];
}

Expand Down Expand Up @@ -145,8 +150,6 @@ protected function getScriptData(): array
*/
protected function getMigrations(): array
{
return [
'create_filament3-timepicker_table',
];
return [];
}
}
2 changes: 1 addition & 1 deletion src/Forms/Components/TimePickerField.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TimePickerField extends Field
{
protected string $view = 'filament3-timepicker::components.time-picker-field';
protected string $view = 'filament-timepicker::components.time-picker-field';

protected string $okLabel = 'Ok';

Expand Down
6 changes: 1 addition & 5 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use Filament\Forms\FormsServiceProvider;
use Filament\Infolists\InfolistsServiceProvider;
use Filament\Notifications\NotificationsServiceProvider;
use Filament\SpatieLaravelSettingsPluginServiceProvider;
use Filament\SpatieLaravelTranslatablePluginServiceProvider;
use Filament\Support\SupportServiceProvider;
use Filament\Tables\TablesServiceProvider;
use Filament\Widgets\WidgetsServiceProvider;
Expand Down Expand Up @@ -43,8 +41,6 @@ protected function getPackageProviders($app)
InfolistsServiceProvider::class,
LivewireServiceProvider::class,
NotificationsServiceProvider::class,
SpatieLaravelSettingsPluginServiceProvider::class,
SpatieLaravelTranslatablePluginServiceProvider::class,
SupportServiceProvider::class,
TablesServiceProvider::class,
WidgetsServiceProvider::class,
Expand All @@ -57,7 +53,7 @@ public function getEnvironmentSetUp($app)
config()->set('database.default', 'testing');

/*
$migration = include __DIR__.'/../database/migrations/create_filament3-timepicker_table.php.stub';
$migration = include __DIR__.'/../database/migrations/create_filament-timepicker_table.php.stub';
$migration->up();
*/
}
Expand Down

0 comments on commit 7922d60

Please sign in to comment.