apify-cli 1.4.2-beta.0 → 1.4.2-beta.2

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/README.md CHANGED
@@ -1,283 +1,129 @@
1
- # Apify command-line interface (Apify CLI)
1
+ # Apify CLI
2
2
 
3
3
  [![NPM version](https://badge.fury.io/js/apify-cli.svg)](https://www.npmjs.com/package/apify-cli)
4
4
  [![GitHub workflow](https://github.com/apify/apify-cli/actions/workflows/check.yaml/badge.svg)](https://github.com/apify/apify-cli/actions/workflows/check.yaml)
5
5
 
6
- Apify command-line interface (Apify CLI) helps you create, develop, build and run
7
- [Apify Actors](https://www.apify.com/actors),
8
- and manage the Apify cloud platform from any computer.
6
+ Apify CLI is the command-line tool for creating, developing, and deploying [Apify Actors](https://www.apify.com/actors), and for managing the Apify cloud platform from your terminal.
9
7
 
10
- Apify Actors are cloud programs that can perform arbitrary web scraping, automation or data processing job.
11
- They accept input, perform their job and generate output.
12
- While you can develop Actors in an online IDE directly in the [Apify web application](https://console.apify.com/),
13
- for complex projects it is more convenient to develop Actors locally on your computer
14
- using <a href="https://github.com/apify/apify-sdk-js">Apify SDK</a>
15
- and only push the Actors to the Apify cloud during deployment.
16
- This is where the Apify CLI comes in.
8
+ ## Features
17
9
 
18
- Note that Actors running on the Apify platform are executed in Docker containers, so with an appropriate `Dockerfile`
19
- you can build your Actors in any programming language.
20
- However, we recommend using JavaScript / Node.js, for which we provide most libraries and support.
10
+ - Create, develop, and deploy Apify Actors from your terminal
11
+ - Run Actors locally for development and testing, or in the Apify cloud
12
+ - Manage Actors, datasets, key-value stores, and request queues
13
+ - Manage secret environment variables used by your Actors
14
+ - Works with any programming language — Actors run as Docker containers on the platform
21
15
 
22
- ## Installation
23
-
24
- ### Via bundles
25
-
26
- #### MacOS / Unix
27
-
28
- ```bash
29
- curl -fsSL https://apify.com/install-cli.sh | bash
30
- ```
31
-
32
- #### Windows
33
-
34
- ```powershell
35
- irm https://apify.com/install-cli.ps1 | iex
36
- ```
37
-
38
- ### Via Homebrew
16
+ ## Quick start
39
17
 
40
- On macOS (or Linux), you can install the Apify CLI via the [Homebrew package manager](https://brew.sh).
41
-
42
- ```bash
43
- brew install apify-cli
44
- ```
18
+ 1. **Install the CLI** (macOS / Linux):
45
19
 
46
- ### Via NPM
20
+ ```bash
21
+ curl -fsSL https://apify.com/install-cli.sh | bash
22
+ ```
47
23
 
48
- First, make sure you have [Node.js](https://nodejs.org) version 22 or higher with NPM installed on your computer:
24
+ For Windows and other installation options, see [Installation](#installation).
49
25
 
50
- ```bash
51
- node --version
52
- npm --version
53
- ```
26
+ 2. **Log in** with your [Apify API token](https://console.apify.com/settings/integrations):
54
27
 
55
- Install or upgrade Apify CLI by running:
28
+ ```bash
29
+ apify login
30
+ ```
56
31
 
57
- ```bash
58
- npm install -g apify-cli
59
- ```
60
-
61
- Alternatively, you can use [fnm (Fast Node Manager)](https://github.com/Schniz/fnm) and install Apify CLI only into a selected user-level Node version without requiring root privileges:
62
-
63
- ```bash
64
- fnm install 22
65
- fnm use 22
66
- npm install -g apify-cli
67
- ```
68
-
69
- Finally, verify that Apify CLI was installed correctly by running:
70
-
71
- ```bash
72
- apify --version
73
- ```
74
-
75
- > You can also skip the manual global installation altogether and use `npx apify-cli` with all the following commands instead.
76
-
77
- ## Basic usage
78
-
79
- The following examples demonstrate the basic usage of Apify CLI.
80
-
81
- ### Create a new Actor from scratch
82
-
83
- ```bash
84
- apify create my-hello-world
85
- ```
32
+ 3. **Create, run, and deploy** your first Actor:
86
33
 
87
- First, you will be prompted to select a template with the boilerplate for the Actor, to help you get started quickly.
88
- The command will create a directory called `my-hello-world` that contains a Node.js project
89
- for the Actor and a few configuration files.
34
+ ```bash
35
+ apify create # it will walk you through an interactive wizard
36
+ cd my-actor
37
+ apify run
38
+ apify push
39
+ ```
90
40
 
91
- > If you decided to skip the installation and go with `npx`, the command will be `npx apify-cli create my-hello-world`.
92
-
93
- ### Create a new Actor from existing project
94
-
95
- ```bash
96
- cd ./my/awesome/project
97
- apify init
98
- ```
99
-
100
- This command will only set up local Actor development environment in an existing directory,
101
- i.e. it will create the `.actor/actor.json` file and `apify_storage` directory.
102
-
103
- Before you can run your project locally using `apify run`, you have to set up the right start command in `package.json` under scripts.start. For example:
104
-
105
- ```text
106
- {
107
- ...
108
- "scripts": {
109
- "start": "node your_main_file.js",
110
- },
111
- ...
112
- }
113
- ```
114
-
115
- You can find more information about by running `apify help run`.
116
-
117
- ### Create a new Actor from Scrapy project
118
-
119
- If you want to run a Scrapy project on Apify platform, follow the [Scrapy integration guide](https://docs.apify.com/cli/docs/integrating-scrapy).
41
+ ## Installation
120
42
 
121
- ### Run the Actor locally
43
+ ### macOS / Linux (bundle, recommended)
122
44
 
123
45
  ```bash
124
- cd my-hello-world
125
- apify run
46
+ curl -fsSL https://apify.com/install-cli.sh | bash
126
47
  ```
127
48
 
128
- This command runs the Actor on your local machine.
129
- Now's your chance to develop the logic - or magic :smirk:
130
-
131
- ### Login with your Apify account
49
+ ### macOS / Linux (Homebrew)
132
50
 
133
51
  ```bash
134
- apify login
52
+ brew install apify-cli
135
53
  ```
136
54
 
137
- Before you can interact with the Apify cloud, you need to [create an Apify account](https://console.apify.com/)
138
- and log in to it using the above command. You will be prompted for
139
- your [Apify API token](https://console.apify.com/settings/integrations).
140
- Note that the command will store the API token and other sensitive information to `~/.apify`.
55
+ ### Windows
141
56
 
142
- ### Push the Actor to the Apify cloud
143
-
144
- ```bash
145
- apify push
57
+ ```powershell
58
+ irm https://apify.com/install-cli.ps1 | iex
146
59
  ```
147
60
 
148
- This command uploads your project to the Apify cloud and builds an Actor from it. On the platform, Actor needs to be built before it can be run.
61
+ ### npm (cross-platform)
149
62
 
150
- ### Run an Actor on the Apify cloud
63
+ Requires [Node.js](https://nodejs.org) 22 or higher:
151
64
 
152
65
  ```bash
153
- apify call
66
+ npm install -g apify-cli
154
67
  ```
155
68
 
156
- Runs the Actor corresponding to the current directory on the Apify platform.
69
+ You can also run the CLI without a global install via `npx apify-cli <command>`.
157
70
 
158
- This command can also be used to run other Actors, for example:
71
+ Verify the installation:
159
72
 
160
73
  ```bash
161
- apify call apify/hello-world
162
- ```
163
-
164
- ### So what's in this .actor/actor.json file?
165
-
166
- This file associates your local development project with an Actor on the Apify platform.
167
- It contains information such as Actor name, version, build tag and environment variables.
168
- Make sure you commit this file to the Git repository.
169
-
170
- For example, `.actor/actor.json` file can look as follows:
171
-
172
- ```json
173
- {
174
- "actorSpecification": 1,
175
- "name": "name-of-my-scraper",
176
- "version": "0.0",
177
- "buildTag": "latest",
178
- "environmentVariables": {
179
- "MYSQL_USER": "my_username",
180
- "MYSQL_PASSWORD": "@mySecretPassword"
181
- },
182
- "dockerfile": "./Dockerfile",
183
- "readme": "./ACTOR.md",
184
- "input": "./input_schema.json",
185
- "storages": {
186
- "dataset": "./dataset_schema.json"
187
- }
188
- }
74
+ apify --version
189
75
  ```
190
76
 
191
- **`Dockerfile` field**\
192
- If you specify the path to your Docker file under the `dockerfile` field, this file will be used for Actor builds on the platform. If not specified, the system will look for Docker files at `.actor/Dockerfile` and `Dockerfile` in this order of preference.
193
-
194
- **`Readme` field** \
195
- If you specify the path to your readme file under the `readme` field, the readme at this path will be used on the platform. If not specified, readme at `.actor/README.md` and `README.md` will be used in this order of preference.
77
+ ## Commands
196
78
 
197
- **`Input` field**\
198
- You can embed your [input schema](https://docs.apify.com/actors/development/input-schema#specification-version-1) object directly in `actor.json` under `input` field. Alternatively, you can provide a path to a custom input schema. If not provided, the input schema at `.actor/INPUT_SCHEMA.json` and `INPUT_SCHEMA.json` is used in this order of preference.
79
+ The table below lists the most common commands. For the full reference, see the [command reference](https://docs.apify.com/cli/docs/reference).
199
80
 
200
- **`Storages.dataset` field**\
201
- You can define the schema of the items in your dataset under the `storages.dataset` field. This can be either an embedded object or a path to a JSON schema file. You can read more about the schema of your Actor output [here](https://docs.apify.com/actors/development/output-schema#specification-version-1).
81
+ | Command | Description |
82
+ | --------------- | --------------------------------------------------------- |
83
+ | `apify create` | Create a new Actor project from a template |
84
+ | `apify init` | Initialize an existing project as an Actor |
85
+ | `apify run` | Run the Actor locally |
86
+ | `apify login` | Authenticate with the Apify platform |
87
+ | `apify logout` | Log out of the Apify platform |
88
+ | `apify push` | Deploy the Actor to the Apify cloud |
89
+ | `apify pull` | Pull an Actor from the cloud to your local machine |
90
+ | `apify call` | Run the Actor on the Apify cloud |
91
+ | `apify builds` | Manage Actor builds (`create`, `info`, `ls`, `log`, `rm`) |
92
+ | `apify secrets` | Manage secret environment variables |
93
+ | `apify help` | Show help for any command |
202
94
 
203
- **Note on migration from deprecated config "apify.json"**\
204
- _Note that previously, Actor config was stored in the `apify.json` file that has been deprecated. You can find the (very slight) differences and migration info in [migration guidelines](https://github.com/apify/apify-cli/blob/master/MIGRATIONS.md)._
95
+ Actor configuration lives in `.actor/actor.json`. See the [Actor configuration docs](https://docs.apify.com/platform/actors/development/actor-definition/actor-json) for the full schema (name, version, build tag, environment variables, Dockerfile, input schema, storages).
205
96
 
206
- ## Environment variables
97
+ ## Documentation
207
98
 
208
- There are two options how you can set up environment variables for Actors.
99
+ - [Apify CLI documentation](https://docs.apify.com/cli)
100
+ - [Command reference](https://docs.apify.com/cli/docs/reference)
101
+ - [Actor development guide](https://docs.apify.com/platform/actors/development)
102
+ - [Apify platform documentation](https://docs.apify.com/platform)
209
103
 
210
- ### Set up environment variables in .actor/actor.json
104
+ ## Telemetry
211
105
 
212
- All keys from `env` will be set as environment variables into Apify platform after you push Actor to Apify. Current values on Apify will be overridden.
106
+ Apify CLI collects anonymous usage data to help us improve the tool and the Apify platform. See [Telemetry](https://docs.apify.com/cli/docs/telemetry) for details on what is collected.
213
107
 
214
- ```json
215
- {
216
- "actorSpecification": 1,
217
- "name": "dataset-to-mysql",
218
- "version": "0.1",
219
- "buildTag": "latest",
220
- "environmentVariables": {
221
- "MYSQL_USER": "my_username",
222
- "MYSQL_PASSWORD": "@mySecretPassword"
223
- }
224
- }
225
- ```
226
-
227
- ### Set up environment variables in Apify Console
228
-
229
- In [Apify Console](https://console.apify.com/actors) select your Actor, you can set up variables into Source tab.
230
- After setting up variables in the app, remove the `environmentVariables` from `.actor/actor.json`. Otherwise, variables from `.actor/actor.json` will override variables in the app.
231
-
232
- ```json
233
- {
234
- "actorSpecification": 1,
235
- "name": "dataset-to-mysql",
236
- "version": "0.1",
237
- "buildTag": "latest"
238
- }
239
- ```
240
-
241
- #### How to set secret environment variables in .actor/actor.json
242
-
243
- CLI provides commands to manage secrets environment variables. Secrets are stored to the `~/.apify` directory.
244
- You can add a new secret using the command:
108
+ To opt out, either run:
245
109
 
246
110
  ```bash
247
- apify secrets:add mySecretPassword pwd1234
111
+ apify telemetry disable
248
112
  ```
249
113
 
250
- After adding a new secret you can use the secret in `.actor/actor.json`.
251
-
252
- ```text
253
- {
254
- "actorSpecification": 1,
255
- "name": "dataset-to-mysql",
256
- ...
257
- "environmentVariables": {
258
- "MYSQL_PASSWORD": "@mySecretPassword"
259
- },
260
- ...
261
- }
262
- ```
114
+ or set the `APIFY_CLI_DISABLE_TELEMETRY=1` environment variable.
263
115
 
264
- ### Need help?
116
+ ## Contributing
265
117
 
266
- To see all CLI commands simply run:
118
+ Contributions are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for local setup, code style, test categories, and PR guidelines.
267
119
 
268
- ```bash
269
- apify help
270
- ```
271
-
272
- To get information about a specific command run:
273
-
274
- ```bash
275
- apify help COMMAND
276
- ```
120
+ ## Feedback & support
277
121
 
278
- Still haven't found what you were looking for? Please go to [Apify Help center](https://www.apify.com/help)
279
- or [contact us](https://www.apify.com/contact).
122
+ - Report bugs or request features via [GitHub Issues](https://github.com/apify/apify-cli/issues)
123
+ - Browse the [Apify Help Center](https://www.apify.com/help)
124
+ - [Contact Apify support](https://www.apify.com/contact)
125
+ - Join the community on [Discord](https://discord.gg/crawlee-apify-801163717915574323)
280
126
 
281
- ## Command reference
127
+ ## License
282
128
 
283
- See a list of all our commands on the [reference page](https://docs.apify.com/cli/docs/reference)
129
+ [Apache-2.0](./LICENSE.md)