@cloudbase/cli 2.5.1-alpha.0 → 2.5.1-alpha.2
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/commands/lowcode/app.js +13 -0
- package/lib/utils/dts.js +18 -9
- package/package.json +1 -1
|
@@ -59,6 +59,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
59
59
|
};
|
|
60
60
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
61
|
exports.ModelTypeSync = exports.LowCodeDeployApp = exports.LowCodeBuildAppConfig = exports.LowCodePreviewApp = exports.LowCodeBuildApp = exports.LowCodeWatch = void 0;
|
|
62
|
+
const lodash_1 = require("lodash");
|
|
62
63
|
const common_1 = require("../common");
|
|
63
64
|
const decorators_1 = require("../../decorators");
|
|
64
65
|
const utils_1 = require("./utils");
|
|
@@ -344,6 +345,18 @@ let ModelTypeSync = class ModelTypeSync extends common_1.Command {
|
|
|
344
345
|
envId: ctx.envId
|
|
345
346
|
}, null, 2), 'utf8');
|
|
346
347
|
}
|
|
348
|
+
if (!(yield fs_extra_1.default.pathExists('tsconfig.json'))) {
|
|
349
|
+
yield fs_extra_1.default.writeFile('tsconfig.json', JSON.stringify({
|
|
350
|
+
compilerOptions: {
|
|
351
|
+
allowJs: true
|
|
352
|
+
}
|
|
353
|
+
}, null, 2), 'utf8');
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
const config = yield fs_extra_1.default.readJson('tsconfig.json', 'utf8');
|
|
357
|
+
(0, lodash_1.set)(config, 'compilerOptions.allowJs', true);
|
|
358
|
+
yield fs_extra_1.default.writeFile('tsconfig.json', JSON.stringify(config, null, 2), 'utf8');
|
|
359
|
+
}
|
|
347
360
|
const cloudService = yield getCloudServiceInstance(ctx);
|
|
348
361
|
const datasourceList = yield cloudService.lowcode.request('DescribeDataSourceList', {
|
|
349
362
|
EnvId: ctx.envId,
|
package/lib/utils/dts.js
CHANGED
|
@@ -24,19 +24,28 @@ function generateDataModelDTS(dataModelList) {
|
|
|
24
24
|
};
|
|
25
25
|
})));
|
|
26
26
|
const result = `
|
|
27
|
-
import {
|
|
27
|
+
import { DataModelMethods } from "@cloudbase/wx-cloud-client-sdk";
|
|
28
28
|
${dtsList.map((item) => item.dts).join('\n')}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
|
|
30
|
+
interface IModels {
|
|
31
|
+
${dtsList
|
|
32
32
|
.map((item) => {
|
|
33
33
|
return `
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/**
|
|
35
|
+
* 数据模型:${item.title}
|
|
36
|
+
*/
|
|
37
|
+
${item.name}: DataModelMethods<${getModelInterfaceName(item.name)}>;`;
|
|
38
38
|
})
|
|
39
|
-
.join('\n')}
|
|
39
|
+
.join('\n')}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare module "@cloudbase/wx-cloud-client-sdk" {
|
|
43
|
+
interface OrmClient extends IModels {}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare global {
|
|
47
|
+
interface WxCloud {
|
|
48
|
+
models: IModels;
|
|
40
49
|
}
|
|
41
50
|
}`;
|
|
42
51
|
return result;
|