doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.6k stars 1.46k forks source link

Issues when trying to add Docz to an existing Gatsby project #1633

Closed cristiulian closed 2 years ago

cristiulian commented 3 years ago

Bug Report

Following the steps from here: https://www.gatsbyjs.com/tutorial/writing-documentation-with-docz/ When running the develop script, I get a bunch of errors.

To Reproduce

  1. gatsby new my-gatsby-site-with-docz
  2. cd my-gatsby-site-with-docz
  3. npm install gatsby-theme-docz docz
  4. Add gatsby-theme-docz under plugins in gatsby-config.js
    
    module.exports = {
    siteMetadata: {
    title: `Gatsby Default Starter`,
    description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
    author: `@gatsbyjs`,
    },
    plugins: [
    `gatsby-theme-docz`,
    `gatsby-plugin-react-helmet`,
    `gatsby-plugin-image`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
    `gatsby-plugin-gatsby-cloud`,
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
    ],
    }
5. Create ./src/docs/index.mdx with some basic content.
```mdx
---
name: Getting Started
route: /
---
# Getting Started
## Hello world
Type here the most beautiful getting started that you ever saw!
  1. Run npm run develop ("gatsby develop" in package.json)
  2. Get these errors:
> gatsby-starter-default@0.1.0 develop D:\_GIT\my-gatsby-site-with-docz
> gatsby develop

info

There are 6 other flags available that you might be interested in:
- FAST_DEV · Enable all experiments aimed at improving develop server start time
- DEV_SSR · (Umbrella Issue (https://gatsby.dev/dev-ssr-feedback)) · Server Side Render (SSR) pages on full reloads during develop. Helps you detect SSR bugs and fix them without needing to do full builds.
- PRESERVE_WEBPACK_CACHE · (Umbrella Issue (https://gatsby.dev/cache-clearing-feedback)) · Use webpack's persistent caching and don't delete webpack's cache when changing gatsby-node.js &  
gatsby-config.js files.
- PRESERVE_FILE_DOWNLOAD_CACHE · (Umbrella Issue (https://gatsby.dev/cache-clearing-feedback)) · Don't delete the downloaded files cache when changing gatsby-node.js & gatsby-config.js     
files.
- PARALLEL_SOURCING · EXPERIMENTAL · (Umbrella Issue (https://gatsby.dev/parallel-sourcing-feedback)) · Run all source plugins at the same time instead of serially. For sites with multiple 
source plugins, this can speedup sourcing and transforming considerably.
- FUNCTIONS · EXPERIMENTAL · (Umbrella Issue (https://gatsby.dev/functions-feedback)) · Compile Serverless functions in your Gatsby project and write them to disk, ready to deploy to Gatsby Cloud

success open and validate gatsby-configs - 1.999s
warn Plugin gatsby-source-filesystem is not compatible with your gatsby version 3.4.1 - It requires gatsby@^2.2.0
warn Plugin gatsby-plugin-emotion is not compatible with your gatsby version 3.4.1 - It requires gatsby@^2.0.0
warn Plugin gatsby-source-filesystem is not compatible with your gatsby version 3.4.1 - It requires gatsby@^2.2.0
warn Plugin gatsby-plugin-emotion is not compatible with your gatsby version 3.4.1 - It requires gatsby@^2.0.0
success load plugins - 2.790s
success onPreInit - 0.048s
success initialize cache - 0.026s
success copy gatsby files - 0.274s
success onPreBootstrap - 0.055s
success createSchemaCustomization - 0.008s

 ERROR #11321  PLUGIN

"gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle:

unknown: Expected corresponding JSX closing tag for <img> (43:216)

  41 | <h2>{`� Quick start (Gatsby Cloud)`}</h2>
  42 | <p>{`Deploy this starter with one click on `}<a parentName="p" {...{"href":"https://www.gatsbyjs.com/cloud/"}}>{`Gatsby Cloud`}</a>{`:`}</p>
> 43 | <p><a parentName="p" {...{"href":"https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-default"}}><img 
src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud"></a></p>
     |
                                  ^
  44 | <h2>{`� What's inside?`}</h2>
  45 | <p>{`A quick look at the top-level files and directories you'll see in a Gatsby project.`}</p>
  46 | <pre><code parentName="pre" {...{}}>{`.D:/_GIT/my-gatsby-site-with-docz/README.md: unknown: Expected corresponding JSX closing tag for <img> (43:216)

  41 | <h2>{`� Quick start (Gatsby Cloud)`}</h2>
  42 | <p>{`Deploy this starter with one click on `}<a parentName="p" {...{"href":"https://www.gatsbyjs.com/cloud/"}}>{`Gatsby Cloud`}</a>{`:`}</p>
> 43 | <p><a parentName="p" {...{"href":"https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-default"}}><img 
src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud"></a></p>
     |
                                  ^
  44 | <h2>{`� What's inside?`}</h2>
  45 | <p>{`A quick look at the top-level files and directories you'll see in a Gatsby project.`}</p>
  46 | <pre><code parentName="pre" {...{}}>{`.

  SyntaxError: unknown: Expected corresponding JSX closing tag for <img> (43:216)
    41 | <h2>{`� Quick start (Gatsby Cloud)`}</h2>
    42 | <p>{`Deploy this starter with one click on `}<a parentName="p" {...{"href":"https://www.gatsbyjs.com/cloud/"}}>{`  3mGatsby Cloud`}</a>{`:`}</p>
  > 43 | <p><a parentName="p" {...{"href":"https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-default"}}><img 
src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud"></a></p>
       |
                                      ^
    44 | <h2>{`� What's inside?`}</h2>
    45 | <p>{`A quick look at the top-level files and directories you'll see in a Gatsby project.`}</p  3m>
    46 | <pre><code parentName="pre" {...{}}>{`.D:/_GIT/my-gatsby-site-  with-docz/README.md: unknown: Expected corresponding JSX closing tag for <img> (43:216)
    41 | <h2>{`� Quick start (Gatsby Cloud)`}</h2>
    42 | <p>{`Deploy this starter with one click on `}<a parentName="p" {...{"href":"https://www.gatsbyjs.com/cloud/"}}>{`  3mGatsby Cloud`}</a>{`:`}</p>
  > 43 | <p><a parentName="p" {...{"href":"https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-default"}}><img 
src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud"></a></p>
       |
                                      ^
    44 | <h2>{`� What's inside?`}</h2>
    45 | <p>{`A quick look at the top-level files and directories you'll see in a Gatsby project.`}</p  3m>
    46 | <pre><code parentName="pre" {...{}}>{`.

  - error.js:97 Object._raise
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/error.js:97:45

  - error.js:92 Object.raiseWithData
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/error.js:92:17

  - error.js:41 Object.raise
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/error.js:41:17

  - index.js:510 Object.jsxParseElementAt
    [my-gatsby-site-with-docz]/[@babel]/parser/src/plugins/jsx/index.js:510:18

  - index.js:467 Object.jsxParseElementAt
    [my-gatsby-site-with-docz]/[@babel]/parser/src/plugins/jsx/index.js:467:34

  - index.js:467 Object.jsxParseElementAt
    [my-gatsby-site-with-docz]/[@babel]/parser/src/plugins/jsx/index.js:467:34

  - index.js:467 Object.jsxParseElementAt
    [my-gatsby-site-with-docz]/[@babel]/parser/src/plugins/jsx/index.js:467:34

  - index.js:546 Object.jsxParseElement
    [my-gatsby-site-with-docz]/[@babel]/parser/src/plugins/jsx/index.js:546:19

  - index.js:557 Object.parseExprAtom
    [my-gatsby-site-with-docz]/[@babel]/parser/src/plugins/jsx/index.js:557:21

  - expression.js:615 Object.parseExprSubscripts
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/expression.js:615:23

  - expression.js:595 Object.parseUpdate
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/expression.js:595:21

  - expression.js:562 Object.parseMaybeUnary
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/expression.js:562:23

  - expression.js:366 Object.parseExprOps
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/expression.js:366:23

  - expression.js:331 Object.parseMaybeConditional
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/expression.js:331:23

  - expression.js:286 Object.parseMaybeAssign
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/expression.js:286:21

  - expression.js:241 
    [my-gatsby-site-with-docz]/[@babel]/parser/src/parser/expression.js:241:12

 ERROR #11321  PLUGIN

"gatsby-theme-docz" threw an error while running the sourceNodes lifecycle:

repo.browsetemplate.replace is not a function

  TypeError: repo.browsetemplate.replace is not a function

  - index.js:745 getRepoUrl
    [my-gatsby-site-with-docz]/[docz-core]/dist/index.js:745:62

  - index.js:783 getInitialConfig
    [my-gatsby-site-with-docz]/[docz-core]/dist/index.js:783:19

  - index.js:817 Object.state [as config]
    [my-gatsby-site-with-docz]/[docz-core]/dist/index.js:817:19

  - sourceNodes.js:23 Object.module.exports
    [my-gatsby-site-with-docz]/[gatsby-theme-docz]/lib/sourceNodes.js:23:12

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - api-runner-node.js:434 runAPI
    [my-gatsby-site-with-docz]/[gatsby]/src/utils/api-runner-node.js:434:16

warn The gatsby-theme-docz plugin has generated no Gatsby nodes. Do you need it?
success Checking for changed pages - 0.004s
success source and transform nodes - 1.388s

 ERROR

Missing onError handler for invocation 'building-schema', error was 'Error: TypeError[File.publicURL]: Cannot convert to OutputType the following value: Object({ type: String, args:        
Object({  }), description: "Copy file to static directory and return public url to it", resolve: [function resolve] })'. Stacktrace was 'Error: TypeError[File.publicURL]: Cannot convert to 
OutputType the following value: Object({ type: String, args: Object({  }), description: "Copy file to static directory and return public url to it", resolve: [function resolve] })
    at TypeMapper.convertOutputFieldConfig (D:\_GIT\my-gatsby-site-with-docz\node_modules\graphql-compose\lib\TypeMapper.js:320:13)
    at ObjectTypeComposer.setField (D:\_GIT\my-gatsby-site-with-docz\node_modules\graphql-compose\lib\ObjectTypeComposer.js:215:114)
    at D:\_GIT\my-gatsby-site-with-docz\node_modules\graphql-compose\lib\ObjectTypeComposer.js:242:14
    at Array.forEach (<anonymous>)
    at ObjectTypeComposer.addNestedFields (D:\_GIT\my-gatsby-site-with-docz\node_modules\graphql-compose\lib\ObjectTypeComposer.js:235:28)
    at forEach (D:\_GIT\my-gatsby-site-with-docz\node_modules\gatsby\src\schema\schema.js:750:39)
    at Array.forEach (<anonymous>)
    at D:\_GIT\my-gatsby-site-with-docz\node_modules\gatsby\src\schema\schema.js:750:18
    at async Promise.all (index 31)
    at updateSchemaComposer (D:\_GIT\my-gatsby-site-with-docz\node_modules\gatsby\src\schema\schema.js:190:3)
    at buildSchema (D:\_GIT\my-gatsby-site-with-docz\node_modules\gatsby\src\schema\schema.js:64:3)
    at build (D:\_GIT\my-gatsby-site-with-docz\node_modules\gatsby\src\schema\index.js:105:18)
    at buildSchema (D:\_GIT\my-gatsby-site-with-docz\node_modules\gatsby\src\services\build-schema.ts:19:3)'

⠇ building schema

It gets stuck here.

Environment

pedronauck commented 3 years ago

Hi dude, I'm updating all dependencies in order to launch v2.4 with an updated and stabled version of Docz. I think next week I'll get with this, after that we can maybe go back here and see if will happen this yet.

mosesoak commented 2 years ago

I tried to add Docz to a Gatsby 3 site and got a build error right off, so I'll probably be trying out other similar libs -- any plans to support Gatsby 3?

$ docz dev

Building app
warn Plugin gatsby-source-filesystem is not compatible with your gatsby version 3.9.1 - It requires
gatsby@^2.2.0
warn Plugin gatsby-plugin-emotion is not compatible with your gatsby version 3.9.1 - It requires gatsby@^2.0.0
warn Plugin gatsby-source-filesystem is not compatible with your gatsby version 3.9.1 - It requires
gatsby@^2.2.0
warn Plugin gatsby-plugin-emotion is not compatible with your gatsby version 3.9.1 - It requires gatsby@^2.0.0

 ERROR 

Error in "/home/mg/projects/acb001/node_modules/gatsby-plugin-netlify/gatsby-node.js": Cannot read property
'RawSource' of undefined

  TypeError: Cannot read property 'RawSource' of undefined

  - WebpackAssetsManifest.js:17 Object.<anonymous>
    [acb001]/[webpack-assets-manifest]/src/WebpackAssetsManifest.js:17:47

  - v8-compile-cache.js:192 Module._compile
    [acb001]/[v8-compile-cache]/v8-compile-cache.js:192:30

  - loader.js:1157 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1157:10

  - loader.js:985 Module.load
    internal/modules/cjs/loader.js:985:32

  - loader.js:878 Function.Module._load
    internal/modules/cjs/loader.js:878:14

  - loader.js:1025 Module.require
    internal/modules/cjs/loader.js:1025:19

  - v8-compile-cache.js:159 require
    [acb001]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - gatsby-node.js:5 Object.<anonymous>
    [acb001]/[gatsby-plugin-netlify]/gatsby-node.js:5:53

  - v8-compile-cache.js:192 Module._compile
    [acb001]/[v8-compile-cache]/v8-compile-cache.js:192:30

  - loader.js:1157 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1157:10

  - loader.js:985 Module.load
    internal/modules/cjs/loader.js:985:32

  - loader.js:878 Function.Module._load
    internal/modules/cjs/loader.js:878:14

  - loader.js:1025 Module.require
    internal/modules/cjs/loader.js:1025:19

  - v8-compile-cache.js:159 require
    [acb001]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - resolve-module-exports.ts:197 resolveModuleExports
    [acb001]/[gatsby]/src/bootstrap/resolve-module-exports.ts:197:26

  - validate.ts:349 
    [acb001]/[gatsby]/src/bootstrap/load-plugins/validate.ts:349:31

not finished open and validate gatsby-configs, load plugins - 2.130s
renatobenks commented 2 years ago

Hey @mosesoak, we're actually working right now to upgrade all our dependencies, so supporting gatsby v3 it's totally in our plans, but even it's on the road. Unfortunately, we don't have a perspective yet about when we're going to launch it, once we're using this for doing some new stuff to avoid further regressive issues.

renatobenks commented 2 years ago

I'll be closing this one as we're going to wanna get it solved in a single issue (https://github.com/doczjs/docz/issues/1654), as referred above. If it's happening also in a web environment (or non-react-native projects), please, open a new issue.