From 53e4cf04b76c6ddbe260bae5cb8eabc52045d475 Mon Sep 17 00:00:00 2001 From: Jack Platten Date: Sun, 24 May 2026 17:33:51 -0700 Subject: [PATCH] Add json to ignore fix date on `new` --- .changeset/README.md | 8 ++++++++ .changeset/chubby-suits-hammer.md | 5 +++++ .changeset/config.json | 11 +++++++++++ .gitignore | 1 + src/commands/new.ts | 4 ++-- src/commands/publish.ts | 5 ++++- 6 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .changeset/README.md create mode 100644 .changeset/chubby-suits-hammer.md create mode 100644 .changeset/config.json diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 0000000..654c6d4 --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets). + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md). diff --git a/.changeset/chubby-suits-hammer.md b/.changeset/chubby-suits-hammer.md new file mode 100644 index 0000000..24acece --- /dev/null +++ b/.changeset/chubby-suits-hammer.md @@ -0,0 +1,5 @@ +--- +"@plttn/mkd": minor +--- + +Use sentinel date when creating post diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000..5c58ec9 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.gitignore b/.gitignore index 621e2ad..8e20e32 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules /test tsconfig.tsbuildinfo +mkd.json diff --git a/src/commands/new.ts b/src/commands/new.ts index bd6aadf..842164b 100644 --- a/src/commands/new.ts +++ b/src/commands/new.ts @@ -43,11 +43,11 @@ async function generateFrontmatter( config: Config, ): Promise { const description = await makeDescription(title); - const now = new Date(); + // const now = new Date(); const data = { [config.titleKey]: title, - [config.publishedAtKey]: now, + [config.publishedAtKey]: "3000-01-01T00:00:00Z", [config.authorKey]: config.author, [config.draftKey]: true, [config.descriptionKey]: description, diff --git a/src/commands/publish.ts b/src/commands/publish.ts index 3e7d8f2..c7a6561 100644 --- a/src/commands/publish.ts +++ b/src/commands/publish.ts @@ -4,6 +4,7 @@ import { isCancel, intro, outro, + autocomplete, } from "@clack/prompts"; import matter from "gray-matter"; import type { Config, Deps } from "../lib/deps"; @@ -41,7 +42,7 @@ async function getPostsToPublish( const options = postsToOptions(drafts, config); intro("Publishing posts"); - const selected = await autocompleteMultiselect({ + const selected = await autocomplete({ message: "Select posts to publish", options, }); @@ -57,9 +58,11 @@ async function getPostsToPublish( } async function updateDraftFrontMatter(draft: Post, deps: Deps) { + const now = new Date(); const parsed = matter(draft.content); const fm = parsed.data as Record; fm[deps.config.draftKey] = false; + fm[deps.config.publishedAtKey] = now; const updatedContent = matter.stringify(parsed.content, fm); await deps.pfs.write(`${deps.config.blogDir}/${draft.file}`, updatedContent); return { ...draft, content: updatedContent }; -- 2.51.2