Skip to content

Commit

Permalink
init: add package files
Browse files Browse the repository at this point in the history
  • Loading branch information
mohaphez committed Dec 7, 2023
0 parents commit 477138a
Show file tree
Hide file tree
Showing 27 changed files with 14,414 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-code-editor` 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) dotswan <tech@dotswan.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.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Filament Code Editor

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Software License][ico-license]][link-license]


## Introduction

The Filament Code Editor package enhances Filament with a specialized field type, allowing seamless code editing powered by the CodeMirror JavaScript library within Filament components. This integration provides users with a dedicated environment for editing various code languages such as CSS, HTML, JavaScript, JSON, and PHP directly within Filament forms.

* Key Features:
* Integration of the CodeMirror JavaScript library into Filament components.
* Support for multiple code languages including CSS, HTML, JavaScript, JSON, and PHP.
* Effortless editing of code within the familiar Filament interface.

## Installation

To integrate the Filament Code Editor package into your project, use Composer:

```bash
composer require dotswan/filament-code-editor
```

## Basic Usage

To implement the code editor field within Filament forms, use the `CodeEditor` field type:

```php
use Dotswan\FilamentCodeEditor\Fields\CodeEditor;

CodeEditor::make('codes')
// Additional configuration goes here, if needed
->id('unique_field_id');
```

## Supported Languages

The Filament Code Editor supports the following languages:

* CSS
* HTML
* JavaScript
* JSON
* PHP

Customize and manage code for these languages effortlessly within your Filament forms.

## License

This package is distributed under the [MIT License](link-to-your-license).

## Security

Security is a priority for us. If you encounter any security-related issues or vulnerabilities, please report them via our [GitHub issue tracker][link-github-issue]. For direct communication, reach out to [tech@dotswan.com](mailto:tech@dotswan.com).

## Contribution

Contributions are welcome and valued. Enhancements, suggestions, and bug reports help improve this package for everyone. Here's how you can contribute:

1. Fork the Project
2. Create a Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

Thank you for considering contributing to the Filament Code Editor!

[ico-version]: https://img.shields.io/packagist/v/dotswan/filament-code-editor.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/dotswan/filament-code-editor.svg?style=flat-square

[link-packagist]: https://packagist.org/packages/dotswan/filament-code-editor
[link-license]: https://github.com/dotswan/filament-code-editor/blob/master/LICENSE.md
[link-downloads]: https://packagist.org/packages/dotswan/filament-code-editor
[link-github-issue]: https://github.com/dotswan/filament-code-editor/issues
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/js/filament-code-editor.js',
})
76 changes: 76 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"name": "dotswan/filament-code-editor",
"description": "",
"keywords": [
"dotswan",
"laravel",
"filament-code-editor"
],
"homepage": "https://github.com/dotswan/filament-code-editor",
"support": {
"issues": "https://github.com/dotswan/filament-code-editor/issues",
"source": "https://github.com/dotswan/filament-code-editor"
},
"license": "MIT",
"authors": [
{
"name": "Dotswan",
"email": "tech@dotswan.com",
"role": "Developer"
}
],
"require": {
"php": "^8.1",
"filament/filament": "^3.0",
"spatie/laravel-package-tools": "^1.15.0",
"illuminate/contracts": "^10.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.9",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-arch": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0"
},
"autoload": {
"psr-4": {
"Dotswan\\FilamentCodeEditor\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Dotswan\\FilamentCodeEditor\\Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/pint"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"phpstan/extension-installer": true
}
},
"extra": {
"laravel": {
"providers": [
"Dotswan\\FilamentCodeEditor\\FilamentCodeEditorServiceProvider"
],
"aliases": {
"FilamentCodeEditor": "Dotswan\\FilamentCodeEditor\\Facades\\FilamentCodeEditor"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Loading

0 comments on commit 477138a

Please sign in to comment.