From 17fecc67ab3827245eed2f1a163b66717364a3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Sun, 5 Jul 2026 00:51:43 +0200 Subject: [PATCH] fix(ts-empty): drop unused @crawlee/cheerio dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ts-empty template ships `@crawlee/cheerio` in `dependencies` even though the template's `src/main.ts` imports nothing from Crawlee — the sole reference is a commented-out `// import { CheerioCrawler } ...` line. This has a few unwanted side effects for users of the template and for tooling that inspects the generated project: - ~190 packages get installed for a stub Actor that should install just `apify` and its transitive deps. - `apify run` classifies the project as a Crawlee project based on the presence of the dep and applies the default `--purge` behavior, which is surprising for an empty template that has no crawler state to purge. - Code assistants / LLMs reading the manifest see the dep and reach for Crawlee APIs (e.g. `new CheerioCrawler({ router })`), which then fail against the currently installed Crawlee major version and produce confusing errors from an "empty" starter. The parallel `ts-crawlee-cheerio` template already exists as the canonical starting point for users who want a Crawlee-based scraper, so this change simply drops the unused dep from `ts-empty`, cleans up the commented Crawlee/`routes.js` imports in `src/main.ts`, and points the README at `ts-crawlee-cheerio` for the scraping use case. Surfaced during an evaluation of Apify surfaces for agent-driven Actor development. Co-Authored-By: Claude Opus 4.7 --- templates/ts-empty/README.md | 7 ++++--- templates/ts-empty/package.json | 3 +-- templates/ts-empty/src/main.ts | 7 ------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/templates/ts-empty/README.md b/templates/ts-empty/README.md index 69806116e..bff5002f0 100644 --- a/templates/ts-empty/README.md +++ b/templates/ts-empty/README.md @@ -2,16 +2,17 @@ -Start a new [web scraping](https://apify.com/web-scraping) project quickly and easily in TypeScript (Node.js) with our empty project template. It provides a basic structure for the Actor with [Apify SDK](https://docs.apify.com/sdk/js/) and allows you to easily add your own functionality. +Start a new Apify Actor project in TypeScript (Node.js) with only the [Apify SDK](https://docs.apify.com/sdk/js/) preinstalled. Add whatever dependencies and functionality your Actor needs. ## Included features - **[Apify SDK](https://docs.apify.com/sdk/js/)** - a toolkit for building [Actors](https://apify.com/actors) -- **[Crawlee](https://crawlee.dev/)** - web scraping and browser automation library ## How it works -Insert your own code between `await Actor.init()` and `await Actor.exit()`. If you would like to use the [Crawlee](https://crawlee.dev/) library simply uncomment its import `import { CheerioCrawler } from '@crawlee/cheerio';`. +Insert your own code between `await Actor.init()` and `await Actor.exit()`. Install additional dependencies as needed. + +If you want to build a web scraper on top of [Crawlee](https://crawlee.dev/), start from the **Crawlee + Cheerio** template instead — it comes preconfigured with `@crawlee/cheerio` and an example crawler. ## Resources diff --git a/templates/ts-empty/package.json b/templates/ts-empty/package.json index 209367b16..ed71ddc24 100644 --- a/templates/ts-empty/package.json +++ b/templates/ts-empty/package.json @@ -7,8 +7,7 @@ "node": ">=18.0.0" }, "dependencies": { - "apify": "^3.7.0", - "@crawlee/cheerio": "^3.15.3" + "apify": "^3.7.0" }, "devDependencies": { "@apify/eslint-config": "^2.0.0", diff --git a/templates/ts-empty/src/main.ts b/templates/ts-empty/src/main.ts index 9dc3860b7..ae8d30797 100644 --- a/templates/ts-empty/src/main.ts +++ b/templates/ts-empty/src/main.ts @@ -1,12 +1,5 @@ // Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/) import { Actor, log } from 'apify'; -// Crawlee - web scraping and browser automation library (Read more at https://crawlee.dev) -// import { CheerioCrawler } from '@crawlee/cheerio'; - -// this is ESM project, and as such, it requires you to specify extensions in your relative imports -// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions -// note that we need to use `.js` even when inside TS files -// import { router } from './routes.js'; // The init() call configures the Actor to correctly work with the Apify-provided environment - mainly the storage infrastructure. It is necessary that every Actor performs an init() call. await Actor.init();