UNPKG

mfdoc

Version:

Auto generate JS SDK and HTTP API documentation

26 lines 961 B
import fse from 'fs-extra'; import { identity } from 'lodash-es'; import path from 'path'; import { indexArray } from 'softkave-js-utils'; export function filterEndpointsByTags(endpoints, tags) { if (tags.length === 0) { return endpoints; } const tagsMap = indexArray(tags, { indexer: identity }); return endpoints.filter(endpoint => { return endpoint.tags?.some(tag => tagsMap[tag]); }); } export async function hasPackageJson(params) { const { outputPath } = params; const pkgJsonPath = path.join(outputPath, 'package.json'); return ((await fse.exists(pkgJsonPath)) && (await fse.stat(pkgJsonPath)).isFile()); } export const kInstallScripts = { npm: (pkgName) => `npm install ${pkgName}`, yarn: (pkgName) => `yarn add ${pkgName}`, pnpm: (pkgName) => `pnpm add ${pkgName}`, bun: (pkgName) => `bun add ${pkgName}`, deno: (pkgName) => `deno add ${pkgName}`, }; //# sourceMappingURL=utils.js.map