documentationjs / gulp-documentation

Use gulp with documentation to generate great documentation for your JavaScript projects.
http://documentation.js.org/
BSD 2-Clause "Simplified" License
64 stars 14 forks source link

Recursion doesn't seem to be working #12

Open kwhitaker opened 8 years ago

kwhitaker commented 8 years ago

When I attempt to run my gulp-documentation task, it works fine on the file pointed to as the src, but won't recurse into any of my imported files.

Here's the task in question:

gulp.task('docs', () => {
  return gulp.src('src/init.jsx')
    .pipe(documentation({format: 'md', filename: 'api.md'}))
    .pipe(gulp.dest('docs'))
})

and the command I use to run my gulp task:

NODE_PATH=$NODE_PATH:src NODE_ENV=development babel-node ./node_modules/.bin/gulp docs
tmcw commented 8 years ago

Are you using CommonJS or es6 imports? Can you share a link to the source code, or any other details?

kwhitaker commented 8 years ago

@tmcw I'm using ES6 imports.

Here's a snippet of the source code:

import {connect} from 'react-redux'
import {fetchConfig} from 'state/config'
import Config from 'components/ecosystems/config'
import React, {PropTypes} from 'react'
import TitleBar from 'components/molecules/title-bar'
import NotFound from 'components/organisms/not-found'
import SiteFooter from 'components/atoms/site-footer'
import './global.sass'

/**
 * The Layout component is the top-level component of the app.
 */
export class Layout extends React.Component {

  static propTypes = {
    config: PropTypes.shape({
      existing: PropTypes.bool,
      error: PropTypes.object,
      loading: PropTypes.bool.isRequired,
      serverSettings: PropTypes.shape({
        hostName: PropTypes.string,
        userName: PropTypes.string,
        password: PropTypes.string,
        version: PropTypes.string,
      }),
    }),
    development: PropTypes.bool,
    dispatch: PropTypes.func,
    fetchConfig: PropTypes.func,
    router: PropTypes.shape({
      url: PropTypes.string,
      route: PropTypes.shape({
        name: PropTypes.string,
        options: PropTypes.object,
      }),
    }),
  };

  componentDidMount() {
    this.props.fetchConfig()
  }

  /**
   * Only include DevTools if in development.
   * @returns {React.Component}
   */
  renderDevTools() {
    if (this.props.development) {
      const DevTools = require('utils/dev-tools')
      return <DevTools/>
    }
    return null
  }

  /**
   * Return the main content selected by the current route.
   * @returns {React.Component}
   */
  renderMainContent() {
    const {config} = this.props
    if (!config.existing) {
      return <Config isFetching={config.loading}/>
    }

    switch (this.props.router.route.name) {
      case 'config':
        return <Config/>
      default:
        return <NotFound path={this.props.router.url}/>
    }
  }

  render() {
    const {config, router} = this.props
    const existingConfig = config.existing && !config.loading

    return (
      <div>
        <TitleBar currentRoute={router.route.name} showNav={existingConfig}/>
        {this.renderMainContent()}
        <SiteFooter version={config.serverSettings.version}/>
        {this.renderDevTools()}
      </div>
    )
  }

}

export default connect(
  state => ({
    router: state.router,
    config: state.config.toJS(),
  }), {fetchConfig}
)(Layout)
jgrauel commented 8 years ago

I am having the same issue with CommonJS requires.