@tuya-sat/micro-script 3.0.21-beta.3 → 3.0.21-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.
|
@@ -246,7 +246,7 @@ function getCommonConfig({ isDev, isBuild, }) {
|
|
|
246
246
|
if (!multiApps) {
|
|
247
247
|
multiApps = [];
|
|
248
248
|
fs.readdirSync(path_1.default.join(process.cwd(), 'apps')).forEach((dir) => {
|
|
249
|
-
multiApps = [...multiApps,
|
|
249
|
+
multiApps = [...multiApps, { name: dir }];
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
multiApps.forEach((app) => {
|
|
@@ -36,19 +36,19 @@ const utils_1 = require("../../utils");
|
|
|
36
36
|
function mockSaasInfo(app, microPort) {
|
|
37
37
|
let { multiApps, debuggerConfig: { isMainApp }, } = require(paths_1.default.microConfig);
|
|
38
38
|
const idsMap = new Map();
|
|
39
|
+
if (!multiApps) {
|
|
40
|
+
multiApps = [];
|
|
41
|
+
fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps')).forEach((dir) => {
|
|
42
|
+
multiApps = [...multiApps, { name: dir }];
|
|
43
|
+
});
|
|
44
|
+
}
|
|
39
45
|
multiApps === null || multiApps === void 0 ? void 0 : multiApps.forEach((app) => {
|
|
40
46
|
idsMap.set(app.name, { entry_id: (0, uuid_1.v4)(), oem_micro_app_id: (0, uid_1.uid)(16) });
|
|
41
47
|
});
|
|
42
48
|
if (!isMainApp) {
|
|
43
49
|
app.get('/api/saas-info', (req, res) => {
|
|
44
50
|
const lang = parseCookie(req.headers['cookie'], 'main-i18next');
|
|
45
|
-
if ((0, utils_1.isMonorepo)()
|
|
46
|
-
if (!multiApps) {
|
|
47
|
-
multiApps = [];
|
|
48
|
-
fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps')).forEach((dir) => {
|
|
49
|
-
multiApps = [...multiApps, [{ name: dir }]];
|
|
50
|
-
});
|
|
51
|
-
}
|
|
51
|
+
if ((0, utils_1.isMonorepo)() || (multiApps && multiApps.length > 0)) {
|
|
52
52
|
const result = {
|
|
53
53
|
apps: [],
|
|
54
54
|
entry_info: { entries: [], entry_mode: 'normal' },
|
|
@@ -57,7 +57,8 @@ function mockSaasInfo(app, microPort) {
|
|
|
57
57
|
};
|
|
58
58
|
multiApps.forEach((app) => {
|
|
59
59
|
const entry_id = idsMap.get(app.name).entry_id;
|
|
60
|
-
const
|
|
60
|
+
const dir = (0, utils_1.isMonorepo)() ? `apps/${app.name}` : `${app.dir}`;
|
|
61
|
+
const manifest = fs_extra_1.default.readJSONSync(path.join(process.cwd(), dir, 'manifest.json'), 'utf-8');
|
|
61
62
|
const oem_micro_app_id = idsMap.get(app.name).oem_micro_app_id;
|
|
62
63
|
const baseUrl = `/apps/${oem_micro_app_id}`;
|
|
63
64
|
result.saas_id_info_list.push({
|
|
@@ -65,7 +66,7 @@ function mockSaasInfo(app, microPort) {
|
|
|
65
66
|
universal_id: '',
|
|
66
67
|
});
|
|
67
68
|
const micoApp = consturctApp(manifest, oem_micro_app_id, baseUrl, lang, microPort, app.name);
|
|
68
|
-
const entryInfo = consturctEntry(manifest, oem_micro_app_id, entry_id, baseUrl, lang,
|
|
69
|
+
const entryInfo = consturctEntry(manifest, oem_micro_app_id, entry_id, baseUrl, lang, dir);
|
|
69
70
|
const permission = consturctPermissions();
|
|
70
71
|
result.apps.push(micoApp);
|
|
71
72
|
result.entry_info.entries.push(entryInfo);
|
package/dist/utils/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
34
34
|
const getAnnotations = () => {
|
|
35
35
|
let { multiApps } = require(paths_1.default.microConfig);
|
|
36
36
|
if ((0, exports.isMonorepo)()) {
|
|
37
|
-
return fs_extra_1.default.readJSONSync(path.join(process.cwd(), fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps'))[0], 'manifest.json')).annotations;
|
|
37
|
+
return fs_extra_1.default.readJSONSync(path.join(process.cwd(), 'apps', fs_extra_1.default.readdirSync(path.join(process.cwd(), 'apps'))[0], 'manifest.json')).annotations;
|
|
38
38
|
}
|
|
39
39
|
else if (multiApps && multiApps.length > 0) {
|
|
40
40
|
return fs_extra_1.default.readJSONSync(path.join(process.cwd(), multiApps[0].dir, 'manifest.json')).annotations;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.0.21-beta.
|
|
3
|
+
"version": "3.0.21-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.21-beta.
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.0.21-beta.
|
|
28
|
-
"@tuya-sat/micro-utils": "3.0.21-beta.
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.0.21-beta.5",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.0.21-beta.5",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.0.21-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",
|