项目作者: bevry

项目描述 :
 A clerk for retrieving compatible plugins from the npm database
高级语言: TypeScript
项目地址: git://github.com/bevry/pluginclerk.git
创建时间: 2015-09-04T14:21:21Z
项目社区:https://github.com/bevry/pluginclerk

开源协议:Other

下载


pluginclerk

Status of the GitHub Workflow: bevry
NPM version
NPM downloads


GitHub Sponsors donate button
ThanksDev donate button
Patreon donate button
Liberapay donate button
Buy Me A Coffee donate button
Open Collective donate button
crypto donate button
PayPal donate button


Discord server badge
Twitch community badge

A clerk for retrieving compatible plugins from the npm database

Usage

Complete API Documentation.

  1. import PluginClerk from 'pluginclerk'
  2. // Create the new clerk instance with our configuration
  3. const clerk = new PluginClerk({
  4. // Required: The keyword that must be specified inside the plugin's package.json:keywords property
  5. keyword: 'docpad-plugin',
  6. // Optional: A prefix that the name of the plugin must be prefixed by to be valid
  7. // Defaults to nothing
  8. prefix: 'docpad-plugin-',
  9. // Optional: A function used for logging receives the arguments (logLevel, ...message)
  10. // Defaults to nothing
  11. log: console.log,
  12. // Optional: The amount of milliseconds until we have to query the npm database again
  13. // Defaults to one day
  14. cacheDuration: null,
  15. // Optional: The registry hostname we should use for the API calls
  16. // Defaults to "https://registry.npmjs.org"
  17. registryHostname: null,
  18. })
  19. // Fetch the latest version of a particular plugin
  20. // Note the `installPeers` result,
  21. // as `docpad-plugin-eco` has the peerDependency `docpad`,
  22. // and no dependencies where supplied, it should be installed
  23. clerk
  24. .fetchPlugin({ name: 'docpad-plugin-eco' })
  25. .then(console.log)
  26. .catch(console.error)
  27. /* {
  28. success: true,
  29. message: 'Successfully fetched the latest and compatible version of the plugin docpad-plugin-eco',
  30. skippedVersions: {},
  31. latestVersion: '2.1.0',
  32. installVersion: '2.1.0',
  33. installPeers: [ 'docpad' ]
  34. } */
  35. // Fetch the latest version of a particular plugin that is compatible with the specified dependencies
  36. // Note the `installPeers` result,
  37. // as `docpad-plugin-eco` has the peerDependency `docpad`,
  38. // and we supplied it, there is no need to install it
  39. clerk
  40. .fetchPlugin({
  41. name: 'docpad-plugin-eco',
  42. requirements: { docpad: '6.78.0' },
  43. })
  44. .then(console.log)
  45. .catch(console.error)
  46. /* {
  47. success: true,
  48. message: 'Successfully fetched the latest and compatible version of the plugin docpad-plugin-eco',
  49. skippedVersions: {},
  50. latestVersion: '2.1.0',
  51. installVersion: '2.1.0',
  52. installPeers: [ ]
  53. } */
  54. // Fetch the latest version of a particular plugin that is compatible with the specified dependencies
  55. // Note the `installVersion` and `skippedVersions` results,
  56. // a few plugin versions where skipped because they required a `docpad` version range that our supplied `docpad` version didn't fulfill
  57. // Note the `installPeers` result,
  58. // as `docpad-plugin-eco` has the peerDependency `docpad`, and we supplied it, there is no need to install it
  59. clerk
  60. .fetchPlugin({
  61. name: 'docpad-plugin-eco',
  62. requirements: { docpad: '5.0.0' },
  63. })
  64. .then(console.log)
  65. .catch(console.error)
  66. /* ] {
  67. success: true,
  68. message: 'Successfully fetched an older and compatible version of the plugin docpad-plugin-eco',
  69. skippedVersions: {
  70. '2.1.0': { docpad: '^6.59.0' }
  71. '2.0.0': { docpad: '^6.53.0' }
  72. },
  73. latestVersion: '2.1.0',
  74. installVersion: '1.0.0',
  75. installPeers: [] }
  76. } */
  77. // You can also fetch all plugins with some basic information
  78. clerk.fetchPlugins({}).then(console.log).catch(console.error)
  79. /* {
  80. success: true,
  81. message: 'Successfully fetched the plugins',
  82. plugins: {
  83. 'docpad-plugin-eco': {
  84. 'description': '...',
  85. 'homepage': '...',
  86. 'version': '2.1.0'
  87. }
  88. }
  89. } */
  90. // You can also fetch all plugins with their compatibility information
  91. clerk
  92. .fetchPlugins({ requirements: { docpad: '5.0.0' } })
  93. .then(console.log)
  94. .catch(console.error)
  95. /* {
  96. success: true,
  97. message: 'Successfully fetched the plugins',
  98. plugins: {
  99. 'docpad-plugin-eco': {
  100. 'description': '...',
  101. 'homepage': '...',
  102. 'version': '1.0.0',
  103. 'compatibility': {} // result of fetchPlugin
  104. }
  105. }
  106. } */

Install

npm

  • Install: npm install --save pluginclerk
  • Import: import pkg from ('pluginclerk')
  • Require: const pkg = require('pluginclerk').default

Deno

  1. import pkg from 'https://unpkg.com/pluginclerk@^6.5.0/edition-deno/index.ts'

Editions

This package is published with the following editions:

  • pluginclerk/source/index.ts is TypeScript source code with Import for modules
  • pluginclerk aliases pluginclerk/edition-es2022/index.js
  • pluginclerk/edition-es2022/index.js is TypeScript compiled against ES2022 for Node.js 18 || 20 || 21 with Require for modules
  • pluginclerk/edition-es2022-esm/index.js is TypeScript compiled against ES2022 for Node.js 18 || 20 || 21 with Import for modules
  • pluginclerk/edition-types/index.d.ts is TypeScript compiled Types with Import for modules
  • pluginclerk/edition-deno/index.ts is TypeScript source code made to be compatible with Deno

History

Discover the release history by heading on over to the HISTORY.md file.

Backers

Code

Discover how to contribute via the CONTRIBUTING.md file.

Authors

Maintainers

Contributors

Finances

GitHub Sponsors donate button
ThanksDev donate button
Patreon donate button
Liberapay donate button
Buy Me A Coffee donate button
Open Collective donate button
crypto donate button
PayPal donate button

Sponsors

  • Andrew Nesbitt — Software engineer and researcher
  • Balsa — We’re Balsa, and we’re building tools for builders.
  • Codecov — Empower developers with tools to improve code quality and testing.
  • Poonacha Medappa
  • Rob Morris
  • Sentry — Real-time crash reporting for your web apps, mobile apps, and games.
  • Syntax — Syntax Podcast

Donors

License

Unless stated otherwise all works are:

and licensed under: