chore: clean up build files

This commit is contained in:
Younes ENNAJI
2024-10-06 15:54:53 +01:00
parent 60d0f2ed30
commit 004334f642
3 changed files with 48 additions and 54 deletions
-3
View File
@@ -1,6 +1,3 @@
pnpm-lock.yaml
pnpm-workspace.yaml
**/node_modules **/node_modules
src/**/Resources/public/** src/**/Resources/public/**
src/**/Resources/dist/** src/**/Resources/dist/**
-23
View File
@@ -1,23 +0,0 @@
name: Auto Closer PR
on:
pull_request_target:
types: [ opened ]
jobs:
run:
name: 🤖 PR Auto-Closure
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: |
Hi there 👋,
First off, thanks for your effort! 🎉 Unfortunately, this repository is read-only because it's split from our primary monorepo repository.
🙏 We kindly ask if you could direct your valuable contribution to our main repository at https://github.com/php-flasher/php-flasher.
Once you've moved your contribution there, we'll review it and provide feedback. 🕵️‍♂️
Thanks again for your understanding and cooperation. We really appreciate it! 🙌
+48 -28
View File
@@ -1,50 +1,70 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
declare(strict_types=1);
require __DIR__.'/../vendor/autoload.php';
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
$filesystem = new Filesystem();
// Define the shared resources
$shared = realpath(__DIR__.'/../.shared'); $shared = realpath(__DIR__.'/../.shared');
$resources = array( $resources = [
$shared, $shared,
__DIR__.'/../.github/FUNDING.yml', __DIR__.'/../.github/FUNDING.yml',
__DIR__.'/../README.md', __DIR__.'/../README.md',
__DIR__.'/../LICENSE', __DIR__.'/../LICENSE',
); ];
$dirs = array(__DIR__.'/../packs', __DIR__.'/../src'); // Directories to search for packages
$dirs = [__DIR__.'/../src'];
$packages = array_reduce($dirs, function ($files, $dir) { // Find all composer.json files within the specified directories
return array_merge($files, glob("$dir/*/composer.json"), glob("$dir/*/*/composer.json")); $finder = new Finder();
}, array()); $finder->files()
->in($dirs)
->name('composer.json')
->depth('< 3'); // Adjust depth as needed
foreach ($packages as $package) { $packages = [];
$package = realpath(dirname($package));
// Collect package directories
foreach ($finder as $file) {
$packages[] = dirname($file->getRealPath());
}
foreach ($packages as $packageDir) {
foreach ($resources as $resource) { foreach ($resources as $resource) {
$resource = realpath($resource); if (!is_string($resource)) {
$dest = $package.str_replace(realpath(__DIR__.'/../'), '', $resource);
if (!is_dir($resource) && file_exists($resource)) {
copy($resource, $dest);
continue; continue;
} }
$files = new RecursiveIteratorIterator( $resourcePath = realpath($resource);
new RecursiveDirectoryIterator($resource, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
);
foreach ($files as $file) { if (!$resourcePath) {
$target = $resource === $shared continue; // Skip if the resource doesn't exist
? $package.str_replace($resource, '', $file->getPathname()) }
: $dest .'/'. $file->getFilename();
if ($file->isDir()) { $relativePath = str_replace(realpath(__DIR__.'/../') ?: '', '', $resourcePath);
system('rm -rf -- ' . escapeshellarg($dest)); $destination = $packageDir.$relativePath;
@mkdir(dirname($target), 0777, true);
continue; if (is_file($resourcePath)) {
// Ensure the destination directory exists
$filesystem->mkdir(dirname($destination));
// Copy the file
$filesystem->copy($resourcePath, $destination, true);
} elseif (is_dir($resourcePath)) {
if ($resourcePath === $shared) {
// Copy contents of the shared directory into the package directory
$filesystem->mirror($shared, $packageDir, null, ['override' => true]);
} else {
// Copy the entire directory to the destination
$filesystem->mirror($resourcePath, $destination, null, ['override' => true]);
} }
@mkdir(dirname($target), 0777, true);
@copy($file->getPathname(), $target);
} }
} }
} }