feat: 增加scm graph插件
This commit is contained in:
parent
e55f722486
commit
d7c4a124d5
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,337 @@
|
|||
module.exports = {
|
||||
"extension": {
|
||||
"publisher": "alex-ext-public",
|
||||
"name": "web-scm",
|
||||
"version": "0.0.9"
|
||||
},
|
||||
"packageJSON": {
|
||||
"name": "web-scm",
|
||||
"publisher": "alex-ext-public",
|
||||
"version": "0.0.9",
|
||||
"displayName": "web-scm",
|
||||
"description": "SCM for Web",
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"kaitianContributes": {
|
||||
"workerMain": "./out/worker/index.js"
|
||||
},
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "git.commit",
|
||||
"title": "git commit",
|
||||
"icon": "$(check)",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.refresh",
|
||||
"title": "git refresh",
|
||||
"icon": "$(refresh)",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.branch",
|
||||
"title": "create branch",
|
||||
"icon": "$(branch)",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.branchFrom",
|
||||
"title": "create branch from",
|
||||
"icon": "$(branch)",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.openFile",
|
||||
"title": "git open file",
|
||||
"icon": "$(go-to-file)",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.stage",
|
||||
"title": "git stage",
|
||||
"icon": "$(add)",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.clean",
|
||||
"title": "git clean",
|
||||
"icon": "$(discard)",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.cleanAll",
|
||||
"title": "git cleanAll",
|
||||
"icon": "$(discard)",
|
||||
"category": "Git"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
"scm/title": [
|
||||
{
|
||||
"command": "git.commit",
|
||||
"group": "navigation",
|
||||
"when": "scmProvider == webscm"
|
||||
},
|
||||
{
|
||||
"command": "git.refresh",
|
||||
"group": "navigation",
|
||||
"when": "scmProvider == webscm"
|
||||
},
|
||||
{
|
||||
"command": "git.branch",
|
||||
"when": "scmProvider == webscm"
|
||||
},
|
||||
{
|
||||
"command": "git.branchFrom",
|
||||
"when": "scmProvider == webscm"
|
||||
}
|
||||
],
|
||||
"scm/resourceState/context": [
|
||||
{
|
||||
"command": "git.openFile",
|
||||
"when": "scmProvider == webscm",
|
||||
"group": "inline"
|
||||
},
|
||||
{
|
||||
"command": "git.clean",
|
||||
"when": "scmProvider == webscm",
|
||||
"group": "inline"
|
||||
}
|
||||
],
|
||||
"scm/resourceGroup/context": [
|
||||
{
|
||||
"command": "git.cleanAll",
|
||||
"when": "scmProvider == webscm",
|
||||
"group": "inline"
|
||||
}
|
||||
],
|
||||
"scm/change/title": [
|
||||
{
|
||||
"command": "git.cleanAll",
|
||||
"when": "originalResourceScheme == git"
|
||||
}
|
||||
]
|
||||
},
|
||||
"colors": [
|
||||
{
|
||||
"id": "gitDecoration.addedResourceForeground",
|
||||
"description": "%colors.added%",
|
||||
"defaults": {
|
||||
"light": "#587c0c",
|
||||
"dark": "#81b88b",
|
||||
"highContrast": "#1b5225",
|
||||
"highContrastLight": "#374e06"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.modifiedResourceForeground",
|
||||
"description": "%colors.modified%",
|
||||
"defaults": {
|
||||
"light": "#895503",
|
||||
"dark": "#E2C08D",
|
||||
"highContrast": "#E2C08D",
|
||||
"highContrastLight": "#895503"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.deletedResourceForeground",
|
||||
"description": "%colors.deleted%",
|
||||
"defaults": {
|
||||
"light": "#ad0707",
|
||||
"dark": "#c74e39",
|
||||
"highContrast": "#c74e39",
|
||||
"highContrastLight": "#ad0707"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.renamedResourceForeground",
|
||||
"description": "%colors.renamed%",
|
||||
"defaults": {
|
||||
"light": "#007100",
|
||||
"dark": "#73C991",
|
||||
"highContrast": "#73C991",
|
||||
"highContrastLight": "#007100"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.untrackedResourceForeground",
|
||||
"description": "%colors.untracked%",
|
||||
"defaults": {
|
||||
"light": "#007100",
|
||||
"dark": "#73C991",
|
||||
"highContrast": "#73C991",
|
||||
"highContrastLight": "#007100"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.ignoredResourceForeground",
|
||||
"description": "%colors.ignored%",
|
||||
"defaults": {
|
||||
"light": "#8E8E90",
|
||||
"dark": "#8C8C8C",
|
||||
"highContrast": "#A7A8A9",
|
||||
"highContrastLight": "#8e8e90"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.stageModifiedResourceForeground",
|
||||
"description": "%colors.stageModified%",
|
||||
"defaults": {
|
||||
"light": "#895503",
|
||||
"dark": "#E2C08D",
|
||||
"highContrast": "#E2C08D",
|
||||
"highContrastLight": "#895503"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.stageDeletedResourceForeground",
|
||||
"description": "%colors.stageDeleted%",
|
||||
"defaults": {
|
||||
"light": "#ad0707",
|
||||
"dark": "#c74e39",
|
||||
"highContrast": "#c74e39",
|
||||
"highContrastLight": "#ad0707"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.conflictingResourceForeground",
|
||||
"description": "%colors.conflict%",
|
||||
"defaults": {
|
||||
"light": "#ad0707",
|
||||
"dark": "#e4676b",
|
||||
"highContrast": "#c74e39",
|
||||
"highContrastLight": "#ad0707"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gitDecoration.submoduleResourceForeground",
|
||||
"description": "%colors.submodule%",
|
||||
"defaults": {
|
||||
"light": "#1258a7",
|
||||
"dark": "#8db9e2",
|
||||
"highContrast": "#8db9e2",
|
||||
"highContrastLight": "#1258a7"
|
||||
}
|
||||
}
|
||||
],
|
||||
"keybindings": [
|
||||
{
|
||||
"command": "git.commit",
|
||||
"key": "ctrl+enter",
|
||||
"mac": "cmd+enter",
|
||||
"when": "scmRepository"
|
||||
}
|
||||
],
|
||||
"workerMain": "./out/worker/index.js"
|
||||
}
|
||||
},
|
||||
"defaultPkgNlsJSON": {
|
||||
"common.cancel": "Cancel",
|
||||
"common.certain": "Certain",
|
||||
"alex.git.refresh": "git refresh",
|
||||
"alex.git.inputBox.placeholder": "Message ({0} commit and push directly)",
|
||||
"changes": "Changes",
|
||||
"staged.changes": "Staged Changes",
|
||||
"merge.changes": "Merge Changes",
|
||||
"untracked.changes": "Untracked Changes",
|
||||
"git.title.workingTree": "{0} (WorkingTree)",
|
||||
"git.title.untracked": "{0} (Untracked)",
|
||||
"git.title.deleted": "{0} (Deleted)",
|
||||
"git.title.added": "{0} (Added)",
|
||||
"git error details": "Git Error",
|
||||
"deleted": "Deleted",
|
||||
"added": "Added",
|
||||
"modified": "Modified",
|
||||
"diff": "Diff",
|
||||
"discard": "Discard Changes",
|
||||
"confirm delete": "Are you sure you want to DELETE {0}?\nThis is IRREVERSIBLE!\nThis file will be FOREVER LOST if you proceed.",
|
||||
"restore file": "Restore file",
|
||||
"confirm restore": "Are you sure you want to restore {0}?",
|
||||
"confirm discard": "Are you sure you want to discard changes in {0}?",
|
||||
"delete file": "Delete file",
|
||||
"delete files": "Delete Files",
|
||||
"restore files": "Restore files",
|
||||
"confirm restore multiple": "Are you sure you want to restore {0} files?",
|
||||
"confirm discard multiple": "Are you sure you want to discard changes in {0} files?",
|
||||
"warn untracked": "This will DELETE {0} untracked files!\nThis is IRREVERSIBLE!\nThese files will be FOREVER LOST.",
|
||||
"there are untracked files single": "The following untracked file will be DELETED FROM DISK if discarded: {0}.",
|
||||
"there are untracked files": "There are {0} untracked files which will be DELETED FROM DISK if discarded.",
|
||||
"confirm discard all 2": "{0}\n\nThis is IRREVERSIBLE, your current working set will be FOREVER LOST.",
|
||||
"yes discard tracked": "Discard 1 Tracked File",
|
||||
"yes discard tracked multiple": "Discard {0} Tracked Files",
|
||||
"discardAll": "Discard All {0} Files",
|
||||
"confirm discard all single": "Are you sure you want to discard changes in {0}?",
|
||||
"confirm discard all": "Are you sure you want to discard ALL changes in {0} files?\nThis is IRREVERSIBLE!\nYour current working set will be FOREVER LOST if you proceed.",
|
||||
"discardAll multiple": "Discard 1 File",
|
||||
"confirm delete multiple": "Are you sure you want to DELETE {0} files?\nThis is IRREVERSIBLE!\nThese files will be FOREVER LOST if you proceed.",
|
||||
"commit message": "Commit message",
|
||||
"provide commit message": "Please provide a commit message",
|
||||
"commit success": "Commit to {0} success \n Whether to go to {1} to create a PR",
|
||||
"commit failed": "Commit failed",
|
||||
"confirm stage files with merge conflicts": "Are you sure you want to stage {0} files with merge conflicts",
|
||||
"confirm stage file with merge conflicts": "Are you sure you want to stage {0} with merge conflicts?"
|
||||
},
|
||||
"pkgNlsJSON": {
|
||||
"zh-CN": {
|
||||
"common.cancel": "取消",
|
||||
"common.certain": "确定",
|
||||
"common.toplatform": "提交成功,是否去 {0} 创建 PR",
|
||||
"alex.git.refresh": "git refresh",
|
||||
"alex.git.inputBox.placeholder": "消息({0} 直接提交并推送) ",
|
||||
"changes": "更改",
|
||||
"staged.changes": "暂存的更改",
|
||||
"merge.changes": "合并的更改",
|
||||
"untracked.changes": "未追踪的更改",
|
||||
"git.title.workingTree": "{0} (工作树)",
|
||||
"git.title.untracked": "{0} (未追踪)",
|
||||
"git.title.deleted": "{0} (已删除)",
|
||||
"git.title.added": "{0} (新增)",
|
||||
"git error details": "Git Error",
|
||||
"deleted": "已删除",
|
||||
"added": "新增",
|
||||
"modified": "修改",
|
||||
"diff": "更改",
|
||||
"discard": "放弃更改",
|
||||
"confirm delete": "确定要删除 {0} 吗?",
|
||||
"restore file": "恢复文件",
|
||||
"confirm restore": "确认是否还原 {0}",
|
||||
"confirm discard": "确定要放弃 {0} 中更改吗?",
|
||||
"delete file": "删除文件",
|
||||
"delete files": "删除文件",
|
||||
"restore files": "还原文件",
|
||||
"confirm restore multiple": "确认还原 {0} 个文件?",
|
||||
"confirm discard multiple": "确认放弃在 {0} 个文件中的更改?",
|
||||
"warn untracked": "确认删除 {0} 个文件!\nT此操作不可撤消!文件将被永久删除。",
|
||||
"there are untracked files single": "若放弃下面未跟踪的文件,其将被从硬盘上删除: {0}。",
|
||||
"there are untracked files": "若放弃 {0} 个未跟踪的文件,其将被从硬盘上删除。",
|
||||
"confirm discard all 2": "{0}\n\n此操作不可撤销,你当前的工作集将会永远丢失。",
|
||||
"yes discard tracked": "放弃1个文件",
|
||||
"yes discard tracked multiple": "放弃 {0} 个追踪的文件",
|
||||
"discardAll": "放弃 所有 {0} 个文件",
|
||||
"confirm discard all single": "确定放弃 {0} 中的更改吗?",
|
||||
"confirm discard all": "确定要放弃在 {0} 个文件中的所有更改吗?此操作不可撤销!你当前的工作集将会永远丢失。",
|
||||
"discardAll multiple": "放弃1个文件",
|
||||
"confirm delete multiple": "确认删除 {0} 个文件!\nT此操作不可撤消!文件将被永久删除。",
|
||||
"commit message": "提交信息",
|
||||
"provide commit message": "请输入提交信息",
|
||||
"commit success": "向分支 {0} 提交成功",
|
||||
"commit failed": "提交失败",
|
||||
"confirm stage files with merge conflicts": "确定要暂存含有合并冲突的 {0} 个文件吗?",
|
||||
"confirm stage file with merge conflicts": "确定要暂存含有合并冲突的 {0} 吗?"
|
||||
}
|
||||
},
|
||||
"nlsList": [
|
||||
{
|
||||
"filename": "package.nls.zh-cn.json",
|
||||
"languageId": ".zh-cn"
|
||||
}
|
||||
],
|
||||
"extendConfig": {},
|
||||
"webAssets": [
|
||||
"package.json",
|
||||
"out/worker/index.js"
|
||||
],
|
||||
"mode": "public"
|
||||
}
|
||||
10
src/main.tsx
10
src/main.tsx
|
|
@ -22,7 +22,10 @@ import codeRunner from './extensions/alex-ext-public.code-runner-for-web.js';
|
|||
import emmet from './extensions/alex-ext-public.emmet.js';
|
||||
import codeswing from './extensions/alex-ext-public.codeswing.js';
|
||||
import referencesView from './extensions/alex-ext-public.references-view.js';
|
||||
|
||||
// import gitlens from './extensions/alex-ext-public.gitlens.js';
|
||||
import graph from './extensions/alex-ext-public.git-graph.js';
|
||||
// import imagePreview from './extensions/alex-ext-public.image-preview.js';
|
||||
import webSCM from './extensions/alex-ext-public.web-scm.js';
|
||||
import * as SCMPlugin from './plugins/web-scm.plugin';
|
||||
import * as AlexApp from './plugins/alex-app.plugin';
|
||||
|
||||
|
|
@ -107,11 +110,10 @@ const App = () => (
|
|||
json,
|
||||
markdown,
|
||||
typescript,
|
||||
// TODO 后续增加插件 这些插件暂时还没有在公网发布
|
||||
// gitlens,
|
||||
// graph,
|
||||
graph,
|
||||
// imagePreview,
|
||||
// webSCM,
|
||||
webSCM,
|
||||
referencesView,
|
||||
codeswing,
|
||||
emmet,
|
||||
|
|
|
|||
|
|
@ -10,14 +10,24 @@ export const activate = ({ commands }: IPluginAPI) => {
|
|||
"code-service.replace-browser-url",
|
||||
(path: string) => {
|
||||
const fullPath = `/gitlink${path}`;
|
||||
console.log(fullPath);
|
||||
const [owner, name, blob, ref, ...filePath] = path.split('/')
|
||||
window.history.replaceState(null, "", fullPath);
|
||||
}
|
||||
);
|
||||
|
||||
// scm 插件使用 英文 en-us
|
||||
// TODO alex内暴露命令
|
||||
commands.registerCommand(
|
||||
'alex.env.language',
|
||||
() => {
|
||||
return 'zh-cn'
|
||||
}
|
||||
),
|
||||
commands.registerCommand(
|
||||
"code-service.replace-browser-url-hash",
|
||||
|
||||
(hash: string) => {
|
||||
console.log(11111);
|
||||
if (hash !== location.hash) {
|
||||
ignoreHash = hash;
|
||||
const { href } = window.location;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { IPluginAPI } from './common';
|
||||
import * as localforage from 'localforage';
|
||||
import type { IPluginAPI } from "./common";
|
||||
import * as localforage from "localforage";
|
||||
|
||||
export const PLUGIN_ID = 'web-scm';
|
||||
export const PLUGIN_ID = "web-scm";
|
||||
|
||||
export interface CacheFile {
|
||||
uri: any;
|
||||
|
|
@ -34,47 +34,47 @@ export enum Status {
|
|||
|
||||
export const activate = ({ commands }: IPluginAPI) => {
|
||||
if (!localforage.supports(localforage.INDEXEDDB)) {
|
||||
throw new Error('[SCM] IndexedDB Not Support');
|
||||
throw new Error("[SCM] IndexedDB Not Support");
|
||||
}
|
||||
|
||||
// 只存储在IndexedDB
|
||||
localforage.config({
|
||||
driver: localforage.INDEXEDDB,
|
||||
name: 'WEB_SCM',
|
||||
storeName: 'WEB_SCM_TABLE',
|
||||
name: "WEB_SCM",
|
||||
storeName: "WEB_SCM_TABLE",
|
||||
});
|
||||
|
||||
commands.registerCommand('web-scm.localforage.get', async (key: string) => {
|
||||
commands.registerCommand("web-scm.localforage.get", async (key: string) => {
|
||||
return await localforage.getItem(key);
|
||||
});
|
||||
commands.registerCommand(
|
||||
'web-scm.localforage.set',
|
||||
"web-scm.localforage.set",
|
||||
async (key: string, value: any) => {
|
||||
return await localforage.setItem(key, value);
|
||||
}
|
||||
);
|
||||
commands.registerCommand(
|
||||
'web-scm.localforage.remove',
|
||||
"web-scm.localforage.remove",
|
||||
async (key: string, valye: any) => {
|
||||
return await localforage.removeItem(key);
|
||||
}
|
||||
);
|
||||
commands.registerCommand(
|
||||
'web-scm.localforage.removeModify',
|
||||
"web-scm.localforage.removeModify",
|
||||
async (key: string, value: any) => {
|
||||
return await localforage.removeItem(key);
|
||||
}
|
||||
);
|
||||
commands.registerCommand('web-scm.localforage.clear', async () => {
|
||||
commands.registerCommand("web-scm.localforage.clear", async () => {
|
||||
return await localforage.clear();
|
||||
});
|
||||
commands.registerCommand(
|
||||
'web-scm.localforage.iterate',
|
||||
"web-scm.localforage.iterate",
|
||||
async (basePath: string) => {
|
||||
const files: CacheFile[] = [];
|
||||
await localforage.iterate((value: CacheFile, key: string) => {
|
||||
if (key.startsWith(basePath)) {
|
||||
if (key.endsWith(':MODIFY')) {
|
||||
if (key.endsWith(":MODIFY")) {
|
||||
files.push(value);
|
||||
}
|
||||
// if (
|
||||
|
|
@ -90,7 +90,9 @@ export const activate = ({ commands }: IPluginAPI) => {
|
|||
}
|
||||
);
|
||||
|
||||
commands.registerCommand('web-scm.windowOpen', async (path: string) => {
|
||||
commands.registerCommand("web-scm.windowOpen", async (path: string) => {
|
||||
window.open(path);
|
||||
});
|
||||
|
||||
commands.registerCommand("web-scm.yuyanlog", (code, msg, extra) => {});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -114,9 +114,8 @@ module.exports = (env, options) => {
|
|||
'/code-service': {
|
||||
target: CODE_SERVICE_HOST,
|
||||
headers: {
|
||||
// cookie 模拟
|
||||
Cookie:
|
||||
'autologin_trustie=ebdf7bf2e3a7b7e38db85cbfb052a4f5639b480b;user_id=BAhpA3p1AQ%3D%3D--016cfd4d2c67651b141d9ea39b418fff55bd859c;states=%7B%22select_params%22%3A%7B%22page%22%3A1%2C%22limit%22%3A15%2C%22fixed_version_id%22%3A%222031%22%7D%2C%22assigned_to_ids%22%3A%22%E8%B4%9F%E8%B4%A3%E4%BA%BA%22%2C%22status_type%22%3A%221%22%2C%22issue_tag_ids%22%3A%22%E6%A0%87%E8%AE%B0%22%2C%22tracker_ids%22%3A%22%E7%B1%BB%E5%9E%8B%22%2C%22author_ids%22%3A%22%E5%8F%91%E5%B8%83%E4%BA%BA%22%2C%22fixed_version_ids%22%3A%22CloudIDE%22%2C%22status_ids%22%3A%22%E7%8A%B6%E6%80%81%22%2C%22done_ratios%22%3A%22%E5%AE%8C%E6%88%90%E5%BA%A6%22%2C%22paix%22%3A%22%E6%8E%92%E5%BA%8F%22%2C%22update_author_ids%22%3A%22%E6%9B%B4%E6%8D%A2%E8%B4%9F%E8%B4%A3%E4%BA%BA%22%2C%22update_status_ids%22%3A%22%E4%BF%AE%E6%94%B9%E7%8A%B6%E6%80%81%22%2C%22begin%22%3A%22%22%2C%22end%22%3A%22%22%7D;_educoder_session=bd5f5284909f8e080964f649497d837b',
|
||||
// cookie 模拟 提交代码 qingyou/test
|
||||
Cookie: 'user_id=BAhpA3p1AQ%3D%3D--016cfd4d2c67651b141d9ea39b418fff55bd859c; autologin=undefined; autologin_trustie=dbab4c6a48684c51b6691a28de3f6e4201c4fce3; states=undefined'
|
||||
},
|
||||
secure: false,
|
||||
changeOrigin: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue