admin管理员组

文章数量:1026989

I am about to release a javascript library.

I would like to save the file as [library-name].1.0.0

Then as the library will evolve you will be able to download new versions, e.g.

  • [library-name].1.0.1.js
  • [library-name].1.0.2.js
  • [library-name].1.0.3.js
  • [library-name].1.1.0.js
  • [library-name].1.2.0.js
  • [library-name].2.0.0.js

My question is: is there any reason not to save the version in the name of the file?

I am using other 3rd party libraries and the ones for which I don't store the version I always have to figure out if I have to upgrade or not.

For instance, I use codemirror.js, and I always wonder if I am using the latest version.

I am about to release a javascript library.

I would like to save the file as [library-name].1.0.0

Then as the library will evolve you will be able to download new versions, e.g.

  • [library-name].1.0.1.js
  • [library-name].1.0.2.js
  • [library-name].1.0.3.js
  • [library-name].1.1.0.js
  • [library-name].1.2.0.js
  • [library-name].2.0.0.js

My question is: is there any reason not to save the version in the name of the file?

I am using other 3rd party libraries and the ones for which I don't store the version I always have to figure out if I have to upgrade or not.

For instance, I use codemirror.js, and I always wonder if I am using the latest version.

Share Improve this question edited Apr 3, 2013 at 11:04 Paul D. Waite 99k57 gold badges203 silver badges271 bronze badges asked Apr 3, 2013 at 9:09 Zo72Zo72 15.4k18 gold badges74 silver badges105 bronze badges 1
  • Please don't vote this one to close it. I really think this is a genuine question whose answers might help people decide whether to add the version in the file name or not. – Zo72 Commented Apr 3, 2013 at 10:17
Add a ment  | 

4 Answers 4

Reset to default 3

If you are giving it for download, then its a good idea to have version number as part of file name. Also its a good idea to add version number along with the license info at the beginning of the file like jQuery does

Checkout - http://code.jquery./jquery-1.9.1.min.js

Only case where you shouldn't add version number is when you are referencing a script file throughout your website - because you don't want to change all references whenever you update the script.

I've never released any libraries myself, but putting the version number in the file name sounds like a fine idea to me.

On upgrading, I think not putting the version number in the file name is used for libraries where the author doesn't expect to introduce breaking changes in future versions, only bug fixes and additions that don't affect code already written against the library. This means that people who use the library but don't host it themselves (i.e. who point to the library on a public CDN) automatically point to the latest version, and thus get bug fixes without having to do anything.

But, as you say, for people who download the library and host it themselves, it does mean they have to open the library file to check the version number.

If you want to match what some other library publishers do, you might want to have a look at Semantic Versioning - it codifies the x.x.x version numbering system.

And if you're going to release your library through Github (which I believe is what the cool kids do these days), you might want to use Jonathan "Wolf" Rentzsch's system for doing semantic versioning there.

If you are using unit tests you can make sure that the V1 unit tests all work fine against V2 before releasing the library.

Smashing article on js unit testing

If I understood your question correctly, one reason not to include the version name is that if you're hosting the script users using that CDN-hosted file don't have to change any code when you upgrade.

I am about to release a javascript library.

I would like to save the file as [library-name].1.0.0

Then as the library will evolve you will be able to download new versions, e.g.

  • [library-name].1.0.1.js
  • [library-name].1.0.2.js
  • [library-name].1.0.3.js
  • [library-name].1.1.0.js
  • [library-name].1.2.0.js
  • [library-name].2.0.0.js

My question is: is there any reason not to save the version in the name of the file?

I am using other 3rd party libraries and the ones for which I don't store the version I always have to figure out if I have to upgrade or not.

For instance, I use codemirror.js, and I always wonder if I am using the latest version.

I am about to release a javascript library.

I would like to save the file as [library-name].1.0.0

Then as the library will evolve you will be able to download new versions, e.g.

  • [library-name].1.0.1.js
  • [library-name].1.0.2.js
  • [library-name].1.0.3.js
  • [library-name].1.1.0.js
  • [library-name].1.2.0.js
  • [library-name].2.0.0.js

My question is: is there any reason not to save the version in the name of the file?

I am using other 3rd party libraries and the ones for which I don't store the version I always have to figure out if I have to upgrade or not.

For instance, I use codemirror.js, and I always wonder if I am using the latest version.

Share Improve this question edited Apr 3, 2013 at 11:04 Paul D. Waite 99k57 gold badges203 silver badges271 bronze badges asked Apr 3, 2013 at 9:09 Zo72Zo72 15.4k18 gold badges74 silver badges105 bronze badges 1
  • Please don't vote this one to close it. I really think this is a genuine question whose answers might help people decide whether to add the version in the file name or not. – Zo72 Commented Apr 3, 2013 at 10:17
Add a ment  | 

4 Answers 4

Reset to default 3

If you are giving it for download, then its a good idea to have version number as part of file name. Also its a good idea to add version number along with the license info at the beginning of the file like jQuery does

Checkout - http://code.jquery./jquery-1.9.1.min.js

Only case where you shouldn't add version number is when you are referencing a script file throughout your website - because you don't want to change all references whenever you update the script.

I've never released any libraries myself, but putting the version number in the file name sounds like a fine idea to me.

On upgrading, I think not putting the version number in the file name is used for libraries where the author doesn't expect to introduce breaking changes in future versions, only bug fixes and additions that don't affect code already written against the library. This means that people who use the library but don't host it themselves (i.e. who point to the library on a public CDN) automatically point to the latest version, and thus get bug fixes without having to do anything.

But, as you say, for people who download the library and host it themselves, it does mean they have to open the library file to check the version number.

If you want to match what some other library publishers do, you might want to have a look at Semantic Versioning - it codifies the x.x.x version numbering system.

And if you're going to release your library through Github (which I believe is what the cool kids do these days), you might want to use Jonathan "Wolf" Rentzsch's system for doing semantic versioning there.

If you are using unit tests you can make sure that the V1 unit tests all work fine against V2 before releasing the library.

Smashing article on js unit testing

If I understood your question correctly, one reason not to include the version name is that if you're hosting the script users using that CDN-hosted file don't have to change any code when you upgrade.

本文标签: Should I put the version number of my JavaScript library in the file nameStack Overflow