@gct-paas/cli 0.1.6-dev.7 → 0.1.6
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/dist/actions/gen-api/model-manage.cjs +1 -1
- package/dist/actions/index.cjs +8 -1
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/init-git/init-git.cjs +33 -0
- package/dist/actions/init-git/init-git.d.ts +3 -0
- package/dist/commands/index.cjs +2 -0
- package/dist/commands/init-git/init-git.cjs +16 -0
- package/dist/commands/init-git/init-git.d.ts +6 -0
- package/es/actions/gen-api/model-manage.mjs +1 -1
- package/es/actions/index.d.ts +1 -0
- package/es/actions/index.mjs +1 -0
- package/es/actions/init-git/init-git.d.ts +3 -0
- package/es/actions/init-git/init-git.mjs +23 -0
- package/es/bin.mjs +0 -0
- package/es/commands/index.mjs +2 -0
- package/es/commands/init-git/init-git.d.ts +6 -0
- package/es/commands/init-git/init-git.mjs +9 -0
- package/package.json +13 -13
package/dist/actions/index.cjs
CHANGED
|
@@ -15,5 +15,12 @@ Object.defineProperty(exports, "GenCdnLibAction", {
|
|
|
15
15
|
return _genCdnLib.GenCdnLibAction;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "InitGitAction", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _initGit.InitGitAction;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
var _genApi = require("./gen-api/gen-api.cjs");
|
|
19
|
-
var _genCdnLib = require("./gen-cdn-lib/gen-cdn-lib.cjs");
|
|
25
|
+
var _genCdnLib = require("./gen-cdn-lib/gen-cdn-lib.cjs");
|
|
26
|
+
var _initGit = require("./init-git/init-git.cjs");
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InitGitAction = void 0;
|
|
7
|
+
var _child_process = require("child_process");
|
|
8
|
+
var _consola = require("consola");
|
|
9
|
+
var _simpleGit = _interopRequireDefault(require("simple-git"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const GIT_CONFIGS = {
|
|
12
|
+
"merge.ours.driver": "true",
|
|
13
|
+
"pull.ff": "only",
|
|
14
|
+
"core.autocrlf": "false",
|
|
15
|
+
"core.safecrlf": "true",
|
|
16
|
+
"core.eol": "lf"
|
|
17
|
+
};
|
|
18
|
+
class InitGitAction {
|
|
19
|
+
async run() {
|
|
20
|
+
_consola.consola.start("\u521D\u59CB\u5316 Husky...");
|
|
21
|
+
(0, _child_process.execSync)("npx husky", {
|
|
22
|
+
stdio: "inherit"
|
|
23
|
+
});
|
|
24
|
+
const git = (0, _simpleGit.default)(process.cwd());
|
|
25
|
+
_consola.consola.start("\u914D\u7F6E Git \u672C\u5730\u8BBE\u7F6E...");
|
|
26
|
+
for (const [key, value] of Object.entries(GIT_CONFIGS)) {
|
|
27
|
+
await git.addConfig(key, value, false, "local");
|
|
28
|
+
_consola.consola.info(` git config --local ${key} "${value}"`);
|
|
29
|
+
}
|
|
30
|
+
_consola.consola.success("Git \u914D\u7F6E\u521D\u59CB\u5316\u5B8C\u6210");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.InitGitAction = InitGitAction;
|
package/dist/commands/index.cjs
CHANGED
|
@@ -7,10 +7,12 @@ exports.CommandLoader = void 0;
|
|
|
7
7
|
var _consola = require("consola");
|
|
8
8
|
var _genApi = require("./gen-api/gen-api.cjs");
|
|
9
9
|
var _genCdnLib = require("./gen-cdn-lib/gen-cdn-lib.cjs");
|
|
10
|
+
var _initGit = require("./init-git/init-git.cjs");
|
|
10
11
|
class CommandLoader {
|
|
11
12
|
static load(program) {
|
|
12
13
|
new _genApi.GenApiCommand().load(program);
|
|
13
14
|
new _genCdnLib.GenCdnLibCommand().load(program);
|
|
15
|
+
new _initGit.InitGitCommand().load(program);
|
|
14
16
|
this.handleInvalidCommand(program);
|
|
15
17
|
}
|
|
16
18
|
static handleInvalidCommand(program) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InitGitCommand = void 0;
|
|
7
|
+
var _actions = require("../../actions/index.cjs");
|
|
8
|
+
class InitGitCommand {
|
|
9
|
+
load(program) {
|
|
10
|
+
program.command("init-git").description("\u521D\u59CB\u5316\u9879\u76EE\u901A\u7528 Git \u914D\u7F6E").action(this.action.bind(this));
|
|
11
|
+
}
|
|
12
|
+
async action() {
|
|
13
|
+
await new _actions.InitGitAction().run();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.InitGitCommand = InitGitCommand;
|
|
@@ -56,7 +56,7 @@ export class ModelManage {
|
|
|
56
56
|
if (param.name === "requestBody") {
|
|
57
57
|
requestEntity = { title: "IObject" };
|
|
58
58
|
} else if (param.name === "file") {
|
|
59
|
-
requestEntity = { title: "
|
|
59
|
+
requestEntity = { title: "UploadFileData" };
|
|
60
60
|
} else {
|
|
61
61
|
const refKey = this.getOriginRef(param.schema);
|
|
62
62
|
requestEntity = cfg.definitions[refKey];
|
package/es/actions/index.d.ts
CHANGED
package/es/actions/index.mjs
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import { consola } from "consola";
|
|
3
|
+
import simpleGit from "simple-git";
|
|
4
|
+
const GIT_CONFIGS = {
|
|
5
|
+
"merge.ours.driver": "true",
|
|
6
|
+
"pull.ff": "only",
|
|
7
|
+
"core.autocrlf": "false",
|
|
8
|
+
"core.safecrlf": "true",
|
|
9
|
+
"core.eol": "lf"
|
|
10
|
+
};
|
|
11
|
+
export class InitGitAction {
|
|
12
|
+
async run() {
|
|
13
|
+
consola.start("\u521D\u59CB\u5316 Husky...");
|
|
14
|
+
execSync("npx husky", { stdio: "inherit" });
|
|
15
|
+
const git = simpleGit(process.cwd());
|
|
16
|
+
consola.start("\u914D\u7F6E Git \u672C\u5730\u8BBE\u7F6E...");
|
|
17
|
+
for (const [key, value] of Object.entries(GIT_CONFIGS)) {
|
|
18
|
+
await git.addConfig(key, value, false, "local");
|
|
19
|
+
consola.info(` git config --local ${key} "${value}"`);
|
|
20
|
+
}
|
|
21
|
+
consola.success("Git \u914D\u7F6E\u521D\u59CB\u5316\u5B8C\u6210");
|
|
22
|
+
}
|
|
23
|
+
}
|
package/es/bin.mjs
CHANGED
|
File without changes
|
package/es/commands/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { consola } from "consola";
|
|
2
2
|
import { GenApiCommand } from "./gen-api/gen-api.mjs";
|
|
3
3
|
import { GenCdnLibCommand } from "./gen-cdn-lib/gen-cdn-lib.mjs";
|
|
4
|
+
import { InitGitCommand } from "./init-git/init-git.mjs";
|
|
4
5
|
export class CommandLoader {
|
|
5
6
|
static load(program) {
|
|
6
7
|
new GenApiCommand().load(program);
|
|
7
8
|
new GenCdnLibCommand().load(program);
|
|
9
|
+
new InitGitCommand().load(program);
|
|
8
10
|
this.handleInvalidCommand(program);
|
|
9
11
|
}
|
|
10
12
|
static handleInvalidCommand(program) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InitGitAction } from "../../actions/index.mjs";
|
|
2
|
+
export class InitGitCommand {
|
|
3
|
+
load(program) {
|
|
4
|
+
program.command("init-git").description("\u521D\u59CB\u5316\u9879\u76EE\u901A\u7528 Git \u914D\u7F6E").action(this.action.bind(this));
|
|
5
|
+
}
|
|
6
|
+
async action() {
|
|
7
|
+
await new InitGitAction().run();
|
|
8
|
+
}
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/cli",
|
|
3
|
-
"version": "0.1.6
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"bin": {
|
|
@@ -33,15 +33,6 @@
|
|
|
33
33
|
},
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"author": "gct",
|
|
36
|
-
"scripts": {
|
|
37
|
-
"run": "tsx src/bin.ts gen-cdn-lib --tag=dev --dir=/Users/zhr/workspace/gct/gct-paas-cdn/extras",
|
|
38
|
-
"build": "unbuild",
|
|
39
|
-
"publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
|
|
40
|
-
"publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
|
|
41
|
-
"publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
|
|
42
|
-
"publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
|
|
43
|
-
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
44
|
-
},
|
|
45
36
|
"dependencies": {
|
|
46
37
|
"@inquirer/prompts": "^8.2.0",
|
|
47
38
|
"commander": "^14.0.2",
|
|
@@ -57,7 +48,8 @@
|
|
|
57
48
|
"ora": "^9.1.0",
|
|
58
49
|
"pacote": "^21.5.0",
|
|
59
50
|
"picocolors": "^1.1.1",
|
|
60
|
-
"rimraf": "^6.1.2"
|
|
51
|
+
"rimraf": "^6.1.2",
|
|
52
|
+
"simple-git": "^3.33.0"
|
|
61
53
|
},
|
|
62
54
|
"devDependencies": {
|
|
63
55
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -68,5 +60,13 @@
|
|
|
68
60
|
"typescript": "^5.9.3",
|
|
69
61
|
"unbuild": "^3.6.1"
|
|
70
62
|
},
|
|
71
|
-
"
|
|
72
|
-
|
|
63
|
+
"scripts": {
|
|
64
|
+
"run": "tsx src/bin.ts gen-cdn-lib --tag=dev --dir=/Users/zhr/workspace/gct/gct-paas-cdn/extras",
|
|
65
|
+
"build": "unbuild",
|
|
66
|
+
"publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
|
|
67
|
+
"publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
|
|
68
|
+
"publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
|
|
69
|
+
"publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
|
|
70
|
+
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
71
|
+
}
|
|
72
|
+
}
|