(data, pkg)
| 612 | } |
| 613 | |
| 614 | function nodeUsage(data, pkg) { |
| 615 | // Find doc block with example (should only be one the main function) |
| 616 | const main = data.jsdoc.find((doc) => Boolean(doc.examples)) |
| 617 | |
| 618 | const name = main.name |
| 619 | const exampleCode = main.examples[0] |
| 620 | |
| 621 | const code = ` |
| 622 | const analyticsLib = require('analytics').default |
| 623 | const ${name} = require('${pkg.name}').default |
| 624 | |
| 625 | const analytics = analyticsLib({ |
| 626 | app: 'my-app-name', |
| 627 | plugins: [ |
| 628 | ${exampleCode} |
| 629 | ] |
| 630 | }) |
| 631 | |
| 632 | ${renderRelevantMethods(data)}` |
| 633 | |
| 634 | return `<details> |
| 635 | <summary>Server-side Node.js with common JS</summary> |
| 636 | |
| 637 | If using node, you will want to import the \`.default\` |
| 638 | |
| 639 | \`\`\`js |
| 640 | ${indentString(formatCode(code), 2)} |
| 641 | \`\`\` |
| 642 | |
| 643 | </details> |
| 644 | ` |
| 645 | } |
| 646 | |
| 647 | async function browserStandaloneUsage(data, pkg, dir) { |
| 648 | const browserFile = path.join(dir, 'dist', `${pkg.name}.js`) |
no test coverage detected