Skip to content

Commit a90b24a

Browse files
Sun Haoranmeteorlxy
Sun Haoran
authored andcommitted
docs: suggest to use yarn (#1968)
1 parent 5bb6bbd commit a90b24a

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

packages/docs/docs/guide/deploy.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ You can also run the above script in your CI setup to enable automatic deploymen
6666

6767
2. Create a file named `.travis.yml` in the root of your project.
6868

69-
3. Run `npm install` locally and commit `package-lock.json` as it’s required for `npm ci`.
69+
3. Run `yarn` or `npm install` locally and commit the generated lockfile (i.e. `yarn.lock` or `package-lock.json`).
7070

7171
4. Use GitHub Pages deploy provider template and follow the [travis documentation](https://docs.travis-ci.com/user/deployment/pages/).
7272

@@ -75,9 +75,9 @@ language: node_js
7575
node_js:
7676
- lts/*
7777
install:
78-
- npm ci
78+
- yarn install # npm ci
7979
script:
80-
- npm run docs:build
80+
- yarn docs:build # npm run docs:build
8181
deploy:
8282
provider: pages
8383
skip_cleanup: true
@@ -109,8 +109,8 @@ pages:
109109
- node_modules/
110110
111111
script:
112-
- npm install
113-
- npm run docs:build
112+
- yarn install # npm install
113+
- yarn docs:build # npm run docs:build
114114
artifacts:
115115
paths:
116116
- public
@@ -123,7 +123,7 @@ pages:
123123

124124
1. On [Netlify](https://netlify.com), setup up a new project from GitHub with the following settings:
125125

126-
- **Build Command:** `npm run docs:build` or `yarn docs:build`
126+
- **Build Command:** `yarn docs:build` or `npm run docs:build`
127127
- **Publish directory:** `docs/.vuepress/dist`
128128

129129
2. Hit the deploy button!

packages/docs/docs/plugin/official/plugin-google-analytics.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ yarn add -D @vuepress/plugin-google-analytics
1515
# OR npm install -D @vuepress/plugin-google-analytics
1616
```
1717

18+
::: warning
19+
We currently recommend using [Yarn](https://yarnpkg.com/en/) instead of npm to install all dependencies if you are using Google Analytics Plugin, because npm fails to generate the correct dependency tree in this case.
20+
:::
21+
1822
## Usage
1923

2024
```javascript

packages/docs/docs/zh/guide/deploy.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ cd -
6565
如果你打算发布到 `https://<USERNAME or GROUP>.github.io/<REPO>/`(也就是说你的仓库在 `https://github.com/<USERNAME>/<REPO>`),则将 `base` 设置为 `"/<REPO>/"`
6666

6767
2. 在项目的根目录创建一个名为 `.travis.yml` 的文件;
68-
3. 在本地执行 `npm install` 并且在提交中包含 `package-lock.json` 因为 `npm ci` 需要它才能正确执行.
68+
3. 在本地执行 `yarn``npm install` 并且提交生成的 lock 文件(即 `yarn.lock``package-lock.json`);
6969
4. 使用 GitHub Pages 部署提供程序模板并遵循 [Travis 文档](https://docs.travis-ci.com/user/deployment/pages/)
7070

7171
``` yaml
7272
language: node_js
7373
node_js:
7474
- lts/*
7575
install:
76-
- npm ci
76+
- yarn install # npm ci
7777
script:
78-
- npm run docs:build
78+
- yarn docs:build # npm run docs:build
7979
deploy:
8080
provider: pages
8181
skip_cleanup: true
@@ -106,8 +106,8 @@ pages:
106106
- node_modules/
107107
108108
script:
109-
- npm install
110-
- npm run docs:build
109+
- yarn install # npm install
110+
- yarn docs:build # npm run docs:build
111111
artifacts:
112112
paths:
113113
- public
@@ -119,7 +119,7 @@ pages:
119119

120120
1. 在 Netlify 中, 创建一个新的 GitHub 项目,使用以下设置:
121121

122-
- **Build Command:** `npm run build:docs` 或者 `yarn build:docs`
122+
- **Build Command:** `yarn build:docs` 或者 `npm run build:docs`
123123
- **Publish directory:** `docs/.vuepress/dist`
124124

125125
2. 点击 deploy 按钮!

packages/docs/docs/zh/plugin/official/plugin-google-analytics.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ yarn add -D @vuepress/plugin-google-analytics
1414
# OR npm install -D @vuepress/plugin-google-analytics
1515
```
1616

17+
::: warning
18+
如果你的项目正在使用 Google analytics 插件,推荐使用 [Yarn](https://yarnpkg.com/en/) 而不是 npm 来安装所有依赖。因为在这种情形下,npm 会生成错误的依赖树。
19+
:::
20+
1721
## 使用
1822

1923
```javascript

0 commit comments

Comments
 (0)