microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.83k stars 12.46k forks source link

how can i get an automatic build number/version? #15710

Closed zpdDG4gta8XKpMCd closed 7 years ago

zpdDG4gta8XKpMCd commented 7 years ago

i need a time stamp in my code which would tell whether the client and server code match or crash otherwise to prevent execution in an inconsistent environment

is there a way to get an incremental number in my code every time i run a build?

gcnew commented 7 years ago

Why not the build number from CI or current date?

If you want something that doesn't change unless code changes, I've previously used the number of git commits. It can get a little tricky if your CI pulls with depth 1 (as it likely does), however commit timestamp is still there waiting :).

mhegazy commented 7 years ago

C++ has had this in a macro __TIME__; compile-time macros are not that uncommon C# has caller file, and VB and C# have nameof operator.

But i guess we decided not to do compile-time macros at the time being.

zpdDG4gta8XKpMCd commented 7 years ago

it's simple, just change your mind and decide you need them

mhegazy commented 7 years ago

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.