polen 0.10.0-next.3 → 0.10.0-next.4
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/README.md +49 -376
- package/build/api/api.d.ts +1 -0
- package/build/api/api.d.ts.map +1 -1
- package/build/api/api.js +1 -0
- package/build/api/api.js.map +1 -1
- package/build/api/static/index.d.ts +2 -0
- package/build/api/static/index.d.ts.map +1 -0
- package/build/api/static/index.js +2 -0
- package/build/api/static/index.js.map +1 -0
- package/build/api/static/manifest.d.ts +18 -0
- package/build/api/static/manifest.d.ts.map +1 -0
- package/build/api/static/manifest.js +13 -0
- package/build/api/static/manifest.js.map +1 -0
- package/build/api/static/rebase.d.ts +14 -0
- package/build/api/static/rebase.d.ts.map +1 -0
- package/build/api/static/rebase.js +110 -0
- package/build/api/static/rebase.js.map +1 -0
- package/build/api/static/static.d.ts +3 -0
- package/build/api/static/static.d.ts.map +1 -0
- package/build/api/static/static.js +3 -0
- package/build/api/static/static.js.map +1 -0
- package/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +22 -1
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/cli/commands/static/$default.d.ts +3 -0
- package/build/cli/commands/static/$default.d.ts.map +1 -0
- package/build/cli/commands/static/$default.js +38 -0
- package/build/cli/commands/static/$default.js.map +1 -0
- package/build/cli/commands/static/rebase.d.ts +2 -0
- package/build/cli/commands/static/rebase.d.ts.map +1 -0
- package/build/cli/commands/static/rebase.js +26 -0
- package/build/cli/commands/static/rebase.js.map +1 -0
- package/build/cli/commands/static.d.ts +3 -0
- package/build/cli/commands/static.d.ts.map +1 -0
- package/build/cli/commands/static.js +5 -0
- package/build/cli/commands/static.js.map +1 -0
- package/build/lib/demos/builder.d.ts +83 -0
- package/build/lib/demos/builder.d.ts.map +1 -0
- package/build/lib/demos/builder.js +237 -0
- package/build/lib/demos/builder.js.map +1 -0
- package/build/lib/demos/config-schema.d.ts +243 -0
- package/build/lib/demos/config-schema.d.ts.map +1 -0
- package/build/lib/demos/config-schema.js +52 -0
- package/build/lib/demos/config-schema.js.map +1 -0
- package/build/lib/demos/config.d.ts +40 -0
- package/build/lib/demos/config.d.ts.map +1 -0
- package/build/lib/demos/config.js +180 -0
- package/build/lib/demos/config.js.map +1 -0
- package/build/lib/demos/index.d.ts +9 -0
- package/build/lib/demos/index.d.ts.map +1 -0
- package/build/lib/demos/index.js +8 -0
- package/build/lib/demos/index.js.map +1 -0
- package/build/lib/demos/ui/components.d.ts +33 -0
- package/build/lib/demos/ui/components.d.ts.map +1 -0
- package/build/lib/demos/ui/components.js +699 -0
- package/build/lib/demos/ui/components.js.map +1 -0
- package/build/lib/demos/ui/data-collector.d.ts +88 -0
- package/build/lib/demos/ui/data-collector.d.ts.map +1 -0
- package/build/lib/demos/ui/data-collector.js +174 -0
- package/build/lib/demos/ui/data-collector.js.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts +3 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.js +21 -0
- package/build/lib/demos/ui/landing-page-cli.js.map +1 -0
- package/build/lib/demos/ui/landing-page.d.ts +32 -0
- package/build/lib/demos/ui/landing-page.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page.js +83 -0
- package/build/lib/demos/ui/landing-page.js.map +1 -0
- package/build/lib/demos/ui/page-renderer.d.ts +26 -0
- package/build/lib/demos/ui/page-renderer.d.ts.map +1 -0
- package/build/lib/demos/ui/page-renderer.js +104 -0
- package/build/lib/demos/ui/page-renderer.js.map +1 -0
- package/build/lib/demos/utils.d.ts +14 -0
- package/build/lib/demos/utils.d.ts.map +1 -0
- package/build/lib/demos/utils.js +37 -0
- package/build/lib/demos/utils.js.map +1 -0
- package/build/lib/deployment/$$.d.ts +3 -0
- package/build/lib/deployment/$$.d.ts.map +1 -0
- package/build/lib/deployment/$$.js +3 -0
- package/build/lib/deployment/$$.js.map +1 -0
- package/build/lib/deployment/$.d.ts +2 -0
- package/build/lib/deployment/$.d.ts.map +1 -0
- package/build/lib/deployment/$.js +2 -0
- package/build/lib/deployment/$.js.map +1 -0
- package/build/lib/deployment/metadata.d.ts +32 -0
- package/build/lib/deployment/metadata.d.ts.map +1 -0
- package/build/lib/deployment/metadata.js +37 -0
- package/build/lib/deployment/metadata.js.map +1 -0
- package/build/lib/deployment/path-manager.d.ts +41 -0
- package/build/lib/deployment/path-manager.d.ts.map +1 -0
- package/build/lib/deployment/path-manager.js +157 -0
- package/build/lib/deployment/path-manager.js.map +1 -0
- package/build/lib/github-actions/git-controller.d.ts +50 -0
- package/build/lib/github-actions/git-controller.d.ts.map +1 -0
- package/build/lib/github-actions/git-controller.js +90 -0
- package/build/lib/github-actions/git-controller.js.map +1 -0
- package/build/lib/github-actions/github-actions.d.ts +7 -0
- package/build/lib/github-actions/github-actions.d.ts.map +1 -0
- package/build/lib/github-actions/github-actions.js +7 -0
- package/build/lib/github-actions/github-actions.js.map +1 -0
- package/build/lib/github-actions/index.d.ts +2 -0
- package/build/lib/github-actions/index.d.ts.map +1 -0
- package/build/lib/github-actions/index.js +2 -0
- package/build/lib/github-actions/index.js.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts +12 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js +51 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js.map +1 -0
- package/build/lib/github-actions/pr-controller.d.ts +39 -0
- package/build/lib/github-actions/pr-controller.d.ts.map +1 -0
- package/build/lib/github-actions/pr-controller.js +122 -0
- package/build/lib/github-actions/pr-controller.js.map +1 -0
- package/build/lib/github-actions/run-step-cli.d.ts +9 -0
- package/build/lib/github-actions/run-step-cli.d.ts.map +1 -0
- package/build/lib/github-actions/run-step-cli.js +71 -0
- package/build/lib/github-actions/run-step-cli.js.map +1 -0
- package/build/lib/github-actions/runner.d.ts +17 -0
- package/build/lib/github-actions/runner.d.ts.map +1 -0
- package/build/lib/github-actions/runner.js +195 -0
- package/build/lib/github-actions/runner.js.map +1 -0
- package/build/lib/github-actions/schemas/context.d.ts +933 -0
- package/build/lib/github-actions/schemas/context.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/context.js +407 -0
- package/build/lib/github-actions/schemas/context.js.map +1 -0
- package/build/lib/github-actions/schemas/index.d.ts +5 -0
- package/build/lib/github-actions/schemas/index.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/index.js +5 -0
- package/build/lib/github-actions/schemas/index.js.map +1 -0
- package/build/lib/github-actions/search-module.d.ts +38 -0
- package/build/lib/github-actions/search-module.d.ts.map +1 -0
- package/build/lib/github-actions/search-module.js +40 -0
- package/build/lib/github-actions/search-module.js.map +1 -0
- package/build/lib/github-actions/step.d.ts +163 -0
- package/build/lib/github-actions/step.d.ts.map +1 -0
- package/build/lib/github-actions/step.js +121 -0
- package/build/lib/github-actions/step.js.map +1 -0
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +5 -3
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/kit-temp.d.ts +54 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +80 -14
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/kit-temp.test-d.d.ts +2 -0
- package/build/lib/kit-temp.test-d.d.ts.map +1 -0
- package/build/lib/kit-temp.test-d.js +75 -0
- package/build/lib/kit-temp.test-d.js.map +1 -0
- package/build/lib/mask/$$.d.ts +3 -0
- package/build/lib/mask/$$.d.ts.map +1 -0
- package/build/lib/mask/$$.js +3 -0
- package/build/lib/mask/$$.js.map +1 -0
- package/build/lib/mask/$.d.ts +2 -0
- package/build/lib/mask/$.d.ts.map +1 -0
- package/build/lib/mask/$.js +2 -0
- package/build/lib/mask/$.js.map +1 -0
- package/build/lib/mask/apply.d.ts +86 -0
- package/build/lib/mask/apply.d.ts.map +1 -0
- package/build/lib/mask/apply.js +86 -0
- package/build/lib/mask/apply.js.map +1 -0
- package/build/lib/mask/mask.d.ts +124 -0
- package/build/lib/mask/mask.d.ts.map +1 -0
- package/build/lib/mask/mask.js +137 -0
- package/build/lib/mask/mask.js.map +1 -0
- package/build/lib/mask/mask.test-d.d.ts +2 -0
- package/build/lib/mask/mask.test-d.d.ts.map +1 -0
- package/build/lib/mask/mask.test-d.js +102 -0
- package/build/lib/mask/mask.test-d.js.map +1 -0
- package/build/lib/task/$$.d.ts +3 -0
- package/build/lib/task/$$.d.ts.map +1 -0
- package/build/lib/task/$$.js +3 -0
- package/build/lib/task/$$.js.map +1 -0
- package/build/lib/task/$.d.ts +2 -0
- package/build/lib/task/$.d.ts.map +1 -0
- package/build/lib/task/$.js +2 -0
- package/build/lib/task/$.js.map +1 -0
- package/build/lib/task/report.d.ts +28 -0
- package/build/lib/task/report.d.ts.map +1 -0
- package/build/lib/task/report.js +33 -0
- package/build/lib/task/report.js.map +1 -0
- package/build/lib/task/task.d.ts +44 -0
- package/build/lib/task/task.d.ts.map +1 -0
- package/build/lib/task/task.js +63 -0
- package/build/lib/task/task.js.map +1 -0
- package/build/lib/version-history/index.d.ts +3 -0
- package/build/lib/version-history/index.d.ts.map +1 -0
- package/build/lib/version-history/index.js +2 -0
- package/build/lib/version-history/index.js.map +1 -0
- package/build/lib/version-history/types.d.ts +64 -0
- package/build/lib/version-history/types.d.ts.map +1 -0
- package/build/lib/version-history/types.js +5 -0
- package/build/lib/version-history/types.js.map +1 -0
- package/build/lib/version-history/version-history.d.ts +85 -0
- package/build/lib/version-history/version-history.d.ts.map +1 -0
- package/build/lib/version-history/version-history.js +248 -0
- package/build/lib/version-history/version-history.js.map +1 -0
- package/build/sandbox.d.ts +2 -0
- package/build/sandbox.d.ts.map +1 -0
- package/build/sandbox.js +3 -0
- package/build/sandbox.js.map +1 -0
- package/build/template/components/Link.jsx +1 -1
- package/package.json +16 -9
- package/src/api/api.ts +1 -0
- package/src/api/singletons/markdown/markdown.test.ts +1 -1
- package/src/api/static/index.ts +1 -0
- package/src/api/static/manifest.test.ts +106 -0
- package/src/api/static/manifest.ts +16 -0
- package/src/api/static/rebase.test.ts +229 -0
- package/src/api/static/rebase.ts +140 -0
- package/src/api/static/static.ts +2 -0
- package/src/api/utils/asset-url/asset-url.test.ts +4 -4
- package/src/api/vite/plugins/build.ts +25 -1
- package/src/api/vite/plugins/core.ts +1 -1
- package/src/cli/commands/static/$default.ts +43 -0
- package/src/cli/commands/static/rebase.ts +37 -0
- package/src/cli/commands/static.ts +6 -0
- package/src/lib/demos/builder.ts +298 -0
- package/src/lib/demos/config-schema.ts +56 -0
- package/src/lib/demos/config.test.ts +193 -0
- package/src/lib/demos/config.ts +205 -0
- package/src/lib/demos/index.ts +9 -0
- package/src/lib/demos/ui/components.ts +739 -0
- package/src/lib/demos/ui/data-collector.ts +246 -0
- package/src/lib/demos/ui/landing-page-cli.ts +23 -0
- package/src/lib/demos/ui/landing-page.ts +126 -0
- package/src/lib/demos/ui/page-renderer.ts +124 -0
- package/src/lib/demos/utils.ts +43 -0
- package/src/lib/deployment/$$.ts +2 -0
- package/src/lib/deployment/$.test.ts +53 -0
- package/src/lib/deployment/$.ts +1 -0
- package/src/lib/deployment/metadata.ts +40 -0
- package/src/lib/deployment/path-manager.ts +186 -0
- package/src/lib/github-actions/git-controller.ts +151 -0
- package/src/lib/github-actions/github-actions.ts +6 -0
- package/src/lib/github-actions/index.ts +1 -0
- package/src/lib/github-actions/lib/get-pr-deployments.ts +76 -0
- package/src/lib/github-actions/pr-controller.test.ts +172 -0
- package/src/lib/github-actions/pr-controller.ts +183 -0
- package/src/lib/github-actions/run-step-cli.ts +84 -0
- package/src/lib/github-actions/runner.test.ts +192 -0
- package/src/lib/github-actions/runner.ts +226 -0
- package/src/lib/github-actions/schemas/context.ts +424 -0
- package/src/lib/github-actions/schemas/index.ts +5 -0
- package/src/lib/github-actions/search-module.test.ts +110 -0
- package/src/lib/github-actions/search-module.ts +76 -0
- package/src/lib/github-actions/step.test.ts +149 -0
- package/src/lib/github-actions/step.ts +232 -0
- package/src/lib/helpers.ts +4 -3
- package/src/lib/kit-temp.test-d.ts +115 -0
- package/src/lib/kit-temp.test.ts +127 -0
- package/src/lib/kit-temp.ts +126 -14
- package/src/lib/mask/$$.ts +2 -0
- package/src/lib/mask/$.test.ts +248 -0
- package/src/lib/mask/$.ts +1 -0
- package/src/lib/mask/apply.ts +134 -0
- package/src/lib/mask/mask.test-d.ts +144 -0
- package/src/lib/mask/mask.ts +244 -0
- package/src/lib/shiki/shiki.test.ts +1 -1
- package/src/lib/task/$$.ts +2 -0
- package/src/lib/task/$.test.ts +209 -0
- package/src/lib/task/$.ts +1 -0
- package/src/lib/task/report.ts +72 -0
- package/src/lib/task/task.ts +112 -0
- package/src/lib/version-history/index.test.ts +188 -0
- package/src/lib/version-history/index.ts +4 -0
- package/src/lib/version-history/types.ts +68 -0
- package/src/lib/version-history/version-history.ts +293 -0
- package/src/sandbox.ts +1 -0
- package/src/template/components/Link.tsx +1 -1
package/README.md
CHANGED
@@ -2,34 +2,33 @@
|
|
2
2
|
|
3
3
|
A framework for delightful GraphQL developer portals
|
4
4
|
|
5
|
-
##
|
5
|
+
## What is Polen?
|
6
6
|
|
7
|
-
|
8
|
-
npm add polen
|
9
|
-
```
|
7
|
+
Polen transforms your GraphQL schema into a beautiful, interactive developer portal with zero configuration. It automatically generates:
|
10
8
|
|
11
|
-
|
9
|
+
- 📖 **Schema Reference** - Interactive documentation for all types, fields, and operations
|
10
|
+
- 📝 **Changelog** - Track schema evolution over time
|
11
|
+
- 📄 **Custom Pages** - Add guides, tutorials, and API documentation with Markdown/MDX
|
12
|
+
- 🎨 **Beautiful UI** - Modern, responsive design out of the box
|
13
|
+
- 🚀 **Instant Deploy** - Static site generation for easy hosting anywhere
|
12
14
|
|
13
|
-
|
15
|
+
## Quick Start
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
}
|
19
|
-
```
|
17
|
+
```sh
|
18
|
+
# Install Polen
|
19
|
+
npm add polen
|
20
20
|
|
21
|
-
|
21
|
+
# Create a GraphQL schema file
|
22
|
+
echo "type Query { hello: String }" > schema.graphql
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
```
|
24
|
+
# Build your developer portal
|
25
|
+
npx polen build
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
# Preview locally
|
28
|
+
node build/app.js
|
29
|
+
```
|
29
30
|
|
30
|
-
|
31
|
-
node build/app.js
|
32
|
-
```
|
31
|
+
Visit http://localhost:3001 to see your developer portal!
|
33
32
|
|
34
33
|
## Live Demos
|
35
34
|
|
@@ -38,378 +37,52 @@ Experience Polen in action with our live documentation sites:
|
|
38
37
|
### 🌐 [View All Demos](https://the-guild-org.github.io/polen/)
|
39
38
|
|
40
39
|
Featured examples:
|
41
|
-
|
42
40
|
- **[Pokemon GraphQL API](https://the-guild-org.github.io/polen/latest/pokemon/)** - Explore a fun GraphQL API with rich schema documentation
|
43
41
|
- **GitHub GraphQL API** (Coming soon) - Browse GitHub's extensive GraphQL API documentation
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
Our demos are available at different stability levels, matching npm's dist tags:
|
43
|
+
## Documentation
|
48
44
|
|
49
|
-
- **
|
50
|
-
|
51
|
-
|
45
|
+
- **[Getting Started](./docs/getting-started.md)** - Installation and quick start guide
|
46
|
+
- **[Schema Configuration](./docs/guide/schema.md)** - Configure your GraphQL schema
|
47
|
+
- **[Custom Pages](./docs/guide/pages.md)** - Add documentation with Markdown and MDX
|
48
|
+
- **[Build & Deploy](./docs/guide/build.md)** - Build configuration and deployment options
|
49
|
+
- **[CLI Reference](./docs/cli/index.md)** - All available commands
|
50
|
+
- **[Package API](./docs/api/package.md)** - Programmatic usage
|
52
51
|
|
53
|
-
|
54
|
-
- The latest pre-release version (e.g., `1.1.0-beta.1`)
|
55
|
-
- Same as `npm install polen@next`
|
52
|
+
### Features
|
56
53
|
|
57
|
-
- **
|
58
|
-
|
59
|
-
- Same as `npm install polen@1.0.0`
|
60
|
-
|
61
|
-
> [!TIP]
|
62
|
-
> The correspondence between demo URLs and npm versions makes it easy to test features before upgrading. If you're using `polen@1.0.0`, visit `/polen/1.0.0/pokemon` to see exactly how your docs will look!
|
54
|
+
- **[Static Rebase](./docs/features/static-rebase.md)** - Update base paths without rebuilding
|
55
|
+
- **[Syntax Highlighting](./docs/features/syntax-highlighting.md)** - Beautiful code blocks with language support
|
63
56
|
|
64
57
|
## Examples
|
65
58
|
|
66
|
-
Find
|
67
|
-
|
68
|
-
## Guide
|
69
|
-
|
70
|
-
### Schema Reference
|
71
|
-
|
72
|
-
If you [provide Polen with a schema](#providing-a-schema), Polen will
|
73
|
-
automatically render reference documentation for it.
|
74
|
-
|
75
|
-
If you provide multiple versions of your schema then the reference is based on
|
76
|
-
the schema with the latest date.
|
77
|
-
|
78
|
-
### Schema Changelog
|
79
|
-
|
80
|
-
Polen can render a changelog for your schema.
|
81
|
-
|
82
|
-
This feature is automatically enabled when you provide multiple versions of your
|
83
|
-
schema. Refer to [Provide a Schema](#providing-a-schema) for details on how to
|
84
|
-
do that.
|
85
|
-
|
86
|
-
### Schema Augmentations
|
87
|
-
|
88
|
-
#### Descriptions
|
89
|
-
|
90
|
-
You can append/prepend/replace descriptions of types and fields in your schema.
|
91
|
-
|
92
|
-
Any Markdown syntax in your content will be automatically rendered.
|
93
|
-
|
94
|
-
```ts
|
95
|
-
import { Polen } from 'polen'
|
96
|
-
|
97
|
-
export default Polen.defineConfig({
|
98
|
-
templateVariables: {
|
99
|
-
title: `Pokemon Developer Portal`,
|
100
|
-
},
|
101
|
-
schemaAugmentations: [
|
102
|
-
{
|
103
|
-
type: `description`,
|
104
|
-
on: {
|
105
|
-
type: `TargetType`,
|
106
|
-
name: `Query`,
|
107
|
-
},
|
108
|
-
placement: `over`,
|
109
|
-
content:
|
110
|
-
`**Content from [Polen](https://github.com/the-guild-org/polen)**.`,
|
111
|
-
},
|
112
|
-
],
|
113
|
-
})
|
114
|
-
```
|
115
|
-
|
116
|
-
### Providing a Schema
|
117
|
-
|
118
|
-
You can provide a GraphQL schema to Polen in various ways.
|
119
|
-
|
120
|
-
#### File
|
121
|
-
|
122
|
-
Have a single `schema.graphql` SDL file in your project directory. Example:
|
123
|
-
|
124
|
-
```
|
125
|
-
schema.graphql
|
126
|
-
```
|
127
|
-
|
128
|
-
#### Directory
|
129
|
-
|
130
|
-
Have a `schema` directory in your project directory with multiple versions of
|
131
|
-
your schema as SDL files named using format: `YYYY-MM-DD.graphql`. Example:
|
132
|
-
|
133
|
-
```
|
134
|
-
schema/
|
135
|
-
2023-01-13.graphql
|
136
|
-
2020-09-26.graphql
|
137
|
-
```
|
138
|
-
|
139
|
-
This approach allows Polen to render a changelog for your schema. Refer to
|
140
|
-
[Changelog](#changelog).
|
141
|
-
|
142
|
-
#### Memory
|
143
|
-
|
144
|
-
You can provide a schema to Polen in memory via configuration.
|
145
|
-
|
146
|
-
You have control to provide one or multiple schemas, with or without dates.
|
147
|
-
|
148
|
-
If no dates are given then the current time is assumed.
|
149
|
-
|
150
|
-
If you provide multiple versions then Polen can render a changelog for you.
|
151
|
-
Refer to [Changelog](#changelog).
|
152
|
-
|
153
|
-
Basic example:
|
154
|
-
|
155
|
-
```ts
|
156
|
-
// polen.config.ts
|
157
|
-
import { Polen } from 'polen'
|
158
|
-
|
159
|
-
export default Polen.defineConfig({
|
160
|
-
schema: {
|
161
|
-
useDataSources: `memory`,
|
162
|
-
dataSources: {
|
163
|
-
memory: {
|
164
|
-
versions: [
|
165
|
-
{
|
166
|
-
date: new Date('2023-01-13'),
|
167
|
-
value: `type Query { hello: String }`,
|
168
|
-
},
|
169
|
-
],
|
170
|
-
},
|
171
|
-
},
|
172
|
-
},
|
173
|
-
})
|
174
|
-
```
|
175
|
-
|
176
|
-
### Pages
|
177
|
-
|
178
|
-
You can add pages to your developer portal by adding markdown (`.md`) or MDX (`.mdx`) files to a
|
179
|
-
`pages` directory.
|
180
|
-
|
181
|
-
#### Routing
|
182
|
-
|
183
|
-
- A file becomes a page.
|
184
|
-
- The relative (to `pages` directory) file path becomes the web path.
|
185
|
-
- _Navigation Bar_
|
186
|
-
- Top level pages are listed in the navigation bar.
|
187
|
-
- _Index Pages_
|
188
|
-
- A file named `index` is an index page.
|
189
|
-
- The file name is elided in the route. For example `foo/index.md` becomes
|
190
|
-
route `/foo` .
|
191
|
-
- Details:
|
192
|
-
- If both `foo/index.md` and `foo.md` exist, then the former is used, latter
|
193
|
-
ignored, and a warning is raised.
|
194
|
-
|
195
|
-
Example:
|
196
|
-
|
197
|
-
| File | Route | Navigation Bar Title |
|
198
|
-
| --------------------- | ---------- | -------------------- |
|
199
|
-
| `pages/foo.md` | `/foo` | `Foo` |
|
200
|
-
| `pages/foo.mdx` | `/foo` | `Foo` |
|
201
|
-
| `pages/foo/index.md` | `/foo` | `Foo` |
|
202
|
-
| `pages/foo/index.mdx` | `/foo` | `Foo` |
|
203
|
-
| `pages/foo/bar.md` | `/foo/bar` | `Foo` |
|
204
|
-
| `pages/foo/bar.mdx` | `/foo/bar` | `Foo` |
|
205
|
-
|
206
|
-
#### Page Ordering
|
207
|
-
|
208
|
-
You can control the order of pages in the sidebar by prefixing file names with numbers followed by `_` or `-`. The numeric prefix affects only the sidebar ordering - it does not appear in the page URL or title.
|
209
|
-
|
210
|
-
- _Syntax_
|
211
|
-
- Format: `<number>_<name>.md` or `<number>-<name>.md`
|
212
|
-
- Examples: `01_intro.md`, `10_getting-started.md`, `20-configuration.md`
|
213
|
-
- _Ordering_
|
214
|
-
- Pages with numeric prefixes appear before pages without prefixes
|
215
|
-
- Pages are sorted by their numeric value (not alphabetically)
|
216
|
-
- Pages without prefixes are sorted alphabetically after numbered pages
|
217
|
-
- _Collisions_
|
218
|
-
- If multiple files have the same name after removing the prefix (e.g., `10_about.md` and `20_about.md`), the file with the higher number is used
|
219
|
-
- A warning is shown for collision conflicts
|
220
|
-
|
221
|
-
Example:
|
222
|
-
|
223
|
-
| File | Route | Sidebar Title | Order |
|
224
|
-
| ----------------------------- | ------------------ | ----------------- | ----- |
|
225
|
-
| `pages/10_getting-started.md` | `/getting-started` | `Getting Started` | 1st |
|
226
|
-
| `pages/20_configuration.md` | `/configuration` | `Configuration` | 2nd |
|
227
|
-
| `pages/30_advanced.md` | `/advanced` | `Advanced` | 3rd |
|
228
|
-
| `pages/api-reference.md` | `/api-reference` | `Api Reference` | 4th |
|
229
|
-
| `pages/troubleshooting.md` | `/troubleshooting` | `Troubleshooting` | 5th |
|
230
|
-
|
231
|
-
#### Markdown
|
232
|
-
|
233
|
-
Markdown files (`.md`) are supported using [remark](https://remark.js.org/). This is the same underlying engine as [MDX](https://mdxjs.com/) thus you can rely on consistent behavior between your `.md` and `.mdx` files.
|
234
|
-
|
235
|
-
Polen supports:
|
236
|
-
|
237
|
-
- [CommonMark](https://commonmark.org/).
|
238
|
-
- [GitHub Flavored Markdown](https://github.github.com/gfm/).
|
239
|
-
|
240
|
-
In the future you will be able to extend Polen in your project with additional [Remark plugins](https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins). Track this feature in [#64](https://github.com/the-guild-org/polen/issues/64).
|
59
|
+
Find complete example projects in the [examples](./examples) directory:
|
241
60
|
|
242
|
-
|
61
|
+
- `pokemon` - Fun Pokemon API documentation
|
62
|
+
- `github` - GitHub GraphQL API (coming soon)
|
63
|
+
- `minimal` - Minimal setup example
|
243
64
|
|
244
|
-
|
245
|
-
- **[Markdown Guide](https://www.markdownguide.org/)** - Comprehensive reference and cheat sheets
|
246
|
-
- **[GitHub's Markdown Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)** - Practical guide with examples
|
65
|
+
## Why Polen?
|
247
66
|
|
248
|
-
|
67
|
+
- **Zero Configuration** - Works out of the box with just a GraphQL schema
|
68
|
+
- **Developer Focused** - Built specifically for GraphQL API documentation
|
69
|
+
- **Modern Stack** - React, TypeScript, and Vite for fast builds
|
70
|
+
- **Flexible** - Customize everything from branding to page structure
|
71
|
+
- **Static or Server** - Deploy as static files or run as a Node.js server
|
249
72
|
|
250
|
-
|
73
|
+
## Contributing
|
251
74
|
|
252
|
-
|
253
|
-
- Bold, italic, and code formatting
|
254
|
-
- Lists (ordered and unordered)
|
255
|
-
- Links and images
|
256
|
-
- Code blocks with syntax highlighting
|
257
|
-
- Blockquotes
|
258
|
-
- Horizontal rules
|
259
|
-
|
260
|
-
**Via GitHub Flavored Markdown:**
|
261
|
-
|
262
|
-
- Tables
|
263
|
-
- Task lists
|
264
|
-
- Strikethrough text
|
265
|
-
- Autolinks
|
266
|
-
|
267
|
-
#### MDX
|
268
|
-
|
269
|
-
MDX begins where [Markdown](#markdown) ends. So everything stated there such as regarding supported Markdown flavours applies here too.
|
270
|
-
|
271
|
-
MDX files (`.mdx`) allow you to use JSX/React components within your markdown content. This enables
|
272
|
-
interactive documentation with live examples, custom components, and more.
|
273
|
-
|
274
|
-
Example MDX page:
|
275
|
-
|
276
|
-
```mdx
|
277
|
-
# Interactive Documentation
|
278
|
-
|
279
|
-
import { Button } from "@radix-ui/themes";
|
280
|
-
|
281
|
-
This page demonstrates MDX features.
|
282
|
-
|
283
|
-
<Button onClick={() => alert("Hello from MDX!")}>Click me!</Button>
|
284
|
-
|
285
|
-
## Code Examples
|
286
|
-
|
287
|
-
You can mix markdown with React components for powerful documentation:
|
288
|
-
|
289
|
-
export const CodeExample = ({ language, code }) => (
|
290
|
-
<pre>
|
291
|
-
<code className={`language-${language}`}>{code}</code>
|
292
|
-
</pre>
|
293
|
-
);
|
294
|
-
|
295
|
-
<CodeExample
|
296
|
-
language="graphql"
|
297
|
-
code={`
|
298
|
-
query GetUser($id: ID!) {
|
299
|
-
user(id: $id) {
|
300
|
-
name
|
301
|
-
email
|
302
|
-
}
|
303
|
-
}
|
304
|
-
`}
|
305
|
-
/>
|
306
|
-
```
|
307
|
-
|
308
|
-
### Build
|
309
|
-
|
310
|
-
When you build you may choose between SSG and SSR. The default is SSG.
|
311
|
-
|
312
|
-
#### SSG
|
313
|
-
|
314
|
-
```sh
|
315
|
-
npx polen build --type ssg
|
316
|
-
```
|
317
|
-
|
318
|
-
Deploy the contents of the `./build` directory on your favourite static site provider.
|
319
|
-
|
320
|
-
#### SSR
|
321
|
-
|
322
|
-
In the future Polen will have features that motivate using a server, but for now there is no particular benefit. Use `SSG` instead.
|
323
|
-
|
324
|
-
#### Base Path Configuration
|
325
|
-
|
326
|
-
Polen supports deploying to subdirectories through the `build.base` configuration option. This is useful for:
|
327
|
-
|
328
|
-
- GitHub Pages project sites (e.g., `/my-project/`)
|
329
|
-
- PR preview deployments (e.g., `/pr-123/`)
|
330
|
-
- Hosting multiple Polen sites on one domain
|
331
|
-
|
332
|
-
```ts
|
333
|
-
// polen.config.ts
|
334
|
-
import { Polen } from 'polen'
|
335
|
-
|
336
|
-
export default Polen.defineConfig({
|
337
|
-
build: {
|
338
|
-
base: '/my-project/', // Must start and end with /
|
339
|
-
},
|
340
|
-
})
|
341
|
-
```
|
342
|
-
|
343
|
-
When configured, Polen will output differently:
|
344
|
-
|
345
|
-
- For SSG architecture:
|
346
|
-
- Generate static files that work in the subdirectory
|
347
|
-
- For SSR architecture:
|
348
|
-
- A server that serves static assets from the correct path
|
349
|
-
|
350
|
-
You can also set the base path via CLI:
|
351
|
-
|
352
|
-
```bash
|
353
|
-
npx polen build --base /my-project/
|
354
|
-
npx polen dev --base /my-project/
|
355
|
-
```
|
356
|
-
|
357
|
-
The CLI flag takes precedence over the config file setting.
|
358
|
-
|
359
|
-
#### Custom Logo
|
360
|
-
|
361
|
-
You can provide a custom logo for your developer portal by placing a `logo.svg` file in your project's `public` directory:
|
362
|
-
|
363
|
-
```
|
364
|
-
public/
|
365
|
-
logo.svg
|
366
|
-
```
|
367
|
-
|
368
|
-
Polen will automatically use this logo in the navigation bar instead of the default Polen logo.
|
369
|
-
|
370
|
-
### Package
|
371
|
-
|
372
|
-
#### ESM
|
373
|
-
|
374
|
-
Polen is an ESM only package. If you are using CJS, then you need
|
375
|
-
[NodeJS version `>=22.0.0` to `require` it](https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require).
|
376
|
-
|
377
|
-
#### Exports
|
378
|
-
|
379
|
-
You can import a `Polen` namespace from `polen`. You can import its bare exports
|
380
|
-
from `polen/polen`.
|
381
|
-
|
382
|
-
```ts
|
383
|
-
import { Polen } from 'polen'
|
384
|
-
import { defineConfig } from 'polen/polen'
|
385
|
-
|
386
|
-
console.log(Polen.defineConfig === defineConfig) // true
|
387
|
-
```
|
388
|
-
|
389
|
-
### Instant Schema Explorer
|
390
|
-
|
391
|
-
Polen comes with a light-weight command to instantly view any GraphQL schema.
|
392
|
-
|
393
|
-
Example:
|
394
|
-
|
395
|
-
```sh
|
396
|
-
npx polen open --name github
|
397
|
-
```
|
398
|
-
|
399
|
-
See docs for more details
|
400
|
-
|
401
|
-
```sh
|
402
|
-
npx polen open --help
|
403
|
-
```
|
75
|
+
We welcome contributions! See [DEVELOPMENT.md](./DEVELOPMENT.md) for:
|
404
76
|
|
405
|
-
|
77
|
+
- Development setup
|
78
|
+
- Architecture overview
|
79
|
+
- Testing guidelines
|
80
|
+
- Contribution process
|
406
81
|
|
407
|
-
|
82
|
+
## Changelog
|
408
83
|
|
409
|
-
|
410
|
-
[releases on this repo](https://github.com/the-guild-org/polen/releases).
|
84
|
+
See [releases](https://github.com/the-guild-org/polen/releases) for a detailed changelog.
|
411
85
|
|
412
|
-
|
86
|
+
## License
|
413
87
|
|
414
|
-
|
415
|
-
[DEVELOPMENT.md](./DEVELOPMENT.md) for details about workflow, testing, etc.
|
88
|
+
MIT © [The Guild](https://the-guild.dev)
|
package/build/api/api.d.ts
CHANGED
package/build/api/api.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA"}
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
|
package/build/api/api.js
CHANGED
package/build/api/api.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA"}
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api/api.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/static/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/static/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Resource } from '@wollybeard/kit';
|
2
|
+
import { z } from 'zod/v4';
|
3
|
+
export declare const PolenBuildManifestSchema: z.ZodObject<{
|
4
|
+
type: z.ZodEnum<{
|
5
|
+
ssr: "ssr";
|
6
|
+
ssg: "ssg";
|
7
|
+
}>;
|
8
|
+
version: z.ZodString;
|
9
|
+
basePath: z.ZodString;
|
10
|
+
}, z.core.$loose>;
|
11
|
+
export type PolenBuildManifest = z.infer<typeof PolenBuildManifestSchema>;
|
12
|
+
export declare const buildManifest: Resource.Resource<"polen-build-manifest", {
|
13
|
+
[x: string]: unknown;
|
14
|
+
type: "ssr" | "ssg";
|
15
|
+
version: string;
|
16
|
+
basePath: string;
|
17
|
+
}>;
|
18
|
+
//# sourceMappingURL=manifest.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/api/static/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,eAAO,MAAM,wBAAwB;;;;;;;iBAI3B,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE,eAAO,MAAM,aAAa;;;;;EAIxB,CAAA"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Codec, Resource } from '@wollybeard/kit';
|
2
|
+
import { z } from 'zod/v4';
|
3
|
+
export const PolenBuildManifestSchema = z.object({
|
4
|
+
type: z.enum(['ssg', 'ssr']),
|
5
|
+
version: z.string(),
|
6
|
+
basePath: z.string(),
|
7
|
+
}).loose();
|
8
|
+
export const buildManifest = Resource.create({
|
9
|
+
name: 'polen-build-manifest',
|
10
|
+
path: '.polen/build.json',
|
11
|
+
codec: Codec.fromZod(PolenBuildManifestSchema),
|
12
|
+
});
|
13
|
+
//# sourceMappingURL=manifest.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/api/static/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC,KAAK,EAAE,CAAA;AAIV,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC;CAC/C,CAAC,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export type RebasePlan = RebaseOverwritePlan | RebaseCopyPlan;
|
2
|
+
export interface RebaseOverwritePlan {
|
3
|
+
changeMode: 'mutate';
|
4
|
+
newBasePath: string;
|
5
|
+
sourcePath: string;
|
6
|
+
}
|
7
|
+
export interface RebaseCopyPlan {
|
8
|
+
changeMode: 'copy';
|
9
|
+
newBasePath: string;
|
10
|
+
sourcePath: string;
|
11
|
+
targetPath: string;
|
12
|
+
}
|
13
|
+
export declare const rebase: (plan: RebasePlan) => Promise<void>;
|
14
|
+
//# sourceMappingURL=rebase.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rebase.d.ts","sourceRoot":"","sources":["../../../src/api/static/rebase.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,cAAc,CAAA;AAE7D,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,QAAQ,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,MAAM,GAAU,MAAM,UAAU,KAAG,OAAO,CAAC,IAAI,CAiC3D,CAAA"}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import { TinyGlobby } from '#dep/tiny-globby/index';
|
2
|
+
import { Fs, Path } from '@wollybeard/kit';
|
3
|
+
import { Err } from '@wollybeard/kit';
|
4
|
+
import { buildManifest } from "./manifest.js";
|
5
|
+
export const rebase = async (plan) => {
|
6
|
+
// 1. Validate source is a Polen build
|
7
|
+
const manifestResult = await buildManifest.read(plan.sourcePath);
|
8
|
+
if (Err.is(manifestResult)) {
|
9
|
+
throw new Error(`Polen build manifest not found at: ${Path.join(plan.sourcePath, '.polen', 'build.json')}`);
|
10
|
+
}
|
11
|
+
const manifest = manifestResult;
|
12
|
+
// 2. Validate newBasePath is valid URL path
|
13
|
+
if (!isValidUrlPath(plan.newBasePath)) {
|
14
|
+
throw new Error(`Invalid base path: ${plan.newBasePath}`);
|
15
|
+
}
|
16
|
+
// 3. Handle copy vs mutate
|
17
|
+
let workingPath;
|
18
|
+
if (plan.changeMode === 'copy') {
|
19
|
+
if (await Fs.exists(plan.targetPath)) {
|
20
|
+
const isEmpty = await Fs.isEmptyDir(plan.targetPath);
|
21
|
+
if (!isEmpty) {
|
22
|
+
throw new Error(`Target path already exists and is not empty: ${plan.targetPath}`);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
await Fs.copyDir({ from: plan.sourcePath, to: plan.targetPath });
|
26
|
+
workingPath = plan.targetPath;
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
workingPath = plan.sourcePath;
|
30
|
+
}
|
31
|
+
// 4. Update HTML files with new base path
|
32
|
+
await updateHtmlFiles(workingPath, manifest.basePath, plan.newBasePath);
|
33
|
+
// 5. Update manifest
|
34
|
+
await updateManifest(workingPath, { basePath: plan.newBasePath });
|
35
|
+
};
|
36
|
+
//
|
37
|
+
//
|
38
|
+
//
|
39
|
+
//
|
40
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Local Helpers
|
41
|
+
//
|
42
|
+
//
|
43
|
+
// TODO: this is very generic, factor out to kit-temp
|
44
|
+
const isValidUrlPath = (path) => {
|
45
|
+
// URL path should start with / and not contain invalid characters
|
46
|
+
if (!path.startsWith('/'))
|
47
|
+
return false;
|
48
|
+
if (!path.endsWith('/'))
|
49
|
+
return false;
|
50
|
+
// Basic validation - no spaces, proper URL characters
|
51
|
+
const urlPathRegex = /^\/[a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=%]*\/$/;
|
52
|
+
return urlPathRegex.test(path);
|
53
|
+
};
|
54
|
+
const updateHtmlFiles = async (buildPath, oldBasePath, newBasePath) => {
|
55
|
+
// Find all HTML files recursively
|
56
|
+
const htmlFiles = await findHtmlFiles(buildPath);
|
57
|
+
for (const htmlFile of htmlFiles) {
|
58
|
+
await updateHtmlFile(htmlFile, oldBasePath, newBasePath);
|
59
|
+
}
|
60
|
+
};
|
61
|
+
const findHtmlFiles = async (dir) => {
|
62
|
+
return await TinyGlobby.glob('**/*.html', {
|
63
|
+
absolute: true,
|
64
|
+
cwd: dir,
|
65
|
+
onlyFiles: true,
|
66
|
+
});
|
67
|
+
};
|
68
|
+
const updateHtmlFile = async (filePath, oldBasePath, newBasePath) => {
|
69
|
+
const content = await Fs.read(filePath);
|
70
|
+
if (content === null) {
|
71
|
+
throw new Error(`Could not read HTML file: ${filePath}`);
|
72
|
+
}
|
73
|
+
// Simple regex-based approach to update base tag
|
74
|
+
// Look for existing base tag first
|
75
|
+
const baseTagRegex = /<base\s+href\s*=\s*["']([^"']*)["'][^>]*>/i;
|
76
|
+
let updatedContent;
|
77
|
+
if (baseTagRegex.test(content)) {
|
78
|
+
// Update existing base tag
|
79
|
+
updatedContent = content.replace(baseTagRegex, `<base href="${newBasePath}">`);
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
// Insert new base tag in head
|
83
|
+
const headRegex = /<head[^>]*>/i;
|
84
|
+
const headMatch = content.match(headRegex);
|
85
|
+
if (headMatch) {
|
86
|
+
const insertPosition = headMatch.index + headMatch[0].length;
|
87
|
+
updatedContent = content.slice(0, insertPosition)
|
88
|
+
+ `\n <base href="${newBasePath}">`
|
89
|
+
+ content.slice(insertPosition);
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
throw new Error(`Could not find <head> tag in HTML file: ${filePath}`);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
await Fs.write({ path: filePath, content: updatedContent });
|
96
|
+
};
|
97
|
+
const updateManifest = async (buildPath, updates) => {
|
98
|
+
const manifestPath = Path.join(buildPath, '.polen', 'build.json');
|
99
|
+
const manifestResult = await buildManifest.read(buildPath);
|
100
|
+
if (Err.is(manifestResult)) {
|
101
|
+
throw new Error(`Polen build manifest not found at: ${manifestPath}`);
|
102
|
+
}
|
103
|
+
const currentManifest = manifestResult;
|
104
|
+
const updatedManifest = { ...currentManifest, ...updates };
|
105
|
+
await Fs.write({
|
106
|
+
path: manifestPath,
|
107
|
+
content: JSON.stringify(updatedManifest, null, 2),
|
108
|
+
});
|
109
|
+
};
|
110
|
+
//# sourceMappingURL=rebase.js.map
|