From ad11ac7755f36c92b3bf8b4106f1d50715da976e Mon Sep 17 00:00:00 2001 From: Timothy <1695613+timothyis@users.noreply.github.com> Date: Mon, 10 Dec 2018 16:48:44 +0000 Subject: [PATCH 1/8] Update the Now guide to use Now v2 --- docs/docs/deploying-to-now.md | 53 +++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index ddb651ca70317..59fef56e86f51 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -2,36 +2,59 @@ title: Deploying to Now --- -In order to deploy your Gatsby project using [Now](https://zeit.co/now), you can do the following: +[ZEIT Now](https://zeit.co/now) is a [cloud platform for serverless deployment](https://zeit.co/docs/v2/getting-started/introduction-to-now/) that you can use to deploy your Gatsby projects and [alias them](https://zeit.co/docs/v2/domains-and-aliases/aliasing-a-deployment/) to your domain or a free `.now.sh` suffixed URL. -1. Install the Now CLI +This guide will show you how to get started in a few quick steps: -`npm install -g now` +## Step 1: Getting Started with Gatsby +If you haven't already [set up a Gatsby project](https://www.gatsbyjs.org/docs/quick-start) you can do so by using npm's `npx` command in your terminal: -2. Run `gatsby build` at the root of your project. +```shell +npx gatsby new +``` + +## Step 2: Getting Now + +If you're not acquainted with Now, it is an easy-to-use cloud platform for serverless deployments that you can use from [the command-line](https://zeit.co/docs/v2/getting-started/installation/#now-cli) or [the desktop app](https://zeit.co/docs/v2/getting-started/installation/#now-desktop) -3. Run `now` inside `public/`. This will upload your project to the cloud. +We recommend that you download and [install Now Desktop](https://zeit.co/download) which installs Now CLI and keeps it up-to-date automatically. + +To install Now CLI quickly, use the following: +```shell +npm install -g now +``` -For large project sizes, it is better to install a Node server package (such as `serve`, or `http-server`): +## Step 3: Preparing to Deploy -1. Install a Node server package +With Now CLI installed, we can go on to deploy our previously setup Gatsby project by first creating a `now.json` file with the following contents: -`npm install --save serve` +```json:title=now.json +{ + "version": 2, + "name": "my-gatsby-project", + "builds": [ + { "src": "package.json", "use": "@now/static-build", "config": {"distDir": "public"} } + ] +} +``` -2. Add a `start` script to your `package.json` file. This is what Now will use to run your application: +This will allow Now to understand that we want to use the [latest Now 2.0 version](https://zeit.co/blog/now-2) of [the platform](https://zeit.co/docs/v2/platform/overview/), to set the project name to be `my-gatsby-project`, and to use the [@now/static-build builder](https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build/) to take the `package.json` file as an entrypoint and use the `public` directory as the directory our final content will end up at. +The final setup step is to add a script to the `package.json` which will build our application: ```json:title=package.json { "scripts": { - "start": "serve public/" + ... + "now-build": "npm run build" } } ``` -3. Run `now` at the root of your Gatsby project, this will upload your project, run the `build` script, and then your `start` script. +## Step 4: Deploying + +You can deploy your application by running the following in the root of the project directory, where the `now.json` is: +`now` + +That's all! Your application will now deploy, and you will receive a link similar to the following: https://my-gatsby-project-fhcc9hnqc.now.sh/ -To deploy a custom path, run `now` as: -```shell -$ now /usr/src/project -``` From 0eabb429ad3be3cd3a6b282b09b036b6ab5ba44b Mon Sep 17 00:00:00 2001 From: Timothy <1695613+timothyis@users.noreply.github.com> Date: Mon, 10 Dec 2018 16:50:59 +0000 Subject: [PATCH 2/8] Add reference --- docs/docs/deploying-to-now.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index 59fef56e86f51..f5e76cc0a72a7 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -57,4 +57,7 @@ You can deploy your application by running the following in the root of the proj That's all! Your application will now deploy, and you will receive a link similar to the following: https://my-gatsby-project-fhcc9hnqc.now.sh/ +## References: +- [Deploying Gatsby with Now](https://zeit.co/examples/gatsby/) + From b8fb7817f654d3f089061c4648cbce11eaf33210 Mon Sep 17 00:00:00 2001 From: Timothy <1695613+timothyis@users.noreply.github.com> Date: Mon, 10 Dec 2018 20:56:04 +0000 Subject: [PATCH 3/8] Address review comments --- docs/docs/deploying-to-now.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index f5e76cc0a72a7..4da256d5d1f05 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -7,19 +7,22 @@ title: Deploying to Now This guide will show you how to get started in a few quick steps: ## Step 1: Getting Started with Gatsby -If you haven't already [set up a Gatsby project](https://www.gatsbyjs.org/docs/quick-start) you can do so by using npm's `npx` command in your terminal: +If you haven't already [set up a Gatsby project](https://www.gatsbyjs.org/docs/quick-start) you can do so by first installing Gatsby globally: ```shell -npx gatsby new +npm install --global gatsby-cli ``` -## Step 2: Getting Now +Then generate a project with the following command: +```shell +gatsby new +``` -If you're not acquainted with Now, it is an easy-to-use cloud platform for serverless deployments that you can use from [the command-line](https://zeit.co/docs/v2/getting-started/installation/#now-cli) or [the desktop app](https://zeit.co/docs/v2/getting-started/installation/#now-desktop) +## Step 2: Getting Now -We recommend that you download and [install Now Desktop](https://zeit.co/download) which installs Now CLI and keeps it up-to-date automatically. +You can use Now by installing [Now Desktop](https://zeit.co/docs/v2/getting-started/installation/#now-desktop), which also installs Now CLI and keeps it up-to-date automatically. -To install Now CLI quickly, use the following: +To install Now CLI quickly with npm, use the following: ```shell npm install -g now ``` @@ -53,7 +56,9 @@ The final setup step is to add a script to the `package.json` which will build o ## Step 4: Deploying You can deploy your application by running the following in the root of the project directory, where the `now.json` is: -`now` +```bash +now +``` That's all! Your application will now deploy, and you will receive a link similar to the following: https://my-gatsby-project-fhcc9hnqc.now.sh/ From 03155ce383afd7892f69ded6d4a2cbaa0dcdabd6 Mon Sep 17 00:00:00 2001 From: Dustin Schau Date: Mon, 10 Dec 2018 21:26:18 +0000 Subject: [PATCH 4/8] Update docs/docs/deploying-to-now.md Co-Authored-By: timothyis <1695613+timothyis@users.noreply.github.com> --- docs/docs/deploying-to-now.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index 4da256d5d1f05..bb5f2556ac094 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -2,7 +2,7 @@ title: Deploying to Now --- -[ZEIT Now](https://zeit.co/now) is a [cloud platform for serverless deployment](https://zeit.co/docs/v2/getting-started/introduction-to-now/) that you can use to deploy your Gatsby projects and [alias them](https://zeit.co/docs/v2/domains-and-aliases/aliasing-a-deployment/) to your domain or a free `.now.sh` suffixed URL. +[ZEIT Now](https://zeit.co/now) is a [cloud platform for serverless deployment](https://zeit.co/docs/v2/getting-started/introduction-to-now/) that you can use to deploy your Gatsby projects and [alias them](https://zeit.co/docs/v2/domains-and-aliases/aliasing-a-deployment/) to your personal domain or a free `.now.sh` suffixed URL. This guide will show you how to get started in a few quick steps: From 849e168fadb7f8f8b46d0eb9fa1c4f29b89c87f0 Mon Sep 17 00:00:00 2001 From: Dustin Schau Date: Mon, 10 Dec 2018 21:27:02 +0000 Subject: [PATCH 5/8] Update docs/docs/deploying-to-now.md Co-Authored-By: timothyis <1695613+timothyis@users.noreply.github.com> --- docs/docs/deploying-to-now.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index bb5f2556ac094..66e2b1cf7dc36 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -41,7 +41,11 @@ With Now CLI installed, we can go on to deploy our previously setup Gatsby proje } ``` -This will allow Now to understand that we want to use the [latest Now 2.0 version](https://zeit.co/blog/now-2) of [the platform](https://zeit.co/docs/v2/platform/overview/), to set the project name to be `my-gatsby-project`, and to use the [@now/static-build builder](https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build/) to take the `package.json` file as an entrypoint and use the `public` directory as the directory our final content will end up at. +This `now.json` file will allow us to do several things, specifically: + +- Use the [latest Now 2.0 version](https://zeit.co/blog/now-2) of [the platform](https://zeit.co/docs/v2/platform/overview/) +- Set the project name to `my-gatsby-project` +- Use the [@now/static-build builder](https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build/) to take the `package.json` file as an entrypoint and use the `public` directory as the our content directory The final setup step is to add a script to the `package.json` which will build our application: ```json:title=package.json From 49a3e526d1f867a4314db0e6a508eeb394aad218 Mon Sep 17 00:00:00 2001 From: Dustin Schau Date: Mon, 10 Dec 2018 21:27:16 +0000 Subject: [PATCH 6/8] Update docs/docs/deploying-to-now.md Co-Authored-By: timothyis <1695613+timothyis@users.noreply.github.com> --- docs/docs/deploying-to-now.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index 66e2b1cf7dc36..01fee43222d08 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -47,7 +47,7 @@ This `now.json` file will allow us to do several things, specifically: - Set the project name to `my-gatsby-project` - Use the [@now/static-build builder](https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build/) to take the `package.json` file as an entrypoint and use the `public` directory as the our content directory -The final setup step is to add a script to the `package.json` which will build our application: +The final step is to add a script to the `package.json` which will build our application: ```json:title=package.json { "scripts": { From fe3d08364c5da850e66cbb101cb375508e90e675 Mon Sep 17 00:00:00 2001 From: Dustin Schau Date: Mon, 10 Dec 2018 21:27:27 +0000 Subject: [PATCH 7/8] Update docs/docs/deploying-to-now.md Co-Authored-By: timothyis <1695613+timothyis@users.noreply.github.com> --- docs/docs/deploying-to-now.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index 01fee43222d08..4c27e1928182a 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -69,4 +69,3 @@ That's all! Your application will now deploy, and you will receive a link simila ## References: - [Deploying Gatsby with Now](https://zeit.co/examples/gatsby/) - From 7a0b9fd444fc59e1110a5b55bb493fe9f28b62c2 Mon Sep 17 00:00:00 2001 From: Dustin Schau Date: Mon, 10 Dec 2018 15:35:29 -0600 Subject: [PATCH 8/8] Update deploying-to-now.md --- docs/docs/deploying-to-now.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/docs/deploying-to-now.md b/docs/docs/deploying-to-now.md index 4c27e1928182a..165d94230fb00 100644 --- a/docs/docs/deploying-to-now.md +++ b/docs/docs/deploying-to-now.md @@ -7,6 +7,7 @@ title: Deploying to Now This guide will show you how to get started in a few quick steps: ## Step 1: Getting Started with Gatsby + If you haven't already [set up a Gatsby project](https://www.gatsbyjs.org/docs/quick-start) you can do so by first installing Gatsby globally: ```shell @@ -14,6 +15,7 @@ npm install --global gatsby-cli ``` Then generate a project with the following command: + ```shell gatsby new ``` @@ -23,6 +25,7 @@ gatsby new You can use Now by installing [Now Desktop](https://zeit.co/docs/v2/getting-started/installation/#now-desktop), which also installs Now CLI and keeps it up-to-date automatically. To install Now CLI quickly with npm, use the following: + ```shell npm install -g now ``` @@ -36,7 +39,11 @@ With Now CLI installed, we can go on to deploy our previously setup Gatsby proje "version": 2, "name": "my-gatsby-project", "builds": [ - { "src": "package.json", "use": "@now/static-build", "config": {"distDir": "public"} } + { + "src": "package.json", + "use": "@now/static-build", + "config": { "distDir": "public" } + } ] } ``` @@ -48,6 +55,7 @@ This `now.json` file will allow us to do several things, specifically: - Use the [@now/static-build builder](https://zeit.co/docs/v2/deployments/official-builders/static-build-now-static-build/) to take the `package.json` file as an entrypoint and use the `public` directory as the our content directory The final step is to add a script to the `package.json` which will build our application: + ```json:title=package.json { "scripts": { @@ -60,6 +68,7 @@ The final step is to add a script to the `package.json` which will build our app ## Step 4: Deploying You can deploy your application by running the following in the root of the project directory, where the `now.json` is: + ```bash now ``` @@ -67,5 +76,5 @@ now That's all! Your application will now deploy, and you will receive a link similar to the following: https://my-gatsby-project-fhcc9hnqc.now.sh/ ## References: -- [Deploying Gatsby with Now](https://zeit.co/examples/gatsby/) +- [Deploying Gatsby with Now](https://zeit.co/examples/gatsby/)