Type something to search...

Get current commit id of Git and update to package.json

When developing a Node.js project, you may want to keep track of the current commit ID of your Git repository. This information can be useful for debugging, versioning, or deployment purposes. One way to achieve this is by updating the package.json file with the current commit ID during the build process. This article will guide you through the steps to get the current commit ID of Git and update it to the package.json file using Node.js.

"predev": "node ./node_modules/json/lib/json.js -I -f package.json -e \"this.commit='$(git rev-parse --short HEAD)'\"",

Related Post

AWS CodeCommit: The GitHub Large File Storage (Git LFS) Free Alternative

AWS CodeCommit offers a robust alternative to GitHub's Large File Storage (Git LFS) service, providing an efficient solution for managing large files in your Git repositories. Why You Should Reco

Read More

Quickly Convert Markdown to Academic-Style Paper PDF on macOS

In this guide, I'll walk you through how I convert Markdown documents to academic-style paper PDFs on macOS using Pandoc and BasicTeX. This method is quick and straightforward, perfect for when you n

Read More

Electron Build Tools `ERROR Error: Failed to run "choco install pywin32 --yes"`

When working with Electron Build Tools, you might encounter an error related to the installation of pywin32 via Chocolatey. This can be frustrating, especially when it's a required dependency for you

Read More

Migrate a GitHub LFS (Git Large File Storage) repository to AWS CodeCommit

I recently migrated one of my GitHub repositories, which uses Git Large File Storage (LFS), over to AWS CodeCommit. I thought I'd share the process with you in case you’re looking to do something sim

Read More

Reset/Restore All subdirectories of Git

Managing a Git repository effectively often requires resetting or restoring subdirectories to maintain a clean and functional codebase. This guide provides a concise, step-by-step approach to reset o

Read More