@crawlee/cli 4.0.0-beta.341 → 4.0.0-beta.343
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.
|
@@ -115,10 +115,13 @@ export class UpgradeCommand {
|
|
|
115
115
|
}
|
|
116
116
|
if (!migrations.size)
|
|
117
117
|
throw new Error('No migration guides are bundled with this CLI.');
|
|
118
|
-
const from = args.from ?? (await detectProjectMajor());
|
|
119
118
|
const to = args.to ?? Math.max(...migrations.keys());
|
|
119
|
+
let from = args.from ?? (await detectProjectMajor());
|
|
120
|
+
// Bumping the dependencies is usually the first migration step, so the code may still be on the previous major.
|
|
121
|
+
if (args.from === undefined && from === to)
|
|
122
|
+
from = to - 1;
|
|
120
123
|
if (from >= to) {
|
|
121
|
-
throw new Error(`
|
|
124
|
+
throw new Error(`Cannot upgrade from v${from} to v${to}; the target must be newer.`);
|
|
122
125
|
}
|
|
123
126
|
const steps = [];
|
|
124
127
|
const guides = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/cli",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.343",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.13.0"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@crawlee/templates": "4.0.0-beta.
|
|
48
|
+
"@crawlee/templates": "4.0.0-beta.343",
|
|
49
49
|
"@inquirer/prompts": "^8.8.1",
|
|
50
50
|
"ansi-colors": "^4.1.3",
|
|
51
51
|
"semver": "^7.8.5",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "becebadb6e1605a4950ba325fb71d09f80607d3e"
|
|
63
63
|
}
|
|
@@ -5,7 +5,7 @@ description: Plan and perform a Crawlee upgrade using the bundled migration guid
|
|
|
5
5
|
|
|
6
6
|
# Crawlee upgrade plan: v{FROM_MAJOR} to v{TO_MAJOR}
|
|
7
7
|
|
|
8
|
-
Inspect this project and confirm its Crawlee versions before changing files. The guides below link local files; if they are unreadable from here, run `
|
|
8
|
+
Inspect this project and confirm its Crawlee versions before changing files. The guides below link local files; if they are unreadable from here, run the same `crawlee upgrade` command again with `--export <dir>` pointing to a readable directory and use the prompt it prints instead. The CLI selected v{FROM_MAJOR} as the starting major from the project or an explicit `--from` override. Dependencies that are already on v{TO_MAJOR} do not show whether the code was migrated, so the CLI then assumes it was not. If that does not match the code and dependencies, resolve the discrepancy with the user.
|
|
9
9
|
|
|
10
10
|
## Migration sequence
|
|
11
11
|
|
|
@@ -15,21 +15,23 @@ This page summarizes the breaking changes in Crawlee v4. There are many, so the
|
|
|
15
15
|
|
|
16
16
|
## Upgrade with an AI coding tool
|
|
17
17
|
|
|
18
|
-
The v4 CLI prints a migration prompt for an AI coding tool. Run
|
|
18
|
+
The v4 CLI prints a migration prompt for an AI coding tool. Run the latest CLI (a pinned `crawlee@4` works too) from the directory of the project you are migrating, then paste the output into a tool that can read your project:
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
|
-
npx crawlee@
|
|
21
|
+
npx crawlee@latest upgrade
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
The command works both before and after you bump the Crawlee dependencies. Once they are on v4, the project's own CLI has the command too, so `npx crawlee upgrade` is enough.
|
|
25
|
+
|
|
24
26
|
The prompt only contains instructions. They ask the tool to inspect the project, plan, migrate and verify, and to ask once before creating a Git branch and making incremental commits.
|
|
25
27
|
|
|
26
28
|
Adjust the command to your situation:
|
|
27
29
|
|
|
28
|
-
- **Your tool can only read files inside the project.** The prompt links guides in the npx cache. Run `npx crawlee@
|
|
30
|
+
- **Your tool can only read files inside the project.** The prompt links guides in the npx cache. Run `npx crawlee@latest upgrade --export <dir>` to copy them into a directory of your choice and have the prompt link that copy.
|
|
29
31
|
- **The project is a package in a workspace.** Run the command from that package's directory, not the workspace root.
|
|
30
|
-
- **The command cannot tell which major you are on.** It reads the Crawlee runtime dependencies from the nearest `package.json`, preferring installed versions that match the declared ranges. When that is ambiguous, name the starting major: `npx crawlee@
|
|
31
|
-
- **The
|
|
32
|
-
- **A bare `crawlee upgrade` says the command does not exist.** A v3 project runs its local v3 CLI, which has no `upgrade`.
|
|
32
|
+
- **The command cannot tell which major you are on.** It reads the Crawlee runtime dependencies from the nearest `package.json`, preferring installed versions that match the declared ranges. When that is ambiguous, name the starting major: `npx crawlee@latest upgrade --from 3`.
|
|
33
|
+
- **The dependencies are already on v4.** The command cannot tell whether the code was migrated too, so it prints the v3 to v4 prompt anyway and the tool addresses whatever is left.
|
|
34
|
+
- **A bare `npx crawlee upgrade` says the command does not exist.** A v3 project runs its local v3 CLI, which has no `upgrade`. Ask for the latest one: `npx crawlee@latest upgrade`.
|
|
33
35
|
|
|
34
36
|
`--to` defaults to the newest bundled migration, and only v3 to v4 is bundled for now. As guides for later majors are added, the command completes and verifies each major before starting the next, and rejects a path with a missing guide rather than skipping a major.
|
|
35
37
|
|
|
@@ -80,6 +82,8 @@ The purely mechanical renames, collected in one place. Where a row links to a se
|
|
|
80
82
|
| `statistics.state.requestsFinished` (and the other `*Finished*` counters) | `requestsSucceeded` ([details](#finished-request-counters-are-renamed-to-succeeded)) |
|
|
81
83
|
| `statistics.startJob()` / `finishJob()` / `failJob()` | `recordRequestStart()` / `recordRequestSuccess()` / `recordRequestFailure()` ([details](./statistics.md#the-request-recording-methods-are-renamed)) |
|
|
82
84
|
| `browserPoolOptions` | `browserPool` + a `*BrowserPool()` factory ([details](#browserpooloptions-is-removed)) |
|
|
85
|
+
| `AdaptivePlaywrightCrawler` options `launchContext` / `headless` / `browserPool` / `remoteBrowser` / `ignoreIframes` | `browserOptions: { ... }` |
|
|
86
|
+
| `AdaptivePlaywrightCrawler` option `additionalMimeTypes` | `httpOptions: { additionalMimeTypes }` |
|
|
83
87
|
| `gotScraping` (from `@crawlee/utils`) | `GotScrapingHttpClient` (`@crawlee/got-scraping-client`) |
|
|
84
88
|
| Internal KVS keys (`SDK_*` and others) | `CRAWLEE_*` keys ([details](#internal-kvs-keys-renamed)) |
|
|
85
89
|
| `ArgumentError` (from `ow`) | `ArgumentValidationError` ([details](#argument-validation-errors-use-zod)) |
|