You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/blog/2019-01-01-publish-multiple-gatsby-sites/index.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -477,7 +477,7 @@ node_js:
477
477
cache: yarn
478
478
479
479
install:
480
-
- yarn global add lerna jest now
480
+
- yarn global add lerna jest vercel
481
481
- lerna bootstrap
482
482
483
483
matrix:
@@ -494,7 +494,7 @@ script:
494
494
495
495
deploy:
496
496
provider: script
497
-
script: now public --token $VERCEL_TOKEN
497
+
script: vercel public --token $VERCEL_TOKEN
498
498
skip_cleanup: true
499
499
app: $PACKAGE_NAME
500
500
```
@@ -506,9 +506,9 @@ Note that we’ve added some additional environment variables to our matrix so a
506
506
- skip_cleanup — we don’t want Travis to get rid of any files made during the build. We created the ‘public’ folder when running the build, so we don’t want Travis to get rid of it.
507
507
- app — specifies the name of the application we’re deploying,
508
508
509
-
We have to do add a little bit of configuration on our side to ensure that Vercel hosts our sites correctly. The config comes in the form of a `now.json` file, which outlines the options we want Vercel to use when deploying our site. Go into the directory for our blog packages and create a `now.json` file. We want to let Vercel know that we’re deploying a static site, the entry directory to the static site, and what alias we want to assign our site. Put this inside your `now.json` file.
509
+
We have to do add a little bit of configuration on our side to ensure that Vercel hosts our sites correctly. The config comes in the form of a `vercel.json` file, which outlines the options we want Vercel to use when deploying our site. Go into the directory for our blog packages and create a `vercel.json` file. We want to let Vercel know that we’re deploying a static site, the entry directory to the static site, and what alias we want to assign our site. Put this inside your `vercel.json` file.
510
510
511
-
```json:title=now.json
511
+
```json:title=vercel.json
512
512
{
513
513
"type": "static",
514
514
"alias": "lerna-monorepo-blog",
@@ -524,7 +524,7 @@ Note: `public: true` needs to be specified since you’ll most likely have a fre
524
524
525
525
Push these changes to your repo to kick off your build pipeline. If everything was successful then your build will have passed and your site will have deployed. Go to Travis, open up your blog build so you have access to the logs. Scroll right to the bottom to where it says ‘deploying application’ and uncollapse the section. This’ll be the URL that Vercel deployed your site to. It should look something like `https://buildsjdoe383jd.vercel.app`. Copy that url and go back to your command line. Run the following command:
526
526
527
-
`now alias <your randomly generated URL> <your chosen alias>`
527
+
`vercel alias <your randomly generated URL> <your chosen alias>`
528
528
I chose ‘lerna-monorepo-blog’ as my alias, so that one won’t be available for you to use, so choose your own. When you’ve run the command, there will be feedback saying that the alias was successfully created. If not, then it’s likely the command was written incorrectly or the alias is already in use by someone else. Once you’ve added an alias successfully for the blog, do the same for your shop package.
529
529
530
530
Even if you push everything forward now the site’s navigation will still be broken. The very last thing we need to do is add our alias URL as an environment variables in our `.env.production` file. In your blog package’s `.env.production` go ahead and add the following:
@@ -565,7 +565,7 @@ If your CI pipeline isn’t deploying your site correctly, it can be difficult t
565
565
566
566
Deploying your application:
567
567
568
-
If running the now command in your package throws an error, then make sure you’re logged in to Vercel via the CLI. You can do this via Vercel login. Make sure that your `now.json` file points to the correct output of yarn build. It may be your version of Gatsby doesn’t create a build directory called `public` but instead `dist` or `build`.
568
+
If running the now command in your package throws an error, then make sure you’re logged in to Vercel via the CLI. You can do this via Vercel login. Make sure that your `vercel.json` file points to the correct output of yarn build. It may be your version of Gatsby doesn’t create a build directory called `public` but instead `dist` or `build`.
0 commit comments