Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to match Filament3 #14

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ updates:
schedule:
interval: "weekly"
labels:
- "dependencies"
- "dependencies"

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
7 changes: 4 additions & 3 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ permissions:
jobs:
dependabot:
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
paths:
- '**.php'

permissions:
contents: write

jobs:
php-code-styling:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ on:
paths:
- '**.php'
- 'phpstan.neon.dist'
- '.github/workflows/phpstan.yml'

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4

Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,18 @@ on:
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1]
laravel: [10.0, 9.*]
php: [8.3, 8.2, 8.1]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
carbon: ^2.63
- laravel: 9.*
testbench: 7.*
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down Expand Up @@ -51,4 +49,4 @@ jobs:
run: composer show -D

- name: Execute tests
run: vendor/bin/pest
run: vendor/bin/pest --ci
4 changes: 4 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ on:
release:
types: [released]

permissions:
contents: write

jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea
.phpunit.result.cache
.phpunit.cache
build
composer.lock
coverage
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) MohamedSabil83 <[email protected]>
Copyright (c) mohamedsabil83 <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ composer require mohamedsabil83/filament-hijri-picker

## Usage

You can use it as you do with the default [Filament Date/DateTime picker](https://filamentphp.com/docs/2.x/forms/fields#date-time-picker).
You can use it as you do with the default [Filament Date/DateTime picker](https://filamentphp.com/docs/3.x/forms/fields/date-time-picker).

## Testing

Expand Down
50 changes: 50 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import * as esbuild from 'esbuild'

const isDev = process.argv.includes('--dev')

async function compile(options) {
const context = await esbuild.context(options)

if (isDev) {
await context.watch()
} else {
await context.rebuild()
await context.dispose()
}
}

const defaultOptions = {
define: {
'process.env.NODE_ENV': isDev ? `'development'` : `'production'`,
},
bundle: true,
mainFields: ['module', 'main'],
platform: 'neutral',
sourcemap: isDev ? 'inline' : false,
sourcesContent: isDev,
treeShaking: true,
target: ['es2020'],
minify: !isDev,
plugins: [{
name: 'watchPlugin',
setup: function (build) {
build.onStart(() => {
console.log(`Build started at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)
})

build.onEnd((result) => {
if (result.errors.length > 0) {
console.log(`Build failed at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`, result.errors)
} else {
console.log(`Build finished at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)
}
})
}
}],
}

compile({
...defaultOptions,
entryPoints: ['./resources/js/components/hijri-date-time-picker.js'],
outfile: './resources/dist/js/hijri-date-time-picker.js',
})
39 changes: 27 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"description": "A Hijri date time picker component for Filament",
"keywords": [
"laravel",
"filament",
"hijri",
"picker",
"filament-hijri-picker"
],
"homepage": "https://github.com/mohamedsabil83/filament-hijri-picker",
Expand All @@ -16,35 +19,47 @@
],
"require": {
"php": "^8.1",
"filament/filament": "^2.16",
"illuminate/contracts": "^9.0|^10.0",
"spatie/laravel-package-tools": "^1.13.0"
"filament/filament": "^3.0",
"spatie/laravel-package-tools": "^1.14.0",
"illuminate/contracts": "^10.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^6.0|^7.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^7.0|^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"nunomaduro/collision": "^7.8",
"larastan/larastan": "^2.0.1",
"orchestra/testbench": "^8.8",
"pestphp/pest": "^2.20",
"pestphp/pest-plugin-arch": "^2.5",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5|^10.0",
"spatie/laravel-ray": "^1.26"
},
"autoload": {
"psr-4": {
"MohamedSabil83\\FilamentHijriPicker\\": "src"
"MohamedSabil83\\FilamentHijriPicker\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MohamedSabil83\\FilamentHijriPicker\\Tests\\": "tests"
"MohamedSabil83\\FilamentHijriPicker\\Tests\\": "tests/",
"Workbench\\App\\": "workbench/app/"
}
},
"scripts": {
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
"post-autoload-dump": "@composer run prepare",
"clear": "@php vendor/bin/testbench package:purge-filament-hijri-picker --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": [
"@composer run prepare",
"@php vendor/bin/testbench workbench:build --ansi"
],
"start": [
"Composer\\Config::disableProcessTimeout",
"@composer run build",
"@php vendor/bin/testbench serve"
],
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
Expand Down
Loading
Loading