mirror of
https://github.com/OBKoro1/autoCommit.git
synced 2024-12-23 09:39:19 +08:00
update
This commit is contained in:
parent
0a954792ab
commit
00cb772e66
13
package-lock.json
generated
Normal file
13
package-lock.json
generated
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "autocommit",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"moment": {
|
||||||
|
"version": "2.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
|
||||||
|
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
src/index.js
48
src/index.js
@ -2,7 +2,7 @@
|
|||||||
* Author : OBKoro1
|
* Author : OBKoro1
|
||||||
* Date : 2019-12-19 20:23:57
|
* Date : 2019-12-19 20:23:57
|
||||||
* LastEditors : OBKoro1
|
* LastEditors : OBKoro1
|
||||||
* LastEditTime : 2019-12-20 18:54:45
|
* LastEditTime : 2019-12-22 02:01:14
|
||||||
* FilePath : /autoCommit/index.js
|
* FilePath : /autoCommit/index.js
|
||||||
* Description : 自动commit
|
* Description : 自动commit
|
||||||
* https://github.com/OBKoro1
|
* https://github.com/OBKoro1
|
||||||
@ -15,17 +15,19 @@ const fs = require('fs');
|
|||||||
class autoCommit {
|
class autoCommit {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
}
|
}
|
||||||
getData() {
|
getData(paramsObj) {
|
||||||
let time1 = '2019-01-02';
|
let time1 = '2019-01-02';
|
||||||
let time2 = '2019-01-10';
|
let time2 = '2019-01-02';
|
||||||
this.getAll(time1, time2);
|
this.getAllDay(time1, time2);
|
||||||
|
console.log('timeArr', this.timeArr)
|
||||||
}
|
}
|
||||||
formatTime(time) {
|
formatTime(time) {
|
||||||
return `${time} 08:00`;
|
return `${time} 08:00`;
|
||||||
}
|
}
|
||||||
getAll(begin, end) {
|
getAllDay(begin, end) {
|
||||||
let timeArr = []; // TODO: 时间段
|
this.timeArr = [];
|
||||||
const beginSplit = begin.split('-');
|
const beginSplit = begin.split('-');
|
||||||
const endSplit = end.split('-');
|
const endSplit = end.split('-');
|
||||||
const beginDate = new Date();
|
const beginDate = new Date();
|
||||||
@ -34,21 +36,37 @@ class autoCommit {
|
|||||||
endDate.setUTCFullYear(endSplit[0], endSplit[1] - 1, endSplit[2]);
|
endDate.setUTCFullYear(endSplit[0], endSplit[1] - 1, endSplit[2]);
|
||||||
const beginNumber = beginDate.getTime();
|
const beginNumber = beginDate.getTime();
|
||||||
const endNumber = endDate.getTime();
|
const endNumber = endDate.getTime();
|
||||||
for (var k = timeNumber; k <= endNumber; ) {
|
for (var k = beginNumber; k <= endNumber;) {
|
||||||
console.log(new beginNumber(parseInt(k)).format());
|
let day = new Date(parseInt(k))
|
||||||
|
let dayFormat = moment(day).format('YYYY-MM-DD')
|
||||||
|
this.timeArr.push(dayFormat)
|
||||||
k = k + 24 * 60 * 60 * 1000;
|
k = k + 24 * 60 * 60 * 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init() {
|
// 只commit今天
|
||||||
this.getData();
|
commitToday() {
|
||||||
const time = moment().format('DD/MM/YYYY HH:MM:ss');
|
const time = moment().format('DD/MM/YYYY HH:MM:ss');
|
||||||
let time3 = moment('2019-01-02 08:00').format();
|
// TODO:
|
||||||
console.log('time', time2, time3);
|
}
|
||||||
fs.writeFileSync('./test.md', time, 'utf-8');
|
init() {
|
||||||
|
let paramsObj = {
|
||||||
|
beginDay: '2019-01-02',
|
||||||
|
endDay: '2019-01-10',
|
||||||
|
commitNumber: 1 // 每天commit 次数
|
||||||
|
}
|
||||||
|
// TODO: 数组 每段时间commit几次,参数如上
|
||||||
|
// 今天
|
||||||
|
if (!paramsObj.endDay) {
|
||||||
|
paramsObj.endDay = moment().format('YYYY-MM-DD')
|
||||||
|
}
|
||||||
|
this.getData();
|
||||||
// this.commit();
|
// this.commit();
|
||||||
}
|
}
|
||||||
getTime() {
|
readyCommit() {
|
||||||
return '';
|
// const time = moment().format('DD/MM/YYYY HH:MM:ss');
|
||||||
|
let time3 = moment('2019-01-02 08:00').format();
|
||||||
|
fs.writeFileSync('./test.md', time, 'utf-8');
|
||||||
|
|
||||||
}
|
}
|
||||||
commit() {
|
commit() {
|
||||||
// git commit --amend --date="2019-01-02T00:00:00+0800" -am 'autoCommit'
|
// git commit --amend --date="2019-01-02T00:00:00+0800" -am 'autoCommit'
|
||||||
|
Loading…
Reference in New Issue
Block a user