Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Nov 1, 2024
0 parents commit bac7f3c
Show file tree
Hide file tree
Showing 31 changed files with 3,688 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Do not export those files in the Composer archive (lighter dependency)
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/ecs.php export-ignore
/phpstan.neon export-ignore
/tests/ export-ignore

# Auto detect text files and perform LF normalization
* text=auto
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: bencroker
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Bug Report
description: Create a bug report for this plugin.
labels:
- bug
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to submit a bug report! To ensure this hasn’t already been reported, please first search existing issues and ensure you’re running the latest version.
To rule out that this isn’t a setup or configuration issue, please read the docs.
If you still believe you’ve found a bug, please provide a clear and concise description, including:
- What is happening and what you expected to happen.
- Steps to reproduce the issue.
- Screenshots, if applicable.
- type: textarea
id: body
attributes:
label: Bug Report
description: Please provide a clear and concise description of the bug.
validations:
required: true
- type: input
id: pluginVersion
attributes:
label: Plugin Version
description: Provide the plugin version that this relates to, ideally the latest version.
validations:
required: true
- type: input
id: craftVersion
attributes:
label: Craft CMS Version
description: Provide the version of Craft that is installed.
validations:
required: true
- type: input
id: phpVersion
attributes:
label: PHP Version
description: Provide the PHP version, if applicable.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Feature Request
description: Suggest a new feature for this plugin.
labels:
- enhancement
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to submit a feature request! To ensure this isn’t already on our radar, please first search existing issues and ensure you’re running the latest version.
If you still believe you have a new suggestion, please provide a clear and concise description, including:
- What problem you believe your feature request can solve.
- Any alternative solutions or features you have already considered.
- type: textarea
id: body
attributes:
label: Feature Request
description: Please provide a clear and concise suggestion for a feature.
validations:
required: true
- type: input
id: pluginVersion
attributes:
label: Plugin Version
description: Provide the plugin version that this relates to, ideally the latest version.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/support-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Support Request
description: Ask a question about this plugin.
labels:
- question
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to submit a support request! To ensure your question hasn’t already been asked and answered, please first search existing issues and ensure you’re running the latest version.
If your question is still unanswered, please provide a clear and concise description. Note that we are diligent about documentation, so please check whether your question is answered by the plugin docs before submitting.
- type: textarea
id: body
attributes:
label: Support Request
description: Please provide a clear and concise question.
validations:
required: true
- type: input
id: pluginVersion
attributes:
label: Plugin Version
description: Provide the plugin version that this relates to, ideally the latest version.
40 changes: 40 additions & 0 deletions .github/workflows/code-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- develop
workflow_dispatch:
permissions:
contents: read
jobs:
code_analysis:
strategy:
fail-fast: false
matrix:
actions:
- name: 'PHPStan'
run: composer phpstan
- name: 'Coding Standards'
run: composer fix-cs
name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: 'ctype,curl,dom,iconv,imagick,intl,json,mbstring,openssl,pcre,pdo,reflection,spl,zip'
ini-values: post_max_size=256M, max_execution_time=180, memory_limit=512M
tools: composer:v2
- name: Install Composer dependencies
run: composer install --no-interaction --no-ansi --no-progress
- run: ${{ matrix.actions.run }}
21 changes: 21 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create Release
run-name: Create release for ${{ github.event.client_payload.version }}

on:
repository_dispatch:
types:
- craftcms/new-release

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: ncipollo/release-action@v1
with:
body: ${{ github.event.client_payload.notes }}
makeLatest: ${{ github.event.client_payload.latest }}
name: ${{ github.event.client_payload.version }}
prerelease: ${{ github.event.client_payload.prerelease }}
tag: ${{ github.event.client_payload.tag }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release Notes for Spark Plug

## 1.0.0-alpha.1 - Unreleased

- Initial alpha release.
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright © PutYourLightsOn

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.
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[![Stable Version](https://img.shields.io/packagist/v/putyourlightson/craft-spark-plug?label=stable)]((https://packagist.org/packages/putyourlightson/craft-spark-plug))
[![Total Downloads](https://img.shields.io/packagist/dt/putyourlightson/craft-spark-plug)](https://packagist.org/packages/putyourlightson/craft-spark-plug)

<p align="center"><img width="150" src="https://putyourlightson.com/assets/logos/spark-icon.svg"></p>

# Spark Plug Module for Craft CMS

This module provides the core functionality for the [Spark plugin](https://github.com/putyourlightson/craft-spark), real-time, template-driven hypermedia framework for [Craft CMS](https://craftcms.com/). If you are developing a Craft plugin/module and would like to use Spark in the control panel, then you can require this package to give you its functionality, without requiring that the site has the Spark plugin installed.

First require the package in your plugin/module's `composer.json` file.

```json
{
"require": {
"putyourlightson/craft-spark-plug": "^1.0.0-alpha.1"
}
}
```

Then bootstrap the module from within your plugin/module's `init` method.

```php
use craft\base\Plugin;
use putyourlightson\spark\Spark;

class MyPlugin extends Plugin
{
public function init()
{
parent::init();

Spark::bootstrap();
}
}
```

Then use the Spark function and tags as normal in your control panel templates.

```twig
<button data-on-click="{{ spark('_spark/search') }}">Search</button>
```

If your plugin/module registers an asset bundle that depends on Datastar being loaded, ensure that you specify the `DatastarAssetBundle` class as a dependency.

```php
use craft\web\AssetBundle;
use putyourlightson\spark\assets\DatastarAssetBundle;

class MyAssetBundle extends AssetBundle
{
public $depends = [
DatastarAssetBundle::class,
];
}
```

Spark plugin issues should be reported to https://github.com/putyourlightson/craft-spark/issues

Spark plugin changes are documented in https://github.com/putyourlightson/craft-spark/blob/develop/CHANGELOG.md

## Documentation

Learn more and read the documentation at [putyourlightson.com/plugins/spark »](https://putyourlightson.com/plugins/spark)

## License

This plugin is licensed for free under the MIT License.

## Requirements

This plugin requires [Craft CMS](https://craftcms.com/) 5.0.0 or later.

## Installation

Install this package via composer.

```shell
composer require putyourlightson/craft-spark-plug:^1.0.0-alpha.1
```

---

Created by [PutYourLightsOn](https://putyourlightson.com/).
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "putyourlightson/craft-spark-plug",
"description": "A real-time, template-driven hypermedia framework for Craft.",
"version": "1.0.0-alpha.1",
"type": "craft-module",
"license": "proprietary",
"require": {
"php": ">=8.2",
"craftcms/cms": "^5.0",
"putyourlightson/datastar-php": "1.0.1"
},
"require-dev": {
"craftcms/ecs": "dev-main",
"craftcms/phpstan": "dev-main",
"nystudio107/craft-autocomplete": "^1.12"
},
"autoload": {
"psr-4": {
"putyourlightson\\spark\\": "src/"
}
},
"scripts": {
"check-cs": "ecs check --ansi",
"fix-cs": "ecs check --ansi --fix",
"phpstan": "phpstan --memory-limit=1G"
},
"config": {
"allow-plugins": {
"craftcms/plugin-installer": true,
"pestphp/pest-plugin": true,
"yiisoft/yii2-composer": true
},
"optimize-autoloader": true,
"sort-packages": true
},
"support": {
"docs": "https://github.com/putyourlightson/craft-spark-plug",
"source": "https://github.com/putyourlightson/craft-spark-plug",
"issues": "https://github.com/putyourlightson/craft-spark-plug/issues"
}
}
13 changes: 13 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use craft\ecs\SetList;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function(ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/src',
__FILE__,
]);
$ecsConfig->parallel();
$ecsConfig->sets([SetList::CRAFT_CMS_4]);
};
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
includes:
- %currentWorkingDirectory%/vendor/craftcms/phpstan/phpstan.neon
parameters:
level: 5
paths:
- src
Loading

0 comments on commit bac7f3c

Please sign in to comment.