mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
* move from yarn to pnpm for package management * remove lodash.template patch override * remove .yarn folder * update GHA to use pnpm * add @babel/plugin-proposal-decorators * remove .yarnrc.yml * add lock file to copywrite ignore * add @codemirror/view as a dep for its types * use more strict setting about peerDeps * address some peerDep issues with ember-power-select and ember-basic-dropdown * enable TS compilation for the kubernetes engine * enable TS compilation in kv engine * ignore workspace file * use new headless mode in CI * update enos CI scenarios * add qs and express resolutions * run 'pnpm up glob' and 'pnpm up js-yaml' to upgrade those packages * run 'pnpm up preact' because posthog-js had a vulnerable install. see https://github.com/advisories/GHSA-36hm-qxxp-pg3 * add work around for browser timeout errors in test * update other references of yarn to pnpm Co-authored-by: Matthew Irish <39469+meirish@users.noreply.github.com>
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
/* eslint-disable */
|
|
|
|
/*
|
|
run from the ui directory:
|
|
pnpm docfy-md some-component
|
|
|
|
or if the docs are for a component in an in-repo-addon or an engine:
|
|
pnpm docfy-md some-component name-of-engine
|
|
|
|
see the readme ui/docs/how-to-docfy.md for more info
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const jsdoc2md = require('jsdoc-to-markdown');
|
|
|
|
// the fullFilepath arg will override the assumed inputFile which is built using the addonOrEngine arg
|
|
const [nameOrFile, addonOrEngine, fullFilepath] = process.argv.slice(2);
|
|
|
|
const isFile = nameOrFile.includes('.');
|
|
const name = isFile ? nameOrFile?.split('.')[0] : nameOrFile; // can pass component-name or component-name.js
|
|
const path = isFile ? nameOrFile : `${nameOrFile}.js`; // default to js
|
|
|
|
const inputFile = addonOrEngine ? `lib/${addonOrEngine}/addon/components/${path}` : `app/components/${path}`;
|
|
const outputFile = `docs/components/${name}.md`;
|
|
|
|
const outputFormat = `
|
|
{{#module}}
|
|
# {{name}}
|
|
{{>body}}
|
|
{{/module}}
|
|
`;
|
|
|
|
const options = {
|
|
files: fullFilepath || inputFile,
|
|
'example-lang': 'hbs preview-template',
|
|
configure: './jsdoc2md.json',
|
|
template: outputFormat,
|
|
};
|
|
|
|
try {
|
|
const md = jsdoc2md.renderSync(options);
|
|
// for some reason components without a jsdoc @module doesn't throw, so throw manually
|
|
if (md.includes('ERROR')) throw `${md} (there is probably no jsdoc for this component)`;
|
|
fs.writeFileSync(outputFile, md);
|
|
console.log(`✅ ${name}`);
|
|
} catch (error) {
|
|
console.log(`❌ ${name}`);
|
|
console.log(error);
|
|
}
|