Skip to content

Commit 26bc7aa

Browse files
committed
Se usa derafu/foundation
1 parent e8df7c1 commit 26bc7aa

33 files changed

+535
-220
lines changed

.github/workflows/cd.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CD
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- CI
7+
branches:
8+
- main
9+
types:
10+
- completed
11+
12+
jobs:
13+
deploy:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'}}
15+
name: Deploy Static Website
16+
timeout-minutes: 10
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest]
21+
php-version: ['8.3']
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Set up PHP ${{ matrix.php-version }}
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php-version }}
31+
extensions: mbstring
32+
tools: composer
33+
34+
- name: Display PHP version
35+
run: php -v
36+
37+
- name: Install Dependencies
38+
run: composer install --no-progress --no-suggest --prefer-dist
39+
40+
- name: Set up Node.js
41+
uses: actions/setup-node@v3
42+
43+
- name: Install Node.js dependencies
44+
run: npm install
45+
46+
- name: Build with Vite
47+
run: npm run build
48+
49+
- name: Start PHP server
50+
run: php -d display_errors=1 -S 127.0.0.1:9000 public/index.php &
51+
52+
- name: Download static HTML with wget
53+
run: |
54+
mkdir -p output
55+
wget --mirror --convert-links --adjust-extension \
56+
--page-requisites --no-parent \
57+
--directory-prefix=output --no-host-directories \
58+
--restrict-file-names=windows \
59+
http://127.0.0.1:9000/ || [[ $? == 8 ]]
60+
61+
- name: Deploy to GitHub Pages
62+
uses: JamesIves/github-pages-deploy-action@v4
63+
with:
64+
branch: gh-pages
65+
folder: output

.github/workflows/ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,20 @@ jobs:
3030
extensions: mbstring, xdebug
3131
tools: composer
3232

33+
- name: Display PHP version
34+
run: php -v
35+
3336
- name: Install Dependencies
3437
run: composer install --no-progress --no-suggest --prefer-dist
3538

39+
- name: Run PHP Coding Standards Fixer
40+
run: vendor/bin/php-cs-fixer fix -v --dry-run --diff --config=php-cs-fixer.php
41+
42+
- name: Run PHPStan
43+
run: vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=1G
44+
3645
- name: Run PHPUnit
37-
run: composer tests
46+
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration=phpunit.xml
3847

3948
- name: Upload PHPUnit result report
4049
if: failure()
@@ -48,6 +57,3 @@ jobs:
4857
with:
4958
name: tests-coverage-php_${{ matrix.php-version }}.txt
5059
path: var/tests-coverage.txt
51-
52-
- name: Display PHP version
53-
run: php -v

.github/workflows/website.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.gitignore

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1-
/var/
2-
/vendor/
3-
/composer.lock
1+
# PHP files and directories.
2+
var/
3+
vendor/
4+
composer.lock
5+
6+
# Node.js and Vite build.
7+
node_modules/
8+
public/static/
9+
npm-debug.log*
10+
package-lock.json
11+
.sharp-cache.json
12+
13+
# Cache files and temporary directories.
14+
.phpunit.result.cache
15+
.php-cs-fixer.cache
16+
phpstan.cache
17+
coverage/
18+
.phpunit.cache/
19+
20+
# IDE and editor specific files.
21+
.idea/
22+
.vscode/
23+
*.sublime-*
24+
*.swp
25+
*.swo
26+
*~
27+
.project
28+
.buildpath
29+
.settings/
30+
31+
# OS specific files.
32+
.DS_Store
33+
.DS_Store?
34+
._*
35+
.Spotlight-V100
36+
.Trashes
37+
ehthumbs.db
38+
Thumbs.db
39+
desktop.ini
40+
41+
# Environment and configuration files.
42+
.env
43+
.env.local
44+
.env.*.local
45+
*.env.local
46+
.env.backup
47+
48+
# Log files.
49+
*.log
50+
logs/
51+
52+
# Build and compilation files.
53+
dist/
54+
build/
55+
56+
# Other common files and directories to ignore.
57+
.sass-cache/
58+
.tmp/
59+
.htaccess
60+
*.bak
61+
*.cache
62+
*.tmp

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ $result = $processor->process($_FILES['upload'], [
7979

8080
## Contributing
8181

82-
Contributions are welcome! Please feel free to submit a Pull Request.
82+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
8383

8484
## License
8585

86-
This library is licensed under the MIT License. See the `LICENSE` file for more details.
86+
This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

app/bootstrap.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Derafu: Foundation - Base for Derafu's Projects.
7+
*
8+
* Copyright (c) 2025 Esteban De La Fuente Rubio / Derafu <https://www.derafu.org>
9+
* Licensed under the MIT License.
10+
* See LICENSE file for more details.
11+
*/
12+
13+
use Derafu\Http\Runtime;
14+
15+
if (
16+
true === (require_once dirname(__DIR__) . '/vendor/autoload.php')
17+
|| empty($_SERVER['SCRIPT_FILENAME'])
18+
) {
19+
return;
20+
}
21+
22+
// Create the runtime.
23+
$runtimeClass = $_SERVER['APP_RUNTIME'] ?? $_ENV['APP_RUNTIME'] ?? Runtime::class;
24+
$runtime = new $runtimeClass();
25+
26+
// Get the handler.
27+
$app = require $_SERVER['SCRIPT_FILENAME'];
28+
if (!is_callable($app)) {
29+
throw new TypeError(sprintf(
30+
'Invalid return value: callable expected, "%s" returned from "%s".',
31+
get_debug_type($app),
32+
$_SERVER['SCRIPT_FILENAME']
33+
));
34+
}
35+
$handler = $app($runtime->getApplicationContext());
36+
37+
// Run the application using the handler.
38+
exit($runtime->run($handler));

assets/css/app.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Base CSS */
2+
3+
/* Import base CSS from derafu/twig package */
4+
/* @import '../../vendor/derafu/twig/assets/css/derafu-twig.css'; */
5+
6+
/*.derafu-theme-default {
7+
8+
}*/

assets/img/.empty

Whitespace-only changes.

assets/js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Base JavaScript */

assets/js/images.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const images = import.meta.glob('../img/**/*')

0 commit comments

Comments
 (0)