jsdoc-to-markdown
Advanced tools
Comparing version 2.0.0-alpha.15 to 2.0.0-alpha.16
@@ -21,7 +21,7 @@ 'use strict'; | ||
var jsdoc2md = require('../../'); | ||
jsdoc2md._usageStats.defaults.set('cd4', 'cli'); | ||
jsdoc2md._interface = 'cli'; | ||
jsdoc2md.clear().catch(tool.halt); | ||
} else { | ||
var _jsdoc2md = require('../../'); | ||
_jsdoc2md._usageStats.defaults.set('cd4', 'cli'); | ||
_jsdoc2md._interface = 'cli'; | ||
@@ -28,0 +28,0 @@ if (options.config) { |
@@ -44,7 +44,11 @@ 'use strict'; | ||
description: 'Prints the raw jsdoc data.' | ||
}, { name: 'version', type: Boolean }, { | ||
}, { name: 'version', type: Boolean }, { name: 'no-usage-stats', type: Boolean }, { | ||
name: 'no-cache', | ||
type: Boolean, | ||
description: 'By default, repeat invocations against the same input with the same options returns from cache. This option disables that. ' | ||
}, { | ||
name: 'clear', | ||
type: Boolean, | ||
description: 'Clears the cache.' | ||
}, { name: 'no-usage-stats', type: Boolean }, { name: 'no-cache', type: Boolean }]; | ||
}]; | ||
@@ -159,3 +163,3 @@ var dmdDefinitions = [{ | ||
optionList: jsdoc2mdDefinitions, | ||
hide: ['no-usage-stats', 'debug', 'no-cache'] | ||
hide: ['no-usage-stats', 'debug'] | ||
}, { | ||
@@ -162,0 +166,0 @@ header: 'jsdoc options', |
@@ -5,32 +5,69 @@ 'use strict'; | ||
var version = require('../../package').version; | ||
var UsageStats = require('usage-stats'); | ||
var jsdocApi = require('jsdoc-api'); | ||
var dmd = require('dmd'); | ||
var os = require('os'); | ||
var stats = require('./stats').stats; | ||
var UsageStats = require('app-usage-stats'); | ||
var usage = new UsageStats('UA-70853320-3', { | ||
name: 'jsdoc2md', | ||
version: require('../../package').version, | ||
sendInterval: 1000 * 60 * 60 * 24, | ||
metricMap: { | ||
session: 1, | ||
source: 2, | ||
configure: 3, | ||
html: 4, | ||
template: 5, | ||
'heading-depth': 6, | ||
'example-lang': 7, | ||
plugin: 8, | ||
helper: 9, | ||
partial: 10, | ||
'name-format': 11, | ||
'no-gfm': 12, | ||
separators: 13, | ||
'module-index-format': 14, | ||
'global-index-format': 15, | ||
'param-list-format': 16, | ||
'property-list-format': 17, | ||
'member-index-format': 18, | ||
private: 19, | ||
cache: 20 | ||
}, | ||
dimensionMap: { | ||
interface: 4 | ||
} | ||
}); | ||
usage.loadSync(); | ||
exports._interface = 'api'; | ||
exports.render = function (options) { | ||
return stats('render', options, render); | ||
return stats(render, options); | ||
}; | ||
exports.renderSync = function (options) { | ||
return stats('renderSync', options, renderSync, true); | ||
return statsSync(renderSync, options); | ||
}; | ||
exports.getTemplateData = function (options) { | ||
return stats('getTemplateData', options, getTemplateData); | ||
return stats(getTemplateData, options); | ||
}; | ||
exports.getTemplateDataSync = function (options) { | ||
return stats('getTemplateDataSync', options, getTemplateDataSync, true); | ||
return statsSync(getTemplateDataSync, options); | ||
}; | ||
exports.getJsdocData = function (options) { | ||
return stats('getJsdocData', options, getJsdocData); | ||
return stats(getJsdocData, options); | ||
}; | ||
exports.getJsdocDataSync = function (options) { | ||
return stats('getJsdocDataSync', options, getJsdocDataSync, true); | ||
return statsSync(getJsdocDataSync, options); | ||
}; | ||
exports.clear = function () { | ||
return stats('clear', null, clear); | ||
return stats(clear); | ||
}; | ||
exports._usageStats = require('./stats').usageStats; | ||
exports._usageStats = usage; | ||
@@ -65,3 +102,2 @@ function render(options) { | ||
function getJsdocData(options) { | ||
options = options || {}; | ||
var jsdocOptions = new JsdocOptions(options); | ||
@@ -72,3 +108,2 @@ return jsdocApi.explain(jsdocOptions); | ||
function getJsdocDataSync(options) { | ||
options = options || {}; | ||
var jsdocOptions = new JsdocOptions(options); | ||
@@ -134,2 +169,42 @@ return jsdocApi.explainSync(jsdocOptions); | ||
this.private = options.private; | ||
}; | ||
}; | ||
process.on('exit', function () { | ||
usage.saveSync(); | ||
}); | ||
var sendOptions = sendOptions; | ||
function stats(method, options) { | ||
var metrics = Object.assign({ session: 1 }, options); | ||
for (var key in metrics) { | ||
metrics[key] = 1; | ||
} | ||
return Promise.all([usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions), method(options).catch(function (err) { | ||
usage.exception(err.stack, 1, { | ||
hitParams: new Map([['cd', method.name]]) | ||
}); | ||
return usage.send(sendOptions).then(function () { | ||
throw err; | ||
}); | ||
})]).then(function (results) { | ||
return results[1]; | ||
}); | ||
} | ||
function statsSync(method, options) { | ||
var metrics = Object.assign({ session: 1 }, options); | ||
for (var key in metrics) { | ||
metrics[key] = 1; | ||
} | ||
usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions); | ||
try { | ||
return method(options); | ||
} catch (err) { | ||
usage.exception(err.stack, 1, { | ||
hitParams: new Map([['cd', method.name]]) | ||
}); | ||
usage.send(sendOptions).catch(function (err) {}); | ||
} | ||
} |
@@ -6,5 +6,10 @@ 'use strict'; | ||
var a = require('assert'); | ||
jsdoc2md._usageStats.disable(); | ||
var fs = require('fs'); | ||
try { | ||
fs.mkdirSync('tmp-test'); | ||
} catch (err) {} | ||
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4'); | ||
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json'; | ||
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json'; | ||
var runner = new TestRunner(); | ||
@@ -11,0 +16,0 @@ var inputFile = 'src/test/fixture/ignore.js'; |
@@ -6,3 +6,10 @@ 'use strict'; | ||
var a = require('assert'); | ||
jsdoc2md._usageStats.disable(); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
try { | ||
fs.mkdirSync('tmp-test'); | ||
} catch (err) {} | ||
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4'); | ||
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json'; | ||
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json'; | ||
@@ -9,0 +16,0 @@ var runner = new TestRunner(); |
{ | ||
"name": "jsdoc-to-markdown", | ||
"author": "Lloyd Brookes", | ||
"version": "2.0.0-alpha.15", | ||
"version": "2.0.0-alpha.16", | ||
"description": "jsdoc-annotated source in, markdown API docs out.", | ||
@@ -28,2 +28,3 @@ "repository": "https://github.com/jsdoc2md/jsdoc-to-markdown", | ||
"dependencies": { | ||
"app-usage-stats": "^0.3.0", | ||
"array-back": "^1.0.3", | ||
@@ -33,13 +34,12 @@ "command-line-tool": "^0.6.3", | ||
"core-js": "^2.4.1", | ||
"dmd": "^2.0.3-0", | ||
"dmd": "^2.0.3-4", | ||
"feature-detect-es6": "^1.3.1", | ||
"jsdoc-api": "^2.0.1", | ||
"jsdoc-api": "^2.0.3", | ||
"jsdoc-parse": "^2.0.5-0", | ||
"usage-stats": "^0.4.2", | ||
"walk-back": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.14.0", | ||
"coveralls": "^2.11.12", | ||
"test-runner": "^0.2.3" | ||
"babel-preset-es2015": "^6.16.0", | ||
"coveralls": "^2.11.14", | ||
"test-runner": "^0.2.4" | ||
}, | ||
@@ -46,0 +46,0 @@ "standard": { |
@@ -26,7 +26,7 @@ 'use strict' | ||
const jsdoc2md = require('../../') | ||
jsdoc2md._usageStats.defaults.set('cd4', 'cli') | ||
jsdoc2md._interface = 'cli' | ||
jsdoc2md.clear().catch(tool.halt) | ||
} else { | ||
const jsdoc2md = require('../../') | ||
jsdoc2md._usageStats.defaults.set('cd4', 'cli') | ||
jsdoc2md._interface = 'cli' | ||
@@ -33,0 +33,0 @@ /* jsdoc2md --config */ |
@@ -56,9 +56,13 @@ 'use strict' | ||
{ name: 'version', type: Boolean }, | ||
{ name: 'no-usage-stats', type: Boolean }, | ||
{ | ||
name: 'no-cache', | ||
type: Boolean, | ||
description: 'By default, repeat invocations against the same input with the same options returns from cache. This option disables that. ' | ||
}, | ||
{ | ||
name: 'clear', | ||
type: Boolean, | ||
description: 'Clears the cache.' | ||
}, | ||
{ name: 'no-usage-stats', type: Boolean }, | ||
{ name: 'no-cache', type: Boolean }, | ||
} | ||
] | ||
@@ -205,3 +209,3 @@ | ||
optionList: jsdoc2mdDefinitions, | ||
hide: [ 'no-usage-stats', 'debug', 'no-cache' ] | ||
hide: [ 'no-usage-stats', 'debug' ] | ||
}, | ||
@@ -208,0 +212,0 @@ { |
'use strict' | ||
const version = require('../../package').version | ||
const UsageStats = require('usage-stats') | ||
const jsdocApi = require('jsdoc-api') | ||
const dmd = require('dmd') | ||
const os = require('os') | ||
const stats = require('./stats').stats | ||
const UsageStats = require('app-usage-stats') | ||
@@ -16,26 +14,65 @@ /** | ||
const usage = new UsageStats('UA-70853320-3', { | ||
name: 'jsdoc2md', | ||
version: require('../../package').version, | ||
sendInterval: 1000 * 60 * 60 * 24, // 24 hours | ||
metricMap: { | ||
session: 1, | ||
source: 2, | ||
configure: 3, | ||
html: 4, | ||
template: 5, | ||
'heading-depth': 6, | ||
'example-lang': 7, | ||
plugin: 8, | ||
helper: 9, | ||
partial: 10, | ||
'name-format': 11, | ||
'no-gfm': 12, | ||
separators: 13, | ||
'module-index-format': 14, | ||
'global-index-format': 15, | ||
'param-list-format': 16, | ||
'property-list-format': 17, | ||
'member-index-format': 18, | ||
private: 19, | ||
cache: 20 | ||
}, | ||
dimensionMap: { | ||
interface: 4 | ||
} | ||
}) | ||
usage.loadSync() | ||
exports._interface = 'api' | ||
exports.render = function (options) { | ||
return stats('render', options, render) | ||
return stats(render, options) | ||
} | ||
exports.renderSync = function (options) { | ||
return stats('renderSync', options, renderSync, true) | ||
return statsSync(renderSync, options) | ||
} | ||
exports.getTemplateData = function (options) { | ||
return stats('getTemplateData', options, getTemplateData) | ||
return stats(getTemplateData, options) | ||
} | ||
exports.getTemplateDataSync = function (options) { | ||
return stats('getTemplateDataSync', options, getTemplateDataSync, true) | ||
return statsSync(getTemplateDataSync, options) | ||
} | ||
exports.getJsdocData = function (options) { | ||
return stats('getJsdocData', options, getJsdocData) | ||
return stats(getJsdocData, options) | ||
} | ||
exports.getJsdocDataSync = function (options) { | ||
return stats('getJsdocDataSync', options, getJsdocDataSync, true) | ||
return statsSync(getJsdocDataSync, options) | ||
} | ||
exports.clear = function () { | ||
return stats('clear', null, clear) | ||
return stats(clear) | ||
} | ||
/* exposed so the test suite can disable it */ | ||
exports._usageStats = require('./stats').usageStats | ||
exports._usageStats = usage | ||
@@ -121,3 +158,2 @@ /** | ||
function getJsdocData (options) { | ||
options = options || {} | ||
const jsdocOptions = new JsdocOptions(options) | ||
@@ -136,3 +172,2 @@ return jsdocApi.explain(jsdocOptions) | ||
function getJsdocDataSync (options) { | ||
options = options || {} | ||
const jsdocOptions = new JsdocOptions(options) | ||
@@ -297,1 +332,45 @@ return jsdocApi.explainSync(jsdocOptions) | ||
} | ||
process.on('exit', function () { | ||
usage.saveSync() | ||
}) | ||
var sendOptions = sendOptions | ||
function stats (method, options) { | ||
const metrics = Object.assign({ session: 1 }, options) | ||
for (const key in metrics) { | ||
metrics[key] = 1 | ||
} | ||
return Promise.all([ | ||
usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions), | ||
method(options) | ||
.catch(err => { | ||
usage.exception(err.stack, 1, { | ||
hitParams: new Map([[ 'cd', method.name ]]) | ||
}) | ||
return usage.send(sendOptions) | ||
.then(() => { throw err }) | ||
}) | ||
]).then(results => results[1]) | ||
} | ||
function statsSync (method, options) { | ||
const metrics = Object.assign({ session: 1 }, options) | ||
for (const key in metrics) { | ||
metrics[key] = 1 | ||
} | ||
usage.hit({ name: method.name, interface: exports._interface }, metrics, sendOptions) | ||
try { | ||
return method(options) | ||
} catch (err) { | ||
usage.exception(err.stack, 1, { | ||
hitParams: new Map([[ 'cd', method.name ]]) | ||
}) | ||
usage.send(sendOptions) | ||
.catch(err => { | ||
// avoid warning | ||
}) | ||
} | ||
} |
@@ -5,4 +5,11 @@ 'use strict' | ||
const a = require('assert') | ||
jsdoc2md._usageStats.disable() | ||
// 'UA-70853320-4' | ||
const fs = require('fs') | ||
try { | ||
fs.mkdirSync('tmp-test') | ||
} catch (err) { | ||
// exists | ||
} | ||
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4') | ||
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json' | ||
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json' | ||
@@ -9,0 +16,0 @@ const runner = new TestRunner() |
@@ -5,3 +5,12 @@ 'use strict' | ||
const a = require('assert') | ||
jsdoc2md._usageStats.disable() | ||
const path = require('path') | ||
const fs = require('fs') | ||
try { | ||
fs.mkdirSync('tmp-test') | ||
} catch (err) { | ||
// exists | ||
} | ||
jsdoc2md._usageStats.defaults.set('tid', 'UA-70853320-4') | ||
jsdoc2md._usageStats.queuePath = 'tmp-test/unsent.json' | ||
jsdoc2md._usageStats._lastSentPath = 'tmp-test/lastSent.json' | ||
@@ -8,0 +17,0 @@ const runner = new TestRunner() |
Sorry, the diff of this file is not supported yet
64172
27
1315
9
+ Addedapp-usage-stats@^0.3.0
+ Addedapp-usage-stats@0.3.6(transitive)
+ Addedreq-then@0.5.1(transitive)
+ Addedusage-stats@0.7.0(transitive)
- Removedusage-stats@^0.4.2
- Removedreq-then@0.4.1(transitive)
- Removedusage-stats@0.4.4(transitive)
Updateddmd@^2.0.3-4
Updatedjsdoc-api@^2.0.3