create-open17-blog 1.0.0 → 1.1.2
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 +64 -64
- package/dist/index.js +65 -10
- package/package.json +47 -47
package/README.md
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
# create-open17-blog
|
|
2
|
-
|
|
3
|
-
A CLI tool for quickly setting up VitePress blog with `vitepress-theme-open17`
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm create open17-blog my-blog
|
|
9
|
-
# or
|
|
10
|
-
yarn create open17-blog my-blog
|
|
11
|
-
# or
|
|
12
|
-
pnpm create open17-blog my-blog
|
|
13
|
-
# or
|
|
14
|
-
bun create open17-blog my-blog
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
You can also run it without arguments to create a blog in current directory:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm create open17-blog
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Features
|
|
24
|
-
|
|
25
|
-
- 🚀 Quick scaffolding with minimal setup
|
|
26
|
-
- 📁 Generates proper project structure
|
|
27
|
-
- 🎨 Preconfigured with open17 theme defaults
|
|
28
|
-
- 📝 Sample blog post included
|
|
29
|
-
- ⚙️ Type-safe configuration
|
|
30
|
-
- 🔧 Works with npm/yarn/pnpm/bun
|
|
31
|
-
|
|
32
|
-
## What it creates
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
my-blog/
|
|
36
|
-
├── docs/
|
|
37
|
-
│ ├── .vitepress/
|
|
38
|
-
│ │ ├── config.ts # VitePress config with theme
|
|
39
|
-
│ │ └── theme/
|
|
40
|
-
│ │ └── index.ts # Theme entry
|
|
41
|
-
│ ├── posts/
|
|
42
|
-
│ │ └── 2024-xx-xx-hello-open17.md # Sample post
|
|
43
|
-
│ ├── index.md # Homepage with <blog /> component
|
|
44
|
-
│ └── public/ # Static assets
|
|
45
|
-
├── package.json
|
|
46
|
-
└── .gitignore
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## After scaffolding
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
cd my-blog
|
|
53
|
-
npm install
|
|
54
|
-
npm run dev
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Your blog will be available at http://localhost:8090
|
|
58
|
-
|
|
59
|
-
## Options
|
|
60
|
-
|
|
61
|
-
- `-f, --force` - Overwrite target directory if it exists
|
|
62
|
-
|
|
63
|
-
## License
|
|
64
|
-
|
|
1
|
+
# create-open17-blog
|
|
2
|
+
|
|
3
|
+
A CLI tool for quickly setting up VitePress blog with `vitepress-theme-open17`
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm create open17-blog my-blog
|
|
9
|
+
# or
|
|
10
|
+
yarn create open17-blog my-blog
|
|
11
|
+
# or
|
|
12
|
+
pnpm create open17-blog my-blog
|
|
13
|
+
# or
|
|
14
|
+
bun create open17-blog my-blog
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
You can also run it without arguments to create a blog in current directory:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm create open17-blog
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- 🚀 Quick scaffolding with minimal setup
|
|
26
|
+
- 📁 Generates proper project structure
|
|
27
|
+
- 🎨 Preconfigured with open17 theme defaults
|
|
28
|
+
- 📝 Sample blog post included
|
|
29
|
+
- ⚙️ Type-safe configuration
|
|
30
|
+
- 🔧 Works with npm/yarn/pnpm/bun
|
|
31
|
+
|
|
32
|
+
## What it creates
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
my-blog/
|
|
36
|
+
├── docs/
|
|
37
|
+
│ ├── .vitepress/
|
|
38
|
+
│ │ ├── config.ts # VitePress config with theme
|
|
39
|
+
│ │ └── theme/
|
|
40
|
+
│ │ └── index.ts # Theme entry
|
|
41
|
+
│ ├── posts/
|
|
42
|
+
│ │ └── 2024-xx-xx-hello-open17.md # Sample post
|
|
43
|
+
│ ├── index.md # Homepage with <blog /> component
|
|
44
|
+
│ └── public/ # Static assets
|
|
45
|
+
├── package.json
|
|
46
|
+
└── .gitignore
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## After scaffolding
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cd my-blog
|
|
53
|
+
npm install
|
|
54
|
+
npm run dev
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Your blog will be available at http://localhost:8090
|
|
58
|
+
|
|
59
|
+
## Options
|
|
60
|
+
|
|
61
|
+
- `-f, --force` - Overwrite target directory if it exists
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
65
|
Apache-2.0
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as
|
|
2
|
+
import{Command as b}from"commander";import v from"inquirer";import t from"path";import i from"fs-extra";import n from"chalk";import j from"ora";import y from"validate-npm-package-name";var u=new b;u.name("create-open17-blog").description("Create a VitePress blog preconfigured with vitepress-theme-open17").version("1.1.1").argument("[project-name]","Folder to create the project in").option("-f, --force","Overwrite target directory if it exists",!1).action(async(e,a)=>{var s,r;try{let o=process.cwd(),l=e?t.resolve(o,e):o,p=e;p||(p=(await v.prompt([{name:"name",type:"input",message:"Project name:",default:"my-open17-blog"}])).name);let m=y(p);m.validForNewPackages||(console.error(n.red("Invalid project name: "+p)),(s=m.errors)==null||s.forEach(c=>console.error(n.red(" "+c))),(r=m.warnings)==null||r.forEach(c=>console.error(n.yellow(" "+c))),process.exit(1));let g=e?l:t.resolve(o,p);if(i.existsSync(g)){if(!((await i.readdir(g)).length===0)&&!a.force){let{overwrite:w}=await v.prompt([{name:"overwrite",type:"confirm",message:`Target directory ${n.cyan(g)} is not empty. Overwrite?`,default:!1}]);w||process.exit(1),await i.emptyDir(g)}}else await i.ensureDir(g);let h=j("Scaffolding project...").start();await k(g,p),h.succeed("Project scaffolded");let d=T();console.log(),console.log(n.green("Done. Now run:")),e&&console.log(" cd "+n.cyan(e)),console.log(` ${d} install`),console.log(` ${d} run dev`),console.log()}catch(o){console.error(n.red(o.message)),process.exit(1)}});u.parse();async function k(e,a){let s=t.join(e,"docs"),r=t.join(s,".vitepress"),o=t.join(r,"theme");await i.ensureDir(o);let l={name:a,private:!0,type:"module",scripts:{dev:"vitepress dev docs --port 8090",build:"vitepress build docs",preview:"vitepress preview docs"},dependencies:{vite:"^5.2.14",vitepress:"^1.3.4",vue:"^3.4.21","@giscus/vue":"^3.0.0","vitepress-sidebar":"^1.22.0","vitepress-theme-open17":"^1.4.0","@unocss/vite":"^66.0.0",unocss:"^66.0.0"},devDependencies:{}};await i.writeJSON(t.join(e,"package.json"),l,{spaces:2}),await i.writeFile(t.join(e,".gitignore"),`node_modules
|
|
3
3
|
dist
|
|
4
4
|
docs/.vitepress/cache/*
|
|
5
|
-
`),await
|
|
5
|
+
`),await i.writeFile(t.join(s,"index.md"),D()),await i.ensureDir(t.join(s,"posts")),await i.writeFile(t.join(s,"posts",`${f(new Date)}-hello-open17.md`),x()),await i.writeFile(t.join(s,"posts/foo",`${f(new Date)}-second-post.md`),P()),await i.ensureDir(t.join(s,"page")),await i.writeFile(t.join(s,"page","tags.md"),S()),await i.writeFile(t.join(s,"page","categories.md"),I()),await i.writeFile(t.join(s,"page","archive.md"),W()),await i.writeFile(t.join(r,"config.ts"),C()),await i.writeFile(t.join(o,"index.ts"),F()),await i.ensureDir(t.join(s,"public")),await i.writeFile(t.join(e,"uno.config.ts"),_()),await i.writeFile(t.join(e,"README.md"),$(a))}function T(){let e=process.env.npm_config_user_agent||"";return e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm"}function f(e){let a=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${a}-${s}-${r}`}function D(){return`---
|
|
6
6
|
layout: blog
|
|
7
7
|
bgImage:
|
|
8
8
|
light: "https://vitepress.open17.vip/bg.jpg"
|
|
9
9
|
dark: "https://vitepress.open17.vip/bg2_dark.jpg"
|
|
10
10
|
---
|
|
11
|
-
`}function
|
|
11
|
+
`}function x(){return`---
|
|
12
12
|
title: Hello,World!
|
|
13
13
|
date: 2025-08-11
|
|
14
14
|
tags:
|
|
15
15
|
- Hello World
|
|
16
|
+
categories:
|
|
17
|
+
- Demo
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
@@ -40,23 +42,47 @@ Open17 \u662F\u4E00\u6B3E\u4E13\u4E3A VitePress \u8BBE\u8BA1\u7684\u73B0\u4EE3\u
|
|
|
40
42
|
- \u2699\uFE0F [\u4E3B\u9898\u914D\u7F6E](https://vitepress.open17.vip/blog-docs/1-config/) - \u8BE6\u7EC6\u914D\u7F6E\u8BF4\u660E
|
|
41
43
|
- \u{1F3A8} [\u6837\u5F0F\u5B9A\u5236](https://vitepress.open17.vip/blog-docs/1-config/2-style.html) - \u6253\u9020\u4E13\u5C5E\u98CE\u683C
|
|
42
44
|
- \u{1F527} [\u8FDB\u9636\u4F7F\u7528](https://vitepress.open17.vip/blog-docs/2-more/) - \u9AD8\u7EA7\u529F\u80FD\u63A2\u7D22
|
|
43
|
-
`}function P(){return
|
|
45
|
+
`}function P(){return`---
|
|
46
|
+
title: Another Post
|
|
47
|
+
date: 2025-08-12
|
|
48
|
+
tags:
|
|
49
|
+
- Tips
|
|
50
|
+
categories:
|
|
51
|
+
- Notes
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
This is a second sample post to demonstrate multiple categories.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Tips
|
|
60
|
+
|
|
61
|
+
- Keep your posts inside \`/docs/posts\`
|
|
62
|
+
- Use \`tags\` in frontmatter
|
|
63
|
+
- Try the archive and categories pages
|
|
64
|
+
`}function C(){return`import { defineConfigWithTheme } from 'vitepress'
|
|
44
65
|
import type { ThemeConfig } from 'vitepress-theme-open17/config'
|
|
66
|
+
import UnoCSS from 'unocss/vite'
|
|
45
67
|
|
|
46
68
|
export default defineConfigWithTheme<ThemeConfig>({
|
|
47
69
|
title: 'Blog Demo',
|
|
48
70
|
description: 'A VitePress Site',
|
|
71
|
+
vite: {
|
|
72
|
+
plugins: [UnoCSS()],
|
|
73
|
+
},
|
|
49
74
|
themeConfig: {
|
|
50
75
|
search: { provider: 'local' },
|
|
51
76
|
blog: {
|
|
52
|
-
direct: '
|
|
77
|
+
direct: 'lft',
|
|
78
|
+
tagPageLink: '/page/tags',
|
|
79
|
+
categoryPageLink: '/page/categories',
|
|
53
80
|
user: {
|
|
54
81
|
name: 'Open17',
|
|
55
82
|
avatar: 'https://vitepress.open17.vip/ava.jpg',
|
|
56
83
|
describe: 'Made with \u2764\uFE0F by open17',
|
|
57
84
|
},
|
|
58
|
-
|
|
59
|
-
bgImage: { dark: "https://vitepress.open17.vip/bg_dark.jpg" },
|
|
85
|
+
bgImage: { dark: "https://vitepress.open17.vip/bg_dark.jpg", light: "https://vitepress.open17.vip/bg.jpg" },
|
|
60
86
|
},
|
|
61
87
|
nav: [
|
|
62
88
|
{ text: "Home", link: "/" },
|
|
@@ -64,7 +90,8 @@ export default defineConfigWithTheme<ThemeConfig>({
|
|
|
64
90
|
text: "Others",
|
|
65
91
|
items: [
|
|
66
92
|
{ text: "Tags", link: "/page/tags" },
|
|
67
|
-
{ text: "
|
|
93
|
+
{ text: "Categories", link: "/page/categories" },
|
|
94
|
+
{ text: "Archive", link: "/page/archive" },
|
|
68
95
|
],
|
|
69
96
|
},
|
|
70
97
|
],
|
|
@@ -75,19 +102,47 @@ export default defineConfigWithTheme<ThemeConfig>({
|
|
|
75
102
|
}
|
|
76
103
|
})
|
|
77
104
|
`}function F(){return`import Theme from 'vitepress-theme-open17'
|
|
105
|
+
import 'virtual:uno.css'
|
|
106
|
+
|
|
78
107
|
export default Theme
|
|
79
|
-
`}function
|
|
108
|
+
`}function S(){return`---
|
|
80
109
|
layout: tags
|
|
81
110
|
lastUpdated: false
|
|
82
111
|
bgImage:
|
|
83
112
|
light: "https://vitepress.open17.vip/bg.jpg"
|
|
84
113
|
dark: "https://vitepress.open17.vip/bg2_dark.jpg"
|
|
85
114
|
---
|
|
86
|
-
`}function
|
|
115
|
+
`}function I(){return`---
|
|
116
|
+
layout: categories
|
|
117
|
+
lastUpdated: false
|
|
118
|
+
bgImage:
|
|
119
|
+
light: "https://vitepress.open17.vip/bg.jpg"
|
|
120
|
+
dark: "https://vitepress.open17.vip/bg2_dark.jpg"
|
|
121
|
+
---
|
|
122
|
+
`}function W(){return`---
|
|
87
123
|
layout: archive
|
|
88
124
|
lastUpdated: false
|
|
89
125
|
bgImage:
|
|
90
126
|
light: "https://vitepress.open17.vip/bg.jpg"
|
|
91
127
|
dark: "https://vitepress.open17.vip/bg2_dark.jpg"
|
|
92
128
|
---
|
|
129
|
+
`}function _(){return`import { defineConfig, presetWind3 } from 'unocss'
|
|
130
|
+
|
|
131
|
+
export default defineConfig({
|
|
132
|
+
presets: [presetWind3()],
|
|
133
|
+
})
|
|
134
|
+
`}function $(e){return`# ${e}
|
|
135
|
+
|
|
136
|
+
Quick start:
|
|
137
|
+
|
|
138
|
+
\`\`\`bash
|
|
139
|
+
npm i
|
|
140
|
+
npm run dev
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
Build:
|
|
144
|
+
|
|
145
|
+
\`\`\`bash
|
|
146
|
+
npm run build
|
|
147
|
+
\`\`\`
|
|
93
148
|
`}
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-open17-blog",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "CLI tool for quickly setting up vitepress-theme-open17 blog",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"create-open17-blog": "./dist/index.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
13
|
-
"keywords": [
|
|
14
|
-
"vitepress",
|
|
15
|
-
"blog",
|
|
16
|
-
"cli",
|
|
17
|
-
"scaffolding",
|
|
18
|
-
"open17"
|
|
19
|
-
],
|
|
20
|
-
"author": "open17 <opensci@163.com>",
|
|
21
|
-
"license": "Apache-2.0",
|
|
22
|
-
"repository": "https://github.com/open17/vitepress-theme-open17.git",
|
|
23
|
-
"homepage": "https://vitepress.open17.vip",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"commander": "^11.1.0",
|
|
26
|
-
"inquirer": "^9.
|
|
27
|
-
"chalk": "^5.3.0",
|
|
28
|
-
"ora": "^7.0.1",
|
|
29
|
-
"fs-extra": "^11.1.1",
|
|
30
|
-
"validate-npm-package-name": "^5.0.0"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@types/node": "^22.9.0",
|
|
34
|
-
"@types/inquirer": "^9.0.7",
|
|
35
|
-
"@types/fs-extra": "^11.0.4",
|
|
36
|
-
"typescript": "^5.6.3",
|
|
37
|
-
"tsup": "^8.0.1"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"prepublishOnly": "npm run build"
|
|
43
|
-
},
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=16.0.0"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "create-open17-blog",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "CLI tool for quickly setting up vitepress-theme-open17 blog",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-open17-blog": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"vitepress",
|
|
15
|
+
"blog",
|
|
16
|
+
"cli",
|
|
17
|
+
"scaffolding",
|
|
18
|
+
"open17"
|
|
19
|
+
],
|
|
20
|
+
"author": "open17 <opensci@163.com>",
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"repository": "https://github.com/open17/vitepress-theme-open17.git",
|
|
23
|
+
"homepage": "https://vitepress.open17.vip",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"commander": "^11.1.0",
|
|
26
|
+
"inquirer": "^12.9.3",
|
|
27
|
+
"chalk": "^5.3.0",
|
|
28
|
+
"ora": "^7.0.1",
|
|
29
|
+
"fs-extra": "^11.1.1",
|
|
30
|
+
"validate-npm-package-name": "^5.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.9.0",
|
|
34
|
+
"@types/inquirer": "^9.0.7",
|
|
35
|
+
"@types/fs-extra": "^11.0.4",
|
|
36
|
+
"typescript": "^5.6.3",
|
|
37
|
+
"tsup": "^8.0.1"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup src/index.ts --format esm --target node16 --minify",
|
|
41
|
+
"dev": "tsup src/index.ts --format esm --target node16 --watch",
|
|
42
|
+
"prepublishOnly": "npm run build"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=16.0.0"
|
|
46
|
+
}
|
|
47
|
+
}
|