Dam*_*mon 7 javascript json node.js
它可能是不可能的(因为这是JSON而不是JavaScript).我只是想想一个从npm命令在字符串中插入日期戳的最简单方法,而不增加另一个任务运行器的开销等:
"scripts": {
"deploy" : "git add -A; git commit -m \"automated deployment {DateStamp}\"; git push deployment browse --force;"
},
Run Code Online (Sandbox Code Playgroud)
而且无需责备我使用--force;)
Dmi*_*mov 15
NPM脚本只是bash脚本.使用bash功能将datestamp添加到某个提交消息中.
例:
"scripts": {
"deploy" : "git add -A; timestamp=$(date \"+%s\") && git commit -m \"automated deployment $timestamp\"; git push deployment browse --force;"
},
Run Code Online (Sandbox Code Playgroud)