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.
Files changed (49) hide show
  1. package/.github/workflows/ci.yml +3 -3
  2. package/.github/workflows/publish.yml +75 -0
  3. package/.upcontent/config.json +6 -1
  4. package/CONTEXT.md +25 -0
  5. package/Makefile +6 -2
  6. package/README.md +57 -39
  7. package/assets/readme/portal-home.png +0 -0
  8. package/assets/readme/portal-showcase.png +0 -0
  9. package/astro.config.mjs +67 -18
  10. package/customization/config-json.md +9 -1
  11. package/customization/content.md +14 -0
  12. package/customization/navigation.md +2 -0
  13. package/deployment/index.md +1 -0
  14. package/deployment/npm.md +39 -0
  15. package/guides/validate-your-site.md +5 -0
  16. package/index.md +19 -0
  17. package/package.json +15 -9
  18. package/scripts/upcontent-cli.mjs +2 -4
  19. package/scripts/verify-external-build.mjs +9 -1
  20. package/scripts/verify-golden-build.mjs +13 -0
  21. package/src/components/MermaidLoader.astro +17 -3
  22. package/src/content/i18n/en.json +1 -0
  23. package/src/content.config.test.ts +52 -1
  24. package/src/content.config.ts +29 -4
  25. package/src/lib/content-blocklist.ts +2 -2
  26. package/src/lib/doc-links.test.ts +21 -1
  27. package/src/lib/doc-links.ts +9 -4
  28. package/src/lib/homepage.ts +16 -0
  29. package/src/lib/markdown.ts +6 -0
  30. package/src/lib/portal-config.test.ts +11 -1
  31. package/src/lib/portal-config.ts +11 -0
  32. package/src/lib/portal-routes.test.ts +73 -0
  33. package/src/lib/portal-routes.ts +65 -0
  34. package/src/lib/remark-doc-links.test.ts +50 -0
  35. package/src/lib/remark-doc-links.ts +21 -0
  36. package/src/lib/remark-wiki-links.test.ts +10 -8
  37. package/src/lib/remark-wiki-links.ts +17 -8
  38. package/src/lib/seo-sitemap.test.ts +46 -0
  39. package/src/lib/seo-sitemap.ts +55 -0
  40. package/src/lib/sidebar.test.ts +32 -3
  41. package/src/lib/sidebar.ts +26 -17
  42. package/src/overrides/Footer.astro +3 -5
  43. package/src/overrides/Head.astro +86 -3
  44. package/src/pages/robots.txt.ts +46 -0
  45. package/src/upcontent-cli.test.ts +36 -0
  46. package/test-fixtures/external-consumer/.upcontent/config.json +4 -0
  47. package/test-fixtures/external-consumer/noindex.md +7 -0
  48. package/test-fixtures/external-consumer/public.md +6 -0
  49. 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
  },
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: Internal reference
3
+ description: This page should not appear in search results.
4
+ noindex: true
5
+ ---
6
+
7
+ This page is intentionally excluded from the sitemap.
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: Public guide
3
+ description: This page remains discoverable when SEO is enabled.
4
+ ---
5
+
6
+ This page is included in the sitemap.
@@ -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
- )}