From 6b0c22a462820a74e79be84c8574197e6de28e1f Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Tue, 5 Mar 2024 13:18:40 +0100 Subject: [PATCH 1/3] Package name changed --- README.md | 26 +++++++++++++------------- composer.json | 4 ++-- link | 10 +++++----- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index aae5458..7c57fb0 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ Progressive Web App for Symfony =============================== -![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Coding%20Standards/badge.svg) -![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Static%20Analyze/badge.svg) +![Build Status](https://github.com/Spomky-Labs/pwa-bundle/workflows/Coding%20Standards/badge.svg) +![Build Status](https://github.com/Spomky-Labs/pwa-bundle/workflows/Static%20Analyze/badge.svg) -![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Unit%20and%20Functional%20Tests/badge.svg) -![Build Status](https://github.com/Spomky-Labs/phpwa/workflows/Rector%20Checkstyle/badge.svg) +![Build Status](https://github.com/Spomky-Labs/pwa-bundle/workflows/Unit%20and%20Functional%20Tests/badge.svg) +![Build Status](https://github.com/Spomky-Labs/pwa-bundle/workflows/Rector%20Checkstyle/badge.svg) -[![Latest Stable Version](https://poser.pugx.org/Spomky-Labs/phpwa/v/stable.png)](https://packagist.org/packages/Spomky-Labs/phpwa) -[![Total Downloads](https://poser.pugx.org/Spomky-Labs/phpwa/downloads.png)](https://packagist.org/packages/Spomky-Labs/phpwa) -[![Latest Unstable Version](https://poser.pugx.org/Spomky-Labs/phpwa/v/unstable.png)](https://packagist.org/packages/Spomky-Labs/phpwa) -[![License](https://poser.pugx.org/Spomky-Labs/phpwa/license.png)](https://packagist.org/packages/Spomky-Labs/phpwa) +[![Latest Stable Version](https://poser.pugx.org/Spomky-Labs/pwa-bundle/v/stable.png)](https://packagist.org/packages/Spomky-Labs/pwa-bundle) +[![Total Downloads](https://poser.pugx.org/Spomky-Labs/pwa-bundle/downloads.png)](https://packagist.org/packages/Spomky-Labs/pwa-bundle) +[![Latest Unstable Version](https://poser.pugx.org/Spomky-Labs/pwa-bundle/v/unstable.png)](https://packagist.org/packages/Spomky-Labs/pwa-bundle) +[![License](https://poser.pugx.org/Spomky-Labs/pwa-bundle/license.png)](https://packagist.org/packages/Spomky-Labs/pwa-bundle) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Spomky-Labs/phpwa/badge)](https://api.securityscorecards.dev/projects/github.com/Spomky-Labs/phpwa) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Spomky-Labs/pwa-bundle/badge)](https://api.securityscorecards.dev/projects/github.com/Spomky-Labs/pwa-bundle) # Scope -This bundle provides the [Spomky-Labs/phpwa](https://github.com/Spomky-Labs/phpwa) bundle for Symfony. +This bundle provides the [Spomky-Labs/pwa-bundle](https://github.com/Spomky-Labs/pwa-bundle) bundle for Symfony. This will help you to generate Progressive Web Apps (PWA) Manifests and assets (icons or screenshots). Also, it will help you to generate Service Workers based on [Workbox](https://developers.google.com/web/tools/workbox). @@ -27,7 +27,7 @@ Please have a look at the [Web app manifests](https://developer.mozilla.org/en-U Install the bundle with Composer: ```bash -composer require spomky-labs/phpwa +composer require spomky-labs/pwa-bundle ``` This project follows the [semantic versioning](http://semver.org/) strictly. @@ -49,9 +49,9 @@ If you really love that project and the work I have done or if you want I priori # Contributing Requests for new features, bug fixed and all other ideas to make this project useful are welcome. -The best contribution you could provide is by fixing the [opened issues where help is wanted](https://github.com/Spomky-Labs/phpwa/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). +The best contribution you could provide is by fixing the [opened issues where help is wanted](https://github.com/Spomky-Labs/pwa-bundle/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). -Please report all issues in [the main repository](https://github.com/Spomky-Labs/phpwa/issues). +Please report all issues in [the main repository](https://github.com/Spomky-Labs/pwa-bundle/issues). Please make sure to [follow these best practices](.github/CONTRIBUTING.md). diff --git a/composer.json b/composer.json index 7f68597..584251b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "spomky-labs/phpwa", + "name": "spomky-labs/pwa-bundle", "description": "Progressive Web App Manifest Generator Bundle for Symfony.", "type": "symfony-bundle", "license": "MIT", @@ -11,7 +11,7 @@ "homepage": "https://github.com/Spomky" },{ "name": "All contributors", - "homepage": "https://github.com/spomky-labs/phpwa/contributors" + "homepage": "https://github.com/spomky-labs/pwa-bundle/contributors" } ], "autoload": { diff --git a/link b/link index e25523c..25c1a41 100644 --- a/link +++ b/link @@ -11,7 +11,7 @@ require __DIR__.'/vendor/autoload.php'; use Symfony\Component\Filesystem\Filesystem; /** - * Links dependencies to components to a local clone of the main spomky-labs/phpwa GitHub repository. + * Links dependencies to components to a local clone of the main spomky-labs/pwa-bundle GitHub repository. * Inspired by symfony/symfony and async-aws/aws */ @@ -19,8 +19,8 @@ $copy = false !== $k = array_search('--copy', $argv, true); $copy && array_splice($argv, $k, 1); $pathToProject = $argv[1] ?? getcwd(); -if (!is_dir("$pathToProject/vendor/spomky-labs/phpwa")) { - echo 'Link (or copy) dependencies to components to a local clone of the spomky-labs/phpwa GitHub repository.'.PHP_EOL.PHP_EOL; +if (!is_dir("$pathToProject/vendor/spomky-labs/pwa-bundle")) { + echo 'Link (or copy) dependencies to components to a local clone of the spomky-labs/pwa-bundle GitHub repository.'.PHP_EOL.PHP_EOL; echo "Usage: $argv[0] /path/to/the/project".PHP_EOL; echo ' Use `--copy` to copy dependencies instead of symlink'.PHP_EOL.PHP_EOL; echo "The directory \"$pathToProject\" does not exist or the dependencies are not installed, did you forget to run \"composer install\" in your project?".PHP_EOL; @@ -38,8 +38,8 @@ foreach ($directories as $dir) { } } -if (is_dir("$pathToProject/vendor/spomky-labs/phpwa")) { - if ($filesystem->exists($composer = "$pathToProject/vendor/spomky-labs/phpwa/composer.json")) { +if (is_dir("$pathToProject/vendor/spomky-labs/pwa-bundle")) { + if ($filesystem->exists($composer = "$pathToProject/vendor/spomky-labs/pwa-bundle/composer.json")) { $packages[json_decode(file_get_contents($composer))->name] = realpath(__DIR__); } } From bdbd3184f6fe5b8fd032e177173a88c999ce14d3 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Tue, 5 Mar 2024 21:14:58 +0100 Subject: [PATCH 2/3] fixex: Commands create files in wrong folder (#103) --- src/Command/CreateIconsCommand.php | 4 +--- src/Command/CreateScreenshotCommand.php | 4 +--- src/Command/CreateServiceWorkerCommand.php | 4 +--- src/Service/ServiceWorkerCompiler.php | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Command/CreateIconsCommand.php b/src/Command/CreateIconsCommand.php index a29a152..e494393 100644 --- a/src/Command/CreateIconsCommand.php +++ b/src/Command/CreateIconsCommand.php @@ -28,8 +28,6 @@ public function __construct( private readonly Filesystem $filesystem, #[Autowire('%kernel.project_dir%')] private readonly string $projectDir, - #[Autowire('%spomky_labs_pwa.asset_public_prefix%')] - private readonly string $assetPublicPrefix, private readonly null|ImageProcessor $imageProcessor, ) { parent::__construct(); @@ -54,7 +52,7 @@ protected function configure(): void 'o', InputOption::VALUE_OPTIONAL, 'The output directory', - sprintf('%s%s/icons/', $this->projectDir, $this->assetPublicPrefix) + sprintf('%s/assets/icons/', $this->projectDir) ); $this->addOption('filename', null, InputOption::VALUE_OPTIONAL, 'The output directory', 'icon'); $this->addOption( diff --git a/src/Command/CreateScreenshotCommand.php b/src/Command/CreateScreenshotCommand.php index fff967b..f9a9720 100644 --- a/src/Command/CreateScreenshotCommand.php +++ b/src/Command/CreateScreenshotCommand.php @@ -35,8 +35,6 @@ public function __construct( #[Autowire('%kernel.project_dir%')] private readonly string $projectDir, private readonly null|ImageProcessor $imageProcessor, - #[Autowire('%spomky_labs_pwa.asset_public_prefix%')] - private readonly string $assetPublicPrefix, #[Autowire('@pwa.web_client')] null|Client $webClient = null, ) { @@ -66,7 +64,7 @@ protected function configure(): void 'o', InputOption::VALUE_OPTIONAL, 'The output directory', - sprintf('%s%s/icons/', $this->projectDir, $this->assetPublicPrefix) + sprintf('%s/assets/screenshots/', $this->projectDir) ); $this->addOption('filename', null, InputOption::VALUE_OPTIONAL, 'The output filename', 'screenshot'); $this->addOption('width', null, InputOption::VALUE_OPTIONAL, 'The width of the screenshot'); diff --git a/src/Command/CreateServiceWorkerCommand.php b/src/Command/CreateServiceWorkerCommand.php index a5ac1d9..50bc38c 100644 --- a/src/Command/CreateServiceWorkerCommand.php +++ b/src/Command/CreateServiceWorkerCommand.php @@ -25,8 +25,6 @@ public function __construct( private readonly AssetMapperInterface $assetMapper, private readonly Filesystem $filesystem, private readonly FileLocator $fileLocator, - #[Autowire('%spomky_labs_pwa.asset_public_prefix%')] - private readonly string $assetPublicPrefix, #[Autowire('%kernel.project_dir%')] private readonly string $projectDir, ) { @@ -39,7 +37,7 @@ protected function configure(): void 'output', InputArgument::OPTIONAL, 'The output file', - sprintf('%s%s/sw.js', $this->projectDir, $this->assetPublicPrefix) + sprintf('%s/assets/sw.js', $this->projectDir) ); $this->addOption('force', 'f', InputOption::VALUE_NONE, 'Force the generation of the service worker'); } diff --git a/src/Service/ServiceWorkerCompiler.php b/src/Service/ServiceWorkerCompiler.php index 075bac0..fbf8842 100644 --- a/src/Service/ServiceWorkerCompiler.php +++ b/src/Service/ServiceWorkerCompiler.php @@ -24,7 +24,7 @@ public function __construct( private SerializerInterface $serializer, #[Autowire('%spomky_labs_pwa.asset_public_prefix%')] - private readonly string $assetPublicPrefix, + private string $assetPublicPrefix, #[Autowire('%spomky_labs_pwa.sw.enabled%')] private bool $serviceWorkerEnabled, private Manifest $manifest, From 3046639e76a67a88c3ad5f950954cd7bfb5176f6 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Tue, 5 Mar 2024 21:20:51 +0100 Subject: [PATCH 3/3] Merge-up --- src/Service/ServiceWorkerCompiler.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Service/ServiceWorkerCompiler.php b/src/Service/ServiceWorkerCompiler.php index 9a2c3d5..978a81f 100644 --- a/src/Service/ServiceWorkerCompiler.php +++ b/src/Service/ServiceWorkerCompiler.php @@ -32,6 +32,8 @@ public function __construct( string $manifestPublicUrl, #[Autowire('%spomky_labs_pwa.sw.enabled%')] private bool $serviceWorkerEnabled, + #[Autowire('%spomky_labs_pwa.asset_public_prefix%')] + private string $assetPublicPrefix, private Manifest $manifest, private ServiceWorker $serviceWorker, private AssetMapperInterface $assetMapper,