mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
ca6c5854f4
* Fix(#1391): Expose API version even when not running via npm/yarn ## What Expose the current Unleash version in the generated OpenAPI docs, even when running via docker or other processes. ## Why An OpenAPI spec without a version isn't valid. This causes some of our generation tools (such as the one for documentation) to fail. ## How By changing how we fetch the current version: Previously, we used `process.env.npm_package_version!`. However, when you're not running with yarn or npm, this is `undefined`. That causes the version number to not be included when running tests and when running using the official docker image. Instead, we now use `version` from `lib/util/version`. This is the same version as the one used by the UI config endpoint, so it should be the same one as what the front end displays. To the best of my knowledge, this _is_ the version of the API. ## Discussion It _may_ be that I have misunderstood what the version represents, but from what I can tell, it just exports what's listed as the version in package.json. The source code of the `lib/util/version` file is: ```ts // export module version require('pkginfo')(module, 'version'); const { version } = module.exports; export default version; module.exports = version; ``` * Refactor(#1391): rename imported variable for clarity |
||
---|---|---|
.. | ||
lib | ||
mailtemplates | ||
migrations | ||
test | ||
migrator.ts | ||
server-dev.ts | ||
server.ts |