@cloudbase/framework-plugin-low-code 1.7.10 → 1.7.12
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/lib/utils/common.d.ts +0 -29
- package/lib/utils/common.d.ts.map +1 -1
- package/lib/utils/common.js +1 -138
- package/package.json +4 -4
package/lib/utils/common.d.ts
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as childProcess from 'child_process';
|
|
3
|
-
export declare function setReadOnly(target: object, key: string, v: any, deep?: boolean): object;
|
|
4
|
-
export declare type PromiseResult<T> = Promise<[null, T] | [Error, null]>;
|
|
5
|
-
export declare function promiseWrapper<T>(p: Promise<T>): PromiseResult<T>;
|
|
6
|
-
export declare const isWindows: boolean;
|
|
7
|
-
export declare const isMac: boolean;
|
|
8
|
-
export declare const isLinux: boolean;
|
|
9
|
-
export declare function compressingZip(entryList: string[], distPath: string, opts?: {}): Promise<unknown>;
|
|
10
|
-
export interface IPackageJson {
|
|
11
|
-
name: string;
|
|
12
|
-
version: string;
|
|
13
|
-
title?: string;
|
|
14
|
-
desc?: string;
|
|
15
|
-
dependencies: {
|
|
16
|
-
[name: string]: string;
|
|
17
|
-
};
|
|
18
|
-
repository: {
|
|
19
|
-
type: string;
|
|
20
|
-
url: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export declare function getPackageJson(cwd: string): Promise<IPackageJson>;
|
|
24
1
|
export declare function remove(dir: string): Promise<void>;
|
|
25
|
-
export declare function handlePathEscape(path: string): string;
|
|
26
|
-
export declare function isWinPlatform(): boolean;
|
|
27
|
-
export declare function spawnPro(command: string, args?: ReadonlyArray<string>, options?: childProcess.SpawnOptions): Promise<unknown>;
|
|
28
|
-
export declare function getValidNodeModulesPath(): string;
|
|
29
|
-
export declare function getMd5(string: string, len?: number): string;
|
|
30
|
-
export declare function getIPAdress(): string | undefined;
|
|
31
2
|
export declare function processPkgUrlCals2WeappData(cals: any): any;
|
|
32
3
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,iBAEvC;AAED,wBAAgB,2BAA2B,CAAC,IAAI,KAAA,OAO/C"}
|
package/lib/utils/common.js
CHANGED
|
@@ -23,151 +23,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.processPkgUrlCals2WeappData = exports.
|
|
27
|
-
const pump_1 = __importDefault(require("pump"));
|
|
26
|
+
exports.processPkgUrlCals2WeappData = exports.remove = void 0;
|
|
28
27
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
29
|
-
const compressing_1 = __importDefault(require("compressing"));
|
|
30
|
-
const path_1 = __importDefault(require("path"));
|
|
31
|
-
const os_1 = __importDefault(require("os"));
|
|
32
|
-
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
33
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
34
|
-
class ReadOnlyArray extends Array {
|
|
35
|
-
constructor(mutable) {
|
|
36
|
-
super();
|
|
37
|
-
return Object.freeze(mutable.slice());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function setReadOnly(target, key, v, deep = true) {
|
|
41
|
-
let value = v;
|
|
42
|
-
if (deep && typeof value === 'object') {
|
|
43
|
-
if (Array.isArray(value)) {
|
|
44
|
-
value = new ReadOnlyArray(value);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
Object.entries(value).forEach(([k, v]) => setReadOnly(value, k, v));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return Object.defineProperty(target, key, {
|
|
51
|
-
writable: false,
|
|
52
|
-
get() {
|
|
53
|
-
return value;
|
|
54
|
-
},
|
|
55
|
-
set() {
|
|
56
|
-
console.error(`Can not modify readonly value "${key}"`);
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
exports.setReadOnly = setReadOnly;
|
|
61
|
-
function promiseWrapper(p) {
|
|
62
|
-
return new Promise((resolve) => {
|
|
63
|
-
try {
|
|
64
|
-
p.then((i) => resolve([null, i])).catch((e) => resolve([e, null]));
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
resolve([e, null]);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
exports.promiseWrapper = promiseWrapper;
|
|
72
|
-
exports.isWindows = process.platform === 'win32';
|
|
73
|
-
exports.isMac = process.platform === 'darwin';
|
|
74
|
-
exports.isLinux = process.platform === 'linux';
|
|
75
|
-
function compressingZip(entryList, distPath, opts = {}) {
|
|
76
|
-
return new Promise((resolve, reject) => {
|
|
77
|
-
const zipStream = new compressing_1.default.zip.Stream();
|
|
78
|
-
entryList.map((entry) => {
|
|
79
|
-
zipStream.addEntry(entry, opts);
|
|
80
|
-
});
|
|
81
|
-
const destStream = fs_extra_1.default.createWriteStream(distPath);
|
|
82
|
-
(0, pump_1.default)(zipStream, destStream, (err) => {
|
|
83
|
-
if (err) {
|
|
84
|
-
console.error(err);
|
|
85
|
-
reject(err);
|
|
86
|
-
}
|
|
87
|
-
resolve(distPath);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
exports.compressingZip = compressingZip;
|
|
92
|
-
function getPackageJson(cwd) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
return yield fs_extra_1.default.readJson(path_1.default.join(cwd, 'package.json'));
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
exports.getPackageJson = getPackageJson;
|
|
98
28
|
function remove(dir) {
|
|
99
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
30
|
yield fs_extra_1.default.remove(dir);
|
|
101
31
|
});
|
|
102
32
|
}
|
|
103
33
|
exports.remove = remove;
|
|
104
|
-
function handlePathEscape(path) {
|
|
105
|
-
if (os_1.default.platform() !== 'win32') {
|
|
106
|
-
return path;
|
|
107
|
-
}
|
|
108
|
-
return path.replace(/\\/g, '\\\\');
|
|
109
|
-
}
|
|
110
|
-
exports.handlePathEscape = handlePathEscape;
|
|
111
|
-
function isWinPlatform() {
|
|
112
|
-
return os_1.default.platform() === 'win32';
|
|
113
|
-
}
|
|
114
|
-
exports.isWinPlatform = isWinPlatform;
|
|
115
|
-
function spawnPro(command, args, options) {
|
|
116
|
-
return new Promise((resolve, reject) => {
|
|
117
|
-
var _a, _b;
|
|
118
|
-
const process = (0, cross_spawn_1.default)(command, args, options);
|
|
119
|
-
let strOut = '';
|
|
120
|
-
let strErr = '';
|
|
121
|
-
(_a = process.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
|
|
122
|
-
strOut += data;
|
|
123
|
-
});
|
|
124
|
-
(_b = process.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
|
|
125
|
-
strErr += data;
|
|
126
|
-
});
|
|
127
|
-
function handleFinish(code) {
|
|
128
|
-
if (code === 0) {
|
|
129
|
-
resolve(strOut + strErr);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
reject(strOut + strErr);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
process.on('error', (err) => {
|
|
136
|
-
console.error('error', err);
|
|
137
|
-
});
|
|
138
|
-
process.on('close', handleFinish);
|
|
139
|
-
process.on('exit', handleFinish);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
exports.spawnPro = spawnPro;
|
|
143
|
-
function getValidNodeModulesPath() {
|
|
144
|
-
const nodeModulesPath = path_1.default.resolve(__dirname, '../../node_modules');
|
|
145
|
-
const cwdWaPath = path_1.default.resolve(process.cwd(), 'node_modules/.bin/wa');
|
|
146
|
-
if (fs_extra_1.default.pathExistsSync(cwdWaPath)) {
|
|
147
|
-
return path_1.default.resolve(process.cwd(), 'node_modules');
|
|
148
|
-
}
|
|
149
|
-
return nodeModulesPath;
|
|
150
|
-
}
|
|
151
|
-
exports.getValidNodeModulesPath = getValidNodeModulesPath;
|
|
152
|
-
function getMd5(string, len = 8) {
|
|
153
|
-
return crypto_1.default.createHash('md5').update(string).digest('hex').slice(0, len);
|
|
154
|
-
}
|
|
155
|
-
exports.getMd5 = getMd5;
|
|
156
|
-
function getIPAdress() {
|
|
157
|
-
const interfaces = os_1.default.networkInterfaces();
|
|
158
|
-
for (const devName in interfaces) {
|
|
159
|
-
const iface = interfaces[devName] || [];
|
|
160
|
-
for (let i = 0; i < iface.length; i++) {
|
|
161
|
-
const alias = iface[i];
|
|
162
|
-
if (alias.family === 'IPv4' &&
|
|
163
|
-
alias.address !== '127.0.0.1' &&
|
|
164
|
-
!alias.internal) {
|
|
165
|
-
return alias.address;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
exports.getIPAdress = getIPAdress;
|
|
171
34
|
function processPkgUrlCals2WeappData(cals) {
|
|
172
35
|
const { extra = {}, datasources, dataSources } = cals, restCals = __rest(cals, ["extra", "datasources", "dataSources"]);
|
|
173
36
|
return Object.assign(Object.assign(Object.assign({}, extra), restCals), { datasources: datasources || dataSources || [] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.12",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -35,17 +35,16 @@
|
|
|
35
35
|
"url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@cloudbase/cals": "^1.0.
|
|
38
|
+
"@cloudbase/cals": "^1.0.17",
|
|
39
39
|
"@cloudbase/framework-core": "^1.8.16",
|
|
40
40
|
"@cloudbase/framework-plugin-auth": "^1.8.16",
|
|
41
41
|
"@cloudbase/framework-plugin-website": "^1.8.17",
|
|
42
|
-
"@cloudbase/lowcode-builder": "^1.8.
|
|
42
|
+
"@cloudbase/lowcode-builder": "^1.8.25",
|
|
43
43
|
"@cloudbase/lowcode-deployer": "^1.3.1",
|
|
44
44
|
"@formily/react-schema-renderer": "1.1.7",
|
|
45
45
|
"archiver": "^4.0.1",
|
|
46
46
|
"compressing": "^1.4.0",
|
|
47
47
|
"cos-nodejs-sdk-v5": "^2.8.2",
|
|
48
|
-
"cross-spawn": "^6.0.5",
|
|
49
48
|
"fs-extra": "^7.0.1",
|
|
50
49
|
"less": "^4.0.0",
|
|
51
50
|
"lodash": "^4.17.11",
|
|
@@ -60,6 +59,7 @@
|
|
|
60
59
|
"@types/less": "^3.0.1",
|
|
61
60
|
"@types/node": "^13.9.8",
|
|
62
61
|
"@types/weixin-app": "^2.9.0",
|
|
62
|
+
"cross-spawn": "^6.0.5",
|
|
63
63
|
"csstype": "^2.6.10",
|
|
64
64
|
"jest": "^27.5.1",
|
|
65
65
|
"typescript": "^4.7.4"
|