Refactor format actions
This commit is contained in:
parent
786efb4503
commit
0ea97e907e
16
Makefile
16
Makefile
@ -30,22 +30,6 @@ build: clean build-assets build-site
|
|||||||
build-prod:
|
build-prod:
|
||||||
$(MAKE) build TARGET=prod
|
$(MAKE) build TARGET=prod
|
||||||
|
|
||||||
# Format
|
|
||||||
|
|
||||||
format-pages:
|
|
||||||
./tools/npm run format-md
|
|
||||||
|
|
||||||
format-assets:
|
|
||||||
./tools/npm run format-webpack
|
|
||||||
./tools/npm run format-js
|
|
||||||
./tools/npm run format-vue
|
|
||||||
./tools/npm run format-style
|
|
||||||
|
|
||||||
format-php:
|
|
||||||
./tools/php-cs-fixer fix
|
|
||||||
|
|
||||||
format: format-pages format-assets format-php
|
|
||||||
|
|
||||||
watch: clean build-assets
|
watch: clean build-assets
|
||||||
./tools/sculpin generate \
|
./tools/sculpin generate \
|
||||||
--env="${APP_ENV}" \
|
--env="${APP_ENV}" \
|
||||||
|
20
Taskfile.yml
20
Taskfile.yml
@ -50,3 +50,23 @@ tasks:
|
|||||||
vars: { CLI_ARGS: "install" }
|
vars: { CLI_ARGS: "install" }
|
||||||
- task: npm
|
- task: npm
|
||||||
vars: { CLI_ARGS: "install" }
|
vars: { CLI_ARGS: "install" }
|
||||||
|
|
||||||
|
format-pages:
|
||||||
|
cmds:
|
||||||
|
- task: npm
|
||||||
|
vars: { CLI_ARGS: 'run format-md' }
|
||||||
|
|
||||||
|
format-assets:
|
||||||
|
cmds:
|
||||||
|
- task: npm
|
||||||
|
vars: { CLI_ARGS: 'run format-webpack' }
|
||||||
|
- task: npm
|
||||||
|
vars: { CLI_ARGS: 'run format-js' }
|
||||||
|
- task: npm
|
||||||
|
vars: { CLI_ARGS: 'run format-vue' }
|
||||||
|
- task: npm
|
||||||
|
vars: { CLI_ARGS: 'run format-style' }
|
||||||
|
|
||||||
|
format-php:
|
||||||
|
cmds:
|
||||||
|
- docker run {{.DOCKER_COMMON_OPTS}} "{{.PHP_IMAGE}}" php-cs-fixer fix
|
||||||
|
@ -11,9 +11,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|||||||
|
|
||||||
class HtmlPrettierExtension extends Extension
|
class HtmlPrettierExtension extends Extension
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||||
|
@ -4,21 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Homepage\HtmlPrettierBundle;
|
namespace Homepage\HtmlPrettierBundle;
|
||||||
|
|
||||||
use Generator;
|
|
||||||
use Sculpin\Core\Event\SourceSetEvent;
|
use Sculpin\Core\Event\SourceSetEvent;
|
||||||
use Sculpin\Core\Sculpin;
|
use Sculpin\Core\Sculpin;
|
||||||
use Sculpin\Core\Source\SourceInterface;
|
use Sculpin\Core\Source\SourceInterface;
|
||||||
use Sculpin\Core\Source\SourceSet;
|
use Sculpin\Core\Source\SourceSet;
|
||||||
|
|
||||||
use function strlen;
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
class HtmlPrettier implements EventSubscriberInterface
|
class HtmlPrettier implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -47,7 +40,7 @@ class HtmlPrettier implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function filterSource(SourceSet $sourceSet): Generator
|
private function filterSource(SourceSet $sourceSet): \Generator
|
||||||
{
|
{
|
||||||
/** @var SourceInterface $source */
|
/** @var SourceInterface $source */
|
||||||
foreach ($sourceSet->allSources() as $source) {
|
foreach ($sourceSet->allSources() as $source) {
|
||||||
@ -65,7 +58,7 @@ class HtmlPrettier implements EventSubscriberInterface
|
|||||||
|
|
||||||
private function endsWith($haystack, $needle): bool
|
private function endsWith($haystack, $needle): bool
|
||||||
{
|
{
|
||||||
$length = strlen($needle);
|
$length = \strlen($needle);
|
||||||
|
|
||||||
return $length === 0 || (substr($haystack, -$length) === $needle);
|
return $length === 0 || (substr($haystack, -$length) === $needle);
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|||||||
|
|
||||||
class SiteMapExtension extends Extension
|
class SiteMapExtension extends Extension
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||||
|
@ -23,9 +23,6 @@ class SiteMapGenerator implements DataProviderInterface, EventSubscriberInterfac
|
|||||||
*/
|
*/
|
||||||
private $sources;
|
private $sources;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -11,9 +11,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|||||||
|
|
||||||
class TwigExtensionExtension extends Extension
|
class TwigExtensionExtension extends Extension
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||||
|
Loading…
Reference in New Issue
Block a user