upcontent 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +3 -3
- package/.github/workflows/publish.yml +75 -0
- package/.upcontent/config.json +6 -1
- package/CONTEXT.md +25 -0
- package/Makefile +6 -2
- package/README.md +57 -39
- package/assets/readme/portal-home.png +0 -0
- package/assets/readme/portal-showcase.png +0 -0
- package/astro.config.mjs +67 -18
- package/customization/config-json.md +9 -1
- package/customization/content.md +14 -0
- package/customization/navigation.md +2 -0
- package/deployment/index.md +1 -0
- package/deployment/npm.md +39 -0
- package/guides/validate-your-site.md +5 -0
- package/index.md +19 -0
- package/package.json +15 -9
- package/scripts/upcontent-cli.mjs +2 -4
- package/scripts/verify-external-build.mjs +9 -1
- package/scripts/verify-golden-build.mjs +13 -0
- package/src/components/MermaidLoader.astro +17 -3
- package/src/content/i18n/en.json +1 -0
- package/src/content.config.test.ts +52 -1
- package/src/content.config.ts +29 -4
- package/src/lib/content-blocklist.ts +2 -2
- package/src/lib/doc-links.test.ts +21 -1
- package/src/lib/doc-links.ts +9 -4
- package/src/lib/homepage.ts +16 -0
- package/src/lib/markdown.ts +6 -0
- package/src/lib/portal-config.test.ts +11 -1
- package/src/lib/portal-config.ts +11 -0
- package/src/lib/portal-routes.test.ts +73 -0
- package/src/lib/portal-routes.ts +65 -0
- package/src/lib/remark-doc-links.test.ts +50 -0
- package/src/lib/remark-doc-links.ts +21 -0
- package/src/lib/remark-wiki-links.test.ts +10 -8
- package/src/lib/remark-wiki-links.ts +17 -8
- package/src/lib/seo-sitemap.test.ts +46 -0
- package/src/lib/seo-sitemap.ts +55 -0
- package/src/lib/sidebar.test.ts +32 -3
- package/src/lib/sidebar.ts +26 -17
- package/src/overrides/Footer.astro +3 -5
- package/src/overrides/Head.astro +86 -3
- package/src/pages/robots.txt.ts +46 -0
- package/src/upcontent-cli.test.ts +36 -0
- package/test-fixtures/external-consumer/.upcontent/config.json +4 -0
- package/test-fixtures/external-consumer/noindex.md +7 -0
- package/test-fixtures/external-consumer/public.md +6 -0
- package/src/pages/index.astro +0 -20
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import { spawnSync } from 'node:child_process'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
import { describe, expect, it } from 'vitest'
|
|
7
|
+
import yaml from 'js-yaml'
|
|
8
|
+
|
|
9
|
+
const cliPath = fileURLToPath(new URL('../scripts/upcontent-cli.mjs', import.meta.url))
|
|
10
|
+
|
|
11
|
+
describe('upcontent init', () => {
|
|
12
|
+
it('generates a valid GitHub Actions workflow', () => {
|
|
13
|
+
const root = mkdtempSync(join(tmpdir(), 'upcontent-cli-'))
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const result = spawnSync(process.execPath, [cliPath, 'init'], { cwd: root, encoding: 'utf8' })
|
|
17
|
+
expect(result.status).toBe(0)
|
|
18
|
+
|
|
19
|
+
const workflow = readFileSync(join(root, '.github/workflows/deploy-docs.yml'), 'utf8')
|
|
20
|
+
expect(yaml.load(workflow)).toMatchObject({
|
|
21
|
+
jobs: {
|
|
22
|
+
publish: {
|
|
23
|
+
uses: 'lumamontes/upcontent/.github/workflows/reusable-pages.yml@main',
|
|
24
|
+
permissions: {
|
|
25
|
+
contents: 'read',
|
|
26
|
+
pages: 'write',
|
|
27
|
+
'id-token': 'write',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
} finally {
|
|
33
|
+
rmSync(root, { recursive: true, force: true })
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
"site": {
|
|
3
3
|
"title": "External Consumer",
|
|
4
4
|
"description": "A fixture proving consumer-owned configuration.",
|
|
5
|
+
"url": "https://docs.example.com",
|
|
5
6
|
"logo": {
|
|
6
7
|
"src": ".upcontent/logo.svg",
|
|
7
8
|
"alt": "External Consumer"
|
|
8
9
|
},
|
|
9
10
|
"favicon": ".upcontent/favicon.svg"
|
|
10
11
|
},
|
|
12
|
+
"seo": {
|
|
13
|
+
"enabled": true
|
|
14
|
+
},
|
|
11
15
|
"repo": {
|
|
12
16
|
"url": "https://github.com/example/external-consumer"
|
|
13
17
|
},
|
package/src/pages/index.astro
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// Redireciona pro README (raiz do conteúdo) — Starlight não tem homepage
|
|
3
|
-
// própria sem um index.md na collection.
|
|
4
|
-
import { getCollection } from 'astro:content'
|
|
5
|
-
import { PRODUCT_NAME } from '../lib/product-identity'
|
|
6
|
-
|
|
7
|
-
const all = await getCollection('docs')
|
|
8
|
-
const readme = all.find(e => e.id.toLowerCase() === 'readme')
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
{readme ? (
|
|
12
|
-
<meta http-equiv="refresh" content={`0;url=/${readme.id}/`} />
|
|
13
|
-
) : (
|
|
14
|
-
<html lang="pt-BR">
|
|
15
|
-
<body>
|
|
16
|
-
<h1>{PRODUCT_NAME}</h1>
|
|
17
|
-
<p>Rode <code>make dev</code> para visualizar os documentos.</p>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
20
|
-
)}
|