@micropage-sh/cli 2.6.4 → 2.6.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micropage-sh/cli",
3
- "version": "2.6.4",
3
+ "version": "2.6.5",
4
4
  "description": "Micropage CLI: keep your .page files in git and publish static sites from the terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -169,6 +169,11 @@ function frontMatterFromPost(post) {
169
169
  if (post.published_at) {
170
170
  const published = new Date(post.published_at);
171
171
  if (!Number.isNaN(published.getTime())) fmData.date = utcDateString(published);
172
+ } else if (post.date_override) {
173
+ // A draft's held date must round-trip: push sends date: null for files without one,
174
+ // which clears it.
175
+ const held = new Date(post.date_override);
176
+ if (!Number.isNaN(held.getTime())) fmData.date = isMidnightUtc(held) ? utcDateString(held) : held.toISOString();
172
177
  }
173
178
  if (post.description) fmData.description = post.description;
174
179
  if (post.web_visibility && post.web_visibility !== 'listed') fmData.visibility = post.web_visibility;
@@ -352,7 +357,8 @@ async function push(options = {}) {
352
357
  subject: fm.subject || null,
353
358
  preheader: fm.preview || null,
354
359
  };
355
- if (postDate) payload.date = postDate;
360
+ // An explicit null tells the server the file has no date:, so a held draft date is cleared.
361
+ payload.date = postDate || null;
356
362
 
357
363
  try {
358
364
  const result = await fn.invoke('upsert-post', payload);
@@ -402,7 +408,7 @@ async function pull(options = {}) {
402
408
  remotePosts = await db
403
409
  .from('posts')
404
410
  .select(
405
- 'id,slug,title,description,body_markdown,web_visibility,email_enabled,status,hero_image,published_at,created_at',
411
+ 'id,slug,title,description,body_markdown,web_visibility,email_enabled,status,hero_image,published_at,date_override,created_at',
406
412
  )
407
413
  .eq('project_id', config.projectId)
408
414
  .order('created_at', 'desc')