@apify/actor-templates

中文文档
0.1.5发布于 2024/02/15ISCTypeScriptESM + CJS零依赖近 30 天下载 4.7万

A manifest of Apify actor templates.

原始使用文档
文档目录9 节
  1. How to use the templates
  2. Getting started templates
  3. Project boilerplate
  4. Templates API
  5. Publish updated/new template
  6. Update and add templates
  7. How to propagate templates into Apify CLI
  8. Reference
  9. Contributing

Apify Actor templates

This repository stores boilerplate templates and code examples for Apify Actor. The purpose of these templates is to help devlopers get started with actor development on the Apify platform.

How to use the templates

You can start using the actor templates right away with the Apify CLI:

npx apify-cli create my-crawler

or

npm -g install apify-cli
apify create my-actor

After running the command you will be prompted to select one of the templates from the list displayed in your terminal. The available templates are:

Getting started templates

Basic templates to start developing actors on the Apify platform using Node.js (JavaScript/Typescript), or Python. Just install the CLI and watch your actor run.

You can find more code examples in the Apify SDK documentation.

Project boilerplate

If you're already familiar with Actors, you can use the following templates to bootstrap new projects using an empty project templates or Crawlee templates:

Empty projects

Start a new web scraping project quickly and easily in JavaScript/TypeScript (Node.js) or Python with our empty project template. It provides a basic structure for the Actor with Apify JavaScript SDK or Apify Python SDK and allows you to easily add your own functionality.

Crawlee projects

To run the template:

cd my-actor
apify run

Templates API

The template manifest can be fetched programmatically. Apify CLI uses this to always fetch the most up to date templates.

npm i @apify/actor-templates
const templates = require("@apify/actor-templates");

const manifest = await templates.fetchManifest();

Publish updated/new template

All templates are stores in ./templates directory. For each template needs to create an archive of whole source code into the ./dist/templates directory. The archive is used to create a boilerplate template in apify CLI or other places in the Apify system.

Update and add templates

If you want to change a template, you will have to update the template files and the manifest.json file before pushing the changes to the master branch. After pushing to master, the archive will be automatically built using Github actions.

How to propagate templates into Apify CLI

Templates are propagated to Apify CLI templates. You can then find your newly added template when using the apify create command. The propagation happens after committing a new version of the template into the master branch. After tests succeeded the Github action builds archives of each template and pushes these archives into the repository. The CLI command then uses those archives to bootstrap your project folder. We did it this way because we can update template structure/code without publishing any package to npm. It makes templates changes agile.

Reference

Contributing

If you have any ideas for improvements, either submit an issue or create a pull request. For contribution guidelines and the code of conduct, see CONTRIBUTING.md.

版本与发布记录

@apify/actor-templates 共发布 8 个版本,首次发布于 2020/05/17;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.5latest2024/02/152 年前
0.1.42023/11/102 年前
0.1.32022/05/024 年前
0.1.22022/04/014 年前
0.1.12020/05/176 年前
0.1.02020/05/176 年前

关于 @apify/actor-templates 的常见问题

@apify/actor-templates 是什么?

A manifest of Apify actor templates.

如何安装 @apify/actor-templates?

在项目目录运行 npm install @apify/actor-templates,或使用 pnpm add / yarn add / bun add。

@apify/actor-templates 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@apify/actor-templates 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@apify/actor-templates 可以商用吗?

@apify/actor-templates 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@apify/actor-templates 的下载量有多少?

根据 npm 官方下载统计,@apify/actor-templates 在 2026/10/06 – 2026/11/04 这 30 天内被下载 46,782 次,日均约 1,559 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@apify/actor-templates 还在维护吗?

最新版本 0.1.5 发布于 2024/02/15(2 年前);至今共发布 8 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/05/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。