diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index fdfb3c8b..58ddae48 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -68,15 +68,13 @@ jobs: cd ~/drupal COMPOSER_MEMORY_LIMIT=-1 composer require --dev phpspec/prophecy-phpunit:^2 -W if: ${{ startsWith(matrix.drupal, '9') }} + - name: Run phpcs + run: | + ~/drupal/vendor/bin/phpcs -p -s --colors --standard=modules/next/phpcs.xml modules/next - name: Copy module run: cp -R ../next-drupal/modules/next ~/drupal/web/modules/next - name: Run php built-in server run: php -S 127.0.0.1:8080 -t ~/drupal/web & - - name: Run phpcs - run: | - cd ~/drupal/web - cp modules/next/phpcs.xml.dist . - ../vendor/bin/phpcs --standard=./phpcs.xml.dist modules/next -p -s -n --colors - name: Run PHPUnit run: | cd ~/drupal/web diff --git a/modules/next/modules/next_extras/src/Plugin/Field/FieldType/ContentTranslationsFieldItemList.php b/modules/next/modules/next_extras/src/Plugin/Field/FieldType/ContentTranslationsFieldItemList.php index 5ca0c1dd..acfb2e13 100644 --- a/modules/next/modules/next_extras/src/Plugin/Field/FieldType/ContentTranslationsFieldItemList.php +++ b/modules/next/modules/next_extras/src/Plugin/Field/FieldType/ContentTranslationsFieldItemList.php @@ -6,7 +6,7 @@ use Drupal\Core\TypedData\ComputedItemListTrait; /** - * Class ContentTranslationsFieldItemList. + * A list of field item objects with translations. */ class ContentTranslationsFieldItemList extends FieldItemList { diff --git a/modules/next/modules/next_jwt/src/EventSubscriber/JwtEventSubscriber.php b/modules/next/modules/next_jwt/src/EventSubscriber/JwtEventSubscriber.php index 4663b996..598a8ce0 100644 --- a/modules/next/modules/next_jwt/src/EventSubscriber/JwtEventSubscriber.php +++ b/modules/next/modules/next_jwt/src/EventSubscriber/JwtEventSubscriber.php @@ -9,7 +9,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Class JwtEventSubscriber. + * Subscribes to JWT authentication events. */ class JwtEventSubscriber implements EventSubscriberInterface { diff --git a/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php b/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php index 6c2804e8..c5676e21 100644 --- a/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php +++ b/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php @@ -11,7 +11,6 @@ use Drupal\Core\Session\AccountProxyInterface; use Drupal\Core\Url; use Drupal\jwt\Authentication\Provider\JwtAuth; -use Drupal\next\Annotation\PreviewUrlGenerator; use Drupal\next\Entity\NextSiteInterface; use Drupal\next\Exception\InvalidPreviewUrlRequest; use Drupal\next\Plugin\ConfigurablePreviewUrlGeneratorBase; @@ -142,7 +141,8 @@ public function generate(NextSiteInterface $next_site, EntityInterface $entity, $query['timestamp'] = $timestamp = $this->time->getRequestTime(); $query['secret'] = $secret = $this->previewSecretGenerator->generate($timestamp . $slug . $resource_version . $this->user->uuid()); - // Generate a JWT and store it temporarily so that we can retrieve it on validate. + // Generate a JWT and store it temporarily so that we can retrieve it on + // validate. $jwt = $this->jwtAuth->generateToken(); $this->keyValue->get('next_jwt') ->setWithExpire($secret, $jwt, $this->configuration['access_token_expiration']); diff --git a/modules/next/phpcs.xml b/modules/next/phpcs.xml new file mode 100644 index 00000000..b71066cd --- /dev/null +++ b/modules/next/phpcs.xml @@ -0,0 +1,10 @@ + + + + */config/* + */css/* + */js/* + + + + diff --git a/modules/next/phpcs.xml.dist b/modules/next/phpcs.xml.dist deleted file mode 100644 index ad919fda..00000000 --- a/modules/next/phpcs.xml.dist +++ /dev/null @@ -1,12 +0,0 @@ - - - - */.git/* - */config/* - */css/* - */js/* - */vendor/* - \.md - - - diff --git a/modules/next/src/Controller/NextSiteEntityController.php b/modules/next/src/Controller/NextSiteEntityController.php index 126b9a54..07fab5a7 100644 --- a/modules/next/src/Controller/NextSiteEntityController.php +++ b/modules/next/src/Controller/NextSiteEntityController.php @@ -107,7 +107,7 @@ public function environmentVariables(NextSiteInterface $next_site) { '#context' => [ 'name' => $name, 'value' => $value, - ] + ], ]; } diff --git a/modules/next/src/Entity/NextEntityTypeConfig.php b/modules/next/src/Entity/NextEntityTypeConfig.php index 89c2e194..c6284c17 100644 --- a/modules/next/src/Entity/NextEntityTypeConfig.php +++ b/modules/next/src/Entity/NextEntityTypeConfig.php @@ -3,7 +3,6 @@ namespace Drupal\next\Entity; use Drupal\Core\Config\Entity\ConfigEntityBase; -use Drupal\Core\Entity\EntityInterface; use Drupal\next\Plugin\RevalidatorInterface; use Drupal\next\Plugin\SiteResolverInterface; use Drupal\next\RevalidatorPluginCollection; diff --git a/modules/next/src/Entity/NextEntityTypeConfigInterface.php b/modules/next/src/Entity/NextEntityTypeConfigInterface.php index ef4d8b57..213c31c2 100644 --- a/modules/next/src/Entity/NextEntityTypeConfigInterface.php +++ b/modules/next/src/Entity/NextEntityTypeConfigInterface.php @@ -3,12 +3,9 @@ namespace Drupal\next\Entity; use Drupal\Core\Config\Entity\ConfigEntityInterface; -use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityWithPluginCollectionInterface; use Drupal\next\Plugin\RevalidatorInterface; use Drupal\next\Plugin\SiteResolverInterface; -use Drupal\next\RevalidatorPluginCollection; -use Drupal\next\SiteResolverPluginCollection; /** * Provides an interface for next_entity_type_config entity definitions. diff --git a/modules/next/src/Entity/NextSite.php b/modules/next/src/Entity/NextSite.php index c4565841..ffa72d56 100644 --- a/modules/next/src/Entity/NextSite.php +++ b/modules/next/src/Entity/NextSite.php @@ -176,8 +176,8 @@ public function setRevalidateSecret(string $revalidate_secret): NextSiteInterfac * {@inheritdoc} */ public function getPreviewUrlForEntity(EntityInterface $entity): Url { - // Anonymous users do not have access to the preview url. - // Same for authenticated users with no additional roles, since we assume no scope. + // Anonymous users do not have access to the preview url. Same for + // authenticated users with no additional roles, since we assume no scope. if (\Drupal::currentUser()->isAnonymous() || (!count(\Drupal::currentUser()->getRoles(TRUE)) && \Drupal::currentUser()->id() !== "1")) { return $this->getLiveUrlForEntity($entity); } @@ -190,20 +190,21 @@ public function getPreviewUrlForEntity(EntityInterface $entity): Url { /** @var \Drupal\Core\Entity\RevisionableInterface $entity */ $rel = NULL; - // In Drupal terms, a "working copy" is the latest revision. It may or may not - // be a "default" revision. This revision is the working copy because it is - // the revision to which new work will be applied. In other words, it denotes - // the most recent revision which might be considered a work-in-progress. + // In Drupal terms, a "working copy" is the latest revision. It may or may + // not be a "default" revision. This revision is the working copy because + // it is the revision to which new work will be applied. In other words, + // it denotes the most recent revision which might be considered a + // work-in-progress. // @see \Drupal\jsonapi\Revisions\VersionByRel if ($entity->isLatestRevision()) { $rel = 'working-copy'; } - // In Drupal terms, the "latest version" is the latest "default" revision. It - // may or may not have later revisions after it, as long as none of them are - // "default" revisions. This revision is the latest version because it is the - // last revision where work was considered finished. Typically, this means - // that it is the most recent "published" revision. + // In Drupal terms, the "latest version" is the latest "default" revision. + // It may or may not have later revisions after it, as long as none of + // them are "default" revisions. This revision is the latest version + // because it is the last revision where work was considered finished. + // Typically, this means that it is the most recent "published" revision. // @see \Drupal\jsonapi\Revisions\VersionByRel if ($entity->isDefaultRevision()) { $rel = 'latest-version'; @@ -211,7 +212,7 @@ public function getPreviewUrlForEntity(EntityInterface $entity): Url { $resource_version = $rel ? "rel:$rel" : "id:{$entity->getRevisionId()}"; } - // TODO: Extract this to a service. + // @todo Extract this to a service. /** @var \Drupal\next\NextSettingsManagerInterface $next_settings */ $next_settings = \Drupal::service('next.settings.manager'); $preview_url_generator = $next_settings->getPreviewUrlGenerator(); @@ -228,8 +229,8 @@ public function getPreviewUrlForEntity(EntityInterface $entity): Url { $query = $preview_url->getOption('query'); - // Add the plugin to the query. - // This allows next.js app to determine the preview strategy based on the plugin. + // Add the plugin to the query. This allows next.js app to determine the + // preview strategy based on the plugin. $query['plugin'] = $preview_url_generator->getId(); // Add the locale to the query. diff --git a/modules/next/src/Event/EntityActionEventInterface.php b/modules/next/src/Event/EntityActionEventInterface.php index c93cdda8..39c85a7b 100644 --- a/modules/next/src/Event/EntityActionEventInterface.php +++ b/modules/next/src/Event/EntityActionEventInterface.php @@ -20,7 +20,9 @@ interface EntityActionEventInterface { public const UPDATE_ACTION = 'update'; /** - * The entity delete action. We use predelete because we need access to the entity for revalidating. + * The entity delete action. + * + * We use predelete because we need access to the entity for revalidating. */ public const DELETE_ACTION = 'delete'; diff --git a/modules/next/src/Event/EntityRevalidatedEvent.php b/modules/next/src/Event/EntityRevalidatedEvent.php index e65d0ffd..688c0b90 100644 --- a/modules/next/src/Event/EntityRevalidatedEvent.php +++ b/modules/next/src/Event/EntityRevalidatedEvent.php @@ -2,8 +2,6 @@ namespace Drupal\next\Event; -use Drupal\Core\Entity\EntityInterface; - /** * Defines an entity revalidated event. * diff --git a/modules/next/src/Form/NextEntityTypeConfigDeleteForm.php b/modules/next/src/Form/NextEntityTypeConfigDeleteForm.php index 2bfd8eb9..540c4a7f 100644 --- a/modules/next/src/Form/NextEntityTypeConfigDeleteForm.php +++ b/modules/next/src/Form/NextEntityTypeConfigDeleteForm.php @@ -6,7 +6,7 @@ use Drupal\Core\Url; /** - * Provides a deletion confirmation form for the next_entity_type_config deletion form. + * Provides a deletion confirmation form for next_entity_type_config. */ class NextEntityTypeConfigDeleteForm extends EntityDeleteForm { diff --git a/modules/next/src/Form/NextEntityTypeConfigForm.php b/modules/next/src/Form/NextEntityTypeConfigForm.php index eb728e10..feb56514 100644 --- a/modules/next/src/Form/NextEntityTypeConfigForm.php +++ b/modules/next/src/Form/NextEntityTypeConfigForm.php @@ -62,8 +62,10 @@ class NextEntityTypeConfigForm extends EntityForm { */ public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, SiteResolverManagerInterface $site_resolver_manager, RevalidatorManagerInterface $revalidator_manager = NULL) { if (!$revalidator_manager) { - @trigger_error('Calling NextEntityTypeConfigForm::__construct() without the $revalidator_manager argument is deprecated in next:1.4.0. The $revalidator_manager argument will be required in next:2.0.0. See https://www.drupal.org/project/next/releases/1.4.0', E_USER_DEPRECATED); + @trigger_error('Calling NextEntityTypeConfigForm::__construct() without the $revalidator_manager argument is deprecated in next:1.4.0 and will be required in next:2.0.0. See https://www.drupal.org/node/3325622', E_USER_DEPRECATED); + // @codingStandardsIgnoreStart $revalidator_manager = \Drupal::service('plugin.manager.next.revalidator'); + // @codingStandardsIgnoreEnd } $this->entityTypeManager = $entity_type_manager; diff --git a/modules/next/src/Form/NextSettingsForm.php b/modules/next/src/Form/NextSettingsForm.php index d44da020..ac938209 100644 --- a/modules/next/src/Form/NextSettingsForm.php +++ b/modules/next/src/Form/NextSettingsForm.php @@ -43,8 +43,10 @@ class NextSettingsForm extends ConfigFormBase { */ public function __construct(ConfigFactoryInterface $config_factory, SitePreviewerManagerInterface $site_previewer_manager, PreviewUrlGeneratorManagerInterface $preview_url_generator_manager = NULL) { if (!$preview_url_generator_manager) { - @trigger_error('Calling NextSettingsForm::__construct() without the $preview_url_generator_manager argument is deprecated in next:1.3.0. The $preview_url_generator_manager argument will be required in next:2.0.0. See https://www.drupal.org/project/next/releases/1.3.0', E_USER_DEPRECATED); + @trigger_error('Calling NextSettingsForm::__construct() without the $preview_url_generator_manager argument is deprecated in next:1.3.0 and will be required in next:2.0.0. See https://www.drupal.org/node/3308330', E_USER_DEPRECATED); + // @codingStandardsIgnoreStart $preview_url_generator_manager = \Drupal::service('plugin.manager.next.preview_url_generator'); + // @codingStandardsIgnoreEnd } parent::__construct($config_factory); diff --git a/modules/next/src/NextEntityTypeManager.php b/modules/next/src/NextEntityTypeManager.php index e7aa8c31..b0950503 100644 --- a/modules/next/src/NextEntityTypeManager.php +++ b/modules/next/src/NextEntityTypeManager.php @@ -65,7 +65,7 @@ public function getConfigEntityTypeIds() { public function getEntityFromRouteMatch(RouteMatchInterface $route_match): ?EntityInterface { $entity_types_ids = $this->getConfigEntityTypeIds(); - // TODO: Handle all revisionable entity types. + // @todo Handle all revisionable entity types. $revision_routes = ['entity.node.revision', 'entity.node.latest_version']; if (in_array($route_match->getRouteName(), $revision_routes) && in_array('node', $entity_types_ids)) { $node_revision = $route_match->getParameter('node_revision'); @@ -93,9 +93,12 @@ public function getEntityFromRouteMatch(RouteMatchInterface $route_match): ?Enti * {@inheritdoc} */ public function isEntityRevisionable(EntityInterface $entity): bool { + // @todo How do you do dependency injection on optional dependencies? + // @codingStandardsIgnoreStart if (\Drupal::hasService('jsonapi.resource_type.repository')) { - /* @var \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface $resource_type_repository */ + /** @var \Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface $resource_type_repository */ $resource_type_repository = \Drupal::service('jsonapi.resource_type.repository'); + // @codingStandardsIgnoreEnd $resource = $resource_type_repository->get($entity->getEntityTypeId(), $entity->bundle()); return $resource->isVersionable() && $entity->getEntityType()->isRevisionable(); } diff --git a/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php b/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php index e92266d3..ec17960f 100644 --- a/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php +++ b/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php @@ -11,7 +11,6 @@ use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Session\AccountProxyInterface; use Drupal\Core\Url; -use Drupal\next\Annotation\PreviewUrlGenerator; use Drupal\next\Entity\NextSiteInterface; use Drupal\next\Exception\InvalidPreviewUrlRequest; use Drupal\next\Plugin\ConfigurablePreviewUrlGeneratorBase; diff --git a/modules/next/src/Plugin/Next/Revalidator/Path.php b/modules/next/src/Plugin/Next/Revalidator/Path.php index fce7e5c7..af95288e 100644 --- a/modules/next/src/Plugin/Next/Revalidator/Path.php +++ b/modules/next/src/Plugin/Next/Revalidator/Path.php @@ -3,7 +3,6 @@ namespace Drupal\next\Plugin\Next\Revalidator; use Drupal\Core\Form\FormStateInterface; -use Drupal\next\Annotation\Revalidator; use Drupal\next\Event\EntityActionEvent; use Drupal\next\Plugin\ConfigurableRevalidatorBase; use Drupal\next\Plugin\RevalidatorInterface; diff --git a/modules/next/src/Plugin/Next/SitePreviewer/Iframe.php b/modules/next/src/Plugin/Next/SitePreviewer/Iframe.php index fa8f8b3e..d7a36b15 100644 --- a/modules/next/src/Plugin/Next/SitePreviewer/Iframe.php +++ b/modules/next/src/Plugin/Next/SitePreviewer/Iframe.php @@ -10,7 +10,6 @@ use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\Core\Url; use Drupal\next\Form\IframeSitePreviewerSwitcherForm; use Drupal\next\Plugin\ConfigurableSitePreviewerBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -191,7 +190,7 @@ public function render(EntityInterface $entity, array $sites) { 'class' => [ $entity->isPublished() ? 'published' : '', ], - ] + ], ]; } @@ -243,8 +242,8 @@ public function render(EntityInterface $entity, array $sites) { 'iframe_preview' => [ 'sync_route' => $this->configuration['sync_route'], 'skip_routes' => array_map('trim', explode("\n", mb_strtolower($this->configuration['sync_route_skip_routes']))), - ] - ] + ], + ], ], 'library' => [ 'next/site_preview.iframe', diff --git a/modules/next/src/Plugin/Next/SiteResolver/EntityReferenceField.php b/modules/next/src/Plugin/Next/SiteResolver/EntityReferenceField.php index 1fecf658..a1857149 100644 --- a/modules/next/src/Plugin/Next/SiteResolver/EntityReferenceField.php +++ b/modules/next/src/Plugin/Next/SiteResolver/EntityReferenceField.php @@ -19,7 +19,8 @@ * @SiteResolver( * id = "entity_reference_field", * label = "Entity reference field", - * description = "This plugin allows you to select an entity reference field from which to resolve the Next.js site." + * description = "This plugin allows you to select an entity reference field + * from which to resolve the Next.js site." * ) */ class EntityReferenceField extends ConfigurableSiteResolverBase implements ContainerFactoryPluginInterface { diff --git a/modules/next/src/Plugin/Next/SiteResolver/SiteSelector.php b/modules/next/src/Plugin/Next/SiteResolver/SiteSelector.php index 6fceddbb..5a22351d 100644 --- a/modules/next/src/Plugin/Next/SiteResolver/SiteSelector.php +++ b/modules/next/src/Plugin/Next/SiteResolver/SiteSelector.php @@ -16,7 +16,8 @@ * @SiteResolver( * id = "site_selector", * label = "Site selector", - * description = "The site selector plugin allows you to manually select the Next.js sites for the entity type." + * description = "The site selector plugin allows you to manually select the + * Next.js sites for the entity type." * ) */ class SiteSelector extends ConfigurableSiteResolverBase implements ContainerFactoryPluginInterface { diff --git a/modules/next/src/Plugin/RevalidatorBase.php b/modules/next/src/Plugin/RevalidatorBase.php index 5632e805..fd4136f1 100644 --- a/modules/next/src/Plugin/RevalidatorBase.php +++ b/modules/next/src/Plugin/RevalidatorBase.php @@ -6,7 +6,6 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\PluginBase; use Drupal\next\NextSettingsManagerInterface; -use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/next/src/Plugin/RevalidatorInterface.php b/modules/next/src/Plugin/RevalidatorInterface.php index 339da178..dca70f48 100644 --- a/modules/next/src/Plugin/RevalidatorInterface.php +++ b/modules/next/src/Plugin/RevalidatorInterface.php @@ -2,7 +2,6 @@ namespace Drupal\next\Plugin; -use Drupal\Core\Entity\EntityInterface; use Drupal\next\Event\EntityActionEvent; /** diff --git a/modules/next/src/Plugin/SitePreviewerManager.php b/modules/next/src/Plugin/SitePreviewerManager.php index 13b040c9..b4bc756f 100644 --- a/modules/next/src/Plugin/SitePreviewerManager.php +++ b/modules/next/src/Plugin/SitePreviewerManager.php @@ -6,7 +6,6 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\next\Annotation\SitePreviewer; -use Drupal\next\Annotation\SiteResolver; /** * Plugin manager for site previewers. diff --git a/modules/next/src/Render/MainContent/HtmlRenderer.php b/modules/next/src/Render/MainContent/HtmlRenderer.php index 1909062f..0e229ca9 100644 --- a/modules/next/src/Render/MainContent/HtmlRenderer.php +++ b/modules/next/src/Render/MainContent/HtmlRenderer.php @@ -95,11 +95,11 @@ protected function prepare(array $main_content, Request $request, RouteMatchInte return $build; } - // TODO: Make this configurable? + // @todo Make this configurable? $entity_type_id = $entity->getEntityTypeId(); $revision_routes = $entity->getEntityType()->isRevisionable() ? [ "entity.$entity_type_id.revision", - "entity.$entity_type_id.latest_version" + "entity.$entity_type_id.latest_version", ] : []; $routes = array_merge(["entity.$entity_type_id.canonical"], $revision_routes); diff --git a/modules/next/tests/src/Kernel/Controller/NextPreviewUrlControllerTest.php b/modules/next/tests/src/Kernel/Controller/NextPreviewUrlControllerTest.php index 54905576..da752d85 100644 --- a/modules/next/tests/src/Kernel/Controller/NextPreviewUrlControllerTest.php +++ b/modules/next/tests/src/Kernel/Controller/NextPreviewUrlControllerTest.php @@ -50,7 +50,7 @@ protected function setUp(): void { 'id' => 'blog', 'base_url' => 'https://blog.com', 'preview_url' => 'https://blog.com/api/preview', - 'preview_secret' => 'one' + 'preview_secret' => 'one', ]); $this->nextSite->save(); diff --git a/modules/next/tests/src/Kernel/Controller/NextSiteEntityControllerTest.php b/modules/next/tests/src/Kernel/Controller/NextSiteEntityControllerTest.php index 734d2ade..b9c694e0 100644 --- a/modules/next/tests/src/Kernel/Controller/NextSiteEntityControllerTest.php +++ b/modules/next/tests/src/Kernel/Controller/NextSiteEntityControllerTest.php @@ -63,7 +63,7 @@ public function testEnvironmentVariables() { */ public function testOverriddenEnvironmentVariables() { $GLOBALS['config']['next.next_site.' . $this->nextSite->id()] = [ - 'preview_secret' => 'overridden' + 'preview_secret' => 'overridden', ]; $overridden_entity = NextSite::load($this->nextSite->id()); $controller = NextSiteEntityController::create($this->container); diff --git a/modules/next/tests/src/Kernel/Entity/NextEntityTypeConfigTest.php b/modules/next/tests/src/Kernel/Entity/NextEntityTypeConfigTest.php index 4a2cfc7e..ad134adb 100644 --- a/modules/next/tests/src/Kernel/Entity/NextEntityTypeConfigTest.php +++ b/modules/next/tests/src/Kernel/Entity/NextEntityTypeConfigTest.php @@ -52,7 +52,7 @@ protected function setUp(): void { */ public function testSiteResolver() { $blog_site = NextSite::create([ - 'id' => 'blog' + 'id' => 'blog', ]); $blog_site->save(); @@ -116,7 +116,7 @@ public function testSiteResolver() { */ public function testRevalidator() { $blog_site = NextSite::create([ - 'id' => 'blog' + 'id' => 'blog', ]); $blog_site->save(); diff --git a/modules/next/tests/src/Kernel/Entity/NextSiteTest.php b/modules/next/tests/src/Kernel/Entity/NextSiteTest.php index 4b940d72..daff6232 100644 --- a/modules/next/tests/src/Kernel/Entity/NextSiteTest.php +++ b/modules/next/tests/src/Kernel/Entity/NextSiteTest.php @@ -48,7 +48,7 @@ protected function setUp(): void { 'id' => 'blog', 'base_url' => 'https://blog.com', 'preview_url' => 'https://blog.com/api/preview', - 'preview_secret' => 'one' + 'preview_secret' => 'one', ]); $this->nextSite->save(); diff --git a/modules/next/tests/src/Kernel/Event/EntityRevalidatedEventTest.php b/modules/next/tests/src/Kernel/Event/EntityRevalidatedEventTest.php index 90054307..51d9e983 100644 --- a/modules/next/tests/src/Kernel/Event/EntityRevalidatedEventTest.php +++ b/modules/next/tests/src/Kernel/Event/EntityRevalidatedEventTest.php @@ -6,7 +6,6 @@ use Drupal\dblog\Controller\DbLogController; use Drupal\KernelTests\KernelTestBase; use Drupal\next\Entity\NextEntityTypeConfig; -use Drupal\node\Entity\NodeType; use Drupal\Tests\node\Traits\NodeCreationTrait; /** diff --git a/modules/next/tests/src/Kernel/NextEntityTypeManagerTest.php b/modules/next/tests/src/Kernel/NextEntityTypeManagerTest.php index 5ae78c57..f3df8a0a 100644 --- a/modules/next/tests/src/Kernel/NextEntityTypeManagerTest.php +++ b/modules/next/tests/src/Kernel/NextEntityTypeManagerTest.php @@ -5,8 +5,6 @@ use Drupal\KernelTests\KernelTestBase; use Drupal\next\Entity\NextEntityTypeConfig; use Drupal\next\Entity\NextSite; -use Drupal\next\Plugin\Next\PreviewUrlGenerator\SimpleOauth; -use Drupal\next\Plugin\Next\SitePreviewer\Iframe; use Drupal\Tests\node\Traits\NodeCreationTrait; /** @@ -48,7 +46,7 @@ public function testGetSitesForEntity() { $this->assertEmpty($next_entity_type_manager->getSitesForEntity($page)); $blog_site = NextSite::create([ - 'id' => 'blog' + 'id' => 'blog', ]); $blog_site->save(); $this->assertEmpty($next_entity_type_manager->getSitesForEntity($page)); @@ -93,7 +91,7 @@ public function testGetSiteResolver() { $this->assertEmpty($next_entity_type_manager->getSiteResolver($page)); $blog_site = NextSite::create([ - 'id' => 'blog' + 'id' => 'blog', ]); $blog_site->save(); $this->assertEmpty($next_entity_type_manager->getSiteResolver($page)); diff --git a/modules/next/tests/src/Kernel/Plugin/PathRevalidatorTest.php b/modules/next/tests/src/Kernel/Plugin/PathRevalidatorTest.php index 51eb5a18..56306460 100644 --- a/modules/next/tests/src/Kernel/Plugin/PathRevalidatorTest.php +++ b/modules/next/tests/src/Kernel/Plugin/PathRevalidatorTest.php @@ -57,7 +57,7 @@ public function testRevalidate() { $this->container->set('http_client', $client->reveal()); $blog_site = NextSite::create([ - 'id' => 'blog' + 'id' => 'blog', ]); $blog_site->save(); @@ -108,7 +108,7 @@ public function testRevalidate() { _drupal_shutdown_function(); $entity_type_config->setRevalidatorConfiguration('path', [ - 'additional_paths' => "/\n/blog" + 'additional_paths' => "/\n/blog", ])->save(); $client->request('GET', 'http://marketing.com/api/revalidate?slug=/node/3&secret=12345')->shouldBeCalled(); diff --git a/modules/next/tests/src/Kernel/Plugin/SiteResolverTest.php b/modules/next/tests/src/Kernel/Plugin/SiteResolverTest.php index 73d4a593..0cd090fd 100644 --- a/modules/next/tests/src/Kernel/Plugin/SiteResolverTest.php +++ b/modules/next/tests/src/Kernel/Plugin/SiteResolverTest.php @@ -55,7 +55,7 @@ protected function setUp(): void { 'id' => 'blog', 'base_url' => 'https://blog.com', 'preview_url' => 'https://blog.com/api/preview', - 'preview_secret' => 'one' + 'preview_secret' => 'one', ]); $blog->save(); @@ -64,7 +64,7 @@ protected function setUp(): void { 'id' => 'marketing', 'base_url' => 'https://marketing.com', 'preview_url' => 'https://marketing.com/api/preview', - 'preview_secret' => 'two' + 'preview_secret' => 'two', ]); $marketing->save(); diff --git a/modules/next/tests/src/Kernel/Renderer/MainContent/HtmlRendererTest.php b/modules/next/tests/src/Kernel/Renderer/MainContent/HtmlRendererTest.php index 8b392362..96802589 100644 --- a/modules/next/tests/src/Kernel/Renderer/MainContent/HtmlRendererTest.php +++ b/modules/next/tests/src/Kernel/Renderer/MainContent/HtmlRendererTest.php @@ -58,7 +58,7 @@ protected function setUp(): void { 'id' => 'blog', 'base_url' => 'https://blog.com', 'preview_url' => 'https://blog.com/api/preview', - 'preview_secret' => 'one' + 'preview_secret' => 'one', ]); $blog->save(); diff --git a/package.json b/package.json index b15fb8b8..af13b22d 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "prepare": "lerna run prepare && husky install", "watch": "lerna run watch", "lint": "eslint --cache --ext .js,.jsx,.ts,.tsx .", - "phpcs": "./drupal/vendor/bin/phpcs -s -n --colors --standard=modules/next/phpcs.xml.dist modules/next", + "phpcs": "./drupal/vendor/bin/phpcs -p -s --colors --standard=modules/next/phpcs.xml modules/next", "test:next": "./drupal/vendor/bin/phpunit -c ./drupal/web modules/next", "sync:modules": "./scripts/sync-modules.sh \"modules/*\"", "sync:examples": "./scripts/sync-examples.sh \"examples/example-*\"", diff --git a/packages/next-drupal-query/.npmignore b/packages/next-drupal-query/.npmignore new file mode 100644 index 00000000..37c02ed7 --- /dev/null +++ b/packages/next-drupal-query/.npmignore @@ -0,0 +1,3 @@ +/coverage +/CHANGELOG.md +/tests diff --git a/packages/next-drupal/.npmignore b/packages/next-drupal/.npmignore index 95573d20..7299177e 100644 --- a/packages/next-drupal/.npmignore +++ b/packages/next-drupal/.npmignore @@ -1,5 +1,4 @@ -babel.config.js -*.test.js -coverage -__snapshots__ -test \ No newline at end of file +/coverage +/CHANGELOG.md +/tests +/tsconfig.json diff --git a/yarn.lock b/yarn.lock index d03a6049..4757d432 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6695,6 +6695,15 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -7892,11 +7901,6 @@ is-directory@^0.3.1: resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" integrity sha512-yVChGzahRFvbkscn2MlwGismPO12i9+znNruC5gVEntG3qu0xQMzsGg/JFbrsqDOHtHFPci+V5aP5T9I+yeKqw== -is-docker@^2.0.0, is-docker@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" - integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== - is-extendable@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -8197,13 +8201,6 @@ is-word-character@^1.0.0: resolved "https://registry.yarnpkg.com/is-word-character/-/is-word-character-1.0.4.tgz#ce0e73216f98599060592f62ff31354ddbeb0230" integrity sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA== -is-wsl@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" - integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== - dependencies: - is-docker "^2.0.0" - is-yarn-global@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232"