-
Notifications
You must be signed in to change notification settings - Fork 68
feat(version): read app info from package.json #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The package `read-pkg` allows for it, let's use it :)
One possible extensions to this PR
const AppInfo = {
APP_VERSION: readPackageJsonSync().version,
APP_NAME: readPackageJsonSync().name,
APP_DESCRIPTION: readPackageJsonSync().description,
AUTHOR_NAME: readPackageJsonSync().author?.name,
AUTHOR_EMAIL: readPackageJsonSync().author?.email,
AUTHOR_WEBSITE: readPackageJsonSync().author?.url
}; But I was hesitant to make this change for now as I don't know the reason behind you using environment variables for these stuff.. |
Hi @AvinashReddy3108 ! First of all, thank you for your PR. I think it is a very good idea 👌 Anyway, before merge the PR it is necessary to correct the problems reported by tsc. The environment variables are there to provide an option to overwrite all this information. For example, imagine that when you are going to deploy the application in a productive environment you prefer to show the information of the company and not of the developer who implemented the application. In this way, unless overwritten, the package.json data will always be shown, but if we want others for any reason, they could be provided in a very simple way. |
Never faced those issues in my local machine (node 18.x), but tried to solve them nonetheless. PS: the PR's commit history looks embarrassing (sorry about that), please "Squash and Merge" if the CI runs pass. |
@borjapazr I also updated the But won't it be better if there's a |
* package.json: follow npm Docs guidelines https://docs.npmjs.com/cli/v8/configuring-npm/package-json#people-fields-author-contributors * app.config.ts: read more stuff from package.json The package `read-pkg` allows for it, let's use it :) * package.json: fix author URL * fix tsc errors * fix(appinfo): ran prettier * Update .env Co-authored-by: Borja Paz Rodríguez <borjapazr@gmail.com>
Basically, an extension of this commit for other applicable fields in the
AppInfo
array.