plugin-git-manager 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +3 -0
- package/client.js +1 -0
- package/dist/client/100.e08d760e0b01997c.js +10 -0
- package/dist/client/components/CommitHistory.d.ts +2 -0
- package/dist/client/components/FileExplorer.d.ts +2 -0
- package/dist/client/components/GitManagerSettings.d.ts +2 -0
- package/dist/client/components/GitOperations.d.ts +2 -0
- package/dist/client/components/RepositoryConfig.d.ts +2 -0
- package/dist/client/context/GitManagerContext.d.ts +24 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +2 -0
- package/dist/externalVersion.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +45 -0
- package/dist/locale/vi-VN.json +45 -0
- package/dist/node_modules/simple-git/dist/cjs/index.js +7399 -0
- package/dist/node_modules/simple-git/dist/esm/index.js +4745 -0
- package/dist/node_modules/simple-git/dist/esm/package.json +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/api.d.ts +13 -0
- package/dist/node_modules/simple-git/dist/src/lib/args/log-format.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-construct-error.d.ts +15 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-error.d.ts +30 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-response-error.d.ts +32 -0
- package/dist/node_modules/simple-git/dist/src/lib/errors/task-configuration-error.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/git-factory.d.ts +15 -0
- package/dist/node_modules/simple-git/dist/src/lib/git-logger.d.ts +21 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch-delete.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-commit.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-fetch.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-list-log-summary.d.ts +6 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-merge.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-move.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-pull.d.ts +6 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-push.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-remote-messages.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-remote-objects.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/command-config-prefixing-plugin.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/completion-detection.plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/index.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/progress-monitor-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +48 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/timout-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/BranchDeleteSummary.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/CheckIgnore.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/CleanSummary.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/ConfigList.d.ts +13 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/DiffSummary.d.ts +10 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/FileStatusSummary.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/GetRemoteSummary.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/InitSummary.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/MergeSummary.d.ts +16 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts +25 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/StatusSummary.d.ts +19 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/TagList.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/git-executor-chain.d.ts +25 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/git-executor.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/promise-wrapped.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +23 -0
- package/dist/node_modules/simple-git/dist/src/lib/simple-git-api.d.ts +20 -0
- package/dist/node_modules/simple-git/dist/src/lib/task-callback.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/branch.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/change-working-directory.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/check-ignore.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/check-is-repo.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +25 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/config.d.ts +8 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/fetch.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/grep.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/hash-object.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/init.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +32 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/merge.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/move.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/pull.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +8 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +11 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/show.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +4 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/status.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/sub-module.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/tag.d.ts +18 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/version.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +21 -0
- package/dist/node_modules/simple-git/dist/src/lib/types/index.d.ts +136 -0
- package/dist/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +19 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/exit-codes.d.ts +10 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/index.d.ts +8 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +15 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/simple-git-options.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +13 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/task-parser.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/src/lib/utils/util.d.ts +47 -0
- package/dist/node_modules/simple-git/dist/typings/errors.d.ts +5 -0
- package/dist/node_modules/simple-git/dist/typings/index.d.ts +14 -0
- package/dist/node_modules/simple-git/dist/typings/response.d.ts +556 -0
- package/dist/node_modules/simple-git/dist/typings/simple-git.d.ts +1033 -0
- package/dist/node_modules/simple-git/dist/typings/types.d.ts +22 -0
- package/dist/node_modules/simple-git/node_modules/debug/package.json +64 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/browser.js +272 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/common.js +292 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/index.js +10 -0
- package/dist/node_modules/simple-git/node_modules/debug/src/node.js +263 -0
- package/dist/node_modules/simple-git/package.json +1 -0
- package/dist/node_modules/simple-git/promise.js +17 -0
- package/dist/server/actions/git-actions.d.ts +13 -0
- package/dist/server/actions/git-actions.js +354 -0
- package/dist/server/collections/gitRepositories.d.ts +2 -0
- package/dist/server/collections/gitRepositories.js +75 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +48 -0
- package/dist/server/plugin.d.ts +6 -0
- package/dist/server/plugin.js +120 -0
- package/package.json +32 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
- package/src/client/components/CommitHistory.tsx +326 -0
- package/src/client/components/FileExplorer.tsx +329 -0
- package/src/client/components/GitManagerSettings.tsx +123 -0
- package/src/client/components/GitOperations.tsx +195 -0
- package/src/client/components/RepositoryConfig.tsx +188 -0
- package/src/client/context/GitManagerContext.tsx +84 -0
- package/src/client/index.tsx +19 -0
- package/src/client/locale.ts +9 -0
- package/src/index.ts +2 -0
- package/src/locale/en-US.json +45 -0
- package/src/locale/vi-VN.json +45 -0
- package/src/server/actions/git-actions.ts +346 -0
- package/src/server/collections/gitRepositories.ts +45 -0
- package/src/server/index.ts +2 -0
- package/src/server/plugin.ts +81 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var gitRepositories_exports = {};
|
|
28
|
+
__export(gitRepositories_exports, {
|
|
29
|
+
default: () => gitRepositories_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(gitRepositories_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var gitRepositories_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "gitRepositories",
|
|
35
|
+
title: "Git Repositories",
|
|
36
|
+
fields: [
|
|
37
|
+
{
|
|
38
|
+
type: "string",
|
|
39
|
+
name: "name",
|
|
40
|
+
interface: "input",
|
|
41
|
+
uiSchema: { title: "Repository Name", type: "string", "x-component": "Input" }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "string",
|
|
45
|
+
name: "repoUrl",
|
|
46
|
+
interface: "input",
|
|
47
|
+
uiSchema: { title: "Repository URL", type: "string", "x-component": "Input" }
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: "string",
|
|
51
|
+
name: "localPath",
|
|
52
|
+
interface: "input",
|
|
53
|
+
uiSchema: { title: "Local Path", type: "string", "x-component": "Input" }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "password",
|
|
57
|
+
name: "pat",
|
|
58
|
+
interface: "password",
|
|
59
|
+
uiSchema: { title: "Personal Access Token", type: "string", "x-component": "Password" }
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: "string",
|
|
63
|
+
name: "defaultBranch",
|
|
64
|
+
defaultValue: "main",
|
|
65
|
+
interface: "input",
|
|
66
|
+
uiSchema: { title: "Default Branch", type: "string", "x-component": "Input" }
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "string",
|
|
70
|
+
name: "status",
|
|
71
|
+
defaultValue: "disconnected",
|
|
72
|
+
interface: "input"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var server_exports = {};
|
|
38
|
+
__export(server_exports, {
|
|
39
|
+
PluginGitManagerServer: () => import_plugin2.PluginGitManagerServer,
|
|
40
|
+
default: () => import_plugin.default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(server_exports);
|
|
43
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
44
|
+
var import_plugin2 = require("./plugin");
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
PluginGitManagerServer
|
|
48
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var plugin_exports = {};
|
|
38
|
+
__export(plugin_exports, {
|
|
39
|
+
PluginGitManagerServer: () => PluginGitManagerServer,
|
|
40
|
+
default: () => plugin_default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
43
|
+
var import_server = require("@nocobase/server");
|
|
44
|
+
var import_path = require("path");
|
|
45
|
+
var gitActions = __toESM(require("./actions/git-actions"));
|
|
46
|
+
class PluginGitManagerServer extends import_server.Plugin {
|
|
47
|
+
async load() {
|
|
48
|
+
await this.db.import({
|
|
49
|
+
directory: (0, import_path.resolve)(__dirname, "collections")
|
|
50
|
+
});
|
|
51
|
+
this.app.resourceManager.define({
|
|
52
|
+
name: "gitManager",
|
|
53
|
+
actions: {
|
|
54
|
+
clone: gitActions.clone,
|
|
55
|
+
pull: gitActions.pull,
|
|
56
|
+
push: gitActions.push,
|
|
57
|
+
fetch: gitActions.fetch,
|
|
58
|
+
diff: gitActions.diff,
|
|
59
|
+
status: gitActions.status,
|
|
60
|
+
log: gitActions.log,
|
|
61
|
+
branches: gitActions.branches,
|
|
62
|
+
checkout: gitActions.checkout,
|
|
63
|
+
fileTree: gitActions.fileTree,
|
|
64
|
+
fileContent: gitActions.fileContent,
|
|
65
|
+
commitDetail: gitActions.commitDetail
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
this.app.acl.registerSnippet({
|
|
69
|
+
name: `pm.${this.name}.read`,
|
|
70
|
+
actions: [
|
|
71
|
+
"gitRepositories:list",
|
|
72
|
+
"gitRepositories:get",
|
|
73
|
+
"gitManager:status",
|
|
74
|
+
"gitManager:log",
|
|
75
|
+
"gitManager:branches",
|
|
76
|
+
"gitManager:diff",
|
|
77
|
+
"gitManager:fileTree",
|
|
78
|
+
"gitManager:fileContent",
|
|
79
|
+
"gitManager:commitDetail"
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
this.app.acl.registerSnippet({
|
|
83
|
+
name: `pm.${this.name}.write`,
|
|
84
|
+
actions: [
|
|
85
|
+
"gitRepositories:create",
|
|
86
|
+
"gitRepositories:update",
|
|
87
|
+
"gitRepositories:destroy",
|
|
88
|
+
"gitManager:clone",
|
|
89
|
+
"gitManager:pull",
|
|
90
|
+
"gitManager:push",
|
|
91
|
+
"gitManager:fetch",
|
|
92
|
+
"gitManager:checkout"
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
this.app.resourceManager.use(async (ctx, next) => {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
if (((_a = ctx.action) == null ? void 0 : _a.resourceName) !== "gitRepositories") {
|
|
98
|
+
return next();
|
|
99
|
+
}
|
|
100
|
+
await next();
|
|
101
|
+
if (ctx.body) {
|
|
102
|
+
const items = Array.isArray(ctx.body) ? ctx.body : ((_b = ctx.body) == null ? void 0 : _b.data) ? Array.isArray(ctx.body.data) ? ctx.body.data : [ctx.body.data] : [ctx.body];
|
|
103
|
+
items.forEach((item) => {
|
|
104
|
+
var _a2;
|
|
105
|
+
if (item && typeof item === "object") {
|
|
106
|
+
if (item.pat) item.pat = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
107
|
+
if ((_a2 = item.dataValues) == null ? void 0 : _a2.pat) item.dataValues.pat = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async install() {
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
var plugin_default = PluginGitManagerServer;
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
PluginGitManagerServer
|
|
120
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "plugin-git-manager",
|
|
3
|
+
"displayName": "Git Manager",
|
|
4
|
+
"displayName.zh-CN": "Git 管理器",
|
|
5
|
+
"description": "Manage Git repositories with PAT authentication - pull, push, fetch, diff, file browsing",
|
|
6
|
+
"version": "1.0.3",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"main": "dist/server/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"src",
|
|
12
|
+
"client.js",
|
|
13
|
+
"server.js",
|
|
14
|
+
"client.d.ts",
|
|
15
|
+
"server.d.ts"
|
|
16
|
+
],
|
|
17
|
+
"nocobase": {
|
|
18
|
+
"supportedVersions": [
|
|
19
|
+
"2.x"
|
|
20
|
+
],
|
|
21
|
+
"editionLevel": 0
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@nocobase/client": "2.x",
|
|
25
|
+
"@nocobase/server": "2.x",
|
|
26
|
+
"@nocobase/database": "2.x",
|
|
27
|
+
"@nocobase/test": "2.x"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"simple-git": "^3.27.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import React, { useEffect, useState, useCallback, memo } from 'react';
|
|
2
|
+
import { Table, Empty, Spin, Typography, Tag, Drawer, List, Button, Space, Select, theme } from 'antd';
|
|
3
|
+
import {
|
|
4
|
+
BranchesOutlined,
|
|
5
|
+
UserOutlined,
|
|
6
|
+
ClockCircleOutlined,
|
|
7
|
+
FileTextOutlined,
|
|
8
|
+
PlusCircleOutlined,
|
|
9
|
+
EditOutlined,
|
|
10
|
+
DeleteOutlined,
|
|
11
|
+
DiffOutlined,
|
|
12
|
+
} from '@ant-design/icons';
|
|
13
|
+
import { useAPIClient } from '@nocobase/client';
|
|
14
|
+
import { useGitManager } from '../context/GitManagerContext';
|
|
15
|
+
import { useT } from '../locale';
|
|
16
|
+
|
|
17
|
+
const { Text } = Typography;
|
|
18
|
+
const { useToken } = theme;
|
|
19
|
+
|
|
20
|
+
const STATUS_COLORS: Record<string, { color: string; icon: React.ReactNode; label: string }> = {
|
|
21
|
+
A: { color: 'green', icon: <PlusCircleOutlined />, label: 'Added' },
|
|
22
|
+
M: { color: 'blue', icon: <EditOutlined />, label: 'Modified' },
|
|
23
|
+
D: { color: 'red', icon: <DeleteOutlined />, label: 'Deleted' },
|
|
24
|
+
R: { color: 'orange', icon: <EditOutlined />, label: 'Renamed' },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const CommitHistory: React.FC = () => {
|
|
28
|
+
const t = useT();
|
|
29
|
+
const { token } = useToken();
|
|
30
|
+
const api = useAPIClient();
|
|
31
|
+
const { selectedRepo, branches: branchList, currentBranch } = useGitManager();
|
|
32
|
+
const [commits, setCommits] = useState<any[]>([]);
|
|
33
|
+
const [loading, setLoading] = useState(false);
|
|
34
|
+
const [selectedCommit, setSelectedCommit] = useState<any>(null);
|
|
35
|
+
const [commitDetail, setCommitDetail] = useState<any>(null);
|
|
36
|
+
const [detailLoading, setDetailLoading] = useState(false);
|
|
37
|
+
const [diffContent, setDiffContent] = useState<string | null>(null);
|
|
38
|
+
const [diffFile, setDiffFile] = useState<string | null>(null);
|
|
39
|
+
|
|
40
|
+
const loadHistory = useCallback(async () => {
|
|
41
|
+
if (!selectedRepo) return;
|
|
42
|
+
setLoading(true);
|
|
43
|
+
try {
|
|
44
|
+
const { data } = await api.request({
|
|
45
|
+
url: 'gitManager:log',
|
|
46
|
+
params: { repositoryId: selectedRepo.id, maxCount: 100 },
|
|
47
|
+
});
|
|
48
|
+
const responseData = data?.data?.data || data?.data;
|
|
49
|
+
setCommits(responseData?.all || []);
|
|
50
|
+
} finally {
|
|
51
|
+
setLoading(false);
|
|
52
|
+
}
|
|
53
|
+
}, [api, selectedRepo]);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (selectedRepo?.status === 'connected') {
|
|
57
|
+
loadHistory();
|
|
58
|
+
} else {
|
|
59
|
+
setCommits([]);
|
|
60
|
+
}
|
|
61
|
+
}, [selectedRepo]);
|
|
62
|
+
|
|
63
|
+
const openCommitDetail = async (commit: any) => {
|
|
64
|
+
setSelectedCommit(commit);
|
|
65
|
+
setDetailLoading(true);
|
|
66
|
+
setDiffContent(null);
|
|
67
|
+
setDiffFile(null);
|
|
68
|
+
try {
|
|
69
|
+
const { data } = await api.request({
|
|
70
|
+
url: 'gitManager:commitDetail',
|
|
71
|
+
params: { repositoryId: selectedRepo.id, commitHash: commit.hash },
|
|
72
|
+
});
|
|
73
|
+
const responseData = data?.data?.data || data?.data;
|
|
74
|
+
setCommitDetail(responseData);
|
|
75
|
+
} catch {
|
|
76
|
+
setCommitDetail(null);
|
|
77
|
+
} finally {
|
|
78
|
+
setDetailLoading(false);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const loadFileDiff = async (commitHash: string, file: string) => {
|
|
83
|
+
setDiffFile(file);
|
|
84
|
+
try {
|
|
85
|
+
const { data } = await api.request({
|
|
86
|
+
url: 'gitManager:diff',
|
|
87
|
+
params: { repositoryId: selectedRepo.id, commitHash, file },
|
|
88
|
+
});
|
|
89
|
+
const responseData = data?.data?.data || data?.data;
|
|
90
|
+
setDiffContent(responseData || '');
|
|
91
|
+
} catch {
|
|
92
|
+
setDiffContent('// Failed to load diff');
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
if (!selectedRepo) {
|
|
97
|
+
return <Empty description={t('No repository selected')} />;
|
|
98
|
+
}
|
|
99
|
+
if (selectedRepo.status !== 'connected') {
|
|
100
|
+
return <Empty description={t('Repository not cloned yet')} />;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const columns = [
|
|
104
|
+
{
|
|
105
|
+
title: '',
|
|
106
|
+
key: 'graph',
|
|
107
|
+
width: 40,
|
|
108
|
+
render: (_: any, __: any, index: number) => (
|
|
109
|
+
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', height: '100%' }}>
|
|
110
|
+
<div
|
|
111
|
+
style={{
|
|
112
|
+
width: 10,
|
|
113
|
+
height: 10,
|
|
114
|
+
borderRadius: '50%',
|
|
115
|
+
background: index === 0 ? token.colorPrimary : token.colorBorder,
|
|
116
|
+
border: `2px solid ${index === 0 ? token.colorPrimary : token.colorBorder}`,
|
|
117
|
+
zIndex: 1,
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: t('Message'),
|
|
125
|
+
dataIndex: 'message',
|
|
126
|
+
key: 'message',
|
|
127
|
+
render: (text: string, record: any) => (
|
|
128
|
+
<div>
|
|
129
|
+
<Text strong style={{ fontSize: 13 }}>{text}</Text>
|
|
130
|
+
<div style={{ marginTop: 2 }}>
|
|
131
|
+
<Text type="secondary" style={{ fontSize: 12 }}>
|
|
132
|
+
<UserOutlined style={{ marginRight: 4 }} />
|
|
133
|
+
{record.author_name}
|
|
134
|
+
<span style={{ margin: '0 8px' }}>·</span>
|
|
135
|
+
<ClockCircleOutlined style={{ marginRight: 4 }} />
|
|
136
|
+
{formatDate(record.date)}
|
|
137
|
+
</Text>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
),
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
title: 'Hash',
|
|
144
|
+
dataIndex: 'hash',
|
|
145
|
+
key: 'hash',
|
|
146
|
+
width: 100,
|
|
147
|
+
render: (hash: string) => (
|
|
148
|
+
<Text code copyable style={{ fontSize: 12 }}>
|
|
149
|
+
{hash?.substring(0, 7)}
|
|
150
|
+
</Text>
|
|
151
|
+
),
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
title: '',
|
|
155
|
+
key: 'action',
|
|
156
|
+
width: 80,
|
|
157
|
+
render: (_: any, record: any) => (
|
|
158
|
+
<Button size="small" icon={<DiffOutlined />} onClick={() => openCommitDetail(record)}>
|
|
159
|
+
Detail
|
|
160
|
+
</Button>
|
|
161
|
+
),
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<div>
|
|
167
|
+
<div style={{ marginBottom: 12, display: 'flex', alignItems: 'center', gap: 12 }}>
|
|
168
|
+
<BranchesOutlined />
|
|
169
|
+
<Select
|
|
170
|
+
size="small"
|
|
171
|
+
style={{ width: 200 }}
|
|
172
|
+
value={currentBranch}
|
|
173
|
+
options={branchList.map((b) => ({ label: b, value: b }))}
|
|
174
|
+
disabled
|
|
175
|
+
/>
|
|
176
|
+
<Text type="secondary">{commits.length} commits</Text>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
{loading ? (
|
|
180
|
+
<Spin />
|
|
181
|
+
) : (
|
|
182
|
+
<Table
|
|
183
|
+
dataSource={commits}
|
|
184
|
+
columns={columns}
|
|
185
|
+
rowKey="hash"
|
|
186
|
+
size="small"
|
|
187
|
+
pagination={{ pageSize: 30, showSizeChanger: true }}
|
|
188
|
+
onRow={(record) => ({ style: { cursor: 'pointer' }, onClick: () => openCommitDetail(record) })}
|
|
189
|
+
/>
|
|
190
|
+
)}
|
|
191
|
+
|
|
192
|
+
<Drawer
|
|
193
|
+
title={
|
|
194
|
+
selectedCommit ? (
|
|
195
|
+
<div>
|
|
196
|
+
<Text strong>{selectedCommit.message}</Text>
|
|
197
|
+
<div>
|
|
198
|
+
<Text type="secondary" style={{ fontSize: 12 }}>
|
|
199
|
+
{selectedCommit.hash?.substring(0, 7)} · {selectedCommit.author_name} · {formatDate(selectedCommit.date)}
|
|
200
|
+
</Text>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
) : 'Commit Detail'
|
|
204
|
+
}
|
|
205
|
+
open={!!selectedCommit}
|
|
206
|
+
onClose={() => {
|
|
207
|
+
setSelectedCommit(null);
|
|
208
|
+
setCommitDetail(null);
|
|
209
|
+
setDiffContent(null);
|
|
210
|
+
setDiffFile(null);
|
|
211
|
+
}}
|
|
212
|
+
width={800}
|
|
213
|
+
>
|
|
214
|
+
{detailLoading ? (
|
|
215
|
+
<Spin />
|
|
216
|
+
) : commitDetail ? (
|
|
217
|
+
<div>
|
|
218
|
+
<Text strong>Changed Files ({commitDetail.files?.length || 0})</Text>
|
|
219
|
+
<List
|
|
220
|
+
size="small"
|
|
221
|
+
style={{ marginTop: 8 }}
|
|
222
|
+
dataSource={commitDetail.files || []}
|
|
223
|
+
renderItem={(item: any) => {
|
|
224
|
+
const info = STATUS_COLORS[item.status] || STATUS_COLORS.M;
|
|
225
|
+
const isActive = diffFile === item.file;
|
|
226
|
+
return (
|
|
227
|
+
<List.Item
|
|
228
|
+
style={{
|
|
229
|
+
cursor: 'pointer',
|
|
230
|
+
background: isActive ? token.colorPrimaryBg : undefined,
|
|
231
|
+
padding: '6px 12px',
|
|
232
|
+
borderRadius: 4,
|
|
233
|
+
}}
|
|
234
|
+
onClick={() => loadFileDiff(selectedCommit.hash, item.file)}
|
|
235
|
+
>
|
|
236
|
+
<Space>
|
|
237
|
+
<Tag color={info.color} style={{ minWidth: 70, textAlign: 'center' }}>
|
|
238
|
+
{info.icon} {info.label}
|
|
239
|
+
</Tag>
|
|
240
|
+
<Text style={{ fontSize: 13 }}>{item.file}</Text>
|
|
241
|
+
</Space>
|
|
242
|
+
</List.Item>
|
|
243
|
+
);
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
|
|
247
|
+
{diffContent !== null && (
|
|
248
|
+
<div style={{ marginTop: 16 }}>
|
|
249
|
+
<Text strong style={{ display: 'block', marginBottom: 8 }}>
|
|
250
|
+
<FileTextOutlined /> {diffFile}
|
|
251
|
+
</Text>
|
|
252
|
+
<DiffViewer content={diffContent} />
|
|
253
|
+
</div>
|
|
254
|
+
)}
|
|
255
|
+
</div>
|
|
256
|
+
) : null}
|
|
257
|
+
</Drawer>
|
|
258
|
+
</div>
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const DiffViewer: React.FC<{ content: string }> = memo(({ content }) => {
|
|
263
|
+
const { token } = useToken();
|
|
264
|
+
const lines = content.split('\n');
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<div
|
|
268
|
+
style={{
|
|
269
|
+
fontFamily: "'JetBrains Mono', 'Fira Code', Consolas, monospace",
|
|
270
|
+
fontSize: 12,
|
|
271
|
+
lineHeight: 1.5,
|
|
272
|
+
border: `1px solid ${token.colorBorderSecondary}`,
|
|
273
|
+
borderRadius: 6,
|
|
274
|
+
overflow: 'auto',
|
|
275
|
+
maxHeight: 500,
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
{lines.map((line, i) => {
|
|
279
|
+
let bg = 'transparent';
|
|
280
|
+
let color = token.colorText;
|
|
281
|
+
if (line.startsWith('+') && !line.startsWith('+++')) {
|
|
282
|
+
bg = 'rgba(46, 160, 67, 0.12)';
|
|
283
|
+
color = '#2ea043';
|
|
284
|
+
} else if (line.startsWith('-') && !line.startsWith('---')) {
|
|
285
|
+
bg = 'rgba(248, 81, 73, 0.12)';
|
|
286
|
+
color = '#f85149';
|
|
287
|
+
} else if (line.startsWith('@@')) {
|
|
288
|
+
bg = 'rgba(56, 139, 253, 0.08)';
|
|
289
|
+
color = '#388bfd';
|
|
290
|
+
} else if (line.startsWith('diff') || line.startsWith('index')) {
|
|
291
|
+
color = token.colorTextSecondary;
|
|
292
|
+
}
|
|
293
|
+
return (
|
|
294
|
+
<div
|
|
295
|
+
key={i}
|
|
296
|
+
style={{
|
|
297
|
+
padding: '0 12px',
|
|
298
|
+
background: bg,
|
|
299
|
+
color,
|
|
300
|
+
whiteSpace: 'pre',
|
|
301
|
+
minHeight: 20,
|
|
302
|
+
}}
|
|
303
|
+
>
|
|
304
|
+
<span style={{ display: 'inline-block', width: 40, color: token.colorTextQuaternary, userSelect: 'none', textAlign: 'right', marginRight: 12 }}>
|
|
305
|
+
{i + 1}
|
|
306
|
+
</span>
|
|
307
|
+
{line}
|
|
308
|
+
</div>
|
|
309
|
+
);
|
|
310
|
+
})}
|
|
311
|
+
</div>
|
|
312
|
+
);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
function formatDate(dateStr: string): string {
|
|
316
|
+
if (!dateStr) return '';
|
|
317
|
+
const d = new Date(dateStr);
|
|
318
|
+
const now = new Date();
|
|
319
|
+
const diffMs = now.getTime() - d.getTime();
|
|
320
|
+
const diffHours = diffMs / (1000 * 60 * 60);
|
|
321
|
+
|
|
322
|
+
if (diffHours < 1) return `${Math.round(diffMs / 60000)}m ago`;
|
|
323
|
+
if (diffHours < 24) return `${Math.round(diffHours)}h ago`;
|
|
324
|
+
if (diffHours < 168) return `${Math.round(diffHours / 24)}d ago`;
|
|
325
|
+
return d.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' });
|
|
326
|
+
}
|