Skip to content

Commit

Permalink
Update PwaCollector and exported_files workflow
Browse files Browse the repository at this point in the history
The PwaCollector class is updated to import Data from Symfony's VarDumper and modify the return type of the getData method. The isInstallable method is also refactored for a cleaner return statement. The exported_files workflow in the .github folder is altered to additionally exclude the 'templates' directory from the generated tar file.
  • Loading branch information
Spomky committed Apr 7, 2024
1 parent 1a76724 commit c7ceccd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/exported_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: "Check exported files"
run: |
EXPECTED="LICENSE,README.md,RELEASES.md,SECURITY.md,composer.json"
CURRENT="$(git archive HEAD | tar --list --exclude="assets" --exclude="assets/*" --exclude="src" --exclude="src/*" | paste -s -d ",")"
CURRENT="$(git archive HEAD | tar --list --exclude="assets" --exclude="assets/*" --exclude="src" --exclude="src/*" --exclude="templates" --exclude="templates/*" | paste -s -d ",")"
echo "CURRENT =${CURRENT}"
echo "EXPECTED=${EXPECTED}"
test "${CURRENT}" == "${EXPECTED}"
14 changes: 7 additions & 7 deletions src/DataCollector/PwaCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Serializer\Encoder\JsonEncode;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\VarDumper\Cloner\Data;
use Throwable;
use function count;
use function in_array;
Expand Down Expand Up @@ -61,11 +62,12 @@ public function collect(Request $request, Response $response, Throwable $excepti
'installable' => $this->isInstallable(),
'output' => $this->serializer->serialize($this->manifest, 'json', $jsonOptions),
];

dump($this->data);
}

public function getData(): array
/**
* @return array<string, mixed>|Data
*/
public function getData(): array|Data
{
return $this->data;
}
Expand Down Expand Up @@ -94,7 +96,7 @@ public function getName(): string
}

/**
* @return array{status: bool, reasons: string[]}
* @return array{status: bool, reasons: array<string, bool>}
*/
private function isInstallable(): array
{
Expand All @@ -107,9 +109,7 @@ private function isInstallable(): array
['standalone', 'fullscreen', 'minimal-ui'],
true
),
'The manifest must have at least one icon' => $this->manifest->icons === null || count(
$this->manifest->icons
) === 0,
'The manifest must have at least one icon' => count($this->manifest->icons) === 0,
'The manifest must have the "prefer_related_applications" property set to a value other than "true"' => $this->manifest->preferRelatedApplications === true,
];

Expand Down

0 comments on commit c7ceccd

Please sign in to comment.