Hello!
I'm trying to develop my first extension. I've cloned this summary extension since it's pretty similar to what I'm planning to make.
I haven't modified the code yet, only making superficial changes to composer.json and extend.php. I've at least triple-checked path names in each to avoid the issue raised in this post as best I can (though it's still very possible I've messed something up here).
I'm using MAMP on a Windows machine which may be part of, if not the whole the issue. Running php flarum info returns a database error, though the local site itself works fine. I am suspicious this is because of the MAMP environment.
Any help would be much appreciated!
I'm developing in flarum/packages/previews, and here's the packages composer.json:
{
"name": "r2rodger/previews",
"description": "View thread previews",
"type": "flarum-extension",
"require": {
"flarum/core": ">=0.1.0-beta.12 <0.1.0-beta.14"
},
"autoload": {
"psr-4": {"R2rodger\\Previews\\": "src/"}
},
"extra": {
"flarum-extension": {
"title": "Previews",
"icon": {
"name": "fas fa-smile",
"backgroundColor": "#238c59",
"color": "#fff"
}
}
}
}
Extension.php
`<?php
/* This is part of the jordanjay/flarum-ext-summaries project.
*
- Modified code (c)2019 Jordan Schnaidt
*
- Original code (c) Toby Zerner toby.zerner@gmail.com
*
- For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.
*/
namespace r2rodger\previews;
use Flarum\Extend;
use Illuminate\Contracts\Events\Dispatcher;
return [
(new Extend\Frontend('forum'))
->js(DIR . '/js/dist/forum.js')
->css(DIR . '/resources/less/forum/extension.less'),
(new Extend\Frontend('admin'))
->js(DIR . '/js/dist/admin.js'),
function (Dispatcher $events) {
$events->subscribe(Listeners\AddApiAttributes::class);
$events->subscribe(Listeners\LoadUserSettings::class);
}];`
Flarum composer.json
....
"require": {
"r2rodger/previews": "*@dev",
....
"repositories": [
{
"type": "path",
"url": "packages/*"
}
]