@tuya-sat/micro-script 2.2.18 → 2.2.19

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.
@@ -43,7 +43,7 @@ function getCommonConfig({ isDev, isBuild, }) {
43
43
  const devMicroTheme = validateMicroTheme();
44
44
  const enableThemeCompile = isDev
45
45
  ? !!devMicroTheme
46
- : annotations["sdf.feat:theme"];
46
+ : annotations["sdf.feat:colorTheme"];
47
47
  //获取style处理的loader
48
48
  const getStyleLoaders = (extraLoader = []) => {
49
49
  extraLoader = toArray(extraLoader);
@@ -112,7 +112,7 @@ function getCommonConfig({ isDev, isBuild, }) {
112
112
  ? enableThemeCompile
113
113
  ? (0, index_1.getLessOptions)(devMicroTheme)
114
114
  : {}
115
- : annotations["sdf.feat:theme"]
115
+ : annotations["sdf.feat:colorTheme"]
116
116
  ? (0, index_1.getLessOptions)(index_1.LIGHT_THEME)
117
117
  : {})), { javascriptEnabled: true }),
118
118
  },
@@ -38,16 +38,23 @@ function getFakeSaas(config) {
38
38
  process.exit(1);
39
39
  }
40
40
  if (!fs_extra_1.default.existsSync(paths_1.default.saasCache)) {
41
- const { data } = yield axios_1.default.get(config.target);
41
+ const { data } = yield axios_1.default.get(new URL("/login", config.target).href);
42
42
  const _SDF_CONFIG = parse_SDF_CONFIG(data);
43
43
  const _SDF = parse_SDF(data);
44
44
  const __MAIN_APP_PUBLIC_PATH = parse__MAIN_APP_PUBLIC_PATH(data);
45
45
  const saas = {
46
46
  _SDF_CONFIG: JSON.parse(_SDF_CONFIG),
47
- _SDF: JSON.parse(_SDF),
47
+ _SDF: Object.assign(Object.assign({}, JSON.parse(_SDF)), { user: {
48
+ user_name: config.username || "admin@tuya.com",
49
+ roles: [
50
+ {
51
+ role_code: "FAKE_ROLE_CODE",
52
+ role_name: "FAKE_ROLE_NAME",
53
+ },
54
+ ],
55
+ } }),
48
56
  __MAIN_APP_PUBLIC_PATH: JSON.parse(__MAIN_APP_PUBLIC_PATH),
49
57
  };
50
- console.log(saas);
51
58
  fs_extra_1.default.writeJSONSync(paths_1.default.saasCache, saas);
52
59
  return saas;
53
60
  }
@@ -16,7 +16,7 @@ const cheerio_1 = __importDefault(require("cheerio"));
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  const fakeSaas_1 = __importDefault(require("./fakeSaas"));
18
18
  const paths_1 = __importDefault(require("../../config/paths"));
19
- const defaultBase = "https://static1.tuyacn.com/static/sdf-gw/v1.0.1.293/";
19
+ const defaultBase = "https://static1.tuyacn.com/static/sdf-gw/v1.0.1.352/";
20
20
  function staticMain(app, debuggerConfig) {
21
21
  app.get([
22
22
  "/",
@@ -30,20 +30,11 @@ function staticMain(app, debuggerConfig) {
30
30
  const { data } = yield axios_1.default.get(new URL("index.html", base).href);
31
31
  const $ = cheerio_1.default.load(data);
32
32
  modifySrcAttr($, base);
33
- insertLocalStorage($);
34
33
  yield insertScript($, debuggerConfig);
35
34
  res.send($.html());
36
35
  }));
37
36
  }
38
37
  exports.default = staticMain;
39
- function insertLocalStorage($) {
40
- //可能有坑
41
- $("head").append($("<script>").text(`
42
- window.localStorage.setItem('isLogin','Yes');
43
- window.localStorage.setItem('_USERNAME','fake_user');
44
- window.localStorage.setItem('_ROLE','普通');
45
- `));
46
- }
47
38
  function initalCustom_configs(saas) {
48
39
  const config = {
49
40
  config_group: "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "2.2.18",
3
+ "version": "2.2.19",
4
4
  "bin": "./dist/bin/cli.js",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  "@babel/preset-react": "7.16.7",
21
21
  "@babel/preset-typescript": "7.16.7",
22
22
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
23
- "@tuya-sat/micro-dev-loader": "2.2.18",
24
- "@tuya-sat/micro-dev-proxy": "2.2.18",
25
- "@tuya-sat/micro-utils": "2.2.18",
23
+ "@tuya-sat/micro-dev-loader": "2.2.19",
24
+ "@tuya-sat/micro-dev-proxy": "2.2.19",
25
+ "@tuya-sat/micro-utils": "2.2.19",
26
26
  "babel-loader": "8.2.4",
27
27
  "babel-plugin-import": "1.13.3",
28
28
  "chalk": "4.1.2",