@cloudbase/lowcode-builder 1.6.2 → 1.6.4
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/builder/h5/copy.js +5 -8
- package/lib/builder/h5/material.js +4 -4
- package/lib/builder/service/webpack.js +1 -0
- package/lib/builder/util/generateFiles.js +0 -1
- package/package.json +3 -3
- package/template/html/index.html.ejs +1 -1
- package/template/mp/common/util.js +1 -1
- package/template/webpack/web.prod.js +1 -0
package/lib/builder/h5/copy.js
CHANGED
|
@@ -32,7 +32,6 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
32
32
|
const chalk_1 = __importDefault(require("chalk"));
|
|
33
33
|
const config_1 = require("../config");
|
|
34
34
|
const generateFiles_1 = require("../util/generateFiles");
|
|
35
|
-
const common_1 = require("../util/common");
|
|
36
35
|
const junk = __importStar(require("../util/junk"));
|
|
37
36
|
// 模版文件只复制一次
|
|
38
37
|
async function runCopy(appBuildDir, webRuntimeAppData, i18nConfig) {
|
|
@@ -56,24 +55,18 @@ async function runCopy(appBuildDir, webRuntimeAppData, i18nConfig) {
|
|
|
56
55
|
}
|
|
57
56
|
exports.runCopy = runCopy;
|
|
58
57
|
async function copyMaterialLibraries(dependencies = [], materialsDir, appBuildDir) {
|
|
59
|
-
const localPkg = (0, common_1.getCurrentPackageJson)();
|
|
60
58
|
return Promise.all(dependencies.map(async (componentLib) => {
|
|
61
59
|
const { name, version } = componentLib;
|
|
62
60
|
const materialNameVersion = `${name}@${version}`;
|
|
63
61
|
const materialDir = path.join(materialsDir, materialNameVersion);
|
|
64
62
|
const srcDir = 'src';
|
|
65
63
|
let targetDir = path.join(materialDir, srcDir);
|
|
66
|
-
// 当前本地目录是素材库的时候,直接用本地的
|
|
67
|
-
if (localPkg && localPkg.name === name && localPkg.version === version) {
|
|
68
|
-
console.log('当前本地目录是素材库的时候,直接用本地的', materialNameVersion);
|
|
69
|
-
targetDir = path.join(process.cwd(), 'src');
|
|
70
|
-
}
|
|
71
64
|
const librariesDir = path.join(appBuildDir, 'src/libraries', materialNameVersion);
|
|
72
65
|
const metaJosnPath = path.join(materialDir, 'meta.json');
|
|
73
66
|
if (fs_extra_1.default.existsSync(metaJosnPath)) {
|
|
74
67
|
await fs_extra_1.default.copy(metaJosnPath, path.join(librariesDir, 'meta.json'));
|
|
75
68
|
}
|
|
76
|
-
await fs_extra_1.default.copy(targetDir, librariesDir, {
|
|
69
|
+
await fs_extra_1.default.copy(targetDir, path.join(librariesDir, srcDir), {
|
|
77
70
|
filter: (src, dest) => {
|
|
78
71
|
let path = src.split('/');
|
|
79
72
|
return !junk.is(path[path.length - 1]);
|
|
@@ -84,6 +77,10 @@ async function copyMaterialLibraries(dependencies = [], materialsDir, appBuildDi
|
|
|
84
77
|
if (fs_extra_1.default.existsSync(nodeModulesPath) && !fs_extra_1.default.existsSync(targetNodeModulesPath)) {
|
|
85
78
|
await fs_extra_1.default.symlink(nodeModulesPath, targetNodeModulesPath, 'dir');
|
|
86
79
|
}
|
|
80
|
+
const packageJsonPath = path.join(materialDir, 'package.json');
|
|
81
|
+
if (fs_extra_1.default.existsSync(packageJsonPath)) {
|
|
82
|
+
await fs_extra_1.default.copy(packageJsonPath, path.join(librariesDir, 'package.json'));
|
|
83
|
+
}
|
|
87
84
|
}));
|
|
88
85
|
}
|
|
89
86
|
exports.copyMaterialLibraries = copyMaterialLibraries;
|
|
@@ -79,14 +79,14 @@ async function handleNormalMaterial({ dependencies: normalDependencies, material
|
|
|
79
79
|
if ((_b = (_a = packageJson.weda) === null || _a === void 0 ? void 0 : _a.platform) === null || _b === void 0 ? void 0 : _b.web) {
|
|
80
80
|
const _entries = (_d = (_c = packageJson.weda) === null || _c === void 0 ? void 0 : _c.platform) === null || _d === void 0 ? void 0 : _d.web;
|
|
81
81
|
entries = {
|
|
82
|
-
entry: path.posix.
|
|
83
|
-
components: path.posix.
|
|
84
|
-
actions: path.posix.
|
|
82
|
+
entry: path.posix.join('./', _entries.entry),
|
|
83
|
+
components: path.posix.join('./', _entries.components),
|
|
84
|
+
actions: path.posix.join('./', _entries.actions),
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
else if (packageJson.lowcode) {
|
|
88
88
|
entries = {
|
|
89
|
-
entry: path.posix.
|
|
89
|
+
entry: path.posix.join('./', packageJson.lowcode),
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -289,6 +289,7 @@ function getWebpackWebBuildParams(appId, appBuildDir, publicPath = '/', mode = c
|
|
|
289
289
|
'@cloudbase/js-sdk': 'window.cloudbase',
|
|
290
290
|
'@cloudbase/weda-cloud-sdk/dist/h5': 'window.CloudSDK',
|
|
291
291
|
'@cloudbase/weda-cloud-sdk': 'window.CloudSDK',
|
|
292
|
+
'@cloudbase/weda-client': 'window.WedaClientSDK',
|
|
292
293
|
'@zxing/library': 'window.ZXing',
|
|
293
294
|
'@cloudbase/lowcode-render': 'window["weda-render"]',
|
|
294
295
|
},
|
|
@@ -110,7 +110,6 @@ async function copyFiles(copyFiles, srcDir, dstDir) {
|
|
|
110
110
|
return Promise.all(copyFiles.map(async (filePath) => {
|
|
111
111
|
const srcFile = path_1.default.join(srcDir, filePath);
|
|
112
112
|
const dstFile = path_1.default.join(dstDir, filePath);
|
|
113
|
-
// await fs.copy(path.join(appTemplateDir, 'src', entry), dstFile)
|
|
114
113
|
// 用带 cache 功能的 writeFile 来替换 copy
|
|
115
114
|
const srcContent = await fs_extra_1.default.readFile(srcFile, {
|
|
116
115
|
encoding: 'utf8',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
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",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cloudbase/cals": "^1.0.
|
|
42
|
-
"@cloudbase/lowcode-generator": "^1.6.
|
|
41
|
+
"@cloudbase/cals": "^1.0.3",
|
|
42
|
+
"@cloudbase/lowcode-generator": "^1.6.4",
|
|
43
43
|
"axios": "^0.21.0",
|
|
44
44
|
"browserfs": "^1.4.3",
|
|
45
45
|
"browserify-zlib": "^0.2.0",
|
|
@@ -543,7 +543,7 @@
|
|
|
543
543
|
crossorigin
|
|
544
544
|
src="<%=
|
|
545
545
|
cdnEndpoints.cdngo
|
|
546
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
546
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.413fc7788ab27e709449.bundle.js"
|
|
547
547
|
></script>
|
|
548
548
|
</body>
|
|
549
549
|
</html>
|
|
@@ -95,12 +95,12 @@ export function createEventHandlers(
|
|
|
95
95
|
} catch (e) {
|
|
96
96
|
let eventName = l.key ? `${prefix}$${l.key}_fail` : '';
|
|
97
97
|
if (self[eventName]) {
|
|
98
|
-
console.error(`Action error: [${trigger}:${l.key}]`, e);
|
|
99
98
|
await self[eventName]({
|
|
100
99
|
...event,
|
|
101
100
|
detail: e,
|
|
102
101
|
});
|
|
103
102
|
} else {
|
|
103
|
+
console.error(`Action error: [${trigger}:${l.key}]`, e);
|
|
104
104
|
if (!looseError) {
|
|
105
105
|
app.showToast({
|
|
106
106
|
icon: 'error',
|