{"_id":"@brataaaan/backstage-changelog-plugin-backend","name":"@brataaaan/backstage-changelog-plugin-backend","dist-tags":{"latest":"0.3.2"},"versions":{"0.3.2":{"name":"@brataaaan/backstage-changelog-plugin-backend","version":"0.3.2","main":"src/index.ts","types":"src/index.ts","license":"MPL-2.0","publishConfig":{"access":"public","main":"dist/index.cjs.js","types":"dist/index.d.ts","registry":"https://registry.npmjs.org/"},"backstage":{"role":"backend-plugin"},"repository":{"type":"git","url":"git+https://github.com/brataaaan/backstage-changelog-plugin.git"},"scripts":{"start":"backstage-cli package start","build":"backstage-cli package build","lint":"backstage-cli package lint","test":"backstage-cli package test","clean":"backstage-cli package clean","prepack":"backstage-cli package prepack","postpack":"backstage-cli package postpack"},"dependencies":{"@backstage/backend-common":"^0.19.5","@backstage/backend-plugin-api":"^0.6.6","@backstage/catalog-client":"^1.4.5","@backstage/catalog-model":"^1.4.3","@backstage/config":"^1.1.0","@backstage/errors":"^1.2.3","@types/express":"*","fs-extra":"^11.1.1","express":"^4.17.1","express-promise-router":"^4.1.0","winston":"^3.2.1","node-fetch":"^2.6.7","yn":"^4.0.0"},"devDependencies":{"@backstage/cli":"^0.22.13","@backstage/catalog-client":"^1.4.5","@types/supertest":"^2.0.12","supertest":"^6.2.4","msw":"^1.0.0"},"keywords":["backstage","plugin","backend","changelog","rsc-labs","typescript","javascript"],"gitHead":"1dc4d0f5aafd54500d1517bd576ddba95800eec3","description":"Backstage Changelog Plugin is configurable and customizable plugin for viewing a changelog. You can write your own parser or use default one, which follows [Keep the changelog](https://keepachangelog.com/) notation.","bugs":{"url":"https://github.com/brataaaan/backstage-changelog-plugin/issues"},"homepage":"https://github.com/brataaaan/backstage-changelog-plugin#readme","_id":"@brataaaan/backstage-changelog-plugin-backend@0.3.2","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-eWguHN6mELpGqHy4O29ydRcmhIdjsJDQxm/WoUKftllbHcm1ab2oYgZoCse/FeeMo/c7MSFQHhBeH3WMVUj64A==","shasum":"3b16161a4226aef9403c3b2a07815b63a72c154e","tarball":"https://registry.npmjs.org/@brataaaan/backstage-changelog-plugin-backend/-/backstage-changelog-plugin-backend-0.3.2.tgz","fileCount":5,"unpackedSize":20715,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvH6ZiLcNcEtWHfdmG7sJPz4UzC/EH35s1N41pPvYw6AIgWnHEcsBpWlZUjDGH28vRLPXZhQlG3Dlgdi7EVu/WHdg="}]},"_npmUser":{"name":"brataaaan","email":"johannes@bradt.me"},"directories":{},"maintainers":[{"name":"brataaaan","email":"johannes@bradt.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/backstage-changelog-plugin-backend_0.3.2_1705413893431_0.9325007398014966"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-16T14:04:53.288Z","0.3.2":"2024-01-16T14:04:53.617Z","modified":"2024-01-16T14:04:53.922Z"},"maintainers":[{"name":"brataaaan","email":"johannes@bradt.me"}],"description":"Backstage Changelog Plugin is configurable and customizable plugin for viewing a changelog. You can write your own parser or use default one, which follows [Keep the changelog](https://keepachangelog.com/) notation.","homepage":"https://github.com/brataaaan/backstage-changelog-plugin#readme","keywords":["backstage","plugin","backend","changelog","rsc-labs","typescript","javascript"],"repository":{"type":"git","url":"git+https://github.com/brataaaan/backstage-changelog-plugin.git"},"bugs":{"url":"https://github.com/brataaaan/backstage-changelog-plugin/issues"},"license":"MPL-2.0","readme":"# @rsc-labs/changelog-plugin\n\nBackstage Changelog Plugin is configurable and customizable plugin for viewing a changelog.\nYou can write your own parser or use default one, which follows [Keep the changelog](https://keepachangelog.com/) notation.\n\n### What is Changelog, why and who needs it?\nDescription from [Keep the changelog](https://keepachangelog.com/).\n\nA changelog is a file which contains a curated, chronologically ordered list of notable changes for each version of a project.\nIt is being created to make it easier for users and contributors to see precisely what notable changes have been made between each release (or version) of the project.\nPeople need changelog. Whether consumers or developers, the end users of software are human beings who care about what's in the software. When the software changes, people want to know why and how.\n\n# Getting started\n\nIf you haven't already, check out the [Backstage docs](https://backstage.io/docs/getting-started/) and create a Backstage application with\n```\nnpx @backstage/create-app\n```\n\nThen, you will need to install and configure the changelog plugins for the frontend and the backend.\nFrontend plugin installation can be found here: [Frontend plugin](https://github.com/RSC-Labs/backstage-changelog-plugin/tree/main/plugins/backstage-changelog-plugin)\n\n## Backend plugin\n\nInstall:\n```bash\ncd packages/backend\nyarn add @rsc-labs/backstage-changelog-plugin-backend\n```\n\nCreate a file `packages/backend/src/plugins/changelog.ts`:\n```typescript\nimport {\n    createRouter,\n  } from '@rsc-labs/backstage-changelog-plugin-backend'\n  import { Router } from 'express';\n  import { PluginEnvironment } from '../types';\n  \n  export default async function createPlugin(\n    env: PluginEnvironment,\n  ): Promise<Router> {\n    return await createRouter({\n      discovery: env.discovery,\n      tokenManager: env.tokenManager,\n      logger: env.logger,\n      reader: env.reader\n    });\n  }\n```\n\nAdd the plugin to `packages/backend/src/index.ts`:\n```typescript\n// import:\nimport changelog from './plugins/changelog';\n...\n\nasync function main() {\n  ...\n  // add env\n  const changelogEnv = useHotMemoize(module, () => createEnv('changelog'));\n  ...\n  // add to router\n  apiRouter.use('/changelog', await changelog(changelogEnv));\n  ...\n}\n```\n\nBackend plugin supports 3 fields, which can be used for reading a Changelog.\nChangelog itself is related to entity, so configuration is done by Annotations.\n```yaml\napiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n  name: example-website\n  annotations:\n    backstage.io/source-location: \"file:/home/backstage/backstage-changelog/examples/\"\n    changelog-file-ref: \"url:https://github.com/RSC-Labs/backstage-changelog-plugin/tree/main/CHANGELOG.md\"\n    changelog-name: \"CHANGELOG_CUSTOM_NAME.md\"\n\n```\nPlugin uses following logic:\n1) If \"changelog-file-ref\" is provided it takes precedence over other options, so it is used for reading a Changelog\n2) If not provided, then plugin check is \"changelog-name\" is provided. If yes, then it uses \"backstage.io/source-location\" as a location path together with \"changelog-name\"\n3) If no above options are provided, plugin uses \"backstage.io/source-location\" for reading a file named \"CHANGELOG.md\".\n\nBoth \"file\" and \"url\" options are supported.\n\n## TODO\n\n[ ] Unit tests\n\n## Contribution\n\nContributions are welcome and they are greatly appreciated!\n\n## License\n\nLicensed under the Mozilla Public License, Version 2.0: https://www.mozilla.org/en-US/MPL/2.0/\n\n---\n\n© 2023 RSC https://rsoftcon.com/","readmeFilename":"README.md"}