Skip to content

Commit

Permalink
Fixes for react build
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo124 committed Sep 19, 2023
1 parent 8137a79 commit 50d6c9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ jobs:
git checkout main
npm i
npm run build
cp -r dist/react/* ../public/react
for file in dist/react/* ; do
filename=$(basename -- "$file")
extension="${filename##*.}"
filename="${filename%.*}"
version=${{ github.event.release.tag_name }}
cp dist/react/$file ../public/react/$filename"."$version"."$extension
done
mkdir -p ../public/tinymce_6.4.2/tinymce/js/
cp -r node_modules/tinymce ../public/tinymce_6.4.2/tinymce/js/
cd ..
Expand Down
7 changes: 2 additions & 5 deletions app/Console/Commands/ReactBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;

class ReactBuilder extends Command
{
Expand Down Expand Up @@ -48,21 +47,19 @@ public function __construct()
public function handle()
{
$includes = '';

Storage::makeDirectory(public_path('react'));

$directoryIterator = new \RecursiveDirectoryIterator(public_path('react'), \RecursiveDirectoryIterator::SKIP_DOTS);

foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
if ($file->getExtension() == 'js') {
if ($file->getExtension() == 'js' && stripos($file->getFileName(), config('ninja.app_version')) !== false) {
if (str_contains($file->getFileName(), 'index-')) {
$includes .= '<script type="module" crossorigin src="/react/'.$file->getFileName().'"></script>'."\n";
} else {
$includes .= '<link rel="modulepreload" href="/react/'.$file->getFileName().'">'."\n";
}
}

if (str_contains($file->getFileName(), '.css')) {
if (str_contains($file->getFileName(), '.css' && stripos($file->getFileName(), config('ninja.app_version')) !== false)) {
$includes .= '<link rel="stylesheet" href="/react/'.$file->getFileName().'">'."\n";
}
}
Expand Down

0 comments on commit 50d6c9f

Please sign in to comment.