From 7d303e4c1ebf9330f72d64f622f22af8b3cfbfba Mon Sep 17 00:00:00 2001 From: Ivan Sieder <35377072+ivansieder@users.noreply.github.com> Date: Wed, 3 Jul 2019 17:38:49 +0200 Subject: [PATCH 1/4] Updated for Zeit Now V2 --- docs/guide/deployment.md | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index ed6714dc56..2fa8938284 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -211,6 +211,8 @@ Please refer to the [Firebase Documentation](https://firebase.google.com/docs/ho ### Now +This example uses the latest Now platform version 2. + 1. Install the Now CLI globally: ```bash @@ -222,35 +224,27 @@ npm install -g now ```json { "name": "my-example-app", - "type": "static", - "static": { - "public": "dist", - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ] - }, - "alias": "vue-example", - "files": [ - "dist" - ] + "version": 2, + "builds": [ + { "src": "dist/**", "use": "@now/static"} + ], + "routes": [ + { "src": "/(.*)", "dest": "dist/$1" } + ], + "alias": "vue-example" } ``` - You can further customize the static serving behavior by consulting [Now's documentation](https://zeit.co/docs/deployment-types/static). - 3. Adding a deployment script in `package.json`: ```json - "deploy": "npm run build && now && now alias" + "deploy": "npm run build && now --target production" ``` If you want to deploy publicly by default, you can change the deployment script to the following one: ```json - "deploy": "npm run build && now --public && now alias" + "deploy": "npm run build && now --target production --public" ``` This will automatically point your site's alias to the latest deployment. Now, just run `npm run deploy` to deploy your app. From 9e86bfda2a92ce992e1ca9b6557ae8b5d07c1a89 Mon Sep 17 00:00:00 2001 From: Ivan Sieder <35377072+ivansieder@users.noreply.github.com> Date: Wed, 3 Jul 2019 17:44:55 +0200 Subject: [PATCH 2/4] Fixed styling issue --- docs/guide/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index 2fa8938284..6ec976b42f 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -226,7 +226,7 @@ npm install -g now "name": "my-example-app", "version": 2, "builds": [ - { "src": "dist/**", "use": "@now/static"} + { "src": "dist/**", "use": "@now/static" } ], "routes": [ { "src": "/(.*)", "dest": "dist/$1" } From afd9c43bf0f66875b4d232ae4a17a7e5dcc80cda Mon Sep 17 00:00:00 2001 From: Ivan Sieder <35377072+ivansieder@users.noreply.github.com> Date: Wed, 10 Jul 2019 13:06:20 +0200 Subject: [PATCH 3/4] Added additional hint for router mode set to history --- docs/guide/deployment.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index 6ec976b42f..69a22ad781 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -234,6 +234,36 @@ npm install -g now "alias": "vue-example" } ``` + + In case you want to deploy an application with router mode set to history, the config file should look like the following (if you have different folder names, update your config accordingly): + ```json + { + "name": "my-example-app", + "version": 2, + "builds": [ + { + "src": "dist/**", + "use": "@now/static" + } + ], + "routes": [ + { + "src": "/(js|css|img)/(.*)", + "dest": "/dist/$1/$2" + }, + { + "src": "/favicon.ico", + "dest": "/dist/favicon.ico" + }, + { + "src": "/(.*)", + "dest": "/dist" + } + ], + "alias": "vue-example" + } + ``` + This additional config is required in order to avoid issues when directly deep-linking to a specific page (e.g. when opening my-example-app.now.sh/some-subpage, you would presented with a 404 error otherwise). 3. Adding a deployment script in `package.json`: From a73f57cc4212a73e3e496332e456f1958e860a69 Mon Sep 17 00:00:00 2001 From: Ivan Sieder <35377072+ivansieder@users.noreply.github.com> Date: Thu, 11 Jul 2019 21:30:10 +0200 Subject: [PATCH 4/4] Update docs/guide/deployment.md Co-Authored-By: Natalia Tepluhina --- docs/guide/deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index 69a22ad781..9e77b98d03 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -263,7 +263,7 @@ npm install -g now "alias": "vue-example" } ``` - This additional config is required in order to avoid issues when directly deep-linking to a specific page (e.g. when opening my-example-app.now.sh/some-subpage, you would presented with a 404 error otherwise). + This additional config is required in order to avoid issues when directly deep-linking to a specific page (e.g. when opening `my-example-app.now.sh/some-subpage`, you would be presented with a 404 error otherwise). 3. Adding a deployment script in `package.json`: