rjelierse / dgeni-skeleton

Skeleton for dgeni documentation generator
0 stars 0 forks source link

How to override default /api path to /sdk #1

Open dgavigan opened 9 years ago

dgavigan commented 9 years ago

Appreciate all the help so far. This project has helped me a lot. That said I'm back with another quesiton =).

Per the blog, I found the area.js tag-deg within ng-doc. I too am attempting to move this from the default api to a new path.

Simply changing:

  return (doc.fileInfo.extension === 'js') ? 'api' : doc.fileInfo.relativePath.split('/')[0];

to

   return (doc.fileInfo.extension === 'js') ? 'sdk' : doc.fileInfo.relativePath.split('/')[0];

results in an error where its can't make the paths anymore for the modules. I'm guessing there is more to setting this new path other than just telling *.js files to go to a new sdk area. Does this new path have to be defined somewhere else?

I also tried to create a new area.js and load from the lib/dgeni/scaffolding/inline-tag-defs

var area = require('./inline-tag-defs/area');

module.exports = new Package('scaffolding', [ngdoc])
  .factory(getVersion.name, getVersion)
  .factory(gitData.name, gitData)
  .factory(deployment.name, deployment)
  .factory(type.name, type)
  .factory(area.name, area)
....

While this doesn't result in an error, it just takes the default /api ... most likely because the native area.js gets defined last within ng-doc

rjelierse commented 9 years ago

To override the area tag, you should create a new tag definition in the tag-defs and add it as following:

module.exports = new Package('scaffolding', [ngdoc])
  // ... 
  .config(function(parseTagsProcessor, getInjectables) {
    parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions.concat(getInjectables([require('./tag-defs/area')]));
  })

For the path change, there are more things you'll need to change:

dgavigan commented 9 years ago

had to switch gears for a bit. i will give it a go later today and get back to you. thanks for the help again.

dgavigan commented 9 years ago

.... One month later

Trying to get back to this, and little fuzzy after some time, but most is coming back to me =)

The templates are resolved with the api area path, so you need to copy the templates to scaffolding under the sdk prefix.

I've copied the templates into a subdirectory of /sdk

screen shot 2015-08-14 at 2 28 08 pm

However, whenever I try to build, I keep getting errors that it can't find anything with such pattern:

screen shot 2015-08-14 at 2 28 21 pm

100% sure I am doing something (or many) things wrong. Any advice?

Thanks