修改插件名称

This commit is contained in:
OBKoro1 2020-01-03 15:12:02 +08:00
parent 53eee36cab
commit 19a115efbb
11 changed files with 7 additions and 166 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -2,7 +2,6 @@
### 如果觉得本插件还不错的话,给个[Star](https://github.com/OBKoro1/autoCommit)吧~ ### 如果觉得本插件还不错的话,给个[Star](https://github.com/OBKoro1/autoCommit)吧~
<!-- TODO: package.json 抄一下 -->
<!-- TODO: wiki readme --> <!-- TODO: wiki readme -->
<!-- TODO: npm包形式 --> <!-- TODO: npm包形式 -->
<!-- webview 的icon --> <!-- webview 的icon -->

View File

@ -12,6 +12,6 @@
<!-- TODO: icon --> <!-- TODO: icon -->
<!-- 分支未创建 未上传问题 --> <!-- 注意保持git干净不要有未合并merge、rebase等情况 -->
<!-- 注意保持git干净不要有未合并merge、rebase等情况 --> <!-- TODO: 提交到分支不会显示在绿色格子里面 合并后 才有 -->

BIN
images/.DS_Store vendored

Binary file not shown.

BIN
images/command.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,6 +1,6 @@
{ {
"name": "autoCommit", "name": "auto-commit",
"displayName": "autoCommit", "displayName": "Auto Commit",
"description": "自动提交commit到github", "description": "自动提交commit到github",
"publisher": "OBKoro1", "publisher": "OBKoro1",
"version": "1.0.0", "version": "1.0.0",
@ -20,7 +20,7 @@
"email": "obkoro1@foxmail.com", "email": "obkoro1@foxmail.com",
"url": "http://obkoro1.com/web_accumulate/" "url": "http://obkoro1.com/web_accumulate/"
}, },
"icon": "images/icon3.png", "icon": "images/icon.png",
"galleryBanner": { "galleryBanner": {
"color": "#3B4859", "color": "#3B4859",
"theme": "dark" "theme": "dark"
@ -44,8 +44,8 @@
"commands": [ "commands": [
{ {
"command": "extension.autoCommit", "command": "extension.autoCommit",
"title": "Github自动提交 autoCommit", "title": "控制Github绿色格子的commit数量",
"category": "Github自动提交 autoCommit" "category": "auto commit Github自动提交 "
} }
] ]
}, },

View File

@ -1,116 +0,0 @@
/*
* Author : OBKoro1
* Date : 2019-12-19 20:23:57
* LastEditors : OBKoro1
* LastEditTime : 2019-12-27 15:50:22
* FilePath : /autoCommit/src/index.js
* Description : 自动commit
* https://github.com/OBKoro1
*/
const { execSync } = require('child_process');
const moment = require('moment');
const fs = require('fs');
class autoCommit {
constructor() {
this.init();
}
getData() {
this.getAllDay(this.paramsObj.beginDay, this.paramsObj.endDay);
this.readyCommit();
}
// 格式化日期
formatTime(time) {
return `${time} 08:00`;
}
// 获取两个日期之间的间隔: [ '2019-02-02', '2019-02-03' ... ]
getAllDay(begin, end) {
this.timeArr = [];
const beginSplit = begin.split('-');
const endSplit = end.split('-');
const beginDate = new Date();
beginDate.setUTCFullYear(beginSplit[0], beginSplit[1] - 1, beginSplit[2]);
const endDate = new Date();
endDate.setUTCFullYear(endSplit[0], endSplit[1] - 1, endSplit[2]);
const beginNumber = beginDate.getTime();
const endNumber = endDate.getTime();
for (let k = beginNumber; k <= endNumber; ) {
const day = new Date(parseInt(k));
const dayFormat = moment(day).format('YYYY-MM-DD');
this.timeArr.push(dayFormat);
k = k + 24 * 60 * 60 * 1000;
}
}
init() {
// TODO: 获取参数
let paramsObj = {
beginDay: '2019-12-27',
itemSrc: '/Users/koro/work/web_my/testCommit' // 要commit的项目地址
};
let defaultOption = {
beginDay: moment().format('YYYY-MM-DD'), // 默认为今天
endDay: moment().format('YYYY-MM-DD'), // 默认为今天
fileSrc: `commit.md`,
commitNumber: 1 // 每天commit 次数
};
this.paramsObj = Object.assign(defaultOption, paramsObj);
this.getData();
}
// commit
readyCommit() {
console.log('日期数组:', this.timeArr);
console.log('每个日期提交次数:', this.paramsObj.commitNumber);
let totalNum = 0; // 总commit次数
// 遍历日期
this.timeArr.forEach(item => {
// 每个日期commit次数
for (let i = 0; i < this.paramsObj.commitNumber; i++) {
let time = this.formatTime(item); // 2019-01-02 08:00
time = moment(time).format(); // 2019-01-02T00:00:00+0800
const commitContent = `${time}${i}`;
fs.writeFileSync(
`${this.paramsObj.itemSrc}/${this.paramsObj.fileSrc}`,
commitContent,
'utf-8'
);
let res = this.myExecSync(
`cd ${this.paramsObj.itemSrc} && git add . && git commit -m 'autoCommit' --date='${time}' && git pull && git push origin master`
);
console.log('res 开始', res);
console.log('res 结束');
let cmd = `git log -1 \
--date=iso --pretty=format:'{"commit": "%h","author": "%aN <%aE>","date": "%ad","message": "%s"},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'`;
let log = this.myExecSync(cmd);
console.log('log 开始', log);
console.log('log 结束');
totalNum++;
console.log('commit内容', commitContent);
}
console.log(`总commit次数${totalNum}`);
});
}
myExecSync(cmd) {
// 除了该方法直到子进程完全关闭后才返回 执行完毕 返回
try {
const res = execSync(cmd, {
encoding: 'utf8',
timeout: 0,
maxBuffer: 200 * 1024,
killSignal: 'SIGTERM',
cwd: undefined,
env: undefined
});
return res;
} catch (err) {
console.log(`执行命令出错:${cmd}`);
}
}
}
new autoCommit();

View File

@ -1,42 +0,0 @@
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your extension and command.
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesnt yet need to load the plugin.
* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
## Get up and running straight away
* Press `F5` to open a new window with your extension loaded.
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
* Find output from your extension in the debug console.
## Make changes
* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Explore the API
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
## Run tests
* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
* Press `F5` to run the tests in a new window with your extension loaded.
* See the output of the test result in the debug console.
* Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
* You can create folders inside the `test` folder to structure your tests any way you want.
## Go further
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).