@tuya-sat/micro-script 3.0.27-beta.4 → 3.0.27-beta.5
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.
|
@@ -37,10 +37,11 @@ function mockSaasInfo(app, microPort) {
|
|
|
37
37
|
let { multiApps, debuggerConfig: { isMainApp }, } = require(paths_1.default.microConfig);
|
|
38
38
|
const idsMap = new Map();
|
|
39
39
|
multiApps = (0, utils_1.processMultiApps)(multiApps);
|
|
40
|
-
multiApps === null || multiApps === void 0 ? void 0 : multiApps.forEach((app) => {
|
|
41
|
-
idsMap.set(app.name, { entry_id: (0, uuid_1.v4)(), oem_micro_app_id: (0, uid_1.uid)(16) });
|
|
42
|
-
});
|
|
43
40
|
if (isMainApp && fs_extra_1.default.existsSync(path.join(process.cwd(), 'apps'))) {
|
|
41
|
+
const dirs = fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps'));
|
|
42
|
+
dirs === null || dirs === void 0 ? void 0 : dirs.forEach(dir => {
|
|
43
|
+
idsMap.set(dir, { entry_id: (0, uuid_1.v4)(), oem_micro_app_id: (0, uid_1.uid)(16) });
|
|
44
|
+
});
|
|
44
45
|
app.get('/api/saas-info', (req, res) => {
|
|
45
46
|
const lang = 'zh';
|
|
46
47
|
const result = {
|
|
@@ -49,11 +50,10 @@ function mockSaasInfo(app, microPort) {
|
|
|
49
50
|
permissions: {},
|
|
50
51
|
saas_id_info_list: [],
|
|
51
52
|
};
|
|
52
|
-
const dirs = fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps'));
|
|
53
53
|
dirs.forEach((dir) => {
|
|
54
|
-
const entry_id =
|
|
54
|
+
const entry_id = idsMap.get(dir).entry_id;
|
|
55
55
|
const manifest = fs_extra_1.default.readJSONSync(path.join(process.cwd(), 'apps', dir, 'manifest.json'), 'utf-8');
|
|
56
|
-
const oem_micro_app_id =
|
|
56
|
+
const oem_micro_app_id = idsMap.get(dir).oem_micro_app_id;
|
|
57
57
|
const baseUrl = `/apps/${oem_micro_app_id}`;
|
|
58
58
|
result.saas_id_info_list.push({
|
|
59
59
|
oem_micro_app_id: oem_micro_app_id,
|
|
@@ -79,6 +79,9 @@ function mockSaasInfo(app, microPort) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
if (!isMainApp) {
|
|
82
|
+
multiApps === null || multiApps === void 0 ? void 0 : multiApps.forEach((app) => {
|
|
83
|
+
idsMap.set(app.name, { entry_id: (0, uuid_1.v4)(), oem_micro_app_id: (0, uid_1.uid)(16) });
|
|
84
|
+
});
|
|
82
85
|
app.get('/api/saas-info', (req, res) => {
|
|
83
86
|
const lang = parseCookie(req.headers['cookie'], 'main-i18next');
|
|
84
87
|
if ((0, utils_1.isMonorepo)() || (multiApps && multiApps.length > 0)) {
|
|
@@ -159,6 +162,7 @@ function consturctEntry(manifest, oem_micro_app_id, entry_id, baseUrl, lang, dir
|
|
|
159
162
|
if (menu.sub_entry_list.length) {
|
|
160
163
|
stack.push(...menu.sub_entry_list);
|
|
161
164
|
}
|
|
165
|
+
menu.icon = 'https://images.tuyacn.com/rms-static/5d202fa0-e909-11eb-815d-e39234ce96ff-1626751199130.png?tyName=space-manage.png';
|
|
162
166
|
}
|
|
163
167
|
return fakeMenu;
|
|
164
168
|
}
|
package/dist/scripts/start.js
CHANGED
|
@@ -24,14 +24,14 @@ const template_1 = __importDefault(require("../template"));
|
|
|
24
24
|
let defaultPort = 9000;
|
|
25
25
|
console.log(chalk_1.default.yellow('如果是pc端的微应用调试,请勿使用该命令,考虑使用`start --main`或`start --main --proxy`'));
|
|
26
26
|
//检测端口占用情况
|
|
27
|
-
console.log("process.env.
|
|
28
|
-
if (process.env.
|
|
27
|
+
console.log("process.env.PROT", process.env.PROT);
|
|
28
|
+
if (process.env.PROT) {
|
|
29
29
|
const compiler = (0, bundleServer_1.createServerCompiler)();
|
|
30
30
|
(0, bundleServer_1.runBundleServer)({
|
|
31
|
-
port: Number(process.env.
|
|
31
|
+
port: Number(process.env.PROT),
|
|
32
32
|
compiler,
|
|
33
33
|
internalDevConfig: {
|
|
34
|
-
open:
|
|
34
|
+
open: false,
|
|
35
35
|
setupMiddlewares(middleware, { app }) {
|
|
36
36
|
(0, mock_1.default)(app);
|
|
37
37
|
(0, proxy_1.default)(app);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.0.27-beta.
|
|
3
|
+
"version": "3.0.27-beta.5",
|
|
4
4
|
"bin": "./dist/bin/cli.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@babel/preset-typescript": "7.16.7",
|
|
24
24
|
"@babel/traverse": "^7.20.13",
|
|
25
25
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
|
26
|
-
"@tuya-sat/micro-dev-loader": "3.0.27-beta.
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.0.27-beta.
|
|
28
|
-
"@tuya-sat/micro-utils": "3.0.27-beta.
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.0.27-beta.5",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.0.27-beta.5",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.0.27-beta.5",
|
|
29
29
|
"@types/kill-port": "^2.0.0",
|
|
30
30
|
"babel-loader": "8.2.4",
|
|
31
31
|
"babel-plugin-import": "1.13.3",
|