create-vuepress-theme-plume 1.0.0-rc.164 → 1.0.0-rc.165

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/lib/index.js CHANGED
@@ -13,7 +13,7 @@ import handlebars from "handlebars";
13
13
  import { osLocale } from "os-locale";
14
14
 
15
15
  //#region package.json
16
- var version = "1.0.0-rc.163";
16
+ var version = "1.0.0-rc.164";
17
17
 
18
18
  //#endregion
19
19
  //#region src/constants.ts
@@ -244,8 +244,8 @@ async function generate(mode, data, cwd = process.cwd()) {
244
244
  content: "shamefully-hoist=true\nshell-emulator=true"
245
245
  });
246
246
  if (data.packageManager === "yarn") {
247
- const { output: output$1 } = await spawn("yarn", ["--version"]);
248
- if (output$1.startsWith("2")) fileList.push({
247
+ const { output } = await spawn("yarn", ["--version"]);
248
+ if (output.startsWith("2")) fileList.push({
249
249
  filepath: ".yarnrc.yml",
250
250
  content: "nodeLinker: 'node-modules'\n"
251
251
  });
@@ -278,8 +278,7 @@ async function generate(mode, data, cwd = process.cwd()) {
278
278
  });
279
279
  const ext = data.useTs ? "" : userPkg.type !== "module" ? ".mjs" : ".js";
280
280
  const REG_EXT = /\.ts$/;
281
- const output = mode === Mode.create ? path.join(cwd, data.root) : cwd;
282
- await writeFiles(renderedFiles, output, (filepath) => {
281
+ await writeFiles(renderedFiles, mode === Mode.create ? path.join(cwd, data.root) : cwd, (filepath) => {
283
282
  if (filepath.endsWith(".d.ts")) return filepath;
284
283
  if (ext) return filepath.replace(REG_EXT, ext);
285
284
  return filepath;
@@ -480,8 +479,7 @@ async function prompt(mode, root) {
480
479
  //#region src/run.ts
481
480
  async function run(mode, root) {
482
481
  intro(colors.cyan("Welcome to VuePress and vuepress-theme-plume !"));
483
- const result = await prompt(mode, root);
484
- const data = resolveData(result, mode);
482
+ const data = resolveData(await prompt(mode, root), mode);
485
483
  const progress = spinner();
486
484
  progress.start(t("spinner.start"));
487
485
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-vuepress-theme-plume",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.164",
4
+ "version": "1.0.0-rc.165",
5
5
  "description": "The cli for create vuepress-theme-plume's project",
6
6
  "author": "pengzhanbo <q942450674@outlook.com> (https://github.com/pengzhanbo/)",
7
7
  "license": "MIT",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "plume-deps": {
39
39
  "vuepress": "2.0.0-rc.24",
40
- "vue": "^3.5.21",
40
+ "vue": "^3.5.22",
41
41
  "http-server": "^14.1.1",
42
- "typescript": "^5.9.2"
42
+ "typescript": "^5.9.3"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsdown"
@@ -0,0 +1,124 @@
1
+ /**
2
+ * @see https://theme-plume.vuejs.press/guide/collection/ 查看文档了解配置详情。
3
+ *
4
+ * Collections 配置文件,它在 `.vuepress/plume.config.{{#if useTs}}ts{{else}}js{{/if}}` 中被导入。
5
+ *
6
+ * 请注意,你应该先在这里配置好 Collections,然后再启动 vuepress,主题会在启动 vuepress 时,
7
+ * 读取这里配置的 Collections,然后在与 Collection 相关的 Markdown 文件中,自动生成 permalink。
8
+ *
9
+ * collection 的 type 为 `post` 时,表示为 文档列表类型(即没有侧边导航栏,有文档列表页)
10
+ * 可用于实现如 博客、专栏 等以文章列表聚合形式的文档集合 (内容相对碎片化的)
11
+ *
12
+ * collection 的 type 为 `doc` 时,表示为文档类型(即有侧边导航栏)
13
+ * 可用于实现如 笔记、知识库、文档等以侧边导航栏形式的文档集合 (内容强关联、成体系的)
14
+ * 如果发现 侧边栏没有显示,那么请检查你的配置是否正确,以及 Markdown 文件中的 permalink
15
+ * 是否是以对应的 Collection 配置的 link 的前缀开头。 是否展示侧边栏是根据 页面链接 的前缀 与 `collection.link`
16
+ * 的前缀是否匹配来决定。
17
+ */
18
+
19
+ /**
20
+ * 在受支持的 IDE 中会智能提示配置项。
21
+ *
22
+ * - `defineCollections` 是用于定义 collection 集合的帮助函数
23
+ * - `defineCollection` 是用于定义单个 collection 配置的帮助函数
24
+ *
25
+ * 通过 `defineCollection` 定义的 collection 配置,应该填入 `defineCollections` 中
26
+ */
27
+ import { defineCollection, defineCollections } from 'vuepress-theme-plume'
28
+
29
+ {{#if multiLanguage}}
30
+ {{#each locales}}
31
+ /* =================== locale: {{ lang }} ======================= */
32
+
33
+ const {{ prefix }}Blog = defineCollection({
34
+ // post 类型,这里用于实现 博客功能
35
+ type: 'post',
36
+ // 文档集合所在目录,相对于 `docs{{ path }}`
37
+ dir: 'blog',
38
+ // 文档标题,它将用于在页面的面包屑导航中显示
39
+ title: 'Blog',
40
+ // 文章列表页的链接,如果 `linkPrefix` 未定义,它也将作为 相关的文章的 permalink 的前缀
41
+ link: '/blog/',
42
+ // linkPrefix: '/article/', // 相关文章的链接前缀
43
+ // postList: true, // 是否启用文章列表页
44
+ // tags: true, // 是否启用标签页
45
+ // archives: true, // 是否启用归档页
46
+ // categories: true, // 是否启用分类页
47
+ // postCover: 'right', // 文章封面位置
48
+ // pagination: 15, // 每页显示文章数量
49
+ })
50
+
51
+ const {{ prefix }}DemoDoc = defineCollection({
52
+ // doc 类型,该类型带有侧边栏
53
+ type: 'doc',
54
+ // 文档集合所在目录,相对于 `docs{{ path }}`
55
+ dir: 'demo',
56
+ // `dir` 所指向的目录中的所有 markdown 文件,其 permalink 需要以 `linkPrefix` 配置作为前缀
57
+ // 如果 前缀不一致,则无法生成侧边栏。
58
+ // 所以请确保 markdown 文件的 permalink 都以 `{{ path }}` + `linkPrefix` 开头
59
+ linkPrefix: '/demo',
60
+ // 文档标题,它将用于在页面的面包屑导航中显示
61
+ title: 'Demo',
62
+ // 手动配置侧边栏结构
63
+ sidebar: ['', 'foo', 'bar'],
64
+ // 根据文件结构自动生成侧边栏
65
+ // sidebar: 'auto',
66
+ })
67
+
68
+ /**
69
+ * 导出所有的 collections
70
+ * ({{ prefix }}Blog 为博客示例,如果不需要博客功能,请删除)
71
+ * ({{ prefix }}DemoDoc 为参考示例,如果不需要它,请删除)
72
+ */
73
+ export const {{ prefix }}Collections = defineCollections([
74
+ {{ prefix }}Blog,
75
+ {{ prefix }}DemoDoc,
76
+ ])
77
+
78
+ {{/each}}
79
+ {{else}}
80
+ const blog = defineCollection({
81
+ // post 类型,这里用于实现 博客功能
82
+ type: 'post',
83
+ // 文档集合所在目录,相对于 `docs{{ path }}`
84
+ dir: 'blog',
85
+ // 文档标题,它将用于在页面的面包屑导航中显示
86
+ title: 'Blog',
87
+ // 文章列表页的链接,如果 `linkPrefix` 未定义,它也将作为 相关的文章的 permalink 的前缀
88
+ link: '/blog/',
89
+ // linkPrefix: '/article/', // 相关文章的链接前缀
90
+ // postList: true, // 是否启用文章列表页
91
+ // tags: true, // 是否启用标签页
92
+ // archives: true, // 是否启用归档页
93
+ // categories: true, // 是否启用分类页
94
+ // postCover: 'right', // 文章封面位置
95
+ // pagination: 15, // 每页显示文章数量
96
+ })
97
+
98
+ const demoDoc = defineCollection({
99
+ // doc 类型,该类型带有侧边栏
100
+ type: 'doc',
101
+ // 文档集合所在目录,相对于 `docs{{ path }}`
102
+ dir: 'demo',
103
+ // `dir` 所指向的目录中的所有 markdown 文件,其 permalink 需要以 `linkPrefix` 配置作为前缀
104
+ // 如果 前缀不一致,则无法生成侧边栏。
105
+ // 所以请确保 markdown 文件的 permalink 都以 `linkPrefix` 开头
106
+ linkPrefix: '/demo',
107
+ // 文档标题,它将用于在页面的面包屑导航中显示
108
+ title: 'Demo',
109
+ // 手动配置侧边栏结构
110
+ sidebar: ['', 'foo', 'bar'],
111
+ // 根据文件结构自动生成侧边栏
112
+ // sidebar: 'auto',
113
+ })
114
+
115
+ /**
116
+ * 导出所有的 collections
117
+ * (blog 为博客示例,如果不需要博客功能,请删除)
118
+ * (demoDoc 为参考示例,如果不需要它,请删除)
119
+ */
120
+ export default defineCollection([
121
+ blog,
122
+ demoDoc,
123
+ ])
124
+ {{/if}}
@@ -54,23 +54,6 @@ export default defineUserConfig({
54
54
  // contributors: true,
55
55
  // changelog: false,
56
56
 
57
- /**
58
- * 博客
59
- * @see https://theme-plume.vuejs.press/config/basic/#blog
60
- */
61
- // blog: false, // 禁用博客
62
- // blog: {
63
- // postList: true, // 是否启用文章列表页
64
- // tags: true, // 是否启用标签页
65
- // archives: true, // 是否启用归档页
66
- // categories: true, // 是否启用分类页
67
- // postCover: 'right', // 文章封面位置
68
- // pagination: 15, // 每页显示文章数量
69
- // },
70
-
71
- /* 博客文章页面链接前缀 */
72
- article: '/article/',
73
-
74
57
  /**
75
58
  * 编译缓存,加快编译速度
76
59
  * @see https://theme-plume.vuejs.press/config/basic/#cache
@@ -116,9 +99,9 @@ export default defineUserConfig({
116
99
  // readingTime: true,
117
100
 
118
101
  /**
119
- * markdown
120
- * @see https://theme-plume.vuejs.press/config/markdown/
121
- */
102
+ * markdown
103
+ * @see https://theme-plume.vuejs.press/config/markdown/
104
+ */
122
105
  // markdown: {
123
106
  // abbr: true, // 启用 abbr 语法 *[label]: content
124
107
  // annotation: true, // 启用 annotation 语法 [+label]: content
@@ -15,7 +15,7 @@ export const {{prefix}}Navbar = defineNavbarConfig([
15
15
  { text: '{{#if isEn}}Archives{{else}}归档{{/if}}', link: '{{ path }}blog/archives/' },
16
16
  {
17
17
  text: '{{#if isEn}}Notes{{else}}笔记{{/if}}',
18
- items: [{ text: '{{#if isEn}}Demo{{else}}示例{{/if}}', link: '{{ path }}notes/demo/README.md' }]
18
+ items: [{ text: '{{#if isEn}}Demo{{else}}示例{{/if}}', link: '{{ path }}demo/README.md' }]
19
19
  },
20
20
  ])
21
21
 
@@ -28,7 +28,7 @@ export default defineNavbarConfig([
28
28
  { text: '{{#if isEn}}Archives{{else}}归档{{/if}}', link: '/blog/archives/' },
29
29
  {
30
30
  text: '{{#if isEn}}Notes{{else}}笔记{{/if}}',
31
- items: [{ text: '{{#if isEn}}Demo{{else}}示例{{/if}}', link: '/notes/demo/README.md' }]
31
+ items: [{ text: '{{#if isEn}}Demo{{else}}示例{{/if}}', link: '/demo/README.md' }]
32
32
  },
33
33
  ])
34
34
  {{/if}}
@@ -12,11 +12,11 @@
12
12
 
13
13
  import { defineThemeConfig } from 'vuepress-theme-plume'
14
14
  {{#if multiLanguage}}
15
+ import { enCollections, zhCollections } from './collections'
15
16
  import { enNavbar, zhNavbar } from './navbar'
16
- import { enNotes, zhNotes } from './notes'
17
17
  {{else}}
18
18
  import navbar from './navbar'
19
- import notes from './notes'
19
+ import collections from './collections'
20
20
  {{/if}}
21
21
 
22
22
  /**
@@ -64,7 +64,7 @@ export default defineThemeConfig({
64
64
  },
65
65
 
66
66
  navbar,
67
- notes,
67
+ collections,
68
68
 
69
69
  /**
70
70
  * 公告板
@@ -102,7 +102,7 @@ export default defineThemeConfig({
102
102
  },
103
103
 
104
104
  navbar: {{ prefix }}Navbar,
105
- notes: {{ prefix }}Notes,
105
+ collections: {{ prefix }}Collections,
106
106
 
107
107
  /**
108
108
  * 公告板
@@ -1,75 +0,0 @@
1
- /**
2
- * @see https://theme-plume.vuejs.press/guide/document/ 查看文档了解配置详情。
3
- *
4
- * Notes 配置文件,它在 `.vuepress/plume.config.{{#if useTs}}ts{{else}}js{{/if}}` 中被导入。
5
- *
6
- * 请注意,你应该先在这里配置好 Notes,然后再启动 vuepress,主题会在启动 vuepress 时,
7
- * 读取这里配置的 Notes,然后在与 Note 相关的 Markdown 文件中,自动生成 permalink。
8
- *
9
- * 如果你发现 侧边栏没有显示,那么请检查你的配置是否正确,以及 Markdown 文件中的 permalink
10
- * 是否是以对应的 note 配置的 link 的前缀开头。 是否展示侧边栏是根据 页面链接 的前缀 与 `note.link`
11
- * 的前缀是否匹配来决定。
12
- */
13
-
14
- /**
15
- * 在受支持的 IDE 中会智能提示配置项。
16
- *
17
- * - `defineNoteConfig` 是用于定义单个 note 配置的帮助函数
18
- * - `defineNotesConfig` 是用于定义 notes 集合的帮助函数
19
- *
20
- * 通过 `defineNoteConfig` 定义的 note 配置,应该填入 `defineNotesConfig` 的 notes 数组中
21
- */
22
- import { defineNoteConfig, defineNotesConfig } from 'vuepress-theme-plume'
23
-
24
- {{#if multiLanguage}}
25
- {{#each locales}}
26
- /* =================== locale: {{ lang }} ======================= */
27
-
28
- const {{ prefix }}DemoNote = defineNoteConfig({
29
- dir: 'demo',
30
- // `dir` 所指向的目录中的所有 markdown 文件,其 permalink 需要以 `link` 配置作为前缀
31
- // 如果 前缀不一致,则无法生成侧边栏。
32
- // 所以请确保 markdown 文件的 permalink 都以 `link` 开头
33
- link: '/demo',
34
- // 手动配置侧边栏结构
35
- sidebar: ['', 'foo', 'bar'],
36
- // 根据文件结构自动生成侧边栏
37
- // sidebar: 'auto',
38
- })
39
-
40
- /**
41
- * 导出所有的 note
42
- * 每一个 note 都应该填入到 `notes.notes` 数组中
43
- * ({{ prefix }}DemoNote 为参考示例,如果不需要它,请删除)
44
- */
45
- export const {{ prefix }}Notes = defineNotesConfig({
46
- dir: '{{ removeLeadingSlash path }}notes',
47
- link: '{{ path }}',
48
- notes: [{{ prefix }}DemoNote],
49
- })
50
-
51
- {{/each}}
52
- {{else}}
53
- const demoNote = defineNoteConfig({
54
- dir: 'demo',
55
- // `dir` 所指向的目录中的所有 markdown 文件,其 permalink 需要以 `link` 配置作为前缀
56
- // 如果 前缀不一致,则无法生成侧边栏。
57
- // 所以请确保 markdown 文件的 permalink 都以 `link` 开头
58
- link: '/demo',
59
- // 手动配置侧边栏结构
60
- sidebar: ['', 'foo', 'bar'],
61
- // 根据文件结构自动生成侧边栏
62
- // sidebar: 'auto',
63
- })
64
-
65
- /**
66
- * 导出所有的 note
67
- * 每一个 note 都应该填入到 `notes.notes` 数组中
68
- * (DemoNote 为参考示例,如果不需要它,请删除)
69
- */
70
- export default defineNotesConfig({
71
- dir: 'notes',
72
- link: '/',
73
- notes: [demoNote],
74
- })
75
- {{/if}}
File without changes
File without changes
File without changes
File without changes