From fac8a160a2a8b011c8148102e1fdc8f881dbf410 Mon Sep 17 00:00:00 2001 From: Adam Sobotka Date: Wed, 27 Feb 2019 23:26:10 +0100 Subject: [PATCH] Updated Now part of deployment guide They released version 2 of deployment configuration and guide didn't work anymore. --- docs/guide/deployment.md | 46 +++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/docs/guide/deployment.md b/docs/guide/deployment.md index f6e44b250c..ee41a07cf4 100644 --- a/docs/guide/deployment.md +++ b/docs/guide/deployment.md @@ -216,44 +216,38 @@ Please refer to the [Firebase Documentation](https://firebase.google.com/docs/ho ```bash npm install -g now ``` +or +```bash +yarn global add now +``` 2. Add a `now.json` file to your project root: ```json - { - "name": "my-example-app", - "type": "static", - "static": { - "public": "dist", - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ] - }, - "alias": "vue-example", - "files": [ - "dist" - ] - } +{ + "version": 2, + "name": "vue", + "builds": [ + { "src": "package.json", "use": "@now/static-build" } + ], + "routes": [ + {"src": "^/js/(.*)", "dest": "/js/$1"}, + {"src": "^/css/(.*)", "dest": "/css/$1"}, + {"src": "^/img/(.*)", "dest": "/img/$1"}, + {"src": ".*", "dest": "/index.html"} + ] +} ``` 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" - ``` - - If you want to deploy publicly by default, you can change the deployment script to the following one: +3. Adding a build script in `package.json`: ```json - "deploy": "npm run build && now --public && now alias" + "now-build": "npm run build" ``` - This will automatically point your site's alias to the latest deployment. Now, just run `npm run deploy` to deploy your app. +Now, just run `now` or `now --public` to deploy your app. ### Stdlib