简体   繁体   English

更改代码时触发的事件?

[英]Event that triggers when code is changed?

Hi is there an event that detects changes to the js code so you could change the version number evertime you do something with the code您好,是否有一个事件可以检测 js 代码的更改,因此您可以在每次对代码执行某些操作时更改版本号

I am to lazy to change the version number on my site every time I work on it:)每次我在网站上工作时,我都懒得更改网站上的版本号:)

There are a lot of ways to do this, which is the good news.有很多方法可以做到这一点,这是个好消息。 The bad news is that the most appropriate method for your project will depend very heavily on the details of how your project is set up, what method you use to deploy it, and so on.坏消息是,最适合您的项目的方法在很大程度上取决于项目的设置方式、部署方式等细节。 Generally things like automatic version increments on deployment are done by CI/CD tools, and that's a large field.通常像部署时的自动版本增量这样的事情是由 CI/CD 工具完成的,这是一个很大的领域。 You'll have to do some research on your own, with your project specifics as well as your needs in mind, to decide on the best solution.你必须自己做一些研究,考虑到你的项目细节和你的需求,来决定最好的解决方案。 For example, if this is a private project and you don't want to bother with semantic versioning you can simply increment a counter, whereas a more elaborate project might have more complicated requirements.例如,如果这是一个私人项目并且您不想为语义版本控制而烦恼,您可以简单地增加一个计数器,而更复杂的项目可能有更复杂的要求。

Your question is tagged with javascript, although it's not clear what package manager you're using (if any).你的问题是用 javascript 标记的,虽然不清楚你使用的是什么包管理器(如果有的话)。 If you're working with npm or yarn you can use push or commit hooks, which is perhaps the simplest option.如果您正在使用 npm 或 yarn,您可以使用 push 或 commit 钩子,这可能是最简单的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM