Skip to content

Bump the webpack group across 1 directory with 2 updates #1539

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

Open
wants to merge 2 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
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
841 changes: 545 additions & 296 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"tailwindcss": "^3.4.14",
"ts-loader": "^9.5.1",
"typescript": "^5.7.2",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1",
"webpack-notifier": "^1.15.0"
},
"license": "ISC",
Expand Down
8 changes: 4 additions & 4 deletions src/Command/AOICommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$key = $input->getArgument('region');
$region = $this->provider->getRegion(null, $key);

$name = sprintf('Welcome Tool for %s', $region['name']);
$name = \sprintf('Welcome Tool for %s', $region['name']);
$filters = [
'geometry' => $this->provider->getGeometry($region['continent'], $region['key']),
'all_reasons' => '40',
Expand All @@ -71,14 +71,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$response = $this->api->updateAreaOfInterest($region['osmcha.id'], $name, $filters);
}

$io->text(sprintf('%s %s', $response->getInfo('http_method'), $response->getInfo('url')));
$io->text(\sprintf('%s %s', $response->getInfo('http_method'), $response->getInfo('url')));

$data = $response->toArray();

if (null !== $date) {
$io->success(sprintf('OSMCha Area of Interest identifier for "%s" is "%s" (%s).', $name, $data['id'], $data['properties']['filters']['date__gte']));
$io->success(\sprintf('OSMCha Area of Interest identifier for "%s" is "%s" (%s).', $name, $data['id'], $data['properties']['filters']['date__gte']));
} else {
$io->success(sprintf('OSMCha Area of Interest identifier for "%s" is "%s".', $name, $data['id']));
$io->success(\sprintf('OSMCha Area of Interest identifier for "%s" is "%s".', $name, $data['id']));
}

return Command::SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/AOIListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$features = array_merge($features, $content['results']['features']);
}

$io->info(sprintf('Found %d Area(s) of Interest.', $count));
$io->info(\sprintf('Found %d Area(s) of Interest.', $count));

$welcome = array_filter($features, fn ($feature) => 'Welcome Tool' === substr($feature['properties']['name'], 0, 12));

Expand Down
8 changes: 4 additions & 4 deletions src/Command/DeletedUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function download(SymfonyStyle $io): string
break;

case \STREAM_NOTIFY_REDIRECTED:
$io->text(sprintf('Being redirected to: %s', $message));
$io->text(\sprintf('Being redirected to: %s', $message));
break;

case \STREAM_NOTIFY_CONNECT:
Expand Down Expand Up @@ -110,7 +110,7 @@ protected function download(SymfonyStyle $io): string

$this->filesystem->dumpFile($path, $content);

$io->info(sprintf('Saved to "%s"!', $path));
$io->info(\sprintf('Saved to "%s"!', $path));

$this->stopwatch->stop('download');

Expand Down Expand Up @@ -167,7 +167,7 @@ private function clean(SymfonyStyle $io, string $path): void

$this->filesystem->remove($path);

$io->info(sprintf('"%s" deleted!', $path));
$io->info(\sprintf('"%s" deleted!', $path));

$this->stopwatch->start('clean');
}
Expand All @@ -181,6 +181,6 @@ private function getPerformance(SymfonyStyle $io): void
];

$io->table(['Event', 'Duration (ms)', 'Memory (MB)'], $perf);
$io->text(sprintf('Total: %.2f seconds - %.1f MB', array_sum(array_column($perf, 1)) / 1000, array_sum(array_column($perf, 2))));
$io->text(\sprintf('Total: %.2f seconds - %.1f MB', array_sum(array_column($perf, 1)) / 1000, array_sum(array_column($perf, 2))));
}
}
16 changes: 8 additions & 8 deletions src/Command/NewMapperCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

// If there never was an update, get new mappers from the last 5 days
$date = (new \DateTime())->sub(new \DateInterval('P5D'))->format('Y-m-d');
$io->info(sprintf('Region was not processed yet, get new mappers from %s.', $date));
$io->info(\sprintf('Region was not processed yet, get new mappers from %s.', $date));
} else {
$date = $region->getLastUpdate()->sub(new \DateInterval('P1D'))->format('Y-m-d');
}
Expand All @@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->stopwatch->start('update-aoi');

$io->title(sprintf('Update the Area of Interest "%s" (%s)', $key, $date));
$io->title(\sprintf('Update the Area of Interest "%s" (%s)', $key, $date));

$aoiCommand = $this->getApplication()->find('osmcha:aoi');
$aoiCommand->run(new ArrayInput([
Expand All @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->stopwatch->start('process');

$io->title(sprintf('Get new mappers from Area of Interest "%s"', $key));
$io->title(\sprintf('Get new mappers from Area of Interest "%s"', $key));

try {
/** @var int[] $usersId */
Expand Down Expand Up @@ -137,10 +137,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->entityManager->persist($mapper);

$io->info(sprintf('Mapper %s (%d) added with %d changeset(s) (first changeset: %d)', $mapper->getDisplayName(), $mapper->getId(), \count($mapperChangesets), $firstChangeset->getId()));
$io->info(\sprintf('Mapper %s (%d) added with %d changeset(s) (first changeset: %d)', $mapper->getDisplayName(), $mapper->getId(), \count($mapperChangesets), $firstChangeset->getId()));
}
} else {
$io->note(sprintf('Mapper #%d already exists', $usersId[$i]));
$io->note(\sprintf('Mapper #%d already exists', $usersId[$i]));
}
} catch (\Exception $e) {
$io->error($e->getMessage());
Expand Down Expand Up @@ -180,7 +180,7 @@ private function getNewChangesets(array $region, array &$users, SymfonyStyle $io

$users = array_values(array_unique(array_map(fn (array $feature) => (int) $feature['properties']['uid'], $features), \SORT_NUMERIC));

$io->success(sprintf('Found %d new changeset(s) from %d new user(s)', \count($features), \count($users)));
$io->success(\sprintf('Found %d new changeset(s) from %d new user(s)', \count($features), \count($users)));

return $features;
}
Expand Down Expand Up @@ -219,7 +219,7 @@ private function getMapper(int $userId, SymfonyStyle $io): Mapper
$users = $response['users'];

if (0 === \count($users)) {
throw new \InvalidArgumentException(sprintf('User #%d not found', $userId));
throw new \InvalidArgumentException(\sprintf('User #%d not found', $userId));
}

$mapper = $this->mapperProvider->fromOSM($users[0]);
Expand All @@ -237,6 +237,6 @@ private function getPerformance(SymfonyStyle $io): void
];

$io->table(['Event', 'Duration (ms)', 'Memory (MB)'], $perf);
$io->text(sprintf('Total: %.2f seconds - %.1f MB', array_sum(array_column($perf, 1)) / 1000, array_sum(array_column($perf, 2))));
$io->text(\sprintf('Total: %.2f seconds - %.1f MB', array_sum(array_column($perf, 1)) / 1000, array_sum(array_column($perf, 2))));
}
}
4 changes: 2 additions & 2 deletions src/Service/OSMChaAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function updateAreaOfInterest(string $id, string $name, array $filters):

$response = $this->osmchaClient->request(
'PUT',
sprintf('aoi/%s/', $id),
\sprintf('aoi/%s/', $id),
[
'json' => [
'name' => $name,
Expand All @@ -92,7 +92,7 @@ public function getAreaOfInterestChangesets(string $id): ResponseInterface

$response = $this->osmchaClient->request(
'GET',
sprintf('aoi/%s/changesets/', $id),
\sprintf('aoi/%s/changesets/', $id),
[
'query' => [
'page_size' => 500,
Expand Down
4 changes: 2 additions & 2 deletions src/Service/OpenStreetMapAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function getUsers(array $ids): ResponseInterface
{
$response = $this->osmClient->request(
'GET',
sprintf('users.json?%s', http_build_query(['users' => implode(',', $ids)]))
\sprintf('users.json?%s', http_build_query(['users' => implode(',', $ids)]))
);

return $response;
Expand All @@ -26,7 +26,7 @@ public function getChangesetsByUser(int $id): ResponseInterface
{
$response = $this->osmClient->request(
'GET',
sprintf('changesets.xml?%s', http_build_query(['user' => $id]))
\sprintf('changesets.xml?%s', http_build_query(['user' => $id]))
);

return $response;
Expand Down
14 changes: 7 additions & 7 deletions src/Service/RegionsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct(
private readonly RegionRepository $regionRepository,
private readonly string $projectDirectory,
) {
$yaml = Yaml::parseFile(sprintf('%s/config/regions.yaml', $this->projectDirectory));
$yaml = Yaml::parseFile(\sprintf('%s/config/regions.yaml', $this->projectDirectory));

$this->regions = $yaml['regions'] ?? [];
}
Expand All @@ -28,14 +28,14 @@ public function getRegions(): array
public function getRegion(?string $continent, string $key): array
{
if (null !== $continent && !isset($this->regions[$continent][$key])) {
throw new \Exception(sprintf('Key "%s.%s" is not defined in regions configuration file.', $continent, $key));
throw new \Exception(\sprintf('Key "%s.%s" is not defined in regions configuration file.', $continent, $key));
}

if (null === $continent) {
$group = array_filter($this->regions, fn ($value) => \in_array($key, array_keys($value), true));

if (0 === \count($group)) {
throw new \Exception(sprintf('Key "%s" is not defined in regions configuration file.', $key));
throw new \Exception(\sprintf('Key "%s" is not defined in regions configuration file.', $key));
} else {
$continent = array_key_first($group);
}
Expand All @@ -50,18 +50,18 @@ public function getRegion(?string $continent, string $key): array

public function getGeometry(string $continent, string $key): array
{
$path = sprintf('%s/assets/regions/%s/%s.geojson', $this->projectDirectory, $continent, $key);
$path = \sprintf('%s/assets/regions/%s/%s.geojson', $this->projectDirectory, $continent, $key);
if (!file_exists($path) || !is_readable($path)) {
throw new \Exception(sprintf('Geometry is not defined for region "%s".', $key));
throw new \Exception(\sprintf('Geometry is not defined for region "%s".', $key));
}

$content = file_get_contents($path);
if (false === $content) {
throw new \Exception(sprintf('Can\'t read geometry for region "%s".', $key));
throw new \Exception(\sprintf('Can\'t read geometry for region "%s".', $key));
}
$data = json_decode($content, true, 512, \JSON_THROW_ON_ERROR);
if (null === $data) {
throw new \Exception(sprintf('Geometry for region "%s" doesn\'t seem to be valid.', $key));
throw new \Exception(\sprintf('Geometry for region "%s" doesn\'t seem to be valid.', $key));
}

return $data;
Expand Down
2 changes: 1 addition & 1 deletion src/Service/TemplatesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TemplatesProvider

public function __construct(private readonly string $projectDirectory)
{
$glob = glob(sprintf('%s/templates/messages/*/*/*.md', $this->projectDirectory));
$glob = glob(\sprintf('%s/templates/messages/*/*/*.md', $this->projectDirectory));

foreach ($glob as $path) {
if (true === is_readable($path)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/EditorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function shortenEditorName(?string $name): string
}

return isset($shortName) ?
sprintf('<span class="cursor-help" title="%s">%s</span>', $name, $shortName) :
\sprintf('<span class="cursor-help" title="%s">%s</span>', $name, $shortName) :
$name;
}
}
Loading