mirror of
https://github.com/OBKoro1/autoCommit.git
synced 2024-11-22 02:19:23 +08:00
1.0.0
This commit is contained in:
parent
551562c9ff
commit
77facfe79f
@ -14,4 +14,4 @@
|
|||||||
|
|
||||||
### [V1.0.0]
|
### [V1.0.0]
|
||||||
|
|
||||||
- Initial release
|
插件开源
|
||||||
|
BIN
images/autoCommit.gif
Normal file
BIN
images/autoCommit.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 MiB |
BIN
images/commit-color.png
Normal file
BIN
images/commit-color.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -2,7 +2,7 @@
|
|||||||
* Author : OBKoro1
|
* Author : OBKoro1
|
||||||
* Date : 2019-12-30 16:59:30
|
* Date : 2019-12-30 16:59:30
|
||||||
* LastEditors : OBKoro1
|
* LastEditors : OBKoro1
|
||||||
* LastEditTime : 2020-01-07 22:30:03
|
* LastEditTime : 2020-01-08 10:48:40
|
||||||
* FilePath : /autoCommit/src/models/commitHandle.ts
|
* FilePath : /autoCommit/src/models/commitHandle.ts
|
||||||
* Description : commit 具体操作
|
* Description : commit 具体操作
|
||||||
* https://github.com/OBKoro1
|
* https://github.com/OBKoro1
|
||||||
@ -13,7 +13,12 @@ import * as moment from 'moment';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { execSync, exec } from 'child_process';
|
import { execSync, exec } from 'child_process';
|
||||||
import { RandomNumber } from '../util/util';
|
import { RandomNumber } from '../util/util';
|
||||||
import { getPanelWebview, outputLog, isProduction } from '../util/vscodeUtil';
|
import {
|
||||||
|
getPanelWebview,
|
||||||
|
outputLog,
|
||||||
|
isProduction,
|
||||||
|
getExtensionContext
|
||||||
|
} from '../util/vscodeUtil';
|
||||||
import WebView from './WebView';
|
import WebView from './WebView';
|
||||||
|
|
||||||
interface timeElement {
|
interface timeElement {
|
||||||
@ -149,7 +154,7 @@ class CommitHandle {
|
|||||||
if (this.cancelCommit()) {
|
if (this.cancelCommit()) {
|
||||||
if (totalNum < 1) return;
|
if (totalNum < 1) return;
|
||||||
outputLog('回滚中...');
|
outputLog('回滚中...');
|
||||||
const res = await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
let cmd = `cd ${this.paramsObj.itemSrc} && git reset --hard HEAD~${totalNum}`;
|
let cmd = `cd ${this.paramsObj.itemSrc} && git reset --hard HEAD~${totalNum}`;
|
||||||
exec(cmd, (error, stdout, stderr) => {
|
exec(cmd, (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -164,6 +169,7 @@ class CommitHandle {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
outputLog('提交中...');
|
outputLog('提交中...');
|
||||||
|
this.autoCommitView.postMessage('提交中...', '提交中');
|
||||||
const res = await new Promise((resolve, reject) => {
|
const res = await new Promise((resolve, reject) => {
|
||||||
let cmd = `cd ${this.paramsObj.itemSrc} && git pull && git push`;
|
let cmd = `cd ${this.paramsObj.itemSrc} && git pull && git push`;
|
||||||
exec(cmd, (error, stdout, stderr) => {
|
exec(cmd, (error, stdout, stderr) => {
|
||||||
@ -182,8 +188,10 @@ class CommitHandle {
|
|||||||
}
|
}
|
||||||
commitEnd(totalNum: number) {
|
commitEnd(totalNum: number) {
|
||||||
this.userCancel = false; // 重新打开终止开关
|
this.userCancel = false; // 重新打开终止开关
|
||||||
this.autoCommitView.postMessage('commit 完成', 'commit 完成');
|
this.autoCommitView.postMessage('commit 完成', this.paramsObj);
|
||||||
|
getExtensionContext().globalState.update('commit-params', this.paramsObj);
|
||||||
outputLog('自动commit完成', `总commit次数${totalNum}`);
|
outputLog('自动commit完成', `总commit次数${totalNum}`);
|
||||||
|
outputLog('保存参数信息');
|
||||||
}
|
}
|
||||||
cancelCommit() {
|
cancelCommit() {
|
||||||
if (this.userCancel) {
|
if (this.userCancel) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Author : OBKoro1
|
* Author : OBKoro1
|
||||||
* Date : 2019-12-25 17:08:18
|
* Date : 2019-12-25 17:08:18
|
||||||
* @LastEditors : OBKoro1
|
* LastEditors : OBKoro1
|
||||||
* @LastEditTime : 2020-01-02 21:49:13
|
* LastEditTime : 2020-01-08 10:04:53
|
||||||
* FilePath : /autoCommit/src/models/index.ts
|
* FilePath : /autoCommit/src/models/index.ts
|
||||||
* Description : 插件逻辑入口
|
* Description : 插件逻辑入口
|
||||||
* https://github.com/OBKoro1
|
* https://github.com/OBKoro1
|
||||||
@ -39,6 +39,9 @@ class ExtensionLogic {
|
|||||||
};
|
};
|
||||||
this.autoCommitView.create(option);
|
this.autoCommitView.create(option);
|
||||||
this.autoCommitView.postMessage('isProduction', isProduction());
|
this.autoCommitView.postMessage('isProduction', isProduction());
|
||||||
|
const formData = this.context.globalState.get('commit-params')
|
||||||
|
this.autoCommitView.postMessage('init-formData', formData)
|
||||||
|
|
||||||
}
|
}
|
||||||
// 处理webview的消息
|
// 处理webview的消息
|
||||||
private messageCallBack(message: webviewMsg) {
|
private messageCallBack(message: webviewMsg) {
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
* Author : OBKoro1
|
* Author : OBKoro1
|
||||||
* Date : 2019-12-25 17:13:30
|
* Date : 2019-12-25 17:13:30
|
||||||
* LastEditors : OBKoro1
|
* LastEditors : OBKoro1
|
||||||
* LastEditTime : 2020-01-02 13:44:30
|
* LastEditTime : 2020-01-08 09:59:48
|
||||||
* FilePath : /autoCommit/src/util/vscodeUtil.ts
|
* FilePath : /autoCommit/src/util/vscodeUtil.ts
|
||||||
* Description : vscode 相关的公共方法
|
* Description : vscode 相关的公共方法
|
||||||
* https://github.com/OBKoro1
|
* https://github.com/OBKoro1
|
||||||
*/
|
*/
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
let extensionContext = '';
|
let extensionContext: vscode.ExtensionContext;
|
||||||
let webview: any;
|
let webview: any;
|
||||||
|
|
||||||
// 存储插件上下午文
|
// 存储插件上下午文
|
||||||
@ -18,7 +18,7 @@ function setExtensionContext(context: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取插件上下文
|
// 获取插件上下文
|
||||||
function getExtensionContext() {
|
function getExtensionContext(): vscode.ExtensionContext {
|
||||||
return extensionContext;
|
return extensionContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ function outputLog(...arr: any) {
|
|||||||
|
|
||||||
// 是否生产环境
|
// 是否生产环境
|
||||||
function isProduction() {
|
function isProduction() {
|
||||||
return process.env.NODE_ENV === 'production' // production时 为打包安装版本
|
return process.env.NODE_ENV === 'production'; // production时 为打包安装版本
|
||||||
}
|
}
|
||||||
|
|
||||||
// vscode 消息通知
|
// vscode 消息通知
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="tip">觉得这个插件还不错的话, 请给我点个<el-link href="https://github.com/OBKoro1/autoCommit" type="primary" target="_blank">Star⭐️</el-link>吧~</div>
|
<div class="tip">觉得这个插件还不错的话, 请给我点个<el-link href="https://github.com/OBKoro1/autoCommit" type="primary" target="_blank">Star⭐️</el-link>吧~</div>
|
||||||
<div v-if="!isProduction">
|
<div v-if="!isProduction">
|
||||||
<div>{{ showText.logArr }}</div>
|
<div>{{ form }}</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@ -173,9 +173,8 @@
|
|||||||
command: [],
|
command: [],
|
||||||
data: []
|
data: []
|
||||||
},
|
},
|
||||||
runNow: 0, // 0 初始化 1运行中 2运行结束 3取消运行
|
runNow: 0, // 0 初始化 1运行中 2运行结束 3取消运行 4push中
|
||||||
form: {
|
form: {
|
||||||
// TODO: 保存其他几个参数
|
|
||||||
// itemSrc: '/Users/koro/work/web_my/testCommit',
|
// itemSrc: '/Users/koro/work/web_my/testCommit',
|
||||||
randomCommit: true,
|
randomCommit: true,
|
||||||
itemSrc: '点击选择要commit的项目文件夹',
|
itemSrc: '点击选择要commit的项目文件夹',
|
||||||
@ -269,7 +268,17 @@
|
|||||||
const { command, data } = event.data;
|
const { command, data } = event.data;
|
||||||
this.showText.command.unshift(command)
|
this.showText.command.unshift(command)
|
||||||
this.showText.data.unshift(data)
|
this.showText.data.unshift(data)
|
||||||
if (command === 'choose item success') {
|
if(command === 'init-formData'){
|
||||||
|
if (data) {
|
||||||
|
this.form = data
|
||||||
|
// this.form.timeArr = [
|
||||||
|
// {
|
||||||
|
// value: '',
|
||||||
|
// commitNumber: 0
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
}
|
||||||
|
} else if (command === 'choose item success') {
|
||||||
// 选择文件夹成功
|
// 选择文件夹成功
|
||||||
this.form.itemSrc = data
|
this.form.itemSrc = data
|
||||||
}else if(command === 'choose item error'){
|
}else if(command === 'choose item error'){
|
||||||
@ -279,7 +288,9 @@
|
|||||||
message: `${data}根目录没有.git文件夹`,
|
message: `${data}根目录没有.git文件夹`,
|
||||||
duration: 0
|
duration: 0
|
||||||
});
|
});
|
||||||
} else if(command === 'commit 完成'){
|
} else if(command === ''){
|
||||||
|
|
||||||
|
}else if(command === 'commit 完成'){
|
||||||
// commit 完成
|
// commit 完成
|
||||||
this.runNow = 2
|
this.runNow = 2
|
||||||
} else if(command === 'console-log'){
|
} else if(command === 'console-log'){
|
||||||
|
Loading…
Reference in New Issue
Block a user