-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate.php
36 lines (29 loc) · 1.58 KB
/
update.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$files = [
__DIR__ . '/../../projects/psx/README.md' => __DIR__ . '/docs/intro.md',
__DIR__ . '/../../projects/psx-components/psx-api/README.md' => __DIR__ . '/docs/components/api.md',
__DIR__ . '/../../projects/psx-components/psx-schema/README.md' => __DIR__ . '/docs/components/schema.md',
__DIR__ . '/../../projects/psx-components/psx-data/README.md' => __DIR__ . '/docs/components/data.md',
__DIR__ . '/../../projects/psx-components/psx-sql/README.md' => __DIR__ . '/docs/components/sql.md',
__DIR__ . '/../../projects/psx-components/psx-openapi/README.md' => __DIR__ . '/docs/components/openapi.md',
__DIR__ . '/../../projects/psx-components/psx-asyncapi/README.md' => __DIR__ . '/docs/components/asyncapi.md',
__DIR__ . '/../../projects/psx-components/psx-openrpc/README.md' => __DIR__ . '/docs/components/openrpc.md',
__DIR__ . '/../../projects/psx-components/psx-record/README.md' => __DIR__ . '/docs/components/record.md',
__DIR__ . '/../../projects/psx-components/psx-datetime/README.md' => __DIR__ . '/docs/components/datetime.md',
__DIR__ . '/../../projects/psx-components/psx-uri/README.md' => __DIR__ . '/docs/components/uri.md',
];
$index = 1;
foreach ($files as $source => $dest) {
echo 'Update ' . pathinfo($dest, PATHINFO_BASENAME) . "\n";
$content = file_get_contents($source);
if (str_ends_with($dest, 'intro.md')) {
$content = str_replace('## About', '# Introduction', $content);
}
$prefix = <<<TEXT
---
sidebar_position: {$index}
---
TEXT;
file_put_contents($dest, $prefix . $content);
$index++;
}