Skip to content

Commit

Permalink
chore: merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Oct 7, 2020
2 parents 027386e + 73e059a commit a3c7322
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 68 deletions.
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ yarn
# if you have the old vue-cli installed globally, you may
# need to uninstall it first.
cd packages/@vue/cli
# before yarn link, you can delete the link in `~/.config/yarn/link/@vue` (see issue: [yarn link error message is not helpful](https://github.com/yarnpkg/yarn/issues/7054))
yarn link

# create test projects in /packages/test
Expand Down
98 changes: 37 additions & 61 deletions docs/guide/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Typically, your static website will be hosted on https://yourUserName.gitlab.io/


```javascript
// vue.config.js file to be place in the root of your repository
// vue.config.js file to be placed in the root of your repository
module.exports = {
publicPath: process.env.NODE_ENV === 'production'
Expand Down Expand Up @@ -178,6 +178,21 @@ In order to receive direct hits using `history mode` on Vue Router, you need to
More information on [Netlify redirects documentation](https://www.netlify.com/docs/redirects/#history-pushstate-and-single-page-apps).
If you are using [@vue/cli-plugin-pwa](https://cli.vuejs.org/core-plugins/pwa.html#vue-cli-plugin-pwa) make sure to exclude the `_redirects` file from being cached by the service worker.
To do so, add the following to your `vue.config.js`:
```javascript
// vue.config.js file to be placed in the root of your repository
module.exports = {
pwa: {
workboxOptions: {
exclude: [/_redirects/]
}
}
}
```
Checkout [workboxOptions](https://cli.vuejs.org/core-plugins/pwa.html#configuration) and [exclude](https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.InjectManifest#InjectManifest) for more.
### Render
[Render](https://render.com) offers [free static site hosting](https://render.com/docs/static-sites) with fully managed SSL, a global CDN and continuous auto deploys from GitHub.
Expand Down Expand Up @@ -269,77 +284,38 @@ Please refer to the [Firebase Documentation](https://firebase.google.com/docs/ho

### Vercel

This example uses the latest Vercel platform version 2.
[Vercel](https://vercel.com/home) is a cloud platform that enables developers to host Jamstack websites and web services that deploy instantly, scale automatically, and requires no supervision, all with zero configuration. They provide a global edge network, SSL encryption, asset compression, cache invalidation, and more.

1. Install the Vercel CLI:
#### Step 1: Deploying your Vue project to Vercel

```bash
npm install -g vercel
To deploy your Vue project with a [Vercel for Git Integration](https://vercel.com/docs/git-integrations), make sure it has been pushed to a Git repository.

# Or, if you prefer a local one
npm install vercel
```
Import the project into Vercel using the [Import Flow](https://vercel.com/import/git). During the import, you will find all relevant [options](https://vercel.com/docs/build-step#build-&-development-settings) preconfigured for you with the ability to change as needed.

2. Add a `vercel.json` file to your project root:
After your project has been imported, all subsequent pushes to branches will generate [Preview Deployments](https://vercel.com/docs/platform/deployments#preview), and all changes made to the [Production Branch](https://vercel.com/docs/git-integrations#production-branch) (commonly "master" or "main") will result in a [Production Deployment](https://vercel.com/docs/platform/deployments#production).

```json
{
"name": "my-example-app",
"version": 2,
"builds": [
{
"src": "package.json",
"use": "@vercel/static-build"
}
],
"routes": [
{
"src": "/(js|css|img)/.*",
"headers": { "cache-control": "max-age=31536000, immutable" }
},
{ "handle": "filesystem" },
{ "src": ".*", "dest": "/" }
],
"alias": "example.com"
}
```
Once deployed, you will get a URL to see your app live, such as the following: https://vue-example-tawny.vercel.app/.

If you have different/additional folders, modify the route accordingly:

```diff
- {
- "src": "/(js|css|img)/.*",
- "headers": { "cache-control": "max-age=31536000, immutable" }
- }
+ {
+ "src": "/(js|css|img|fonts|media)/.*",
+ "headers": { "cache-control": "max-age=31536000, immutable" }
+ }
```
#### Step 2 (optional): Using a Custom Domain

If your `outputDir` is not the default `dist`, say `build`:

```diff
- {
- "src": "package.json",
- "use": "@vercel/static-build"
- }
+ {
+ "src": "package.json",
+ "use": "@vercel/static-build",
+ "config": { "distDir": "build" }
+ }
```
If you want to use a Custom Domain with your Vercel deployment, you can **Add** or **Transfer in** your domain via your Vercel [account Domain settings.](https://vercel.com/dashboard/domains)

3. Adding a `now-build` script in `package.json`:
To add your domain to your project, navigate to your [Project](https://vercel.com/docs/platform/projects) from the Vercel Dashboard. Once you have selected your project, click on the "Settings" tab, then select the **Domains** menu item. From your projects **Domain** page, enter the domain you wish to add to your project.

```json
"vercel-build": "npm run build"
```
Once the domain as been added, you will be presented with different methods for configuring it.

#### Deploying a fresh Vue project

You can deploy a fresh Vue project, with a Git repository set up for you, with the following Deploy Button:

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/git?s=https%3A%2F%2Fgithub.com%2Fvercel%2Fvercel%2Ftree%2Fmaster%2Fexamples%2Fvue)

To make a deployment, run `vercel`.
## References:

If you want your deployment aliased, run `vercel --target production` instead.
- [Example Source](https://github.com/vercel/vercel/tree/master/examples/vue)
- [Official Vercel Guide](https://vercel.com/guides/deploying-vuejs-to-vercel)
- [Vercel Deployment Docs](https://vercel.com/docs)
- [Vercel Custom Domain Docs](https://vercel.com/docs/custom-domains)

### Stdlib

Expand Down
3 changes: 0 additions & 3 deletions docs/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ If you have the previous `vue-cli` (1.x or 2.x) package installed globally, you

::: tip Node Version Requirement
Vue CLI 4.x requires [Node.js](https://nodejs.org/) version 8.9 or above (v10+ recommended). You can manage multiple versions of Node on the same machine with [n](https://github.com/tj/n), [nvm](https://github.com/creationix/nvm) or [nvm-windows](https://github.com/coreybutler/nvm-windows).

As Node.js v8 has reached end-of-life, it's now recommended to use Node.js v10+ for best compatibility.
If you have to stay with Node.js v8, please make sure npm v6 is used as the default package manager. (`npm -v` to check the version, and `vue config --set packageManager npm` to set the default package manager.)
:::

To install the new package, use one of the following commands. You need administrator privileges to execute these unless npm was installed on your system through a Node.js version manager (e.g. n or nvm).
Expand Down
5 changes: 5 additions & 0 deletions docs/guide/webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ You can redirect the output into a file for easier inspection:
``` bash
vue inspect > output.js
```
By default, `inspect` command will show the output for development config. To see the production configuration, you need to run

``` bash
vue inspect --mode production > output.prod.js
```

Note the output is not a valid webpack config file, it's a serialized format only meant for inspection.

Expand Down
17 changes: 17 additions & 0 deletions docs/zh/guide/build-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,20 @@ dist/foo.1.js 5.24 kb 1.64 kb
<!-- foo-one 的实现的 chunk 会在用到的时候自动获取 -->
<foo-one></foo-one>
```

## 在构建时使用 vuex
在构建 [Web Components 组件](#web-components-组件)[](#库)时,入口点不是 `main.js` ,而是 `entry-wc.js` 文件,该文件由此生成: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/resolveWcEntry.js

因此,要在 Web Components 组件的目标中使用 vuex ,你需要在 `App.vue` 中初始化存储 (store):
``` js
import store from './store'

// ...

export default {
store,
name: 'App',
// ...
}
```

3 changes: 0 additions & 3 deletions docs/zh/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ Vue CLI 的包名称由 `vue-cli` 改成了 `@vue/cli`。

::: tip Node 版本要求
Vue CLI 4.x 需要 [Node.js](https://nodejs.org/) v8.9 或更高版本 (推荐 v10 以上)。你可以使用 [n](https://github.com/tj/n)[nvm](https://github.com/creationix/nvm)[nvm-windows](https://github.com/coreybutler/nvm-windows) 在同一台电脑中管理多个 Node 版本。

由于 Node.js v8 已不再维护,我们建议使用 Node.js v10 以上的版本,以保证最佳的兼容性。
如果暂时无法升级 Node.js 版本,请使用 npm v6 作为默认的包管理工具。(可以用 `npm -v` 检查 npm 版本,然后运行 `vue config --set packageManager npm` 以设置默认包管理工具。)
:::

可以使用下列任一命令安装这个新的包:
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@
"css": {
"modules": {
"label": "Enable CSS Modules",
"description": "By default, only files that ends in *.module.[ext] are treated as CSS modules. Enabling this will treat all style files as CSS modules."
"description": "By default, only files that end with *.module.[ext] are treated as CSS modules. Enabling this will treat all style files as CSS modules."
},
"extract": {
"label": "Extract CSS",
Expand Down

0 comments on commit a3c7322

Please sign in to comment.