Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
liushoukun committed Oct 7, 2024
0 parents commit f62ae8c
Show file tree
Hide file tree
Showing 21 changed files with 527 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

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

## 1.0.0 - 202X-XX-XX

- initial release
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) red-jasmine <liushoukun66@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This is my package filament-product

[![Latest Version on Packagist](https://img.shields.io/packagist/v/red-jasmine/filament-product.svg?style=flat-square)](https://packagist.org/packages/red-jasmine/filament-product)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/red-jasmine/filament-product/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/red-jasmine/filament-product/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/red-jasmine/filament-product/fix-php-code-styling.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/red-jasmine/filament-product/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/red-jasmine/filament-product.svg?style=flat-square)](https://packagist.org/packages/red-jasmine/filament-product)



This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

## Installation

You can install the package via composer:

```bash
composer require red-jasmine/filament-product
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag="filament-product-migrations"
php artisan migrate
```

You can publish the config file with:

```bash
php artisan vendor:publish --tag="filament-product-config"
```

Optionally, you can publish the views using

```bash
php artisan vendor:publish --tag="filament-product-views"
```

This is the contents of the published config file:

```php
return [
];
```

## Usage

```php
$filamentProduct = new Redjasmine\FilamentProduct();
echo $filamentProduct->echoPhrase('Hello, Redjasmine!');
```

## Testing

```bash
composer test
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [liushoukun](https://github.com/red-jasmine)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
50 changes: 50 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import 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/index.js'],
outfile: './resources/dist/filament-product.js',
})
70 changes: 70 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "red-jasmine/filament-product",
"description": "This is my package filament-product",
"keywords": [
"red-jasmine",
"laravel",
"filament-product"
],
"homepage": "https://github.com/red-jasmine/filament-product",
"support": {
"issues": "https://github.com/red-jasmine/filament-product/issues",
"source": "https://github.com/red-jasmine/filament-product"
},
"license": "MIT",
"authors": [
{
"name": "liushoukun",
"email": "liushoukun66@gmail.com",
"role": "Developer"
}
],
"require": {
"php": "^8.1",
"filament/filament": "^3.0",
"spatie/laravel-package-tools": "^1.15.0"
},
"require-dev": {
"nunomaduro/collision": "^7.9",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.1",
"pestphp/pest-plugin-arch": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"spatie/laravel-ray": "^1.26"
},
"autoload": {
"psr-4": {
"Redjasmine\\FilamentProduct\\": "src/",
"Redjasmine\\FilamentProduct\\Database\\Factories\\": "database/factories/"
}
},
"autoload-dev": {
"psr-4": {
"Redjasmine\\FilamentProduct\\Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"phpstan/extension-installer": true
}
},
"extra": {
"laravel": {
"providers": [
"Redjasmine\\FilamentProduct\\FilamentProductServiceProvider"
],
"aliases": {
"FilamentProduct": "Redjasmine\\FilamentProduct\\Facades\\FilamentProduct"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
6 changes: 6 additions & 0 deletions config/product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

// config for Redjasmine/FilamentProduct
return [

];
19 changes: 19 additions & 0 deletions database/factories/ModelFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Redjasmine\FilamentProduct\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/*
class ModelFactory extends Factory
{
protected $model = YourModel::class;
public function definition()
{
return [
];
}
}
*/
19 changes: 19 additions & 0 deletions database/migrations/create_product_table.php.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up()
{
Schema::create('filament_product_table', function (Blueprint $table) {
$table->id();

// add fields

$table->timestamps();
});
}
};
8 changes: 8 additions & 0 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
plugins: {
"postcss-import": {},
"tailwindcss/nesting": {},
tailwindcss: {},
autoprefixer: {},
},
}
1 change: 1 addition & 0 deletions resources/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import '../../vendor/filament/filament/resources/css/theme.css';
Empty file added resources/dist/.gitkeep
Empty file.
Empty file added resources/js/index.js
Empty file.
6 changes: 6 additions & 0 deletions resources/lang/en/product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

// translations for Redjasmine/FilamentProduct
return [
//
];
Empty file added resources/views/.gitkeep
Empty file.
19 changes: 19 additions & 0 deletions src/Commands/FilamentProductCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Redjasmine\FilamentProduct\Commands;

use Illuminate\Console\Command;

class FilamentProductCommand extends Command
{
public $signature = 'filament-product';

public $description = 'My command';

public function handle(): int
{
$this->comment('All done');

return self::SUCCESS;
}
}
16 changes: 16 additions & 0 deletions src/Facades/FilamentProduct.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Redjasmine\FilamentProduct\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @see \Redjasmine\FilamentProduct\FilamentProduct
*/
class FilamentProduct extends Facade
{
protected static function getFacadeAccessor()
{
return \Redjasmine\FilamentProduct\FilamentProduct::class;
}
}
5 changes: 5 additions & 0 deletions src/FilamentProduct.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace Redjasmine\FilamentProduct;

class FilamentProduct {}
37 changes: 37 additions & 0 deletions src/FilamentProductPlugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Redjasmine\FilamentProduct;

use Filament\Contracts\Plugin;
use Filament\Panel;

class FilamentProductPlugin implements Plugin
{
public function getId(): string
{
return 'filament-product';
}

public function register(Panel $panel): void
{
//
}

public function boot(Panel $panel): void
{
//
}

public static function make(): static
{
return app(static::class);
}

public static function get(): static
{
/** @var static $plugin */
$plugin = filament(app(static::class)->getId());

return $plugin;
}
}
Loading

0 comments on commit f62ae8c

Please sign in to comment.