Skip to content

Commit

Permalink
Merge pull request #4453 from platformsh/llms-psh-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kemi-Elizabeth authored Mar 5, 2025
2 parents 0e82b61 + aeffa6a commit d05eecb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sites/platform/config/_default/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vendor:
routes: routes
urls:
main: https://platform.sh/
docs: https://docs.platform.sh/
docs: https://docs.platform.sh
support: https://support.platform.sh/
sales: https://platform.sh/contact
console: https://console.platform.sh/
Expand Down
24 changes: 12 additions & 12 deletions sites/platform/src/create-apps/hooks/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Create your `build` hook to install them all:

1. Create a `build` hook in your [app configuration](/create-apps/app-reference/single-runtime-image.md):

```yaml {configfile="app" dir="client" }
```yaml {configFile="app" dir="client" }
hooks:
build: |
set -e
Expand All @@ -54,7 +54,7 @@ Create your `build` hook to install them all:
If other hooks fail, the deploy still happens.
2. Install your top-level dependencies inside this `build` hook:

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
hooks:
build: |
set -e
Expand All @@ -71,7 +71,7 @@ Create your `build` hook to install them all:
In this case, the app root is `client`.
To run commands from a different directory, you need to change directories (relative to the app root):

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
hooks:
build: |
set -e
Expand All @@ -82,7 +82,7 @@ Create your `build` hook to install them all:

5. Install the dependencies for the testing script:

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
hooks:
build: |
set -e
Expand Down Expand Up @@ -122,7 +122,7 @@ All of this configuration and preparation can be handled in a bash script.
Unlike in the `build` hook, in the `deploy` hook the system is generally read-only.
So create a mount where you can write the Drush configuration:

```yaml {configfile="app" dir="api"}
```yaml {configFile="app" dir="api"}
mounts:
/.drush:
source: storage
Expand All @@ -131,7 +131,7 @@ All of this configuration and preparation can be handled in a bash script.

4. Add a `deploy` hook that runs the preparation script:

```yaml {configfile="app" dir="api"}
```yaml {configFile="app" dir="api"}
hooks:
deploy: !include
type: string
Expand Down Expand Up @@ -159,7 +159,7 @@ So you don't have to rebuild Drupal but you still get fresh content.
1. Set a relationship for Next.js with Drupal.
This allows the Next.js app to make requests and receive data from the Drupal app.

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
relationships:
api:
service: 'api'
Expand All @@ -170,7 +170,7 @@ So you don't have to rebuild Drupal but you still get fresh content.
Like the [`deploy` hook](#configure-drush-and-drupal), the `post_deploy` hook has a read-only file system.
Create mounts for your Next.js files:

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
mounts:
/.cache:
source: local
Expand All @@ -189,7 +189,7 @@ So you don't have to rebuild Drupal but you still get fresh content.

3. Add a `post_deploy` hook that first tests the connection between the apps:

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
hooks:
post_deploy: |
. deploy/platformsh.environment
Expand All @@ -200,7 +200,7 @@ So you don't have to rebuild Drupal but you still get fresh content.

4. Then build the Next.js site:

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
hooks:
post_deploy: |
. deploy/platformsh.environment
Expand All @@ -220,7 +220,7 @@ The following shows only the parts necessary for the hooks.

### Drupal

```yaml {configfile="app" dir="api"}
```yaml {configFile="app" dir="api"}
# The name of this app. Must be unique within the project.
name: 'drupal'
Expand Down Expand Up @@ -265,7 +265,7 @@ mounts:

### Next.js

```yaml {configfile="app" dir="client"}
```yaml {configFile="app" dir="client"}
# The name of this app, which must be unique within the project.
name: 'nextjs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ If so, you can serve all requests by your app code except for those that start w
which you serve with your generated docs.
Use a [`web` configuration](/create-apps/app-reference/single-runtime-image.md#web) similar to the following:

```yaml {configfile="app"}
```yaml {configFile="app"}
web:
locations:
'/':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ If so, you can serve all requests by your app code except for those that start w
which you serve with your generated docs.
Use a [`web` configuration](/create-apps/app-reference/single-runtime-image.md#web) similar to the following:

```yaml {configfile="apps"}
```yaml {configFile="apps"}
applications:
docs:
source:
Expand Down
4 changes: 2 additions & 2 deletions sites/upsun/src/learn/overview/yaml/yaml-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This YAML file is located in your ``.{{% vendor/cli %}}`` directory, at the root
```bash
.
├── {{< vendor/configdir >}}
|   └── {{< vendor/configfile "apps" "strip" >}}
└── <source code>
| └── {{< vendor/configfile "apps" "strip" >}}
└── <SOURCE_CODE>
```
## Mandatory top-level keys
In the ``config.yaml`` file, there are only three mandatory top-level YAML keys:
Expand Down
19 changes: 17 additions & 2 deletions themes/psh-docs/layouts/partials/llms/replace-html.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- $full := .full | default (0) -}}
{{- $level := .level | default (1) -}}
{{- $baseURL := .vendor.urls.docs -}}
{{- $appsConfigFile := .vendor.config.files.apps -}}
{{- $appConfigFile := .vendor.config.files.app -}}
{{- $envConfigFile := .vendor.config.files.env | default "" -}}
{{- $servicesConfigFile := .vendor.config.files.services -}}
{{- $routesConfigFile := .vendor.config.files.routes -}}
{{- if .title -}}
{{- if eq .version "2" }}
{{ range $num := (seq $level) }}#{{ end }} {{ .title | replaceRE `\{\{[%\|\<]?\ *vendor\/name\ *[\%|\>]?\}\}` "Upsun" }}
Expand Down Expand Up @@ -75,15 +80,25 @@

| replaceRE `<title>(.*)?<\/title>` "**$1**"
| replaceRE `<\/?(ol|ul)>` ""
| replaceRE `<li>\n?` ` - ` -}}
| replaceRE `<li>\n?` ` - `
| replaceRE `\:first-child\]\:mt\-0 \[\&\>:last-child\]:mb-0">` ""
| replaceRE ` \{configFile=\"apps\"` (printf ` {location="%s"` $appsConfigFile)
| replaceRE ` \{configFile=\"app\"` (printf ` {location="%s"` $appConfigFile)
| replaceRE ` \{configFile=\"env\"` (printf ` {location="%s"` $envConfigFile)
| replaceRE ` \{configFile=\"routes\"` (printf ` {location="%s"` $routesConfigFile)
| replaceRE ` \{configFile=\"services\"` (printf ` {location="%s"` $servicesConfigFile)
| replaceRE `\{location="([^"]+)"(?: dir="([^"]*)")?\}` ` {location="${2}/${1}"}`
| replaceRE ` {location="/([^"]+)"}` ` {location="${1}"}`

-}}

{{- if .full -}}
{{- $content = $content | replaceRE "(?m)^(#{2,6})(\\s|$)" (printf "${1}%s " $hashes) -}}
{{- end -}}

{{- $content = $content
| replaceRE ` ([a-zA-Z0-9\@:-]){2,}="([][a-zA-Z0-9\.\_\!\+:='\''\;,\/\{\}\(\)\&><↗\ -]{0,})"` ``
| replaceRE "(`[^`]*?)( )?(<)([^>]+)(>)([^`^ ]*?`)" "${1}${2}##PLACEHOLDER_START##${4}##PLACEHOLDER_END##${6}"
| replaceRE `<([A-Z0-9_]+)>` "##PLACEHOLDER_START##${1}##PLACEHOLDER_END##"
| replaceRE `<[^>]+>` ""
| replaceRE "##PLACEHOLDER_START##(.*?)##PLACEHOLDER_END##" "<${1}>"
| replaceRE `\[Back\]\([^)]+\)[\n|\ ]*\[[^\]]+\]\([^)]+\)` "\n"
Expand Down

0 comments on commit d05eecb

Please sign in to comment.