update:2024-08-07 11:15:54 -AutoCommit
This commit is contained in:
1 parent
cbecc3a240
commit
36499642a7
3 files changed
+4
-46
No files matched your search
+1
-1
@@ -3,6 +3,6 @@
|
|||||||
"shelljs": "^0.8.5"
|
"shelljs": "^0.8.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"push": "node update.mjs"
|
"push": "node AutoCommitPush.mjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
星网实习期间学习笔记记录
|
星网实习期间学习笔记记录
|
||||||
|
|
||||||
|
通过```pnpm run push```以推送代码并自动生成commit说明
|
||||||
-44
@@ -1,44 +0,0 @@
|
|||||||
import shell from "shelljs";
|
|
||||||
import _readline from "readline";
|
|
||||||
import { rejects } from "assert";
|
|
||||||
|
|
||||||
const readline = _readline.createInterface({
|
|
||||||
input: process.stdin,
|
|
||||||
output: process.stdout
|
|
||||||
});
|
|
||||||
|
|
||||||
const input = async function (question) {
|
|
||||||
return await new Promise((resolve, rejects) => {
|
|
||||||
try {
|
|
||||||
readline.question(question, output => {
|
|
||||||
readline.close();
|
|
||||||
resolve(output);
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
rejects(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const generateDate = function () {
|
|
||||||
const dateNow = new Date();
|
|
||||||
const paddingNumber = function(num){
|
|
||||||
return ("0" + (num + 1)).slice(-2)
|
|
||||||
}
|
|
||||||
let year = dateNow.getFullYear();
|
|
||||||
let month = paddingNumber((dateNow.getMonth() + 1));
|
|
||||||
let day = paddingNumber(dateNow.getDate());
|
|
||||||
let hour = paddingNumber(dateNow.getHours());
|
|
||||||
let minute = paddingNumber(dateNow.getMinutes());
|
|
||||||
let seconds = paddingNumber(dateNow.getSeconds());
|
|
||||||
return `${year}-${month}-${day} ${hour}:${minute}:${seconds}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
;(async function(){
|
|
||||||
const remark = await input('remark:')
|
|
||||||
const message = `update:${generateDate()} ${remark ? '-remark:'+remark : ''} -AutoCommit`
|
|
||||||
// console.log(message)
|
|
||||||
shell.exec(`git commit -am "${message}"`);
|
|
||||||
shell.exec("git push");
|
|
||||||
})()
|
|
||||||
Reference in new issue
Block a user