doczjs / docz

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

Port not used from custom gatsby-config.js file #1716

Open glassdimlygr opened 2 years ago

glassdimlygr commented 2 years ago

Bug Report

When I create custom gatsby-config.jswith a port and p setting of 3001, docz still runs on 3000.

To Reproduce

  1. create-docz-app my-docz-app && cd my-docz-app
  2. yarn docz:dev
  3. make gatsby-config.js in root with cp .docz/gatsby-config.js ../
  4. replace 3000 with 3001

Expectation: docz runs on port 3001.

Reality: it runs on 3000.

I did some console logging and was able to see that the config is properly merged and the output config has 3001.

{
    final: '[{"resolve":"gatsby-theme-docz","options":{"themeConfig":{},"src":"./","gatsbyRoot":null,"themesDir":"src","mdxExtensions":[".md",".mdx"],"docgenConfig":{},"menu":[],"m
  dPlugins":[],"hastPlugins":[],"ignore":[],"typescript":false,"ts":false,"propsParser":true,"props-parser":true,"debug":false,"native":false,"openBrowser":null,"o":null,"open":nul
  l,"open-browser":null,"port":4838,"p":4838,"root":"/Users/<redacted>/www/<redacted>/.docz","base":"/","source":"./","gatsby-root":null,"files":"**/*.{md,markdown,mdx}","public":"/public
  ","dest":".docz/dist","d":".docz/dist","editBranch":"master","eb":"master","edit-branch":"master","config":"","title":"<redacted>","description":"My awesome app using
  docz","host":"localhost","separator":"-","paths":{"root":"/Users/<redacted>/www/<redacted>","templates":"/Users/<redacted>/www/<redacted>/node_modules/docz-core/dist/templates","docz":"/Users/
  <redacted>/www/<redacted>/.docz","cache":"/Users/<redacted>/www/<redacted>/.docz/.cache","app":"/Users/<redacted>/www/<redacted>/.docz/app","appPackageJson":"/Users/<redacted>/www/<redacted>/package.json","
  appTsConfig":"/Users/<redacted>/www/<redacted>/tsconfig.json","gatsbyConfig":"/Users/<redacted>/www/<redacted>/gatsby-config.js","gatsbyBrowser":"/Users/<redacted>/www/<redacted>/gatsby-browser.js","
  gatsbyNode":"/Users/<redacted>/www/<redacted>/gatsby-node.js","gatsbySSR":"/Users/<redacted>/www/<redacted>/gatsby-ssr.js","importsJs":"/Users/<redacted>/www/<redacted>/.docz/app/imports.js","rootJs"
  :"/Users/<redacted>/www/<redacted>/.docz/app/root.jsx","indexJs":"/Users/<redacted>/www/<redacted>/.docz/app/index.jsx","indexHtml":"/Users/<redacted>/www/<redacted>/.docz/app/index.html","db":"/User
  s/<redacted>/www/<redacted>/.docz/app/db.json"}}},{"resolve":"gatsby-theme-docz","options":{"themeConfig":{},"src":"./","gatsbyRoot":null,"themesDir":"src","mdxExtensions":[".md",".mdx"
  ],"docgenConfig":{},"menu":[],"mdPlugins":[],"hastPlugins":[],"ignore":[],"typescript":false,"ts":false,"propsParser":true,"props-parser":true,"debug":false,"native":false,"openB
  rowser":null,"o":null,"open":null,"open-browser":null,"root":"/Users/<redacted>/www/<redacted>/.docz","base":"/","source":"./","gatsby-root":null,"files":"**/*.{md,markdown,mdx}","publi
  c":"/public","dest":".docz/dist","d":".docz/dist","editBranch":"master","eb":"master","edit-branch":"master","config":"","title":"<redacted>","description":"My awesome app using
  docz","host":"localhost","port":3001,"p":3001,"separator":"-","paths":{"root":"/Users/<redacted>/www/<redacted>","templates":"/Users/<redacted>/www/<redacted>/node_modules/docz-core/dist/templ
  ates","docz":"/Users/<redacted>/www/<redacted>/.docz","cache":"/Users/<redacted>/www/<redacted>/.docz/.cache","app":"/Users/<redacted>/www/<redacted>/.docz/app","appPackageJson":"/Users/<redacted>/www/rat
  e.com/package.json","appTsConfig":"/Users/<redacted>/www/<redacted>/tsconfig.json","gatsbyConfig":"/Users/<redacted>/www/<redacted>/gatsby-config.js","gatsbyBrowser":"/Users/<redacted>/www/<redacted>
  /gatsby-browser.js","gatsbyNode":"/Users/<redacted>/www/<redacted>/gatsby-node.js","gatsbySSR":"/Users/<redacted>/www/<redacted>/gatsby-ssr.js","importsJs":"/Users/<redacted>/www/<redacted>/.docz/app
  /imports.js","rootJs":"/Users/<redacted>/www/<redacted>/.docz/app/root.jsx","indexJs":"/Users/<redacted>/www/<redacted>/.docz/app/index.jsx","indexHtml":"/Users/<redacted>/www/<redacted>/.docz/app/in
  dex.html","db":"/Users/<redacted>/www/<redacted>/.docz/app/db.json"}}}]'
  }

Workaround:

Specify port in package.json like so "docz:dev": "docz dev --port=3001",