Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base path is not auto-set to "/" (default) causes ENOENT: no such file or directory #59

Closed
aaronmallen opened this issue Nov 14, 2018 · 11 comments
Labels
bug v3 Fixed or implemented. To be released.

Comments

@aaronmallen
Copy link

given the following configuration:

{
  "src": [
      {
        "my-lib": [
          "./src/**",
          "!./src/errors/**"
        ]
      },
      "./CHANGELOG.md",
      "./CODE_OF_CONDUCT.md",
      "./CONTRIBUTING.md",
      "./docs/**/*.md"
    ],
  "dest": "./.docma",
  "app": {
    "title": "MyLib",
    "entrance": "content:readme",
    "server": "github",
    "routing": "path"
  }
}

images in the left navigation begin to break and terminal errors are logged:

Error: ENOENT: no such file or directory, stat '$MY_PROJECT/.docma/api/img/tree-parent.png'
Error: ENOENT: no such file or directory, stat '$MY_PROJECT/.docma/api/img//tree-folded.png'
Error: ENOENT: no such file or directory, stat '$MY_PROJECT/.docma/api/img/tree-parent.png'

This appears to be related to setting app.routing to "path" as setting it back to "query" seems to resolve the issue.

@onury
Copy link
Owner

onury commented Nov 15, 2018

Just try adding "base": "/" for app configuration.

@aaronmallen
Copy link
Author

Shouldn't it already be that since I don't have it defined and that's the default value according to the documentation?

@onury
Copy link
Owner

onury commented Nov 15, 2018

Right. I'll fix that with the next release.

Should I assume setting the base resolved your issue?

@aaronmallen
Copy link
Author

At first glance that appears to be the case yes, however I should highlight that this isn't consistently reproducible (i.e. refreshing the page also appeared to fix it until the next build run)

@onury
Copy link
Owner

onury commented Nov 15, 2018

I think that's might be because on the first load the initial page is redirected by the SPA and then you hit reload with the new route. Is that the case?

@aaronmallen
Copy link
Author

Yeah actually it appears that applying "base": "/" does completely fix the issue, I just did 3 rebuilds in a row without seeing the images break. Now if I could just get you to make JSDoc work nicely with multi file libs I'd be in doc heaven 😂 Awesome tool btw thank you so much for this library.

@onury onury changed the title routing path causes Error: ENOENT: no such file or directory Base path is not auto-set to "/" (default) causes ENOENT: no such file or directory Nov 15, 2018
@onury onury added the bug label Nov 15, 2018
@onury
Copy link
Owner

onury commented Nov 15, 2018

You're welcome.

Now if I could just get you to make JSDoc work nicely with multi file libs I'd be in doc heaven

How do you mean? Docma already supports grouping multiple JS files documented under the same route and you can have multiples of that too, if that's what you mean.

@aaronmallen
Copy link
Author

aaronmallen commented Nov 15, 2018

Its not a docma issue really, I don't like having to explicitly name functions in certain situations when using ecma 6. For example:

// index.js
import Component1 from './component-1.js'
import Component2 from './component-2.js'
/** 
 * The primary module
 * @module MyLib
 *
 */
export default {
  Component1,
  Component2
}

// component-1.js

/**
 * The Component1 class
 * @memberof MyLib <- why is this necessary when I'm clearly exporting it in index.js
 */
class Component1 {...}
export default Component1

// component-2.js

/**
 * Component2
 * @function MyLib#Component2 <- why???
 * @param {string} arg - the argument for the function.
 * @returns {Object}
 */
function Component2 (arg) {
  return {
   /**
    * @function MyLib#Component2#someFn <- this basically never works correctly.
    */
    someFn: function () {...},
    /**
     * @function MyLib#Componet2#someOtherFn
     */
   someOtherFn: function () {...}
  }
}
export default Component2

@onury
Copy link
Owner

onury commented Nov 15, 2018

:) Unfortunately that's how JSDoc works.

If you don't want to use @memberof or @name to force organize; maybe you should use @namespace tag.

class Component1 { }
function Component2() { }

/**
 * MyLib namespace...
 * @namespace
 */
const MyLib = {
    /**
     * Component1
     */
    Component1,
    /**
     * Component2
     */
    Component2
};

export default MyLib;

@aaronmallen
Copy link
Author

yeah its just a small nag I have... I actually really hate the namespace feature as it's not overly apparent what a "namespace" is.

@onury onury added Fixed or implemented. To be released. v3 labels Nov 16, 2018
@onury
Copy link
Owner

onury commented Nov 18, 2018

Released with Docma v3.0.0.

@onury onury closed this as completed Nov 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v3 Fixed or implemented. To be released.
Projects
None yet
Development

No branches or pull requests

2 participants