feat: Expose package version in build#108
Merged
stanleyjones merged 2 commits intoliftedinit:mainfrom Feb 13, 2023
Merged
Conversation
✅ Deploy Preview for lifted-alberto ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
stanleyjones
commented
Feb 13, 2023
| REACT_APP_WEB3AUTH_NETWORK=testnet | ||
| REACT_APP_WEB3AUTH_CLIENTID=BKj3lr6GfN2CnvO4CIKo5fuoCg_TpHsAPK7R8lbl6kUlz0CAH_5mFNswScEb7M6szV4hd1Tkwa2oPZ9KiXJB-44 No newline at end of file | ||
| REACT_APP_WEB3AUTH_CLIENTID=BKj3lr6GfN2CnvO4CIKo5fuoCg_TpHsAPK7R8lbl6kUlz0CAH_5mFNswScEb7M6szV4hd1Tkwa2oPZ9KiXJB-44 | ||
| REACT_APP_VERSION=${npm_package_version} |
Contributor
Author
There was a problem hiding this comment.
Get the package version from package.json.
| following command: | ||
|
|
||
| ```sh | ||
| npm version prerelease --preid alpha |
Contributor
Author
There was a problem hiding this comment.
Generate an actually useful version string (instead of just 0.1.0). By using this command, npm will:
- Bump the version (i.e.
0.1.0-alpha.8->0.1.0-alpha.9) - Update
package.json - Commit all changes
- Create a tag (i.e.
0.1.0-alpha.9) - Push changes and tags to GitHub
Comment on lines
+14
to
+15
| "version": "git add -A", | ||
| "postversion": "git push && git push --tags" |
Contributor
Author
There was a problem hiding this comment.
"version" will add the updated package.json to git and "postversion" will push it, along with the newly created tag.
| <meta name="theme-color" content="#000000" /> | ||
| <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
| <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
| <meta name="version" content="%REACT_APP_VERSION%" /> |
Contributor
Author
There was a problem hiding this comment.
Finally, actually expose the more useful version in the front-end code.
rfisch
approved these changes
Feb 13, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In order to better diagnose production bugs, this PR introduces a mechanism for exposing the package version in the production build (specifically in
index.htmlas ametatag).package.json.envand write it inindex.htmlRelated Issue
No related issue, but useful in diagnosing future issues.
Testing
No changes.
Breaking Changes (if applicable)
None.
Screenshots (if applicable)
N/A
Checklist: