radomako / docz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docz

In this example, we create a docz project and make it ready for deployment on Now in just a few steps.

If you have already got a docz project setup, feel free to skip to Step 2 of this example guide.

Step 1: Getting Started with docz

First, to get up-and-running with docz, install it as a dependency in the project folder you are working in:

yarn add --dev docz

Once it is installed, open the package.json file and add the following scripts:

{
  ...
  "scripts": {
    "dev": "docz dev",
    "build": "docz build"
  }
}

You can now build and launch your docz project locally by running:

yarn dev

Initially, the project will not have any content, but you can add a file anywhere in the project that includes a .mdx file extension. You can create a simple file that has a name, some content, and tells docz that the route should be /:

---
name: Hello world
route: /
---

# Hello world!

I'm a documentation page, using MDX, created using [docz](https://docz.site) and deployed with [ZEIT Now](https://zeit.co/now)!

With our docz project running, with the dev script, you will now see our newly created documentation page built and at the root of our project URL!

Step 2: Preparing to Deploy

To deploy to Now, you need to tell Now how to build our docz project. You can do this by first creating a now.json file:

{
  "version": 2,
  "name": "my-docz-project",
  "builds": [
    { "src": "package.json", "use": "@now/static-build" }
  ]
}

The above configures the project to:

However, the @now/static-build builder requires that you pass it instructions on how to build it and that the subsequent build is placed in the dist directory unless otherwise specified.

To tell docz to place our build in the dist directory, you can create a doczrc.js file with the following contents:

export default {
  dest: '/dist'
}

Next, you can provide Now with the necessary build instructions by adding a now-build script to the package.json file:

{
  ...
  "scripts": {
    ...
    "now-build": "yarn build"
  }
}

And that's all. Your docz project is ready to be deployed to Now.

Step 3: Deploying to Now

The final step is to run the following in your terminal, from the root of your docz project:

now

Resources

About


Languages

Language:JavaScript 100.0%