简体   繁体   English

将 package.json 依赖项倒回到时间戳?

[英]rewind package.json dependencies to a timestamp?

Is there a way to specify a timestamp for a package.json dependency?有没有办法为 package.json 依赖项指定时间戳? I want to "rewind" a project to a certain date and get the latest packages at that date.我想将项目“倒带”到某个日期并在该日期获取最新的包。

I am not sure how I would specify this in my dependencies.我不确定如何在我的依赖项中指定它。 Suggestions welcome!欢迎提出建议!

To find the latest version of a package for a given date, you can find the package on NPM or where the code is hosted and look for the version that most closely matches the date.要查找给定日期的 package 的最新版本,您可以在 NPM 或托管代码的位置找到 package 并查找与日期最匹配的版本。 For example on Github you would be looking for tags or releases;例如,在 Github 上,您将寻找标签或版本; on npmjs.com you would look for a date that's in the right range.在 npmjs.com 上,您会查找在正确范围内的日期。 Here's an example on one of my packages .这是我的一个包的示例。 If you hover over "a year ago", "2 years ago", etc., it'll show you the actual timestamp.如果 hover 超过“一年前”、“2 年前”等,它会显示实际时间戳。 Then you can pin to that version.然后你可以固定到那个版本。 If your own project is in a repo, the easiest thing to do would be to find the date, check out a commit at that time, and work from there.如果您自己的项目在 repo 中,最简单的做法是找到日期,检查当时的提交,然后从那里开始工作。

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

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