Skip to content

Commit

Permalink
Fix some issue with public website
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Nov 20, 2024
1 parent ace73b2 commit 1370b54
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 55 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ghpages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
castor website:install
castor website:wasm:export --pack --build
working-directory: ./website
env:
BASE_URL: "/${{ github.event.repository.name }}"

- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
Expand Down
31 changes: 22 additions & 9 deletions website/castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,31 @@
use Castor\Attribute\AsTask;
use Symfony\Component\Process\Process;

use function Castor\context;
use function Castor\fs;
use function Castor\io;
use function Castor\run as do_run;

#[AsTask(description: 'Install dependencies')]
function install()
{
io()->note('Installing dependencies');
io()->title('Installing dependencies');

run(['composer', 'install', '--no-dev', '--optimize-autoloader']);
}

#[AsTask(description: 'Update dependencies')]
function update()
{
io()->title('Installing dependencies');

run(['composer', 'update', '--no-dev', '--optimize-autoloader']);
}

#[AsTask('wasm:build', description: 'Build the wasm-php binary')]
function wasm_build()
{
io()->note('Building wasm-php binary');
io()->title('Building wasm-php binary');

$phpWasmDir = __DIR__ . '/vendor/soyuka/php-wasm';
run(['docker', 'buildx', 'bake'], path: $phpWasmDir);
Expand All @@ -37,7 +46,7 @@ function wasm_build()
#[AsTask('wasm:pack', description: 'Pack custom code')]
function wasm_pack()
{
io()->note('Packing custom code');
io()->title('Packing custom code');

run(['docker', 'run',
'-v', __DIR__ . ':/app',
Expand Down Expand Up @@ -85,7 +94,7 @@ function wasm_export(bool $pack = false, bool $build = false)
wasm_pack();
}

io()->note('Exporting wasm-php');
io()->title('Exporting wasm-php');

fs()->remove(__DIR__ . '/public/build');

Expand All @@ -104,14 +113,18 @@ function wasm_export(bool $pack = false, bool $build = false)
#[AsTask(description: 'Run the server')]
function serve(string $address = 'localhost:9999')
{
io()->note("Serving on http://{$address}");
io()->title("Serving on http://{$address}");

run(['php', '-S', $address, '-t', 'public']);
}

function run(array $command, ?string $path = __DIR__): Process
function run(array $command, string $path = __DIR__): Process
{
return do_run($command, path: $path, timeout: 0, environment: [
'BUILDKIT_PROGRESS' => 'plain',
]);
$context = context()
->withWorkingDirectory($path)
->withEnvironment([
'BUILDKIT_PROGRESS' => 'plain',
]);
;
return do_run($command, context: $context);
}
9 changes: 1 addition & 8 deletions website/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,10 @@
"reference": "main"
}
}
},
{
"type": "path",
"url": "../",
"options": {
"symlink": false
}
}
],
"require": {
"jolicode/jolitypo": "*@dev",
"jolicode/jolitypo": "dev-main@dev",
"soyuka/php-wasm": "dev-main@dev"
},
"config": {
Expand Down
68 changes: 32 additions & 36 deletions website/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1370b54

Please sign in to comment.