@rr0/cms 0.3.60 → 0.3.62
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/dist/CMSGenerator.d.ts +27 -0
- package/dist/CMSGenerator.js +9 -3
- package/package.json +2 -2
package/dist/CMSGenerator.d.ts
CHANGED
|
@@ -24,6 +24,33 @@ export interface CMSGeneratorOptions {
|
|
|
24
24
|
org: DataOptions;
|
|
25
25
|
};
|
|
26
26
|
siteBaseUrl: string;
|
|
27
|
+
/**
|
|
28
|
+
* Where the redirects read out of `.htaccess` are written, and in which of Netlify's two formats.
|
|
29
|
+
*
|
|
30
|
+
* Defaults to a `netlify.toml` at the repository root, which is what this has always produced.
|
|
31
|
+
*
|
|
32
|
+
* The `redirects` format writes Netlify's plainer `_redirects` instead, and the reason to choose
|
|
33
|
+
* it is WHERE it can be put. `netlify.toml` is read from the CLONE, before any build command runs,
|
|
34
|
+
* so a site built by Netlify from git must keep it in version control — a generated file, tracked,
|
|
35
|
+
* inviting exactly the hand-edit that overwrites itself. `_redirects` and `_headers` are read from
|
|
36
|
+
* the DEPLOYED directory, so they can be build output like everything else and never need to be
|
|
37
|
+
* committed at all.
|
|
38
|
+
*
|
|
39
|
+
* `preambleFile` holds whatever the `.htaccess` cannot say and is emitted ahead of the generated
|
|
40
|
+
* lines: a redirect carrying its own status or `force` (`301!` in the plain format), one from an
|
|
41
|
+
* absolute URL on another domain. Without it those lines have nowhere to live but the generated
|
|
42
|
+
* file itself, where every full build wipes them — which is exactly how one site's `ufoathome.org`
|
|
43
|
+
* redirects and its CORS headers disappeared twice. See ssg-api's HtAccessReplaceCommand; naming a
|
|
44
|
+
* file that is not there fails the build rather than dropping it in silence.
|
|
45
|
+
*
|
|
46
|
+
* Headers have no generator because `.htaccess` here carries no `Header` directive worth
|
|
47
|
+
* translating: in the plain format they are simply a static `_headers` file among the copies.
|
|
48
|
+
*/
|
|
49
|
+
netlify?: {
|
|
50
|
+
format: "toml" | "redirects";
|
|
51
|
+
outputPath: string;
|
|
52
|
+
preambleFile?: string;
|
|
53
|
+
};
|
|
27
54
|
timeFormat: Intl.DateTimeFormatOptions;
|
|
28
55
|
directoryPages: string[];
|
|
29
56
|
ufoCaseDirectoryFile: string;
|
package/dist/CMSGenerator.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CaseDirectoryStep, CaseFactory, CaseService } from "./science/crypto/uf
|
|
|
5
5
|
import { cities, CityService, CmsOrganizationFactory, countries, departments, DepartmentService, OrganizationService, regions, RegionService } from "./org/index.js";
|
|
6
6
|
import { RR0ContextImpl } from "./RR0Context.js";
|
|
7
7
|
import { HtmlTable } from "./util/index.js";
|
|
8
|
-
import { ClassDomReplaceCommand, CopyStep, DomReplaceCommand, HtAccessToNetlifyConfigReplaceCommand, HtmlFileContents, Ssg, SsiIncludeReplaceCommand } from "ssg-api";
|
|
8
|
+
import { ClassDomReplaceCommand, CopyStep, DomReplaceCommand, HtAccessToNetlifyConfigReplaceCommand, HtAccessToNetlifyRedirectsReplaceCommand, HtmlFileContents, Ssg, SsiIncludeReplaceCommand } from "ssg-api";
|
|
9
9
|
import { AuthorReplaceCommand, PeopleDirectoryStepFactory, PeopleReplacerFactory } from "./people/index.js";
|
|
10
10
|
import { PersistentSourceRegistry, SourceFileCounter, SourceIndexStep, SourceRenderer, SourceReplacer, SourceReplacerFactory } from "./source/index.js";
|
|
11
11
|
import { NoteFileCounter, NoteRenderer, NoteReplacer, NoteReplacerFactory } from "./note/index.js";
|
|
@@ -75,6 +75,7 @@ export class CMSGenerator {
|
|
|
75
75
|
this.timeService = new TimeService(dataService, timeOptions);
|
|
76
76
|
}
|
|
77
77
|
async generate(args) {
|
|
78
|
+
var _a;
|
|
78
79
|
const timeContext = new TimeContext();
|
|
79
80
|
const context = new RR0ContextImpl(this.options.locale, timeContext, this.config, undefined, undefined, undefined, this);
|
|
80
81
|
context.setVar("mapsApiKey", this.options.googleMapsApiKey);
|
|
@@ -134,10 +135,15 @@ export class CMSGenerator {
|
|
|
134
135
|
return HtmlTable.create(obj, headers);
|
|
135
136
|
}
|
|
136
137
|
}();
|
|
138
|
+
const netlify = (_a = this.options.netlify) !== null && _a !== void 0 ? _a : { format: "toml", outputPath: "netlify.toml" };
|
|
137
139
|
const htAccessToNetlifyConfig = {
|
|
138
|
-
replacements: [
|
|
140
|
+
replacements: [
|
|
141
|
+
netlify.format === "redirects"
|
|
142
|
+
? new HtAccessToNetlifyRedirectsReplaceCommand(this.options.siteBaseUrl, netlify.preambleFile)
|
|
143
|
+
: new HtAccessToNetlifyConfigReplaceCommand(this.options.siteBaseUrl, netlify.preambleFile)
|
|
144
|
+
],
|
|
139
145
|
roots: [".htaccess"],
|
|
140
|
-
getOutputPath: (_context) =>
|
|
146
|
+
getOutputPath: (_context) => netlify.outputPath
|
|
141
147
|
};
|
|
142
148
|
const contentRoots = this.options.contentRoots;
|
|
143
149
|
const contentStepOptions = {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@rr0/cms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.62",
|
|
6
6
|
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"image-size": "^2.0.2",
|
|
42
42
|
"jsdom": "^27.4.0",
|
|
43
43
|
"selenium-webdriver": "^4.39.0",
|
|
44
|
-
"ssg-api": "^1.
|
|
44
|
+
"ssg-api": "^1.18.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@javarome/testscript": "^0.13.1",
|