ferst-core 0.9.0 → 0.9.1
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/bin/ferst-update.mjs +21 -2
- package/cms/config.template.yml +10 -0
- package/content/posts.ts +2 -2
- package/package.json +1 -1
package/bin/ferst-update.mjs
CHANGED
|
@@ -142,6 +142,26 @@ export function coreRangeFor(version) {
|
|
|
142
142
|
return `^${m[1]}.${m[2]}.0`;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
/** Whether `b` is a newer plain x.y.z version than `a`; anything unparsable is not newer. */
|
|
146
|
+
export function isNewerVersion(a, b) {
|
|
147
|
+
const parse = (v) => String(v ?? '').trim().replace(/^v/, '').match(/^(\d+)\.(\d+)\.(\d+)$/)?.slice(1).map(Number);
|
|
148
|
+
const [x, y] = [parse(a), parse(b)];
|
|
149
|
+
if (!x || !y) return false;
|
|
150
|
+
for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return y[i] > x[i];
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The dry run's line about the engine. A site's scheduled run decides from the dry run
|
|
156
|
+
* whether to update, so a newer ferst-core has to read as a change that WOULD apply, like
|
|
157
|
+
* the scaffold changes above it; otherwise an engine-only release never reaches the site.
|
|
158
|
+
*/
|
|
159
|
+
export function coreUpdateNote(installed, latest) {
|
|
160
|
+
if (!latest) return `ferst-core is ${installed ?? '(not installed)'}; the latest version is unknown`;
|
|
161
|
+
if (!installed) return `ferst-core ${latest} WOULD be installed (none installed yet)`;
|
|
162
|
+
return isNewerVersion(installed, latest) ? `ferst-core ${installed} → ${latest} WOULD be installed` : `ferst-core is current (${installed})`;
|
|
163
|
+
}
|
|
164
|
+
|
|
145
165
|
/** Read the `version` out of a package.json's text. Throws if absent. */
|
|
146
166
|
export function extractVersion(pkgJsonText) {
|
|
147
167
|
let v;
|
|
@@ -451,8 +471,7 @@ function main() {
|
|
|
451
471
|
console.log('ferst-update: --no-core — skipping the ferst-core npm bump.');
|
|
452
472
|
} else if (dryRun) {
|
|
453
473
|
dryLatest = (tryExec('npm view ferst-core version', cwd) || '').trim() || null;
|
|
454
|
-
|
|
455
|
-
console.log(`ferst-update: ferst-core installed=${current ?? '(none)'} latest=${dryLatest || '(unknown)'}`);
|
|
474
|
+
console.log(`ferst-update: --dry-run — ${coreUpdateNote(readInstalledCoreVersion(cwd), dryLatest)}`);
|
|
456
475
|
} else {
|
|
457
476
|
const before = readInstalledCoreVersion(cwd);
|
|
458
477
|
console.log('ferst-update: npm install ferst-core@latest --save ...');
|
package/cms/config.template.yml
CHANGED
|
@@ -177,6 +177,16 @@ collections:
|
|
|
177
177
|
- { name: provider, label: Provider name, widget: string, default: Google Calendar }
|
|
178
178
|
- { name: weekStart, label: Week starts on, widget: select, default: monday, options: [{ label: "Monday", value: monday }, { label: "Sunday", value: sunday }] }
|
|
179
179
|
|
|
180
|
+
- name: posts-settings
|
|
181
|
+
label: News
|
|
182
|
+
file: src/content/postsSettings/index.json
|
|
183
|
+
icon: newspaper
|
|
184
|
+
fields:
|
|
185
|
+
- { name: title, label: Heading, widget: string, default: News }
|
|
186
|
+
- { name: intro, label: Intro, widget: text, required: false }
|
|
187
|
+
- { name: perPage, label: Posts per page, widget: number, default: 12, value_type: int, min: 1, max: 48, hint: "How many posts each news page shows. 12 fills rows of one, two, three or four evenly." }
|
|
188
|
+
- { name: excludeFromIndex, label: Tags kept off the main news page, widget: list, required: false, hint: "Tag names (for example newsletter) whose posts appear only on their own tag page." }
|
|
189
|
+
|
|
180
190
|
- name: posts
|
|
181
191
|
label: Posts
|
|
182
192
|
label_singular: Post
|
package/content/posts.ts
CHANGED
|
@@ -43,8 +43,8 @@ export const postsSettingsSchema = z.object({
|
|
|
43
43
|
title: z.string().default('News'),
|
|
44
44
|
/** Optional intro copy for the index. */
|
|
45
45
|
intro: z.string().default(''),
|
|
46
|
-
/** Posts per page in the paginated index. */
|
|
47
|
-
perPage: z.number().int().min(1).default(
|
|
46
|
+
/** Posts per page in the paginated index. 12 fills rows of 1, 2, 3 or 4 tiles evenly. */
|
|
47
|
+
perPage: z.number().int().min(1).default(12),
|
|
48
48
|
/** Tag slugs excluded from the MAIN index (e.g. a `newsletter` tag that has its
|
|
49
49
|
* own view). Kept generic — no capability knows what "newsletter" means. */
|
|
50
50
|
excludeFromIndex: z.array(z.string()).default([]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ferst-core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ferst Core — the shared, brand-agnostic client-site system: Astro components, layouts, content schemas, the layered config resolver, and a neutral styling architecture that every client overrides.",
|
|
6
6
|
"license": "BUSL-1.1",
|