wingedfox / dgeni-alive

Live docs on top of dgeni documentation generator
MIT License
26 stars 14 forks source link

deployments=[Deployments can't be blank] #6

Closed a-stangl closed 8 years ago

a-stangl commented 8 years ago

I'm trying to get the Grunt Task running but I pathetically fail

Running "dgeni-alive:all" (dgeni-alive) task
error:   Invalid property in "generateExamplesProcessor" (in "examples" package)
error:    deployments=[Deployments can't be blank]
error:   Invalid property in "generateProtractorTestsProcessor" (in "examples" package)
error:    deployments=[Deployments can't be blank]
error:   Error processing docs:  processor=generateExamplesProcessor, package=examples, deployments=[Deployments can't be blank], processor=generateProtractorTestsProcessor, package=examples, deployments=[Deployments can't be blank]

My Grunt config is rather simple

options: {
    basePath: '',
    port: 10000,
    openBrowser: true
},
all: {
    title: 'My Docs',
    version: '<%= pkg.version %>',
    expand: false,
    deployments: [
        {name: 'local'}
    ],
    dest: '/docs/js/',
    src: ['src/app/**/*.js', 'vendor/angular/angular.js']
}

https://github.com/angular/dgeni-packages#deployment-configuration shows how to set this property but I have no idea how to set this via my Grunt config.

How can I adjust my Grunt config to get rid of this error without disabling the 'examples' package (if possible).

Thanks.

andy-dorman commented 8 years ago

It looks as though these have been hard coded on the examples branch:

https://github.com/wingedfox/dgeni-alive/blob/examples/src/docgen.js

I'm not sure it that helps you though...

I think you have more control over things if you run it from the command line:

var fs = require('fs');
var root = __dirname;
var packages = [
  require('dgeni-alive/src/packages/jsdoc-ext'),
  require('dgeni-alive/src/packages/ngdoc-ext'),
  require('dgeni-alive/src/packages/links-ext'),
  require('dgeni-alive/src/packages/examples-ext')
];
var path = require('path');
var docgen = require('dgeni-alive/src/docgen')();

docgen.Package(packages)
.config(function(log) {
  log.level = 'info';
})
.config(function(templateFinder, renderDocsProcessor, gitData) {
  templateFinder.templateFolders.unshift(path.resolve(root, 'ngdocs/templates'));
})
.config(function(computePathsProcessor, computeIdsProcessor, createDocMessage, getAliases) {
  computeIdsProcessor.idTemplates.push({
    docTypes: ['component'],
    idTemplate: 'module:${module}.${docType}:${name}',
    getAliases: getAliases
  });

  computePathsProcessor.pathTemplates.push({
    docTypes: ['component'],
    pathTemplate: '${area}/${module}/${docType}/${name}',
    outputPathTemplate:
    'partials/${area}/${module}/${docType}/${name}.html'
  });
})
.config(function (generateExamplesProcessor, generateProtractorTestsProcessor) {
  var deployments = [
    {
      name: 'default',
      examples: {
        commonFiles: {
          scripts: 'dist/js',
          stylesheets: 'dist/css'
        }
      }
    }
  ];
  generateExamplesProcessor.deployments = deployments;
  generateProtractorTestsProcessor.deployments = deployments;
})
.config(function (renderDocsProcessor) {
    renderDocsProcessor.extraData.deploymentTarget = 'default';
})
.config(function(generateWebsite) {
  generateWebsite.locals('productTitle', 'Sequoia Product Console');
});
docgen.src(['client/src/**/*.js', 'ngdocs/**/*.ngdoc'])
.dest('jsdocs')
.generate().then(function() {
  console.log('I\'m done!');
});

something like this, run as:

node dgeni.js

from the command line.

This snippet might not work first time as is - I've pulled out environment specific parts from my own script so as not to confuse you...

a-stangl commented 8 years ago

Thanks for the example, @andy-dorman ! So I guess I have to write my own Grunt task for this.

wingedfox commented 8 years ago

@StAn187, thank you for your question.

This feature is not stable yet and probably should be rewritten. Take a look at the following Grunt config: https://github.com/wingedfox/angular-gettext/blob/master/Gruntfile.js

Deployments property is required by dgeni-packages/examples in order to generate runnable examples.

As by now, you have to tweak your Gruntfile or extend docgen package with the necessary properties.

I hope, next weekend I'll add project config file and all these options will be moved there.

wingedfox commented 8 years ago

@andy-dorman, thank you for pointing there, forgot to remove this code.

BadIdeaException commented 8 years ago

Has there been any progress on this? I still get this error no matter what I do...

Nevermind, it does work now with v0.2.2 - but I had to clone that with git, it's not on npm yet. Mind pushing it there? :)

wingedfox commented 8 years ago

@chris-33, 0.3.1 is there