create-vuepress-theme-plume 1.0.0-rc.103 → 1.0.0-rc.105

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
@@ -134,7 +134,7 @@ async function createPackageJson(mode, pkg, {
134
134
  "docs:preview": `http-server ${docsDir}/.vuepress/dist`
135
135
  };
136
136
  if (mode === 1 /* create */) {
137
- pkg.scripts["vp-update"] = "vp-update";
137
+ pkg.scripts["vp-update"] = `${packageManager === "npm" ? "npx" : `${packageManager} dlx`} vp-update`;
138
138
  }
139
139
  }
140
140
  pkg.devDependencies ??= {};
@@ -495,17 +495,35 @@ async function run(mode, root) {
495
495
  const data = resolveData(result, mode);
496
496
  const progress = spinner();
497
497
  progress.start(t("spinner.start"));
498
- await generate(mode, data);
498
+ try {
499
+ await generate(mode, data);
500
+ } catch (e) {
501
+ console.error(`${colors.red("generate files error: ")}
502
+ `, e);
503
+ process4.exit(1);
504
+ }
499
505
  await sleep(200);
500
506
  const cwd = path4.join(process4.cwd(), data.root);
501
507
  if (data.git) {
502
508
  progress.message(t("spinner.git"));
503
- await execaCommand3("git init", { cwd });
509
+ try {
510
+ await execaCommand3("git init", { cwd });
511
+ } catch (e) {
512
+ console.error(`${colors.red("git init error: ")}
513
+ `, e);
514
+ process4.exit(1);
515
+ }
504
516
  }
505
517
  const pm = data.packageManager;
506
518
  if (data.install) {
507
519
  progress.message(t("spinner.install"));
508
- await execaCommand3(pm === "yarn" ? "yarn" : `${pm} install`, { cwd });
520
+ try {
521
+ await execaCommand3(pm === "yarn" ? "yarn" : `${pm} install`, { cwd });
522
+ } catch (e) {
523
+ console.error(`${colors.red("install dependencies error: ")}
524
+ `, e);
525
+ process4.exit(1);
526
+ }
509
527
  }
510
528
  const cdCommand = mode === 1 /* create */ ? colors.green(`cd ${data.root}`) : "";
511
529
  const runCommand = colors.green(pm === "yarn" ? "yarn docs:dev" : `${pm} run docs:dev`);
@@ -531,5 +549,5 @@ var cli = cac("create-vuepress-theme-plume");
531
549
  cli.command("[root]", "create a new vuepress-theme-plume project / \u521B\u5EFA\u65B0\u7684 vuepress-theme-plume \u9879\u76EE").action((root) => run(1 /* create */, root));
532
550
  cli.command("init [root]", "Initial vuepress-theme-plume in the existing project / \u5728\u73B0\u6709\u9879\u76EE\u4E2D\u521D\u59CB\u5316 vuepress-theme-plume").action((root) => run(0 /* init */, root));
533
551
  cli.help();
534
- cli.version("1.0.0-rc.102");
552
+ cli.version("1.0.0-rc.104");
535
553
  cli.parse();
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.103",
4
+ "version": "1.0.0-rc.105",
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",
@@ -1,12 +1,12 @@
1
1
  import { defineClientConfig } from 'vuepress/client'
2
- import RepoCard from 'vuepress-theme-plume/features/RepoCard.vue'
3
- import CustomComponent from './theme/components/Custom.vue'
2
+ // import RepoCard from 'vuepress-theme-plume/features/RepoCard.vue'
3
+ // import CustomComponent from './theme/components/Custom.vue'
4
4
 
5
- import './theme/styles/custom.css'
5
+ // import './theme/styles/custom.css'
6
6
 
7
7
  export default defineClientConfig({
8
8
  enhance({ app }) {
9
- app.component('RepoCard', RepoCard)
10
- app.component('CustomComponent', CustomComponent)
9
+ // app.component('RepoCard', RepoCard)
10
+ // app.component('CustomComponent', CustomComponent)
11
11
  },
12
12
  })
@@ -32,8 +32,8 @@ export default defineUserConfig({
32
32
  * @see https://theme-plume.vuejs.press/config/plugins/code-highlight/
33
33
  */
34
34
  // shiki: {
35
+ // // 强烈建议预设代码块高亮语言,插件默认加载所有语言会产生不必要的时间开销
35
36
  // languages: ['shell', 'bash', 'typescript', 'javascript'],
36
- // twoslash: true,
37
37
  // },
38
38
 
39
39
  /**
@@ -72,7 +72,7 @@ export default defineUserConfig({
72
72
  // },
73
73
 
74
74
  /**
75
- * comments
75
+ * 评论 comments
76
76
  * @see https://theme-plume.vuejs.press/guide/features/comments/
77
77
  */
78
78
  // comment: {
@@ -50,7 +50,24 @@ npm run docs:preview
50
50
  npm run vp-update
51
51
  ```
52
52
  {{/if}}
53
+ {{#if (equal deploy "github")}}
53
54
 
55
+ ## Deploy to GitHub Pages
56
+
57
+ The plume theme has been created with GitHub Actions: `.github/workflows/docs-deploy.yml`. You also need to make the following settings in the GitHub repository:
58
+
59
+ - [ ] `settings > Actions > General`, Scroll to the bottom of the page, under `Workflow permissions`, check `Read and write permissions`, and click the save button.
60
+
61
+ - [ ] `settings > Pages`, In `Build and deployment`, select `Deploy from a branch` for `Source`, choose `gh-pages` for `Branch`, and click the save button.
62
+ (The `gh-pages` branch may not exist upon first creation. You can complete the above setup first, push the code to the main branch, wait for `github actions` to finish, and then proceed with the setup.)
63
+
64
+ - [ ] Modify the `base` option in `docs/.vuepress/config.ts`:
65
+ - If you are planning to deploy to `https://<USERNAME>.github.io/`, you can skip this step as `base` defaults to `"/"`.
66
+ - If you are planning to deploy to `https://<USERNAME>.github.io/<REPO>/`, meaning your repository URL is `https://github.com/<USERNAME>/<REPO>`, set `base` to `"/<REPO>/"`.
67
+
68
+ To customize a domain name, please refer to [Github Pages](https://docs.github.com/zh/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages)
69
+
70
+ {{/if}}
54
71
  ## Documents
55
72
 
56
73
  - [vuepress](https://vuepress.vuejs.org/)
@@ -50,7 +50,24 @@ npm run docs:preview
50
50
  npm run vp-update
51
51
  ```
52
52
  {{/if}}
53
+ {{#if (equal deploy "github")}}
53
54
 
55
+ ## 部署到 GitHub Pages
56
+
57
+ 主题已创建 github actions: `.github/workflows/docs-deploy.yml`,你还需要在 github 仓库中进行以下设置:
58
+
59
+ - [ ] `settings > Actions > General`,拉到页面底部,在 `Workflow permissions` 下,勾选 `Read and write permissions`,并点击保存按钮
60
+
61
+ - [ ] `settings > Pages`, 在 `Build and deployment` 中,`Source` 选择 `Deploy from a branch`, `Branch` 选择 `gh-pages`,并点击保存按钮
62
+ (首次创建可能没有 `gh-pages`分支,你可以先完成上面的设置后,推送一次代码到主分支,等待 `github actions` 完成后再进行设置)
63
+
64
+ - [ ] 修改 `docs/.vuepress/config.ts` 中的 `base` 选项:
65
+ - 如果你准备发布到 `https://<USERNAME>.github.io/` ,你可以省略这一步,因为 `base` 默认就是 `"/"` 。
66
+ - 如果你准备发布到 `https://<USERNAME>.github.io/<REPO>/` ,也就是说你的仓库地址是 `https://github.com/<USERNAME>/<REPO>` ,则将 `base` 设置为 `"/<REPO>/"`。
67
+
68
+ 如需要自定义域名,请查看 [Github Pages 文档](https://docs.github.com/zh/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages)
69
+
70
+ {{/if}}
54
71
  ## 文档
55
72
 
56
73
  - [vuepress](https://vuepress.vuejs.org/)