@tadpolehq/cli 0.1.2 → 0.2.0
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/CHANGELOG.md +57 -0
- package/dist/main.mjs +9 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @tadpolehq/cli
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dc40db7: - Add: filter action (evaluators to filter out specific elements)
|
|
8
|
+
- Add: while action (loop while evaluators return true)
|
|
9
|
+
- Add: maybe action (action that's allowed to fail)
|
|
10
|
+
- Add: as_bool evaluator (casting values to boolean)
|
|
11
|
+
- Add: as_float evaluator (casting strings to floats)
|
|
12
|
+
- Add: as_int evaluator (casting strings to integers)
|
|
13
|
+
- Add: child evaluator (loads a child element at the provided index)
|
|
14
|
+
- Add: wait_until supports life cycle events like networkIdle and networkAlmostIdle
|
|
15
|
+
- Add: log action
|
|
16
|
+
- Add: format expression function
|
|
17
|
+
- Improve: consistent logging across actions
|
|
18
|
+
- Fix: struct errors wrong length check
|
|
19
|
+
- df9baf4: - Add: apply_identity action (overrides user agent and SEC-CH headers with a recent release)
|
|
20
|
+
- Add: set_hardware_concurrency action (overrides the device CPU count)
|
|
21
|
+
- Add: set_device_memory action (overrides the device memory)
|
|
22
|
+
- Add: set_viewport (overrides the user viewport/screen settings)
|
|
23
|
+
- Add: set_webgl_vendor action (overrides the webgl vendor/renderer)
|
|
24
|
+
- Add: screenshot action (takes a screenshot and writes it to a file)
|
|
25
|
+
- Add: random action (randomly executes one of the child actions)
|
|
26
|
+
- Add: --proxy-server cli option
|
|
27
|
+
- Change: use --headless=new and --disable-blink-features=AutomationControlled to further avoid detection
|
|
28
|
+
- 84f3520: - Add: and evaluator (logical and)
|
|
29
|
+
- Add: default evaluator (provides default static value)
|
|
30
|
+
- Add: deq evaluator (dynamic eq operator)
|
|
31
|
+
- Add: dne evaluator (dynamic ne operator)
|
|
32
|
+
- Add: eq evaluator (static eq operator)
|
|
33
|
+
- Add: extract evaluator (regex extract capture groups)
|
|
34
|
+
- Add: matches evaluator (test if input matches regex pattern)
|
|
35
|
+
- Add: ne evaluator (static ne operator)
|
|
36
|
+
- Add: not evaluator (logical not operator)
|
|
37
|
+
- Add: or evaluator (logical or)
|
|
38
|
+
- Add: prop evaluator (access object property)
|
|
39
|
+
- Add: replace evaluator (replaces one or all of the matched pattern with another string)
|
|
40
|
+
- Add: root evaluator (allows access to original input passed to sequence of evaluators)
|
|
41
|
+
- Add: node and struct builders now have extend
|
|
42
|
+
- Add: common regex type to schema
|
|
43
|
+
- Fix: All evaluators do a null check to prevent runtime errors
|
|
44
|
+
- Updated dependencies [dc40db7]
|
|
45
|
+
- Updated dependencies [df9baf4]
|
|
46
|
+
- Updated dependencies [84f3520]
|
|
47
|
+
- @tadpolehq/core@0.2.0
|
|
48
|
+
|
|
49
|
+
## 0.1.3
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 9e09047: - Fix for_each: Used wrong value for remoteObjectId, ensure object isn't a primitive
|
|
54
|
+
- Fix withPrefix: Do not append an extra `.`
|
|
55
|
+
- Add stepPrecision to natural mouse Scroll
|
|
56
|
+
- Fix hover: dom.getBoxModel returns a relative position, not absolute
|
|
57
|
+
- Updated dependencies [9e09047]
|
|
58
|
+
- @tadpolehq/core@0.1.3
|
|
59
|
+
|
|
3
60
|
## 0.1.2
|
|
4
61
|
|
|
5
62
|
### Patch Changes
|
package/dist/main.mjs
CHANGED
|
@@ -73,16 +73,19 @@ async function findChrome() {
|
|
|
73
73
|
for (const path of paths) if (await fileExistsAsync(path)) return path;
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
async function launchChrome(port, headless, userDataDir, fallBackChromePath, windowHeight, windowWidth) {
|
|
76
|
+
async function launchChrome(port, headless, userDataDir, fallBackChromePath, windowHeight, windowWidth, proxyServer) {
|
|
77
77
|
const chromePath = await findChrome() ?? fallBackChromePath;
|
|
78
78
|
if (chromePath === null) throw new Error("Chrome not found. Install Chrome or run manually if path is not standard.");
|
|
79
79
|
if (!fileExistsAsync(userDataDir)) await mkdir(userDataDir, { recursive: true });
|
|
80
80
|
const args = [
|
|
81
81
|
`--remote-debugging-port=${port}`,
|
|
82
82
|
`--user-data-dir=${userDataDir}`,
|
|
83
|
-
`--window-size=${windowWidth},${windowHeight}
|
|
83
|
+
`--window-size=${windowWidth},${windowHeight}`,
|
|
84
|
+
"--disable-blink-features=AutomationControlled",
|
|
85
|
+
"--use-gl=angle"
|
|
84
86
|
];
|
|
85
|
-
if (headless) args.push("--headless");
|
|
87
|
+
if (headless) args.push("--headless=new", "--use-angle=swiftshader", "--enable-unsafe-swiftshader");
|
|
88
|
+
if (proxyServer) args.push(`--proxy-server=${proxyServer}`, "--use-angle=default");
|
|
86
89
|
const child = await spawnAsync(chromePath, args, { detached: true }, (child) => {
|
|
87
90
|
return new Promise((resolve, reject) => {
|
|
88
91
|
const timeout = setTimeout(() => reject(/* @__PURE__ */ new Error("Chrome timeout")), 15e3);
|
|
@@ -102,10 +105,10 @@ const log = createLogger({
|
|
|
102
105
|
transports: [new transports.Console()]
|
|
103
106
|
});
|
|
104
107
|
program.name("tadpole");
|
|
105
|
-
program.command("run <file>").option("--input <value>", "JSON string of input values").option("--output <value>", "Path to write output to").option("--host", "Chrome remote debugging host", "localhost").option("--port <value>", "Chrome remote debugging port", parseInt, 9222).option("--auto", "Whether or not to try to launch Chrome automatically").option("--headless", "If --auto is used, whether or not to start Chrome in headless mode").option("--user-data-dir", "If --auto is used, the custom user-data-dir to use when starting Chrome.", path$1.join(process.cwd(), ".tadpole", "profile")).option("--log-level <value>", "Sets the log level, must be one of 'debug', 'info', 'warn' and 'error'", "warn").option("--chrome-bin <value>", "The full path to the Chrome executable, used as a fallback when used with --auto").option("--window-height <value>", "If --auto is used, the height of the browser window", parseInt, 1080).option("--window-width <value>", "If --auto is used, the width of the browser window", parseInt, 1920).action(async (filePath, options) => {
|
|
108
|
+
program.command("run <file>").option("--input <value>", "JSON string of input values").option("--output <value>", "Path to write output to").option("--host", "Chrome remote debugging host", "localhost").option("--port <value>", "Chrome remote debugging port", parseInt, 9222).option("--auto", "Whether or not to try to launch Chrome automatically").option("--headless", "If --auto is used, whether or not to start Chrome in headless mode").option("--user-data-dir", "If --auto is used, the custom user-data-dir to use when starting Chrome.", path$1.join(process.cwd(), ".tadpole", "profile")).option("--log-level <value>", "Sets the log level, must be one of 'debug', 'info', 'warn' and 'error'", "warn").option("--chrome-bin <value>", "The full path to the Chrome executable, used as a fallback when used with --auto").option("--window-height <value>", "If --auto is used, the height of the browser window", parseInt, 1080).option("--window-width <value>", "If --auto is used, the width of the browser window", parseInt, 1920).option("--proxy-server <value>", "If --auto is used, the proxy server to use when starting chrome").action(async (filePath, options) => {
|
|
106
109
|
log.level = options.logLevel;
|
|
107
110
|
let chrome;
|
|
108
|
-
if (options.auto) chrome = await launchChrome(options.port, options.headless, options.userDataDir, options.chromeBin ?? null, options.windowHeight, options.windowWidth);
|
|
111
|
+
if (options.auto) chrome = await launchChrome(options.port, options.headless, options.userDataDir, options.chromeBin ?? null, options.windowHeight, options.windowWidth, options.proxyServer);
|
|
109
112
|
let input = {};
|
|
110
113
|
if (options.input) input = JSON.parse(options.input);
|
|
111
114
|
const result = await execute(filePath);
|
|
@@ -122,7 +125,7 @@ program.command("run <file>").option("--input <value>", "JSON string of input va
|
|
|
122
125
|
}, 2);
|
|
123
126
|
if (options.output) await writeFile(options.output, serialized);
|
|
124
127
|
else console.log(serialized);
|
|
125
|
-
} else log.error(`Error parsing definition: ${JSON.stringify(result.error.
|
|
128
|
+
} else log.error(`Error parsing definition: ${JSON.stringify(result.error.flatten(), void 0, 2)}`);
|
|
126
129
|
if (chrome) chrome.kill();
|
|
127
130
|
});
|
|
128
131
|
await program.parseAsync(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tadpolehq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Command line interface for managing Tadpole projects",
|
|
5
5
|
"homepage": "https://tadpolehq.com",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"tadpole": "./dist/main.mjs"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@tadpolehq/core": "0.
|
|
25
|
+
"@tadpolehq/core": "0.2.0",
|
|
26
26
|
"commander": "^14.0.2",
|
|
27
27
|
"winston": "^3.19.0"
|
|
28
28
|
},
|