@tuya-sat/micro-script 3.0.27-beta.5 → 3.0.27-beta.6

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.
@@ -38,7 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.getFakeUser = void 0;
39
39
  const axios_1 = __importDefault(require("axios"));
40
40
  const chalk_1 = __importDefault(require("chalk"));
41
- const fs = __importStar(require("fs"));
41
+ const fs = __importStar(require("fs-extra"));
42
42
  const path = __importStar(require("path"));
43
43
  function parse_SDF_CONFIG(html) {
44
44
  var _a;
@@ -62,7 +62,8 @@ function getFakeSaas(config) {
62
62
  process.exit(1);
63
63
  }
64
64
  if (config.isMainApp && fs.existsSync(path.join(process.cwd(), 'apps'))) {
65
- const saas = {
65
+ const saasInfo = fs.readJSONSync(path.join(process.cwd(), 'saas-info.config.json'));
66
+ let saas = {
66
67
  _SDF: {
67
68
  base: '',
68
69
  env: '',
@@ -85,12 +86,15 @@ function getFakeSaas(config) {
85
86
  supported_language: { en: 'English', zh: '简体中文' },
86
87
  tenant_register_support: false,
87
88
  tenant_type: "SINGLE_TENANT",
88
- title: "SaaS UI"
89
+ title: "物联网开放平台"
89
90
  },
90
91
  },
91
92
  _SDF_CONFIG: {},
92
93
  __MAIN_APP_PUBLIC_PATH: 'https://static1.tuyacn.com/static/sdf-main-app/0.0.0-123/',
93
94
  };
95
+ Object.keys(saasInfo).forEach(key => {
96
+ saas._SDF.saas[key] = saasInfo[key] ? saasInfo[key] : saas._SDF.saas[key];
97
+ });
94
98
  return saas;
95
99
  }
96
100
  else {
@@ -41,6 +41,8 @@ const fakeSaas_1 = __importStar(require("./fakeSaas"));
41
41
  const paths_1 = __importDefault(require("../../config/paths"));
42
42
  const webpack_common_1 = require("../../config/webpack.common");
43
43
  const undici_1 = require("undici");
44
+ const fs = __importStar(require("fs-extra"));
45
+ const path = __importStar(require("path"));
44
46
  function parse_SDF(html) {
45
47
  var _a;
46
48
  const REGEX = /(?<=window._SDF=).*?}(?=;)/;
@@ -117,6 +119,15 @@ function insertScript($, debuggerConfig) {
117
119
  }
118
120
  : {})), readThemeConfig()));
119
121
  overrideNotification(saas);
122
+ const saasInfo = fs.readJSONSync(path.join(process.cwd(), 'saas-info.config.json'));
123
+ let $favicon = $('link[rel="icon"]');
124
+ if (!$favicon.length) {
125
+ $('head').prepend('<link rel="icon" />');
126
+ $favicon = $('link[rel="icon"]');
127
+ }
128
+ const favicon = (saasInfo === null || saasInfo === void 0 ? void 0 : saasInfo.favicon) ? saasInfo.favicon : 'https://images.tuyacn.com/rms-static/ae9ba1b0-41d4-11ec-89bb-d7b7de210e4b-1636514225995.png?tyName=favicon.png';
129
+ $favicon
130
+ .attr('href', favicon);
120
131
  // 本地开发态多语言剥离多语言平台,走本地多语言兜底逻辑
121
132
  delete _SDF.saas.saas_locales;
122
133
  $('head').append($('<script>').text(`window._SDF_CONFIG=${JSON.stringify(_SDF_CONFIG)};window._SDF=${JSON.stringify(_SDF)};window.__MAIN_APP_PUBLIC_PATH=${JSON.stringify(__MAIN_APP_PUBLIC_PATH)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "3.0.27-beta.5",
3
+ "version": "3.0.27-beta.6",
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.5",
27
- "@tuya-sat/micro-dev-proxy": "3.0.27-beta.5",
28
- "@tuya-sat/micro-utils": "3.0.27-beta.5",
26
+ "@tuya-sat/micro-dev-loader": "3.0.27-beta.6",
27
+ "@tuya-sat/micro-dev-proxy": "3.0.27-beta.6",
28
+ "@tuya-sat/micro-utils": "3.0.27-beta.6",
29
29
  "@types/kill-port": "^2.0.0",
30
30
  "babel-loader": "8.2.4",
31
31
  "babel-plugin-import": "1.13.3",
@@ -44,6 +44,7 @@
44
44
  "kill-port": "^2.0.1",
45
45
  "less": "4.1.2",
46
46
  "less-loader": "10.2.0",
47
+ "mime": "^3.0.0",
47
48
  "mini-css-extract-plugin": "2.6.0",
48
49
  "open": "8.4.0",
49
50
  "ora": "5.4.1",