Socket
Socket
Sign inDemoInstall

vue-docgen-cli

Package Overview
Dependencies
Maintainers
3
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-docgen-cli - npm Package Compare versions

Comparing version 4.26.3 to 4.27.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [4.27.0](https://github.com/vue-styleguidist/vue-styleguidist/compare/v4.26.3...v4.27.0) (2020-07-17)
**Note:** Version bump only for package vue-docgen-cli
## [4.26.3](https://github.com/vue-styleguidist/vue-styleguidist/compare/v4.26.2...v4.26.3) (2020-07-16)

@@ -8,0 +16,0 @@

4

lib/extractConfig.js

@@ -28,3 +28,5 @@ "use strict";

if (pathArray === void 0) { pathArray = []; }
var configFilePath = configFileFromCmd ? path.resolve(cwd, configFileFromCmd) : path.join(cwd, 'docgen.config.js');
var configFilePath = configFileFromCmd
? path.resolve(cwd, configFileFromCmd)
: path.join(cwd, 'docgen.config.js');
var componentsFromCmd = pathArray[0], outDirFromCmd = pathArray[1];

@@ -31,0 +33,0 @@ var config = __assign({ cwd: cwd,

@@ -11,3 +11,5 @@ "use strict";

"\n---\ntitle: " + displayName + "\n---"
: '') + "\n # " + (deprecated ? "~~" + displayName + "~~" : displayName) + "\n\n " + (deprecated ? "> **Deprecated** " + deprecated[0].description + "\n" : '') + "\n " + (description ? '> ' + description : '') + "\n \n " + (functional ? renderedUsage.functionalTag : '') + "\n " + (author ? author.map(function (a) { return "Author: " + a.description + "\n"; }) : '') + "\n " + (since ? "Since: " + since[0].description + "\n" : '') + "\n " + (version ? "Version: " + version[0].description + "\n" : '') + "\n " + (see ? see.map(function (s) { return "[See](" + s.description + ")\n"; }) : '') + "\n " + (link ? link.map(function (l) { return "[See](" + l.description + ")\n"; }) : '') + "\n\n " + renderedUsage.props + "\n " + renderedUsage.methods + "\n " + renderedUsage.events + "\n " + renderedUsage.slots + "\n " + (docsBlocks ? '---\n' + docsBlocks.join('\n---\n') : '') + "\n\n " + (requiresMd.length ? '---\n' + requiresMd.map(function (component) { return component.content; }).join('\n---\n') : '') + "\n ";
: '') + "\n # " + (deprecated ? "~~" + displayName + "~~" : displayName) + "\n\n " + (deprecated ? "> **Deprecated** " + deprecated[0].description + "\n" : '') + "\n " + (description ? '> ' + description : '') + "\n \n " + (functional ? renderedUsage.functionalTag : '') + "\n " + (author ? author.map(function (a) { return "Author: " + a.description + "\n"; }) : '') + "\n " + (since ? "Since: " + since[0].description + "\n" : '') + "\n " + (version ? "Version: " + version[0].description + "\n" : '') + "\n " + (see ? see.map(function (s) { return "[See](" + s.description + ")\n"; }) : '') + "\n " + (link ? link.map(function (l) { return "[See](" + l.description + ")\n"; }) : '') + "\n\n " + renderedUsage.props + "\n " + renderedUsage.methods + "\n " + renderedUsage.events + "\n " + renderedUsage.slots + "\n " + (docsBlocks ? '---\n' + docsBlocks.join('\n---\n') : '') + "\n\n " + (requiresMd.length
? '---\n' + requiresMd.map(function (component) { return component.content; }).join('\n---\n')
: '') + "\n ";
});

@@ -12,3 +12,4 @@ "use strict";

var t = pr.description ? pr.description : '';
ret += "| " + utils_1.mdclean(p) + " | " + utils_1.mdclean(t) + " | " + utils_1.mdclean(n) + " | " + utils_1.mdclean(v) + " | " + utils_1.mdclean(d) + " |" + '\n';
ret +=
"| " + utils_1.mdclean(p) + " | " + utils_1.mdclean(t) + " | " + utils_1.mdclean(n) + " | " + utils_1.mdclean(v) + " | " + utils_1.mdclean(d) + " |" + '\n';
});

@@ -15,0 +16,0 @@ return ret;

@@ -69,3 +69,5 @@ "use strict";

conf = _a.sent();
prettyMd = function (cont) { return prettier_1.default.format(cont, Object.assign(conf || {}, { parser: 'markdown' })); };
prettyMd = function (cont) {
return prettier_1.default.format(cont, Object.assign(conf || {}, { parser: 'markdown' }));
};
destFolder = path.dirname(destFilePath);

@@ -72,0 +74,0 @@ return [4 /*yield*/, mkdirp(destFolder)];

{
"name": "vue-docgen-cli",
"version": "4.26.3",
"version": "4.27.0",
"scripts": {

@@ -18,3 +18,3 @@ "compile": "tsc -p ./tsconfig.build.json",

"prettier": "^1.18.2",
"vue-docgen-api": "^4.26.0"
"vue-docgen-api": "^4.27.0"
},

@@ -26,3 +26,3 @@ "devDependencies": {

},
"gitHead": "eaa2844fd0e4345a470bde24da4388f604b7fa46"
"gitHead": "d0be3dbdc528c18ff68721317700a35e450e4929"
}

@@ -220,13 +220,13 @@ # vue-docgen-cli

${slotNames
.map(slotName => {
const { description, bindings } = slots[slotName]
const readableBindings = // serialize bindings to display them ina readable manner
bindings && Object.keys(bindings).length
? JSON.stringify(bindings, null, 2)
: ''
return cleanReturn(
`| ${slotName} | ${description} | ${readableBindings} |`
) // remplace returns by <br> to allow them in a table cell
})
.join('\n')}
.map(slotName => {
const { description, bindings } = slots[slotName]
const readableBindings = // serialize bindings to display them ina readable manner
bindings && Object.keys(bindings).length
? JSON.stringify(bindings, null, 2)
: ''
return cleanReturn(
`| ${slotName} | ${description} | ${readableBindings} |`
) // remplace returns by <br> to allow them in a table cell
})
.join('\n')}
`

@@ -233,0 +233,0 @@ }

@@ -13,3 +13,5 @@ import extractConfig from '../extractConfig'

mockWatcher = { on: jest.fn(), close: jest.fn() }
mockGetSources = jest.fn(() => Promise.resolve({ componentFiles: FILES, watcher: mockWatcher, docMap: DOC_MAP }))
mockGetSources = jest.fn(() =>
Promise.resolve({ componentFiles: FILES, watcher: mockWatcher, docMap: DOC_MAP })
)
return mockGetSources

@@ -16,0 +18,0 @@ })

@@ -89,3 +89,4 @@ import * as path from 'path'

const getDocFileName = (componentPath: string) => path.resolve(path.dirname(componentPath), 'Readme.md')
const getDocFileName = (componentPath: string) =>
path.resolve(path.dirname(componentPath), 'Readme.md')

@@ -92,0 +93,0 @@ describe('getDocMap', () => {

@@ -17,3 +17,3 @@ #!/usr/bin/env node

delete config.pages
pages.forEach((page) => {
pages.forEach(page => {
const pageConf = { ...config, ...page }

@@ -20,0 +20,0 @@ run(pageConf)

@@ -24,3 +24,4 @@ import * as path from 'path'

if (!doc.tags) return []
const requireDep = doc.tags.requires?.map((t: ParamTag) => path.join(compDirName, t.description as string)) || []
const requireDep =
doc.tags.requires?.map((t: ParamTag) => path.join(compDirName, t.description as string)) || []
const examplesDep = getExamplesFilePaths(doc.tags, compDirName)

@@ -82,3 +83,10 @@ return [...requireDep, ...examplesDep]

return {
content: templates.component(renderedUsage, doc, config, componentRelativePath, requiresMd, subComponent),
content: templates.component(
renderedUsage,
doc,
config,
componentRelativePath,
requiresMd,
subComponent
),
dependencies: getDependencies(doc, componentRelativeDirectoryPath)

@@ -85,0 +93,0 @@ }

import * as path from 'path'
import * as fs from 'fs'
import { component, events, methods, props, slots, defaultExample, functionalTag } from './compileTemplates'
import {
component,
events,
methods,
props,
slots,
defaultExample,
functionalTag
} from './compileTemplates'
import { SafeDocgenCLIConfig, DocgenCLIConfig } from './config'

@@ -13,3 +21,5 @@ import { findFileCaseInsensitive } from './utils'

): SafeDocgenCLIConfig => {
const configFilePath = configFileFromCmd ? path.resolve(cwd, configFileFromCmd) : path.join(cwd, 'docgen.config.js')
const configFilePath = configFileFromCmd
? path.resolve(cwd, configFileFromCmd)
: path.join(cwd, 'docgen.config.js')
const [componentsFromCmd, outDirFromCmd] = pathArray

@@ -16,0 +26,0 @@

@@ -8,3 +8,6 @@ import { ComponentDoc, Tag, ParamTag } from 'vue-docgen-api'

export function getExamplesFilePaths(tags: { [key: string]: (Tag | ParamTag)[] }, componentDirname: string): string[] {
export function getExamplesFilePaths(
tags: { [key: string]: (Tag | ParamTag)[] },
componentDirname: string
): string[] {
const exampleTags = [...(tags.example || []), ...(tags.examples || [])]

@@ -11,0 +14,0 @@

@@ -18,3 +18,7 @@ import * as path from 'path'

optionsApi: DocGenOptions = {}
): Promise<{ watcher: FSWatcher; docMap: { [filepath: string]: string }; componentFiles: string[] }> {
): Promise<{
watcher: FSWatcher
docMap: { [filepath: string]: string }
componentFiles: string[]
}> {
const watcher = chokidar.watch(components, { cwd })

@@ -27,6 +31,10 @@

const requiredComponents = (
await Promise.all(allComponentFiles.map(async compPath => getRequiredComponents(compPath, optionsApi, cwd)))
await Promise.all(
allComponentFiles.map(async compPath => getRequiredComponents(compPath, optionsApi, cwd))
)
).reduce((acc, components) => acc.concat(components), [])
const componentFiles = allComponentFiles.filter(compPath => !requiredComponents.includes(compPath))
const componentFiles = allComponentFiles.filter(
compPath => !requiredComponents.includes(compPath)
)

@@ -45,3 +53,7 @@ const docMap = getDocMap(

async function getRequiredComponents(compPath: string, optionsApi: DocGenOptions, cwd: string): Promise<string[]> {
async function getRequiredComponents(
compPath: string,
optionsApi: DocGenOptions,
cwd: string
): Promise<string[]> {
const compDirName = path.dirname(compPath)

@@ -48,0 +60,0 @@ const absoluteComponentPath = path.join(cwd, compPath)

@@ -83,3 +83,5 @@ import * as path from 'path'

} catch (e) {
throw new Error(`Error compiling file ${config.outFile} when file ${changedFilePath} has changed: ${e.message}`)
throw new Error(
`Error compiling file ${config.outFile} when file ${changedFilePath} has changed: ${e.message}`
)
}

@@ -86,0 +88,0 @@ } else {

@@ -44,4 +44,8 @@ import { ComponentDoc, ParamTag } from 'vue-docgen-api'

${requiresMd.length ? '---\n' + requiresMd.map(component => component.content).join('\n---\n') : ''}
${
requiresMd.length
? '---\n' + requiresMd.map(component => component.content).join('\n---\n')
: ''
}
`
}

@@ -14,3 +14,4 @@ import { PropDescriptor } from 'vue-docgen-api'

ret += `| ${mdclean(p)} | ${mdclean(t)} | ${mdclean(n)} | ${mdclean(v)} | ${mdclean(d)} |` + '\n'
ret +=
`| ${mdclean(p)} | ${mdclean(t)} | ${mdclean(n)} | ${mdclean(v)} | ${mdclean(d)} |` + '\n'
})

@@ -17,0 +18,0 @@ return ret

@@ -13,3 +13,4 @@ import { SlotDescriptor } from 'vue-docgen-api'

const { description: d, bindings, name } = slot
const readableBindings = bindings && Object.keys(bindings).length ? JSON.stringify(bindings, null, 2) : '' // serialize bindings to display them ina readable manner
const readableBindings =
bindings && Object.keys(bindings).length ? JSON.stringify(bindings, null, 2) : '' // serialize bindings to display them ina readable manner
return `| ${mdclean(name)} | ${mdclean(d || '')} | ${mdclean(readableBindings)} |` // remplace returns by <br> to allow them in a table cell

@@ -16,0 +17,0 @@ })

@@ -17,3 +17,4 @@ import * as path from 'path'

const conf = await prettier.resolveConfig(destFilePath)
const prettyMd = (cont: string) => prettier.format(cont, Object.assign(conf || {}, { parser: 'markdown' }))
const prettyMd = (cont: string) =>
prettier.format(cont, Object.assign(conf || {}, { parser: 'markdown' }))
const destFolder = path.dirname(destFilePath)

@@ -20,0 +21,0 @@ await mkdirp(destFolder)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc