@condenast/ember-docs
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "@condenast/ember-docs", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Creates documentation from Ember apps / addons", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -49,2 +49,9 @@ const commonmark = require('commonmark'); | ||
// Autogenerate documentation stubs for positional params | ||
positionalParams.forEach(name => { | ||
if (!named.find(param => param.name === name)) { | ||
named.push({ name }); | ||
} | ||
}); | ||
return { | ||
@@ -51,0 +58,0 @@ positional: positionalParams.map(name => named.find(param => param.name === name)), |
@@ -168,3 +168,3 @@ const commonmark = require('commonmark'); | ||
if (supplement.type) { | ||
docs.type = supplement.type.name; | ||
docs.type = utils.getType(supplement.type); | ||
} | ||
@@ -188,3 +188,3 @@ } | ||
// This is a variable length list of parameters | ||
} else if (positional.type === 'Literal' && | ||
} else if (positional.type === 'Identifier' && | ||
positional.name.indexOf('_') !== 0) { | ||
@@ -191,0 +191,0 @@ positional = getParameterDocumentation(positional, params); |
@@ -18,2 +18,15 @@ const _ = require('lodash'); | ||
getType(jsdocType) { | ||
if (jsdocType && jsdocType.name) { | ||
return jsdocType.name; | ||
// Turn an expression back into a normalized TypeScript type | ||
} else if (jsdocType && jsdocType.expression) { | ||
if (jsdocType.expression.name === 'Array') { | ||
return jsdocType.applications[0].name + '[]'; | ||
} | ||
return jsdocType.applications[0].name; | ||
} | ||
}, | ||
getNamedExports(ast) { | ||
@@ -20,0 +33,0 @@ let statements = ast.program.body; |
@@ -61,2 +61,20 @@ const parse = require('../../index'); | ||
test('undocumented-positional-param', () => { | ||
let component = parse(path.resolve(__dirname, '../fixtures/classic/app/components/undocumented-positional-param.js'), {}); | ||
expect(component.name).toBe('undocumented-positional-param'); | ||
expect(component.access).toBe('public'); | ||
expect(component.description).toEqual([ | ||
'<p>This component will have autogenerated documentation for\na positional param.</p>\n' | ||
]); | ||
expect(component.parameters).toEqual({ | ||
named: [{ | ||
name: 'first' | ||
}], | ||
positional: [{ | ||
name: 'first' | ||
}] | ||
}); | ||
}); | ||
describe('pods', () => { | ||
@@ -63,0 +81,0 @@ test('text-field', () => { |
@@ -93,2 +93,17 @@ const parse = require('../../index'); | ||
test('rest-params', () => { | ||
let helper = parse(path.resolve(__dirname, '../fixtures/classic/app/helpers/rest-param.js'), {}); | ||
expect(helper.name).toBe('rest-param'); | ||
expect(helper.access).toBe('public'); | ||
expect(helper.description).toEqual(['<p>Joins words together</p>\n']); | ||
expect(helper.parameters).toEqual({ | ||
positional: { | ||
name: '...words', | ||
description: '<p>Words to join</p>\n', | ||
type: 'string[]' | ||
} | ||
}); | ||
}); | ||
test('optional-named-params', () => { | ||
@@ -95,0 +110,0 @@ let helper = parse(path.resolve(__dirname, '../fixtures/classic/app/helpers/optional-named-params.js'), {}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54423
31
1506