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

PluginsResource: Treat moment.js as independent plugin #1295

Merged
Merged
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
29 changes: 18 additions & 11 deletions src/Console/PackageResources/PluginsResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ class PluginsResource extends PackageResource
/**
* The available plugins data. A plugin can contain next data keys:
* - name: The name of the plugin.
* - source: The source of the plugin (relative to base source)
* - target: The target of the plugin (relative to base target)
* - source: The source of the plugin (relative to base source).
* - target: The target of the plugin (relative to base target).
* - resources: An array with resources data items.
* - ignore: A list of file patterns to ignore.
* - recursive: Whether to copy files recursively (default is true).
* - dependencies: A list of plugin keys that are required as dependencies.
*
* When the target is not specified, the source will be used as the
* relative path to the base target destination. A resource can contain the
Expand Down Expand Up @@ -74,10 +75,8 @@ class PluginsResource extends PackageResource
],
'daterangepicker' => [
'name' => 'Date Range Picker',
'resources' => [
['source' => 'daterangepicker'],
['source' => 'moment'],
],
'source' => 'daterangepicker',
'dependencies' => ['moment'],
],
'ekkoLightbox' => [
'name' => 'Ekko Lightbox',
Expand Down Expand Up @@ -157,6 +156,10 @@ class PluginsResource extends PackageResource
],
'recursive' => false,
],
'moment' => [
'name' => 'Moment.js',
'source' => 'moment',
],
'paceProgress' => [
'name' => 'Pace Progress',
'source' => 'pace-progress',
Expand Down Expand Up @@ -186,10 +189,8 @@ class PluginsResource extends PackageResource
],
'tempusdominusBootstrap4' => [
'name' => 'Tempus Dominus for Bootstrap 4',
'resources' => [
['source' => 'tempusdominus-bootstrap-4'],
['source' => 'moment'],
],
'source' => 'tempusdominus-bootstrap-4',
'dependencies' => ['moment'],
],
'toastr' => [
'name' => 'Toastr',
Expand Down Expand Up @@ -355,7 +356,13 @@ protected function preparePlugin($plugin)
*/
protected function installPlugin($plugin)
{
// Check if we need to export the entire plugin.
// First, check and install dependencies plugins, if any.

foreach (($plugin['dependencies'] ?? []) as $pluginKey) {
$this->install($pluginKey);
}

// Now, check if we need to export the entire plugin.

if (! isset($plugin['resources'])) {
$this->publishResource($plugin);
Expand Down