mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
chore: clean up build files
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
pnpm-lock.yaml
|
||||
pnpm-workspace.yaml
|
||||
|
||||
**/node_modules
|
||||
src/**/Resources/public/**
|
||||
src/**/Resources/dist/**
|
||||
|
||||
-23
@@ -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! 🙌
|
||||
@@ -1,50 +1,70 @@
|
||||
#!/usr/bin/env 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');
|
||||
|
||||
$resources = array(
|
||||
$resources = [
|
||||
$shared,
|
||||
__DIR__.'/../.github/FUNDING.yml',
|
||||
__DIR__.'/../README.md',
|
||||
__DIR__.'/../LICENSE',
|
||||
);
|
||||
];
|
||||
|
||||
$dirs = array(__DIR__.'/../packs', __DIR__.'/../src');
|
||||
// Directories to search for packages
|
||||
$dirs = [__DIR__.'/../src'];
|
||||
|
||||
$packages = array_reduce($dirs, function ($files, $dir) {
|
||||
return array_merge($files, glob("$dir/*/composer.json"), glob("$dir/*/*/composer.json"));
|
||||
}, array());
|
||||
// Find all composer.json files within the specified directories
|
||||
$finder = new Finder();
|
||||
$finder->files()
|
||||
->in($dirs)
|
||||
->name('composer.json')
|
||||
->depth('< 3'); // Adjust depth as needed
|
||||
|
||||
foreach ($packages as $package) {
|
||||
$package = realpath(dirname($package));
|
||||
$packages = [];
|
||||
|
||||
// Collect package directories
|
||||
foreach ($finder as $file) {
|
||||
$packages[] = dirname($file->getRealPath());
|
||||
}
|
||||
|
||||
foreach ($packages as $packageDir) {
|
||||
foreach ($resources as $resource) {
|
||||
$resource = realpath($resource);
|
||||
$dest = $package.str_replace(realpath(__DIR__.'/../'), '', $resource);
|
||||
|
||||
if (!is_dir($resource) && file_exists($resource)) {
|
||||
copy($resource, $dest);
|
||||
if (!is_string($resource)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($resource, FilesystemIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
$resourcePath = realpath($resource);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$target = $resource === $shared
|
||||
? $package.str_replace($resource, '', $file->getPathname())
|
||||
: $dest .'/'. $file->getFilename();
|
||||
|
||||
if ($file->isDir()) {
|
||||
system('rm -rf -- ' . escapeshellarg($dest));
|
||||
@mkdir(dirname($target), 0777, true);
|
||||
continue;
|
||||
if (!$resourcePath) {
|
||||
continue; // Skip if the resource doesn't exist
|
||||
}
|
||||
|
||||
@mkdir(dirname($target), 0777, true);
|
||||
@copy($file->getPathname(), $target);
|
||||
$relativePath = str_replace(realpath(__DIR__.'/../') ?: '', '', $resourcePath);
|
||||
$destination = $packageDir.$relativePath;
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user