@tuya-sat/micro-script 0.0.1-beta → 0.0.1-beta.3

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/README.md CHANGED
@@ -1,8 +1,35 @@
1
- # micro-script
1
+ <div id="top"></div>
2
+ <br />
3
+ <div align="center">
4
+ <a href="https://github.com/othneildrew/Best-README-Template">
5
+ <img src="https://images.tuyacn.com/rms-static/da7f7ac0-3e0c-11ec-89bb-d7b7de210e4b-1636098546797.png" alt="Logo" width="80" height="80">
6
+ </a>
2
7
 
3
- ## 💡usage
8
+ <h3 align="center">Saturn - micro-script</h3>
4
9
 
5
- ### dev
10
+ <p align="center">
11
+ 本地开发和打包脚本
12
+ <br/>
13
+ <a href="https://github.com/tuya-sat/discuss">土星项目</a>
14
+ ·
15
+ <a href="https://github.com/tuya-sat/discuss/issues">报告问题</a>
16
+ ·
17
+ <a href="https://github.com/tuya-sat/discuss/issues">提交需求</a>
18
+ </p>
19
+ </div>
20
+
21
+ ## 介绍
22
+ 适用于微应用相关的自定义webpack配置,并集成微应用开发时相关的功能
23
+
24
+ ## 安装
25
+
26
+ ```sh
27
+ yarn add @tuya-sat/micro-script -D
28
+ ```
29
+
30
+ ## 使用
31
+
32
+ ### 本地
6
33
 
7
34
  开箱即用
8
35
  ```bash
@@ -14,8 +41,25 @@ micro-script start
14
41
  micro-script start --proxy
15
42
  ```
16
43
 
17
- ### build
44
+ ### 生产
18
45
 
19
46
  ```bash
20
47
  micro-script
21
48
  ```
49
+
50
+ ## 资源工具
51
+
52
+ * [@tuya-sat/components](https://www.npmjs.com/package/@tuya-sat/components)
53
+ * [@tuya-sat/sdf-cli](https://www.npmjs.com/package/@tuya-sat/sdf-cli)
54
+ * [@tuya-sat/create-micro-app](https://www.npmjs.com/package/@tuya-sat/create-micro-app)
55
+
56
+
57
+ ## License
58
+
59
+ MIT
60
+
61
+
62
+ ## 联系我们
63
+
64
+ 欢迎在 [https://github.com/tuya-sat/discuss/issues](https://github.com/tuya-sat/discuss/issues) 向我们提交反馈
65
+
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
16
16
  const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
17
17
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
18
- const micro_dev_loader_1 = require("@tuya-sat/micro-dev-loader");
19
18
  const paths_1 = __importDefault(require("./paths"));
20
19
  function getCommonConfig({ isDev, isBuild }) {
21
20
  const { name: packageName } = require(paths_1.default.appPkg);
@@ -140,7 +139,6 @@ function getCommonConfig({ isDev, isBuild }) {
140
139
  filename: "static/css/[name].[contenthash:8].css",
141
140
  chunkFilename: "static/css/[name].[contenthash:8].chunk.css",
142
141
  }),
143
- isDev && new micro_dev_loader_1.LayoutMockPlugin(),
144
142
  ].filter(Boolean),
145
143
  };
146
144
  }
@@ -22,6 +22,14 @@ declare const reactTsConfig: ({ isDev, isBuild, currentFramework }: {
22
22
  plugins: string[];
23
23
  };
24
24
  }[];
25
+ exclude?: undefined;
26
+ } | {
27
+ test: RegExp;
28
+ exclude: string;
29
+ use: {
30
+ loader: string;
31
+ }[];
32
+ include?: undefined;
25
33
  } | {
26
34
  test: string;
27
35
  include: string;
@@ -31,6 +39,7 @@ declare const reactTsConfig: ({ isDev, isBuild, currentFramework }: {
31
39
  microFramework: any;
32
40
  };
33
41
  }[];
42
+ exclude?: undefined;
34
43
  })[];
35
44
  };
36
45
  plugins: (ReactRefreshWebpackPlugin | ForkTsCheckerWebpackPlugin)[];
@@ -61,6 +70,14 @@ declare const reactJsConfig: ({ isDev, isBuild, currentFramework }: {
61
70
  plugins: string[];
62
71
  };
63
72
  }[];
73
+ exclude?: undefined;
74
+ } | {
75
+ test: RegExp;
76
+ exclude: string;
77
+ use: {
78
+ loader: string;
79
+ }[];
80
+ include?: undefined;
64
81
  } | {
65
82
  test: string;
66
83
  include: string;
@@ -70,6 +87,7 @@ declare const reactJsConfig: ({ isDev, isBuild, currentFramework }: {
70
87
  microFramework: any;
71
88
  };
72
89
  }[];
90
+ exclude?: undefined;
73
91
  })[];
74
92
  };
75
93
  plugins: (ReactRefreshWebpackPlugin | ForkTsCheckerWebpackPlugin)[];
@@ -40,6 +40,16 @@ const reactConfig = ({ isDev, isBuild, currentFramework, isTs }) => {
40
40
  },
41
41
  ],
42
42
  },
43
+ //处理@tuya-sat/components内的antd组件引用
44
+ {
45
+ test: /node_modules\/@tuya-sat\/components\/(.*?).js$/,
46
+ exclude: paths_1.default.appSrc,
47
+ use: [
48
+ {
49
+ loader: "babel-loader",
50
+ },
51
+ ],
52
+ },
43
53
  isDev && {
44
54
  test: isTs ? paths_1.default.ReactTsEntryFile : paths_1.default.ReactJsEntryFile,
45
55
  include: paths_1.default.appSrc,
@@ -28,6 +28,7 @@ const config = Object.assign(Object.assign({}, (0, webpack_config_1.default)()),
28
28
  level: "warn",
29
29
  }, stats: "errors-warnings" });
30
30
  const compiler = (0, webpack_1.default)(config);
31
+ new micro_dev_loader_1.LayoutMockPlugin().apply(compiler);
31
32
  (() => __awaiter(void 0, void 0, void 0, function* () {
32
33
  let defaultPort = 9000;
33
34
  //检测端口占用情况
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@tuya-sat/micro-script",
3
- "version": "0.0.1-beta",
3
+ "version": "0.0.1-beta.3",
4
4
  "bin": "./dist/bin/cli.js",
5
5
  "type": "commonjs",
6
+ "license": "MIT",
6
7
  "scripts": {
7
8
  "dev": "tsc --watch",
8
9
  "build": "rm -rf dist/ && tsc",
@@ -14,8 +15,8 @@
14
15
  "@babel/preset-react": "^7.14.5",
15
16
  "@babel/preset-typescript": "^7.15.0",
16
17
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
17
- "@tuya-sat/micro-dev-loader": "0.0.1-beta",
18
- "@tuya-sat/micro-dev-proxy": "0.0.1-beta",
18
+ "@tuya-sat/micro-dev-loader": "0.0.1-beta.3",
19
+ "@tuya-sat/micro-dev-proxy": "0.0.1-beta.3",
19
20
  "babel-loader": "^8.2.2",
20
21
  "babel-plugin-import": "^1.13.3",
21
22
  "copy-webpack-plugin": "^9.0.1",