@creekjs/umi-plugins 1.0.0
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/README.md +326 -0
- package/dist/creek-layout/index.d.ts +3 -0
- package/dist/creek-layout/index.js +193 -0
- package/dist/creek-layout/template/icons.tpl +6 -0
- package/dist/creek-layout/template/layout.tpl +123 -0
- package/dist/creek-layout/template/runtime-config.type.tpl +5 -0
- package/dist/creek-layout/template/runtime.tpl +41 -0
- package/dist/creek-layout/template/type.tpl +36 -0
- package/dist/open-api/index.d.ts +3 -0
- package/dist/open-api/index.js +76 -0
- package/dist/template/locale/i18N-package.tpl +16 -0
- package/dist/template/locale/i18N.tpl +15 -0
- package/dist/template/locale/index.tpl +2 -0
- package/dist/template/request/index.tpl +8 -0
- package/dist/template/request/request.tpl +580 -0
- package/dist/template/request/runtime-config.tpl +6 -0
- package/dist/template/request/type.tpl +6 -0
- package/dist/utils/file.d.ts +4 -0
- package/dist/utils/file.js +74 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +27 -0
- package/dist/utils/spawn.d.ts +5 -0
- package/dist/utils/spawn.js +71 -0
- package/dist/utils/withTmpPath.d.ts +6 -0
- package/dist/utils/withTmpPath.js +39 -0
- package/package.json +17 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/spawn.ts
|
|
20
|
+
var spawn_exports = {};
|
|
21
|
+
__export(spawn_exports, {
|
|
22
|
+
isGlobalInstallModule: () => isGlobalInstallModule,
|
|
23
|
+
spawnCommand: () => spawnCommand
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(spawn_exports);
|
|
26
|
+
var spawn = require("cross-spawn");
|
|
27
|
+
function isValidCommand(command) {
|
|
28
|
+
return /^[a-zA-Z0-9@/-]+$/.test(command);
|
|
29
|
+
}
|
|
30
|
+
function isValidCommandParams(commandParams = []) {
|
|
31
|
+
return commandParams.every((command) => /^[a-zA-Z0-9@/-]+$/.test(command));
|
|
32
|
+
}
|
|
33
|
+
function spawnCommand(command, commandParams = [], spawnConfig = { stdio: "inherit" }) {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
if (isValidCommand(command) && isValidCommandParams(commandParams)) {
|
|
36
|
+
const child = spawn(command, commandParams, spawnConfig);
|
|
37
|
+
child.on("exit", (code, signal) => {
|
|
38
|
+
if (code) {
|
|
39
|
+
reject(new Error(`${command}失败,退出码:${code}`));
|
|
40
|
+
} else if (signal) {
|
|
41
|
+
reject(new Error(`${command}被信号中断,信号:${signal}`));
|
|
42
|
+
} else {
|
|
43
|
+
resolve(true);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
reject(`${command}不是一个有效的命令`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function isGlobalInstallModule(moduleName) {
|
|
52
|
+
const child = spawn("pnpm", ["list", "-g"]);
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
child.stdout.on("data", (data) => {
|
|
55
|
+
const output = data.toString();
|
|
56
|
+
if (output.includes(moduleName)) {
|
|
57
|
+
resolve(true);
|
|
58
|
+
} else {
|
|
59
|
+
resolve(false);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
child.stderr.on("data", (data) => {
|
|
63
|
+
reject(`命令执行出错:${data}`);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
isGlobalInstallModule,
|
|
70
|
+
spawnCommand
|
|
71
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/withTmpPath.ts
|
|
20
|
+
var withTmpPath_exports = {};
|
|
21
|
+
__export(withTmpPath_exports, {
|
|
22
|
+
withTmpPath: () => withTmpPath
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(withTmpPath_exports);
|
|
25
|
+
var import_plugin_utils = require("@umijs/max/plugin-utils");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
function withTmpPath(opts) {
|
|
28
|
+
return (0, import_plugin_utils.winPath)(
|
|
29
|
+
(0, import_path.join)(
|
|
30
|
+
opts.api.paths.absTmpPath,
|
|
31
|
+
opts.api.plugin.key && !opts.noPluginDir ? `plugin-${opts.api.plugin.key}` : "",
|
|
32
|
+
opts.path
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
withTmpPath
|
|
39
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@creekjs/umi-plugins",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"father:build": "father build",
|
|
12
|
+
"father:dev": "father dev"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC"
|
|
17
|
+
}
|