Skip to content

Commit 92effc6

Browse files
committed
Move build files to build/ directory
1 parent 20911e2 commit 92effc6

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

.github/workflows/update-standalone.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ on:
66
branches: [main]
77
paths:
88
- 'src/Parsers/parse_text.php'
9-
- 'dist/go.php'
9+
- 'build/**'
1010
- 'dist/styles.css'
1111
- 'dist/app.js'
12-
- 'build-go.php'
1312

1413
jobs:
1514
update:
@@ -24,7 +23,7 @@ jobs:
2423
php-version: '8.3'
2524

2625
- name: Build standalone script
27-
run: php build-go.php
26+
run: php build/build.php
2827

2928
- name: Push to landing page repo
3029
run: |
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<?php
22
/**
3-
* Build script that compiles dist/go.php into a fully self-contained file
3+
* Build script that compiles build/go.php into a fully self-contained file
44
* with CSS, JS, and the shared text parser baked in.
5-
* Output goes to dist/go-standalone.php.
65
*
7-
* Run: php build-go.php
6+
* Run: php build/build.php
87
*/
98

10-
$source = file_get_contents(__DIR__ . '/dist/go.php');
11-
$css = file_get_contents(__DIR__ . '/dist/styles.css');
12-
$js = file_get_contents(__DIR__ . '/dist/app.js');
9+
$root = dirname(__DIR__);
10+
11+
$source = file_get_contents(__DIR__ . '/go.php');
12+
$css = file_get_contents($root . '/dist/styles.css');
13+
$js = file_get_contents($root . '/dist/app.js');
1314

1415
// Read the shared parser, stripping its opening <?php tag
15-
$parser = file_get_contents(__DIR__ . '/src/Parsers/parse_text.php');
16+
$parser = file_get_contents($root . '/src/Parsers/parse_text.php');
1617
$parser = preg_replace('/^<\?php\s*/s', '', $parser);
1718

1819
// Replace the include() calls with the actual file contents
@@ -23,17 +24,18 @@
2324
);
2425

2526
$source = str_replace(
26-
'<?php include(__DIR__ . "/styles.css"); ?>',
27+
'<?php include(__DIR__ . "/../dist/styles.css"); ?>',
2728
$css,
2829
$source
2930
);
3031

3132
$source = str_replace(
32-
'<?php include(__DIR__ . "/app.js"); ?>',
33+
'<?php include(__DIR__ . "/../dist/app.js"); ?>',
3334
$js,
3435
$source
3536
);
3637

37-
file_put_contents(__DIR__ . '/dist/go-standalone.php', $source);
38+
$out = $root . '/dist/go-standalone.php';
39+
file_put_contents($out, $source);
3840

3941
echo "Built dist/go-standalone.php (" . number_format(strlen($source)) . " bytes)\n";

dist/go.php renamed to build/go.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<meta name="description" content="View your phpinfo() output in a pretty, responsive, searchable interface">
3636
<meta name="viewport" content="width=device-width, initial-scale=1">
3737
<style>
38-
<?php include(__DIR__ . "/styles.css"); ?>
38+
<?php include(__DIR__ . "/../dist/styles.css"); ?>
3939
</style>
4040
</head>
4141

@@ -312,7 +312,7 @@ class="px-4 py-1 rounded block"
312312
});
313313
</script>
314314
<script type="module">
315-
<?php include(__DIR__ . "/app.js"); ?>
315+
<?php include(__DIR__ . "/../dist/app.js"); ?>
316316
</script>
317317
</body>
318318
</html>

0 commit comments

Comments
 (0)