Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ styles/write-good/TooWordy.yml
styles/write-good/Weasel.yml
.vale.ini
vale

# Local Netlify folder
.netlify
8 changes: 8 additions & 0 deletions docs/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Local direct-submit config for Netlify dev.
# GitHub App (installation must have "Issues: write" on interledger/open-payments-docs-feedback)
GITHUB_APP_ID=
GITHUB_APP_INSTALLATION_ID=
# Either set PEM inline (Netlify: use literal \n for newlines) or point to a local file
GITHUB_APP_PRIVATE_KEY=
GITHUB_APP_PRIVATE_KEY_PATH=
PUBLIC_FEEDBACK_FUNCTION_URL=/.netlify/functions/feedback
6 changes: 6 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ pnpm-debug.log*
.env
.env.production

# GitHub App key (local dev only; never commit)
.github-app-private-key.pem
*.pem

# macOS-specific files
.DS_Store

.netlify
17 changes: 17 additions & 0 deletions docs/README_FEEDBACK_INTEGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Feedback Widget

The docs footer can either:

- open a prefilled issue in `interledger/open-payments-docs-feedback`
Comment thread
JonathanMatthey marked this conversation as resolved.
- post directly to GitHub through `docs/netlify/functions/feedback.ts`

`openpayments.dev` is a GitHub Pages deploy, so production uses the issue-form fallback
unless you point `PUBLIC_FEEDBACK_FUNCTION_URL` at another hosted endpoint.

## Local dev

1. Copy `docs/.env.example` to `docs/.env`.
2. Run `pnpm dev:netlify` from `docs/`, or `pnpm --filter docs dev:netlify` from the repo root.
3. Open the Netlify URL shown as `Local dev server ready`.

Plain `pnpm start` only exercises the fallback path.
42 changes: 40 additions & 2 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'astro/config'
import starlight from '@astrojs/starlight'
import starlightOpenAPI from 'starlight-openapi'
import starlightLinksValidator from 'starlight-links-validator'
import starlightFullViewMode from 'starlight-fullview-mode'
import remarkMath from 'remark-math'
import rehypeKatex from 'rehype-katex'
import { loadEnv } from 'vite'

const docsRoot = path.dirname(fileURLToPath(import.meta.url))
const envFromFile = loadEnv(
process.env.NODE_ENV === 'production' ? 'production' : 'development',
docsRoot,
''
)

const isNetlifyDev =
process.env.NETLIFY_DEV === 'true' || process.env.NETLIFY_DEV === '1'

const netlifyDevFunctionsProxyTarget = (() => {
const raw =
process.env.URL ||
process.env.DEPLOY_URL ||
envFromFile.NETLIFY_FUNCTIONS_PROXY_TARGET
if (!raw) {
return null
}
try {
return new URL(raw).origin
} catch {
return null
}
})()

// https://astro.build/config
export default defineConfig({
Expand All @@ -31,7 +59,8 @@ export default defineConfig({
],
components: {
Header: './src/components/Header.astro',
PageSidebar: './src/components/PageSidebar.astro'
PageSidebar: './src/components/PageSidebar.astro',
Footer: './src/components/Footer.astro'
},
customCss: [
'./node_modules/@interledger/docs-design-system/src/styles/teal-theme.css',
Expand Down Expand Up @@ -556,6 +585,15 @@ export default defineConfig({
'/sdk/grant-create': '/sdk/grant-create-incoming'
},
server: {
port: 1104
port: 1104,
...(isNetlifyDev &&
netlifyDevFunctionsProxyTarget && {
proxy: {
'/.netlify/functions': {
target: netlifyDevFunctionsProxyTarget,
changeOrigin: true
}
}
})
}
})
9 changes: 8 additions & 1 deletion docs/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ export default defineConfig([
},
tseslint.configs.recommended,
eslintPluginAstro.configs.recommended,
globalIgnores(['dist', '.astro', 'node_modules', 'public', '**/*.min.js']),
globalIgnores([
'dist',
'.astro',
'.netlify',
'node_modules',
'public',
'**/*.min.js'
]),
{
rules: {
'no-console': 'error',
Expand Down
10 changes: 10 additions & 0 deletions docs/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build]
command = "pnpm --dir docs build"
publish = "docs/dist"

[functions]
directory = "docs/netlify/functions"

[dev]
command = "pnpm exec astro dev --host --port 1104 --strictPort"
targetPort = 1104
Loading
Loading