Socket
Socket
Sign inDemoInstall

@apify/actor-templates

Package Overview
Dependencies
0
Maintainers
10
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @apify/actor-templates

A manifest of Apify actor templates.


Version published
Weekly downloads
1.1K
decreased by-24.13%
Maintainers
10
Created
Weekly downloads
 

Readme

Source

Apify Actor templates

This repository stores boilerplate templates and code examples for Apify Actor. The template helps you to get started with your Apify project quickly.

How to use the templates

You can start using them right away in Apify command-line interface:

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

It displays an interactive list of templates for you to choose from. See Apify CLI documentation for more details.

To run the template:

cd my-actor
apify run

Example templates

The example templates provide a quick and easy way to get to know Apify actors. Just install the CLI and watch your actor run.

  • Hello world - The smallest actor you will see today, it only takes input and generates output.
  • Puppeteer single page - Load a single web page using Chrome and Puppeteer and extract data from it.
  • Basic crawler - Crawl a list of URLs using raw HTTP requests.

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

Project boilerplate

If you're already familiar with actors, you can use the following templates to bootstrap new projects quickly:

  • Empty project - Template with very little boilerplate code.
  • Cheerio crawler - Standard and up to date template for developing with CheerioCrawler.
  • Puppeteer crawler - Standard and up to date template for developing with PuppeteerCrawler.

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 ./dist/templates directory. The archive is used to to create a boilerplate template in apify CLI or other places in Apify system.

Update and add templates

If you want to change template, you need to update the files and manifest.json and then push to master. 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 choose one of the templates when using the apify create command. The propagation happens after committing a new version of templates into 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.

FAQs

Last updated on 02 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc