@sugarat/create-theme 0.0.21 → 0.0.23

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
@@ -23,6 +23,12 @@ With PNPM:
23
23
  $ pnpm create @sugarat/theme
24
24
  ```
25
25
 
26
+ With Bun:
27
+
28
+ ```bash
29
+ $ bunx @sugarat/create-theme --bun
30
+ ```
31
+
26
32
  Then follow the prompts!
27
33
 
28
34
  You can also directly specify the project name you want to use via additional command line options. For example, to scaffold a my-first-blog, run:
@@ -36,4 +42,7 @@ yarn create @sugarat/theme my-first-blog
36
42
 
37
43
  # pnpm
38
44
  pnpm create @sugarat/theme my-first-blog
45
+
46
+ # bun
47
+ bunx @sugarat/create-theme my-first-blog --bun
39
48
  ```
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
- var y=Object.create;var g=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var w=(o,n,e,m)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of d(n))!v.call(o,r)&&r!==e&&g(o,r,{get:()=>n[r],enumerable:!(m=_(n,r))||m.enumerable});return o};var a=(o,n,e)=>(e=o!=null?y(h(o)):{},w(n||!o||!o.__esModule?g(e,"default",{value:o,enumerable:!0}):e,o));var j=(o,n,e)=>new Promise((m,r)=>{var f=l=>{try{s(e.next(l))}catch(t){r(t)}},u=l=>{try{s(e.throw(l))}catch(t){r(t)}},s=l=>l.done?m(l.value):Promise.resolve(l.value).then(f,u);s((e=e.apply(o,n)).next())});var c=a(require("path")),i=a(require("process")),p=a(require("fs-extra"));function b(o){let n=c.default.join(__dirname,"template");p.default.copy(n,o,e=>j(this,null,function*(){if(yield p.default.copy(c.default.join(__dirname,"move/gitignore"),c.default.join(o,".gitignore")),yield p.default.copy(c.default.join(__dirname,"move/npmrc"),c.default.join(o,".npmrc")),e)console.error("An error occurred while copying template files:",e);else{console.log("\u{1F389} \u{1F389} created successfully!"),console.log(),console.log(`project in ${o}`),console.log();let m=`Done. Now run:
2
+ var h=Object.create;var f=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var N=(o,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of v(n))!_.call(o,c)&&c!==e&&f(o,c,{get:()=>n[c],enumerable:!(a=w(n,c))||a.enumerable});return o};var u=(o,n,e)=>(e=o!=null?h(y(o)):{},N(n||!o||!o.__esModule?f(e,"default",{value:o,enumerable:!0}):e,o));var j=(o,n,e)=>new Promise((a,c)=>{var r=l=>{try{m(e.next(l))}catch(p){c(p)}},s=l=>{try{m(e.throw(l))}catch(p){c(p)}},m=l=>l.done?a(l.value):Promise.resolve(l.value).then(r,s);m((e=e.apply(o,n)).next())});var t=u(require("path")),b=u(require("process")),g=u(require("fs-extra"));var $=b.default.argv.slice(2),k=$.filter(o=>o.startsWith("--")),d=$.filter(o=>!o.startsWith("--")),F=d[d.length-1]||"my-blog",i=k.includes("--bun");function O(o){let n=t.default.join(__dirname,"template");g.default.copy(n,o,e=>j(this,null,function*(){yield g.default.copy(t.default.join(__dirname,"move/gitignore"),t.default.join(o,".gitignore"));let a=i?"bunfig.toml":"npmrc",c=i?"bunfig.toml":".npmrc";if(yield g.default.copy(t.default.join(__dirname,`move/${a}`),t.default.join(o,c)),i){let r=t.default.join(o,"package.json"),s=yield g.default.readJSON(r);s.scripts.build=`NODE_ENV=production ${s.scripts.build}`,yield g.default.writeJSON(r,s,{spaces:2})}if(e)console.error("An error occurred while copying template files:",e);else{console.log("\u{1F389} \u{1F389} created successfully!"),console.log(),console.log(`project in ${o}`),console.log();let r=i?"bun":"pnpm",s=`Done. Now run:
3
3
 
4
- \u2460 cd ${c.default.parse(o).name}
5
- \u2461 pnpm install
6
- \u2462 pnpm run dev`;console.log(m)}}))}console.log("Creating @sugarat/theme project...");console.log();var N=i.default.argv[2]||"my-blog";b(c.default.join(i.default.cwd(),N));
7
- //# sourceMappingURL=index.js.map
4
+ \u2460 cd ${t.default.parse(o).name}
5
+ \u2461 ${r} install
6
+ \u2462 ${r} run ${i?"--bun ":""}dev
7
+ \u2463 ${r} run ${i?"--bun ":""}build
8
+ \u2464 ${r} run ${i?"--bun ":""}serve`;console.log(s)}}))}console.log("Creating @sugarat/theme project...");console.log();O(t.default.join(b.default.cwd(),F));
@@ -0,0 +1,3 @@
1
+ [install]
2
+ # 设置为淘宝源
3
+ registry = "https://registry.npmmirror.com"
@@ -5,6 +5,9 @@ descriptionHTML: '
5
5
  <span style="color:var(--description-font-color);">1分钟内完成自己的博客创建</span>
6
6
  <pre style="background-color: #292b30; padding: 15px; border-radius: 10px;" class="shiki material-theme-palenight"><code>
7
7
  <span class="line"><span style="color:#FFCB6B;">npm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">create</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">@sugarat/theme@latest</span></span>
8
+ <br/>
9
+ <br/>
10
+ <span class="line"><span style="color:#B392F0;">bunx</span><span style="color:#E1E4E8;"> </span><span style="color:#9ECBFF;">@sugarat/create-theme</span><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">--bun</span></span>
8
11
  </code>
9
12
  </pre>'
10
13
  tag:
@@ -16,6 +19,23 @@ sidebar: false
16
19
  # 快速上手
17
20
  1分钟内完成自己的博客创建
18
21
 
22
+ :::warning 注意事项
23
+ 使用 [pnpm](https://pnpm.io),[yarn](https://www.npmjs.com/package/yarn),[bun](https://bun.sh/) ,需要单独安装
24
+
25
+ **如果喜欢尝鲜,想体验更快的启动和构建速度,推荐使用 bun**(<i style="color:red">windows 用户不建议使用 bun</i>)
26
+
27
+ 其它情况推荐使用 pnpm,*不推荐使用 yarn*
28
+
29
+ :::code-group
30
+
31
+ ```sh [安装 PNPM]
32
+ npm install -g pnpm
33
+ ```
34
+ ```sh [安装 bun]
35
+ npm install -g bun
36
+ ```
37
+ :::
38
+
19
39
  ## 快速创建项目
20
40
  使用 [@sugarat/create-theme](https://github.com/ATQQ/sugar-blog/tree/master/packages/create-theme) 快速创建模板项目
21
41
 
@@ -29,6 +49,17 @@ yarn create @sugarat/theme
29
49
  ```sh [pnpm]
30
50
  pnpm create @sugarat/theme
31
51
  ```
52
+ ```sh [bun]
53
+ bunx @sugarat/create-theme --bun
54
+ ```
55
+ :::
56
+
57
+ :::details bun创建的项目不一样之处
58
+ ① 会多出一个配置文件 `bunfig.toml`,默认配置了淘宝镜像源
59
+
60
+ ② 安装依赖后对应lock文件 `bun.lockb`
61
+
62
+ ③ 运行命令需添加一个 `--bun` 参数,不加就是Node运行,体验不到快速(未来官方会做优化)
32
63
  :::
33
64
 
34
65
  当然你也可以自定义项目名创建
@@ -42,11 +73,17 @@ yarn create @sugarat/theme my-first-blog
42
73
  ```sh [pnpm]
43
74
  pnpm create @sugarat/theme my-first-blog
44
75
  ```
76
+ ```sh [bun]
77
+ bunx @sugarat/create-theme my-first-blog --bun
78
+ ```
45
79
  :::
46
80
 
47
81
  接下来按照 [操作指引](https://app.warp.dev/block/lZAFeRnRFgOcsRSUOU5ApV) 进行操作即可
48
82
 
49
- ![](https://img.cdn.sugarat.top/mdImg/MTY4OTQyMDE1NTcxMA==689420155710)
83
+ | npm/yarn/pnpm | bun |
84
+ | :---------------------------------------------------------------------: | :---------------------------------------------------------------------: |
85
+ | ![](https://img.cdn.sugarat.top/mdImg/MTY4OTQyMDE1NTcxMA==689420155710) | ![](https://img.cdn.sugarat.top/mdImg/MTY5NjE0NzY1NDEwMA==696147654100) |
86
+
50
87
 
51
88
  ① 切换到项目的目录
52
89
  ```sh
@@ -60,16 +97,21 @@ cd my-blog
60
97
  pnpm install
61
98
  ```
62
99
 
63
- ```sh [安装 PNPM]
64
- # 如果你没有 PNPM 请先安装
65
- npm i -g pnpm
100
+ ```sh [bun]
101
+ bun install
66
102
  ```
67
103
  :::
68
104
 
69
105
  ③ 开发启动
70
- ```sh
106
+ :::code-group
107
+ ```sh [pnpm]
71
108
  pnpm dev
72
109
  ```
110
+ ```sh [bun]
111
+ bun run --bun dev
112
+ ```
113
+ :::
114
+
73
115
 
74
116
  ![](https://img.cdn.sugarat.top/mdImg/MTY5NTIxODUyMDU4MQ==695218520581)
75
117
 
@@ -78,9 +120,15 @@ pnpm dev
78
120
  ![](https://img.cdn.sugarat.top/mdImg/MTY3Njk4OTk2Mjc0Nw==676989962747)
79
121
 
80
122
  ④ 构建产物
81
- ```sh
123
+ :::code-group
124
+ ```sh [pnpm]
82
125
  pnpm build
83
126
  ```
127
+ ```sh [bun]
128
+ bun run --bun build
129
+ ```
130
+ :::
131
+
84
132
  ![](https://img.cdn.sugarat.top/mdImg/MTY5NTIxODYwNzA3Nw==695218607077)
85
133
 
86
134
  默认会开启内置的离线全文搜索(基于 `pagefind` 实现)
@@ -92,25 +140,39 @@ const blogTheme = getThemeConfig({
92
140
  // 默认开启pagefind离线的全文搜索支持(如使用其它的可以设置为false)
93
141
  // 如果npx pagefind 时间过长,可以手动将其安装为项目依赖 pnpm add pagefind
94
142
  search: false,
95
- });
143
+ })
96
144
  ```
97
145
 
98
146
  ⑤ 预览构建产物
99
- ```sh
147
+
148
+ :::code-group
149
+ ```sh [pnpm]
100
150
  pnpm serve
101
151
  ```
152
+ ```sh [bun]
153
+ bun run --bun serve
154
+ ```
155
+ :::
102
156
 
103
157
  ![](https://img.cdn.sugarat.top/mdImg/MTY5NTIxODY1NzAzNg==695218657036)
104
158
 
105
159
  ## 升级
106
160
 
107
161
  如果主题更新了,升级主题,原项目只需执行如下指令即可
108
- ```sh
162
+ :::code-group
163
+ ```sh [pnpm]
109
164
  pnpm up @sugarat/theme
110
165
 
111
166
  # 更新 vitepress 版本(通常安装最新的即可,主题包每次更新不出意外都会使用最新的VitePress)
112
167
  pnpm add vitepress@latest
113
168
  ```
169
+ ```sh [bun]
170
+ bun update @sugarat/theme
171
+
172
+ # 更新 vitepress 版本(通常安装最新的即可,主题包每次更新不出意外都会使用最新的VitePress)
173
+ bun install vitepress@latest
174
+ ```
175
+ :::
114
176
 
115
177
  ## 更多
116
178
  * [主题配置:首页&文章](https://theme.sugarat.top/config/frontmatter.html) - 主题提供的一些 `frontmatter`
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@element-plus/icons-vue": "^2.1.0",
14
- "@sugarat/theme": "^0.2.2",
14
+ "@sugarat/theme": "^0.2.4",
15
15
  "element-plus": "^2.3.8",
16
16
  "vue": "^3.3.4"
17
17
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/create-theme",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "author": "粥里有勺糖",
6
6
  "license": "MIT",
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport path from 'node:path'\nimport process from 'process'\nimport fs from 'fs-extra'\n\nfunction createThemeProject(destination) {\n const templatePath = path.join(__dirname, 'template')\n\n fs.copy(templatePath, destination, async (err) => {\n // 同步创建.gitignore文件和.npmrc文件\n await fs.copy(\n path.join(__dirname, 'move/gitignore'),\n path.join(destination, '.gitignore')\n )\n await fs.copy(\n path.join(__dirname, 'move/npmrc'),\n path.join(destination, '.npmrc')\n )\n if (err) {\n console.error('An error occurred while copying template files:', err)\n }\n else {\n console.log('🎉 🎉 created successfully!')\n console.log()\n\n console.log(`project in ${destination}`)\n\n console.log()\n\n const msg = `Done. Now run:\n\n ① cd ${path.parse(destination).name}\n ② pnpm install\n ③ pnpm run dev`\n\n console.log(msg)\n }\n })\n}\n\nconsole.log('Creating @sugarat/theme project...')\nconsole.log()\n\nconst projectName = process.argv[2] || 'my-blog'\ncreateThemeProject(path.join(process.cwd(), projectName))\n"],"mappings":";wpBAEA,IAAAA,EAAiB,mBACjBC,EAAoB,sBACpBC,EAAe,uBAEf,SAASC,EAAmBC,EAAa,CACvC,IAAMC,EAAe,EAAAC,QAAK,KAAK,UAAW,UAAU,EAEpD,EAAAC,QAAG,KAAKF,EAAcD,EAAoBI,GAAQC,EAAA,sBAUhD,GARA,MAAM,EAAAF,QAAG,KACP,EAAAD,QAAK,KAAK,UAAW,gBAAgB,EACrC,EAAAA,QAAK,KAAKF,EAAa,YAAY,CACrC,EACA,MAAM,EAAAG,QAAG,KACP,EAAAD,QAAK,KAAK,UAAW,YAAY,EACjC,EAAAA,QAAK,KAAKF,EAAa,QAAQ,CACjC,EACII,EACF,QAAQ,MAAM,kDAAmDA,CAAG,MAEjE,CACH,QAAQ,IAAI,2CAA6B,EACzC,QAAQ,IAAI,EAEZ,QAAQ,IAAI,cAAcJ,CAAW,EAAE,EAEvC,QAAQ,IAAI,EAEZ,IAAMM,EAAM;AAAA;AAAA,eAER,EAAAJ,QAAK,MAAMF,CAAW,EAAE,IAAI;AAAA;AAAA,wBAIhC,QAAQ,IAAIM,CAAG,CACjB,CACF,EAAC,CACH,CAEA,QAAQ,IAAI,oCAAoC,EAChD,QAAQ,IAAI,EAEZ,IAAMC,EAAc,EAAAC,QAAQ,KAAK,CAAC,GAAK,UACvCT,EAAmB,EAAAG,QAAK,KAAK,EAAAM,QAAQ,IAAI,EAAGD,CAAW,CAAC","names":["import_node_path","import_process","import_fs_extra","createThemeProject","destination","templatePath","path","fs","err","__async","msg","projectName","process"]}