[英]React how to handle app versioning and copyright year?
I have a react app built with Nrwl that has a footer.我有一个用 Nrwl 构建的带有页脚的反应应用程序。 In the footer I have the copyright and the version number.
在页脚中,我有版权和版本号。 What is the best way to dynamically set those?
动态设置它们的最佳方法是什么?
How do you tackle this?你如何解决这个问题?
package.json
to maintain versioning.package.json
推断出来以维护版本控制。
http://worldtimeapi.org/api/timezone/Europe/Dublin
This will give a you a response like following, you can easily get year and further in this.这会给你一个像下面这样的回应,你可以很容易地得到一年甚至更远。
{"abbreviation":"GMT","client_ip":"39.42.97.186","datetime":"2021-02-01T11:09:53.942753+00:00","day_of_week":1,"day_of_year":32,"dst":false,"dst_from":null,"dst_offset":-3600,"dst_until":null,"raw_offset":3600,"timezone":"Europe/Dublin","unixtime":1612177793,"utc_datetime":"2021-02-01T11:09:53.942753+00:00","utc_offset":"+00:00","week_number":5}
const PACKAGE = require('./package.json');
module.exports = {
// Other stuff
plugins: [
new DefinePlugin({
APP_VERSION: PACKAGE.version
});
]
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.