You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a module package that generates text files, and I'm appending the current module version to the generated files. This package helped me to deal with reading the package.json file as expected, I'm really grateful for it.
I'm using TypeScript, and wanted to, as the "Advanced Integration" documentation suggests, generate the version file after the patch.
I've tried to use a postversion.sh as indicated but this caused some issues. For example, this scripts requires you to fiddle with the git tags after creating, and also for my case of using Typescript it wasn't so useful because at this step the code has already been built and this file wasn't there in the process.
I've found a practical way to use it, which I think other people might find useful, which is:
create a "gv" script to generate the file and add it to the build process:
And now, each time you run npm version patch for example, the file is generated and pushed along with the package.json update. Besides that, you've already built the project with the recently generated version, so you can just publish it right away.
I'm not an expert on this, so I might have overlooked something, but this was really helpful on my project, and I didn't had to create a shell file, made it executable and so on, it just works right out of the clone.
Cheers!
The text was updated successfully, but these errors were encountered:
I'm working on a module package that generates text files, and I'm appending the current module version to the generated files. This package helped me to deal with reading the
package.json
file as expected, I'm really grateful for it.I'm using TypeScript, and wanted to, as the "Advanced Integration" documentation suggests, generate the version file after the patch.
I've tried to use a
postversion.sh
as indicated but this caused some issues. For example, this scripts requires you to fiddle with the git tags after creating, and also for my case of using Typescript it wasn't so useful because at this step the code has already been built and this file wasn't there in the process.I've found a practical way to use it, which I think other people might find useful, which is:
And now, each time you run
npm version patch
for example, the file is generated and pushed along with thepackage.json
update. Besides that, you've already built the project with the recently generated version, so you can just publish it right away.I'm not an expert on this, so I might have overlooked something, but this was really helpful on my project, and I didn't had to create a shell file, made it executable and so on, it just works right out of the clone.
Cheers!
The text was updated successfully, but these errors were encountered: