You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5f5739c
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: rename to @angular-schule/prerender-format with option prerenderFormat
The option follows Astro's build.format: prerenderFormat 'directory'
(default, foo/index.html) or 'file' (foo.html). 'flat' is already used
by Angular for i18n output paths.
Also adds a test for the JSON files that the builder and schematic
registration point to.
Copy file name to clipboardExpand all lines: CLAUDE.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This file provides guidance when working with code in this repository.
4
4
5
5
## Overview
6
6
7
-
`@angular-schule/flat-prerender` is an Angular CLI builder that wraps `@angular/build:application`. With `prerenderOutputStyle: "flat"`, prerendered routes are written as `foo.html` instead of `foo/index.html`, so static hosts serve `/foo` without a trailing slash redirect. It implements the option proposed in [angular/angular-cli#29173](https://github.com/angular/angular-cli/issues/29173). Structure and conventions follow [angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages).
7
+
`@angular-schule/prerender-format` is an Angular CLI builder that wraps `@angular/build:application`. With `prerenderFormat: "file"`, prerendered routes are written as `foo.html` instead of `foo/index.html`, so static hosts serve `/foo` without a trailing slash redirect. It implements the option proposed in [angular/angular-cli#29173](https://github.com/angular/angular-cli/issues/29173). Structure and conventions follow [angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages).
`application/schema.json` is generated: the schema of `@angular/build:application` from the installed version plus `prerenderOutputStyle`. Regenerate it after updating `@angular/build` and commit the result. `npm test` fails if it is out of sync.
29
+
`application/schema.json` is generated: the schema of `@angular/build:application` from the installed version plus `prerenderFormat`. Regenerate it after updating `@angular/build` and commit the result. `npm test` fails if it is out of sync.
30
30
31
31
### Test
32
32
```bash
@@ -47,8 +47,8 @@ For testing changes locally with an Angular project:
@@ -65,22 +65,22 @@ Publishes with provenance attestation for supply chain security.
65
65
66
66
For pre-release versions, after publishing:
67
67
```bash
68
-
npm dist-tag add @angular-schule/flat-prerender@X.X.X-rc.X next
68
+
npm dist-tag add @angular-schule/prerender-format@X.X.X-rc.X next
69
69
```
70
70
71
71
## Architecture
72
72
73
73
1.**Builder** (`src/application/`):
74
-
-`builder.ts` - Angular builder entry point, called by `ng build`. Strips `prerenderOutputStyle`, refuses flat output when a server is shipped, delegates to `buildApplication` and fails a build whose prerendered pages did not go through the wrapper.
74
+
-`builder.ts` - Angular builder entry point, called by `ng build`. Strips `prerenderFormat`, refuses the "file" format when a server is shipped, delegates to `buildApplication` and fails a build whose prerendered pages did not go through the wrapper.
75
75
-`ships-server.ts` - The rule for "this build ships an SSR server", shared by builder and `ng add`.
76
-
-`flat-output.ts` - Wraps the internal `prerenderPages()` of `@angular/build`. `execute-post-bundle.js` reads it from the module's exports object at call time, so replacing the export takes effect for regular and localized builds.
76
+
-`file-format.ts` - Wraps the internal `prerenderPages()` of `@angular/build`. `execute-post-bundle.js` reads it from the module's exports object at call time, so replacing the export takes effect for regular and localized builds.
- Swaps the build target's builder and sets `prerenderFormat: "file"`
82
82
- Stops if the build target or one of its configurations ships an SSR server
83
83
84
84
### Internal API
85
85
86
-
`prerenderPages()` in `@angular/build/src/utils/server-rendering/prerender.js` is not public. The builder fails loudly if the module or the export is missing, and `flat-output.spec.ts` checks the call site in `execute-post-bundle.js`. The package supports Angular 22 only. `.github/scripts/test-angular-app.sh` builds a fresh Angular app (lowest and latest 22.x in CI) and checks `ng add`, flat output for two locales and the `/index` error.
86
+
`prerenderPages()` in `@angular/build/src/utils/server-rendering/prerender.js` is not public. The builder fails loudly if the module or the export is missing, and `file-format.spec.ts` checks the call site in `execute-post-bundle.js`. The package supports Angular 22 only. `.github/scripts/test-angular-app.sh` builds a fresh Angular app (lowest and latest 22.x in CI) and checks `ng add`, the "file" output for two locales and the `/index` error.
[](http://opensource.org/licenses/MIT)
6
6
7
7
**Prerender your Angular app as `about.html` instead of `about/index.html`: no more trailing slash redirects! 🚀**
@@ -42,21 +42,21 @@ The builder is a stopgap: developed and tested for Angular 22, until Angular has
42
42
## 🚀 Quick Start <aname="quickstart"></a>
43
43
44
44
```sh
45
-
ng add @angular-schule/flat-prerender
45
+
ng add @angular-schule/prerender-format
46
46
ng build
47
47
```
48
48
49
49
## ⚙️ Installation <aname="installation"></a>
50
50
51
-
`ng add @angular-schule/flat-prerender` installs the package and changes the builder of your build target in `angular.json` and sets `prerenderOutputStyle`.
51
+
`ng add @angular-schule/prerender-format` installs the package and changes the builder of your build target in `angular.json` and sets `prerenderFormat`.
52
52
Your build must already use `"outputMode": "static"`: if the build target (or one of its configurations) ships an SSR server, `ng add` stops and tells you so.
0 commit comments