@midscene/cli 0.2.1-beta-20240807004458.0 → 0.2.1

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/dist/es/index.js CHANGED
@@ -9,7 +9,7 @@ var require_package = __commonJS({
9
9
  module.exports = {
10
10
  name: "@midscene/cli",
11
11
  description: "Cli for Midscene.js",
12
- version: "0.2.1-beta-20240807004458.0",
12
+ version: "0.2.1",
13
13
  "jsnext:source": "./src/index.ts",
14
14
  main: "./dist/lib/index.js",
15
15
  bin: {
@@ -39,6 +39,7 @@ var require_package = __commonJS({
39
39
  "@modern-js/module-tools": "^2.56.1",
40
40
  "@types/node": "^18.0.0",
41
41
  "@types/yargs": "17.0.32",
42
+ execa: "9.3.0",
42
43
  typescript: "~5.0.4",
43
44
  vitest: "^1.6.0"
44
45
  },
@@ -151,23 +152,30 @@ if (findOnlyItemInArgs(args, "help")) {
151
152
  --help Display this help message
152
153
  --version Display the version
153
154
 
154
- Actions (order matters, can be used multiple times):
155
+ Actions (the order matters, can be used multiple times):
155
156
  --action <action> Perform an action, optional
156
157
  --assert <assert> Perform an assert, optional
157
- --query-output <path> Save the result of the query to a file, optional
158
+ --query-output <path> Save the result of the query to a file, this must be put before --query, optional
158
159
  --query <query> Perform a query, optional
159
160
  --sleep <ms> Sleep for a number of milliseconds, optional
160
161
 
161
162
  Examples:
163
+ # headed mode (i.e. visible browser) to visit bing.com and search for 'weather today'
164
+ midscene --headed --url https://wwww.bing.com --action "type 'weather today' in search box, hit enter" --sleep 3000
162
165
 
163
- # headless mode to visit bing.com and search for 'weather today'
164
- midscene --url https://wwww.bing.com --action "type 'weather today', hit enter"
166
+ # visit github status page and save the status to ./status.json
167
+ midscene --url https://www.githubstatus.com/ \\
168
+ --query-output status.json \\
169
+ --query '{name: string, status: string}[], service status of github page'
165
170
 
166
- # headed mode (i.e. visible browser) to visit bing.com and search for 'weather today'
167
- midscene --headed --url https://wwww.bing.com --action "type 'weather today', hit enter"
171
+ Examples with Chinese Prompts
172
+ # headed 模式(即可见浏览器)访问 baidu.com 并搜索“天气”
173
+ midscene --headed --url https://www.baidu.com --action "在搜索框输入 '天气', 敲回车" --sleep 3000
168
174
 
169
- # visit github status page and save the status to status.json
170
- midscene --url https://www.githubstatus.com/ --query-output status.json --query '{name: string, status: string}[], service status of github page'
175
+ # 访问 Github 状态页面并将状态保存到 ./status.json
176
+ midscene --url https://www.githubstatus.com/ \\
177
+ --query-output status.json \\
178
+ --query '{serviceName: string, status: string}[], github 页面的服务状态,返回服务名称'
171
179
  `);
172
180
  process.exit(0);
173
181
  }
@@ -236,7 +244,7 @@ Promise.resolve(
236
244
  if (actionStarted) {
237
245
  assert(
238
246
  validActionArg,
239
- `You cannot use ${argName} here. Please change the order of the arguments.`
247
+ `You cannot put --${argName} here. Please change the order of the arguments.`
240
248
  );
241
249
  }
242
250
  if (validActionArg) {
package/dist/lib/index.js CHANGED
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  module2.exports = {
32
32
  name: "@midscene/cli",
33
33
  description: "Cli for Midscene.js",
34
- version: "0.2.1-beta-20240807004458.0",
34
+ version: "0.2.1",
35
35
  "jsnext:source": "./src/index.ts",
36
36
  main: "./dist/lib/index.js",
37
37
  bin: {
@@ -61,6 +61,7 @@ var require_package = __commonJS({
61
61
  "@modern-js/module-tools": "^2.56.1",
62
62
  "@types/node": "^18.0.0",
63
63
  "@types/yargs": "17.0.32",
64
+ execa: "9.3.0",
64
65
  typescript: "~5.0.4",
65
66
  vitest: "^1.6.0"
66
67
  },
@@ -173,23 +174,30 @@ if (findOnlyItemInArgs(args, "help")) {
173
174
  --help Display this help message
174
175
  --version Display the version
175
176
 
176
- Actions (order matters, can be used multiple times):
177
+ Actions (the order matters, can be used multiple times):
177
178
  --action <action> Perform an action, optional
178
179
  --assert <assert> Perform an assert, optional
179
- --query-output <path> Save the result of the query to a file, optional
180
+ --query-output <path> Save the result of the query to a file, this must be put before --query, optional
180
181
  --query <query> Perform a query, optional
181
182
  --sleep <ms> Sleep for a number of milliseconds, optional
182
183
 
183
184
  Examples:
185
+ # headed mode (i.e. visible browser) to visit bing.com and search for 'weather today'
186
+ midscene --headed --url https://wwww.bing.com --action "type 'weather today' in search box, hit enter" --sleep 3000
184
187
 
185
- # headless mode to visit bing.com and search for 'weather today'
186
- midscene --url https://wwww.bing.com --action "type 'weather today', hit enter"
188
+ # visit github status page and save the status to ./status.json
189
+ midscene --url https://www.githubstatus.com/ \\
190
+ --query-output status.json \\
191
+ --query '{name: string, status: string}[], service status of github page'
187
192
 
188
- # headed mode (i.e. visible browser) to visit bing.com and search for 'weather today'
189
- midscene --headed --url https://wwww.bing.com --action "type 'weather today', hit enter"
193
+ Examples with Chinese Prompts
194
+ # headed 模式(即可见浏览器)访问 baidu.com 并搜索“天气”
195
+ midscene --headed --url https://www.baidu.com --action "在搜索框输入 '天气', 敲回车" --sleep 3000
190
196
 
191
- # visit github status page and save the status to status.json
192
- midscene --url https://www.githubstatus.com/ --query-output status.json --query '{name: string, status: string}[], service status of github page'
197
+ # 访问 Github 状态页面并将状态保存到 ./status.json
198
+ midscene --url https://www.githubstatus.com/ \\
199
+ --query-output status.json \\
200
+ --query '{serviceName: string, status: string}[], github 页面的服务状态,返回服务名称'
193
201
  `);
194
202
  process.exit(0);
195
203
  }
@@ -258,7 +266,7 @@ Promise.resolve(
258
266
  if (actionStarted) {
259
267
  (0, import_node_assert.default)(
260
268
  validActionArg,
261
- `You cannot use ${argName} here. Please change the order of the arguments.`
269
+ `You cannot put --${argName} here. Please change the order of the arguments.`
262
270
  );
263
271
  }
264
272
  if (validActionArg) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midscene/cli",
3
3
  "description": "Cli for Midscene.js",
4
- "version": "0.2.1-beta-20240807004458.0",
4
+ "version": "0.2.1",
5
5
  "jsnext:source": "./src/index.ts",
6
6
  "main": "./dist/lib/index.js",
7
7
  "bin": {
@@ -15,12 +15,13 @@
15
15
  "ora-classic": "5.4.2",
16
16
  "puppeteer": "^22.8.0",
17
17
  "yargs": "17.7.2",
18
- "@midscene/web": "0.2.1-beta-20240807004458.0"
18
+ "@midscene/web": "0.2.1"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@modern-js/module-tools": "^2.56.1",
22
22
  "@types/node": "^18.0.0",
23
23
  "@types/yargs": "17.0.32",
24
+ "execa": "9.3.0",
24
25
  "typescript": "~5.0.4",
25
26
  "vitest": "^1.6.0"
26
27
  },