question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ember specific documentation

See original GitHub issue

Hi! I was talking to @samselikoff at EmberConf and was working on some stuff for a styleguide internally at Condé. Currently, I have some code that will extract out positional / named parameters from helpers and generating appropriate documentation according to that. I’m wondering if it would be good to move that to an open source repository that the ember-learn team can collaborate on so we can all get the benefits.

The current bit of code I have does the following:

  • Pulls the type of the module according to Ember semantics (if it’s in app/components it’s a component)
  • Pulls public / private info according to the name of the file (if it starts with a - or it’s nested, since nested components usually imply that they’re private). With the new module layout, this will be much easier and we can identify whether they are global / local
  • Parses the javascript to identify positional and named parameters in helpers, then mapping those names back to the parameters named in the JSDoc:
    import { helper } from '@ember/component/helper';
    /**
       Say hello!
       @param {string} name Who to say hello to
     */
    export function hello([name]) {
       return `Hello, ${name}`;
    }
    export default helper(hello);
    
    The helper above would generate a doc blob that looks like:
    {
      type: 'helper',
      name: 'hello',
      description: '<p>Say hello!</p>',
      parameters: {
        positional: [{
          name: 'name',
          type: 'string',
          description: 'Who to say hello to'
        }]
      }
    }
    
  • Compiles @example blocks to make it easy to render these in documentation. I like this because it enforces that not only the documentation is up to date, but the actual code examples for developers are up to date.
  • Automatically provides a list of injected services / controllers on a given module.

I think that most of this could be very valuable to the community. However, I really just want to get something up and running quickly for our team so we can start wrangling some of the components we have. The code I wrote is… brittle 😅 and a bit silly. I would very much enjoy sharing this workload with the many smart and thoughtful people working on this project, but would first like to have a bit of a conversation if our goals align.

Most of this work is tough and requires deep knowledge on all the different ways that people can organize Ember projects.

For some transparency into what my plans are, I’m providing a small list of things that I’d like our documentation parser to do:

  • Provide a list of modules that depend on a service. This will help with sprawl / aggressive service injection in applications.
  • Pull default parameters from JS instead of the @param doc. This way, the docs are never out of date.
  • Provide type information on {{yield}} blocks, if possible (we could possibly interpolate what types flow through glimmer by looking at the documentation on the component)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tim-evanscommented, Apr 2, 2018

Closing this; for those interested, see https://github.com/CondeNast-Copilot/ember-docs

Our goal on the repo is to provide a solid baseline to use in ember-cli-addon-docs and friends.

1reaction
pzuraqcommented, Mar 17, 2018

If there are features that the current docs generators don’t support and you’d like to add, definitely open to that. The idea is to be extensive and Ember focussed, even if the backing documenter can’t support it.

For instance, YUIdoc can’t support decorators, but we still want to support them because ESDoc and more modern generators can.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ember - 4.9 - Ember API Documentation
Ember has core methods used in any app, while Ember Data has documentation of the built-in library for making requests to a back...
Read more >
Getting started with Ember - Learn web development | MDN
Ember is a component-service framework that focuses on the overall web ... a set of code files with the ember-specific JavaScript ...
Read more >
ember-cli-addon-docs-yuidoc - GitHub
ember -cli-addon-docs-yuidoc. YUIDoc plugin for Ember CLI Addon Docs. This plugin adds automatic API documentation to your addon through a modified version ...
Read more >
ember-cli - npm
Command line tool for developing ambitious ember.js apps. Latest version: 4.9.2, last published: 18 days ago. Start using ember-cli in your ...
Read more >
Ember Options for Ember - Sentry Documentation
The @sentry/ember add-on includes options to manage Ember specific instrumentation; these options are set on the add-on config directly. JavaScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found