@mintfolio/core 0.1.5 → 0.2.0

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/README.md CHANGED
@@ -1,104 +1,104 @@
1
- <p align="center"><img src="docs/assets/mintfolio-icon.png" width="112" height="112" alt="Mintfolio" /></p>
2
-
3
- # Mintfolio
4
-
5
- 把个人主页和博客放在一起,用 Markdown 写文章,用主题决定它们的样子。
6
-
7
- Mintfolio 基于 Astro。站点目录保存你的资料、文章和图片;引擎负责文章路由、搜索数据、RSS、Sitemap 和密码文章。换一个主题,内容仍然留在原处。
8
-
9
- [使用教程](https://github.com/cnflwzh/mintfolio/wiki/Getting-Started) · [命令参考](docs/cli.md) · [开发主题](https://github.com/cnflwzh/mintfolio/wiki/Theme-Development) · [更新记录](CHANGELOG.md) · [反馈问题](https://github.com/cnflwzh/mintfolio/issues)
10
-
11
- ![Verdant 主题的个人主页](docs/assets/home-desktop.webp)
12
-
13
- *上图使用 Verdant 主题和示例资料。只安装引擎时,默认使用文字为主的 Minimal。*
14
-
15
- ## 能做什么
16
-
17
- - 用 Markdown 管理文章,支持分类、标签、标题与摘要搜索。
18
- - 在主页展示个人资料、技能、项目和社交链接。
19
- - 为单篇文章设置密码,在浏览器中解锁正文。
20
- - 通过命令行新建草稿、安装主题、修改配置并构建网站。
21
- - 输出静态文件,部署到普通 Web 服务器或静态托管平台。
22
-
23
- Core 自带 Minimal;[Verdant](https://github.com/cnflwzh/mintfolio-theme-verdant) 提供文章卡片、八套配色、明暗模式、目录和阅读工具。第三方主题可以从两个 Astro 页面开始,再逐步补齐自己的布局。
24
-
25
- ## 开始使用
26
-
27
- 需要 **Node.js >= 22.12.0**。项目仍在持续开发中。
28
-
29
- ~~~sh
30
- npm install -g @mintfolio/core
31
- mintfolio create my-blog
32
- cd my-blog
33
- mintfolio dev
34
- ~~~
35
-
36
- 打开终端显示的地址。编辑 site.config.ts 填写资料,文章放在 content/blog。
37
-
38
- 想使用上图的 Verdant:
39
-
40
- ~~~sh
41
- mintfolio theme install verdant --use
42
- ~~~
43
-
44
- ## 写第一篇文章
45
-
46
- ~~~sh
47
- mintfolio post new "我的第一篇文章" --slug first-post
48
- ~~~
49
-
50
- 打开 content/blog/first-post.md 写正文。新文章默认是草稿,准备好后再发布并构建:
51
-
52
- ~~~sh
53
- mintfolio post publish first-post
54
- mintfolio build
55
- mintfolio preview
56
- ~~~
57
-
58
- post publish 修改本地草稿状态;build 生成 dist;部署时上传 dist 中的内容。[写作教程](https://github.com/cnflwzh/mintfolio/wiki/Writing) 介绍日期、封面、嵌套目录和密码文章。
59
-
60
- ## 常用操作
61
-
62
- | 想做什么 | 命令或文件 |
63
- | --- | --- |
64
- | 修改网站标题 | mintfolio config set site site.title "我的博客" |
65
- | 编辑个人资料 | site.config.ts |
66
- | 调整主题设置 | mintfolio config edit theme |
67
- | 查看主题配置项 | mintfolio config schema theme |
68
- | 检查环境 | mintfolio doctor |
69
- | 查看命令帮助 | mintfolio --help |
70
-
71
- [配置教程](https://github.com/cnflwzh/mintfolio/wiki/Configuration) 说明内容与显示设置的区别、备案号、图片和配置优先级。
72
-
73
- ## 界面
74
-
75
- ![文章阅读](docs/assets/article-reading.webp)
76
-
77
- <p><img src="docs/assets/home-mobile.webp" width="280" alt="手机上的 Verdant 首页" /> <img src="docs/assets/encrypted-mobile.webp" width="280" alt="手机上的密码文章" /></p>
78
-
79
- ## 开发状态
80
-
81
- 当前重点是完善写作流程、主题接口和跨平台安装。0.x 阶段仍可能调整接口;升级前请保留源文件与锁文件,并阅读版本说明。
82
-
83
- 目前需要知道的几件事:
84
-
85
- - 草稿在开发和生产构建中都不会公开显示。
86
- - 搜索匹配标题和公开摘要,不搜索全文;标签、分类与搜索共用博客归档页。
87
- - Minimal 目前不显示备案号;Verdant 的首页和普通页面支持 icp 字段。
88
- - 密码文章的正文和目录会被加密,标题、图片等信息仍公开。
89
- - CLI 负责本地操作与构建,部署由你选择的托管平台完成。
90
-
91
- ## 仓库
92
-
93
- | 仓库 | 内容 |
94
- | --- | --- |
95
- | [mintfolio](https://github.com/cnflwzh/mintfolio) | 项目入口、CLI、博客引擎与 Minimal |
96
- | [mintfolio-theme-verdant](https://github.com/cnflwzh/mintfolio-theme-verdant) | Verdant 主题 |
97
- | [mintfolio-theme-api](https://github.com/cnflwzh/mintfolio-theme-api) | 主题的公共类型与契约 |
98
- | [mintfolio-theme-starter](https://github.com/cnflwzh/mintfolio-theme-starter) | 可直接修改的主题起点 |
99
-
100
- 想贡献代码,从 [CONTRIBUTING.md](CONTRIBUTING.md) 开始。发现安全问题,请按 [SECURITY.md](SECURITY.md) 私下报告。
101
-
102
- ## 许可证
103
-
1
+ <p align="center"><img src="docs/assets/mintfolio-icon.png" width="112" height="112" alt="Mintfolio" /></p>
2
+
3
+ # Mintfolio
4
+
5
+ 把个人主页和博客放在一起,用 Markdown 写文章,用主题决定它们的样子。
6
+
7
+ Mintfolio 基于 Astro。站点目录保存你的资料、文章和图片;引擎负责文章路由、搜索数据、RSS、Sitemap 和密码文章。换一个主题,内容仍然留在原处。
8
+
9
+ [使用教程](https://github.com/cnflwzh/mintfolio/wiki/Getting-Started) · [命令参考](docs/cli.md) · [开发主题](https://github.com/cnflwzh/mintfolio/wiki/Theme-Development) · [更新记录](CHANGELOG.md) · [反馈问题](https://github.com/cnflwzh/mintfolio/issues)
10
+
11
+ ![Verdant 主题的个人主页](docs/assets/home-desktop.webp)
12
+
13
+ *上图使用 Verdant 主题和示例资料。只安装引擎时,默认使用文字为主的 Minimal。*
14
+
15
+ ## 能做什么
16
+
17
+ - 用 Markdown 管理文章,支持分类、标签、标题与摘要搜索。
18
+ - 在主页展示个人资料、技能、项目和社交链接。
19
+ - 为单篇文章设置密码,在浏览器中解锁正文。
20
+ - 通过命令行新建草稿、安装主题、修改配置并构建网站。
21
+ - 输出静态文件,部署到普通 Web 服务器或静态托管平台。
22
+
23
+ Core 自带 Minimal;[Verdant](https://github.com/cnflwzh/mintfolio-theme-verdant) 提供文章卡片、八套配色、明暗模式、目录和阅读工具。第三方主题可以从两个 Astro 页面开始,再逐步补齐自己的布局。
24
+
25
+ ## 开始使用
26
+
27
+ 需要 **Node.js >= 22.12.0**。项目仍在持续开发中。
28
+
29
+ ~~~sh
30
+ npm install -g @mintfolio/core
31
+ mintfolio create my-blog
32
+ cd my-blog
33
+ mintfolio dev
34
+ ~~~
35
+
36
+ 打开终端显示的地址。编辑 site.config.ts 填写资料,文章放在 content/blog。
37
+
38
+ 想使用上图的 Verdant:
39
+
40
+ ~~~sh
41
+ mintfolio theme install verdant --use
42
+ ~~~
43
+
44
+ ## 写第一篇文章
45
+
46
+ ~~~sh
47
+ mintfolio post new "我的第一篇文章" --slug first-post
48
+ ~~~
49
+
50
+ 打开 content/blog/first-post.md 写正文。新文章默认是草稿,准备好后再发布并构建:
51
+
52
+ ~~~sh
53
+ mintfolio post publish first-post
54
+ mintfolio build
55
+ mintfolio preview
56
+ ~~~
57
+
58
+ post publish 修改本地草稿状态;build 生成 dist;部署时上传 dist 中的内容。[写作教程](https://github.com/cnflwzh/mintfolio/wiki/Writing) 介绍日期、封面、嵌套目录和密码文章。
59
+
60
+ ## 常用操作
61
+
62
+ | 想做什么 | 命令或文件 |
63
+ | --- | --- |
64
+ | 修改网站标题 | mintfolio config set site site.title "我的博客" |
65
+ | 编辑个人资料 | site.config.ts |
66
+ | 调整主题设置 | mintfolio config edit theme |
67
+ | 查看主题配置项 | mintfolio config schema theme |
68
+ | 检查环境 | mintfolio doctor |
69
+ | 查看命令帮助 | mintfolio --help |
70
+
71
+ [配置教程](https://github.com/cnflwzh/mintfolio/wiki/Configuration) 说明内容与显示设置的区别、备案号、图片和配置优先级。
72
+
73
+ ## 界面
74
+
75
+ ![文章阅读](docs/assets/article-reading.webp)
76
+
77
+ <p><img src="docs/assets/home-mobile.webp" width="280" alt="手机上的 Verdant 首页" /> <img src="docs/assets/encrypted-mobile.webp" width="280" alt="手机上的密码文章" /></p>
78
+
79
+ ## 开发状态
80
+
81
+ 当前重点是完善写作流程、主题接口和跨平台安装。0.x 阶段仍可能调整接口;升级前请保留源文件与锁文件,并阅读版本说明。
82
+
83
+ 目前需要知道的几件事:
84
+
85
+ - 草稿在开发和生产构建中都不会公开显示。
86
+ - 搜索匹配标题和公开摘要,不搜索全文;标签、分类与搜索共用博客归档页。
87
+ - Minimal 目前不显示备案号;Verdant 的首页和普通页面支持 icp 字段。
88
+ - 密码文章的正文和目录会被加密,标题、图片等信息仍公开。
89
+ - CLI 负责本地操作与构建,部署由你选择的托管平台完成。
90
+
91
+ ## 仓库
92
+
93
+ | 仓库 | 内容 |
94
+ | --- | --- |
95
+ | [mintfolio](https://github.com/cnflwzh/mintfolio) | 项目入口、CLI、博客引擎与 Minimal |
96
+ | [mintfolio-theme-verdant](https://github.com/cnflwzh/mintfolio-theme-verdant) | Verdant 主题 |
97
+ | [mintfolio-theme-api](https://github.com/cnflwzh/mintfolio-theme-api) | 主题的公共类型与契约 |
98
+ | [mintfolio-theme-starter](https://github.com/cnflwzh/mintfolio-theme-starter) | 可直接修改的主题起点 |
99
+
100
+ 想贡献代码,从 [CONTRIBUTING.md](CONTRIBUTING.md) 开始。发现安全问题,请按 [SECURITY.md](SECURITY.md) 私下报告。
101
+
102
+ ## 许可证
103
+
104
104
  [GPL-3.0-only](LICENSE)。第三方依赖和资源保留各自许可证,见 [第三方声明](THIRD_PARTY_NOTICES.md)。
@@ -31,13 +31,13 @@ export async function activeTheme(root, selector) {
31
31
  return { ...active, selection, selector: theme, same };
32
32
  }
33
33
 
34
- /** @param {string} spec npm package with optional version/range/tag; default and happyhues are aliases. @returns {{name:string,spec:string}} Validated package identity and install spec. */
34
+ /** @param {string} spec npm package with optional version/range/tag; verdant is the official theme alias. @returns {{name:string,spec:string}} Validated package identity and install spec. */
35
35
  export function packageSpec(spec) {
36
36
  const separator = spec.lastIndexOf('@');
37
37
  const split = separator > spec.indexOf('/') && separator > 0;
38
38
  const name = normalizeThemeName(split ? spec.slice(0, separator) : spec);
39
39
  const version = split ? spec.slice(separator + 1) : '';
40
- if (typeof name !== 'string' || !/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(name) || name === 'minimal' || (split && !version) || (version && !semver.validRange(version) && !/^[a-z][a-z0-9._-]*$/i.test(version))) throw new Error('请提供 npm 主题包名,可附加 @版本;例如 default 或 @mintfolio/theme-default@0.1.1。');
40
+ if (typeof name !== 'string' || !/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(name) || name === 'minimal' || (split && !version) || (version && !semver.validRange(version) && !/^[a-z][a-z0-9._-]*$/i.test(version))) throw new Error('请提供 npm 主题包名,可附加 @版本;例如 verdant 或 @mintfolio/theme-verdant@0.1.1。');
41
41
  return { name, spec: name + (version ? `@${version}` : '') };
42
42
  }
43
43
 
package/bin/mintfolio.mjs CHANGED
@@ -17,7 +17,7 @@ const help = {
17
17
 
18
18
  用法:mintfolio [--cwd <目录>] <命令>
19
19
 
20
- create <目录> [--theme default] 创建站点并安装依赖
20
+ create <目录> [--theme verdant] 创建站点并安装依赖
21
21
  init 补齐当前站点的初始化文件
22
22
  upgrade [--version <版本>] 更新当前站点的 Core
23
23
  dev / build / preview / sync 开发、构建、预览或同步内容
@@ -59,8 +59,8 @@ const help = {
59
59
  sync 补齐已安装主题的配置
60
60
  check [主题] 校验清单、配置和页面路径
61
61
 
62
- verdant 是 @mintfolio/theme-default 的别名;default / happyhues 继续兼容。
63
- 示例:mintfolio theme install default --use`,
62
+ verdant 是 @mintfolio/theme-verdant 的别名。
63
+ 示例:mintfolio theme install verdant --use`,
64
64
  config: `用法:mintfolio config <操作> <site|theme>
65
65
 
66
66
  get <范围> [字段] 查看配置;theme 返回合并默认值后的设置
@@ -5,7 +5,7 @@ import { loadTheme, isWithin } from '../src/engine/loader.mjs';
5
5
  import { resolveSettings } from '../src/engine/schema.mjs';
6
6
  import { themeConfigPath } from '../src/engine/theme-config.mjs';
7
7
 
8
- const aliases = { verdant: '@mintfolio/theme-default', default: '@mintfolio/theme-default', happyhues: '@mintfolio/theme-default' };
8
+ const aliases = { verdant: '@mintfolio/theme-verdant' };
9
9
 
10
10
  /** @param {string} name Installed npm package or built-in theme selector. @returns {string} */
11
11
  export function normalizeThemeName(name) { return Object.hasOwn(aliases, name) ? aliases[name] : name; }
package/docs/cli.md CHANGED
@@ -58,17 +58,17 @@ CLI 的文章命令采用默认 `content/blog` 目录。自行更换内容集合
58
58
  ```sh
59
59
  mintfolio theme list
60
60
  mintfolio theme current
61
- mintfolio theme install default
61
+ mintfolio theme install verdant
62
62
  mintfolio theme install @example/theme@1.2.3 --use
63
- mintfolio theme use default
63
+ mintfolio theme use verdant
64
64
  mintfolio theme use minimal
65
65
  mintfolio theme use ./my-theme
66
- mintfolio theme init default
66
+ mintfolio theme init verdant
67
67
  mintfolio theme sync
68
68
  mintfolio theme check
69
69
  ```
70
70
 
71
- `install` 接收 npm 包名,可附加版本、范围或标签;`default` `happyhues` 都映射到 `@mintfolio/theme-default`。安装后生成完整主题配置,只有加 `--use` 才同时切换。再次生成配置保留已有文件。
71
+ `install` 接收 npm 包名,可附加版本、范围或标签;`verdant` 映射到 `@mintfolio/theme-verdant`。安装后生成完整主题配置,只有加 `--use` 才同时切换。再次生成配置保留已有文件。
72
72
 
73
73
  `use` 校验目标主题并修改 `theme.config.mjs`,保留显式页面 overrides。旧的内联 `settings` 会先迁移到旧主题自己的配置文件,再清空内联覆盖,因此切回旧主题时仍保留个性化设置。动态内联表达式不能自动迁移,CLI 会明确报错且不切换主题。
74
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintfolio/core",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "A Markdown blog and personal site toolkit, built with Astro.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -86,7 +86,6 @@ export default function themeRuntime(selection = {}, engine = {}) {
86
86
  addWatchFile(active.themeConfigFile);
87
87
  for (const filename of active.manifestDependencies) addWatchFile(filename);
88
88
  logger.info(`Theme: ${active.definition.manifest.name} ${active.definition.manifest.version}`);
89
- if (themeName === 'happyhues' || themeName === 'default') logger.warn('Use the installed package name "@mintfolio/theme-default". Only Minimal is bundled with Core.');
90
89
  const optionalMissing = ['page', 'archive', 'notFound'].filter((kind) => !active.pages[kind]);
91
90
  if (optionalMissing.length) logger.info(`Using lightweight Minimal renderers for: ${optionalMissing.join(', ')}`);
92
91
  /** @type {Array<keyof import('@mintfolio/theme-api').ThemeCapabilities>} */
@@ -28,8 +28,8 @@ async function resolveManifest(specifier, root) {
28
28
  let filename;
29
29
  if (!specifier || specifier === 'minimal') {
30
30
  filename = fileURLToPath(new URL('../fallback/theme.mjs', import.meta.url));
31
- } else if (['verdant', 'default', 'happyhues'].includes(specifier)) {
32
- return resolveManifest('@mintfolio/theme-default', root);
31
+ } else if (specifier === 'verdant') {
32
+ return resolveManifest('@mintfolio/theme-verdant', root);
33
33
  } else if (specifier.startsWith('.') || path.isAbsolute(specifier)) {
34
34
  filename = path.resolve(root, specifier);
35
35
  if ((await stat(filename)).isDirectory()) filename = path.join(filename, 'theme.mjs');
@@ -11,7 +11,7 @@ export function publicImage(source: string | ImageMetadata): string | PublicImag
11
11
  return { src: source.src, width: source.width, height: source.height, format: source.format };
12
12
  }
13
13
 
14
- /** Shared author/site content, independent of Default's sidebar and other UI. */
14
+ /** Shared author/site content, independent of Verdant's sidebar and other UI. */
15
15
  export function getPublicSite(): PublicSite {
16
16
  return {
17
17
  title: config.site.title,