apify-cli 0.19.3 → 0.19.5
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 +18 -18
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/run.js +9 -4
- package/src/lib/exec.js +6 -1
- package/src/lib/utils.js +20 -3
package/README.md
CHANGED
|
@@ -303,7 +303,7 @@ USAGE
|
|
|
303
303
|
$ apify actor
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
-
_See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
306
|
+
_See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/actor/index.js)_
|
|
307
307
|
|
|
308
308
|
## `apify actor:get-input`
|
|
309
309
|
|
|
@@ -314,7 +314,7 @@ USAGE
|
|
|
314
314
|
$ apify actor:get-input
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
-
_See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
317
|
+
_See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/actor/get-input.js)_
|
|
318
318
|
|
|
319
319
|
## `apify actor:get-value KEY`
|
|
320
320
|
|
|
@@ -328,7 +328,7 @@ ARGUMENTS
|
|
|
328
328
|
KEY Key of the record in key-value store
|
|
329
329
|
```
|
|
330
330
|
|
|
331
|
-
_See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
331
|
+
_See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/actor/get-value.js)_
|
|
332
332
|
|
|
333
333
|
## `apify actor:push-data [ITEM]`
|
|
334
334
|
|
|
@@ -349,7 +349,7 @@ DESCRIPTION
|
|
|
349
349
|
$ cat ./test.json | apify actor:push-data
|
|
350
350
|
```
|
|
351
351
|
|
|
352
|
-
_See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
352
|
+
_See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/actor/push-data.js)_
|
|
353
353
|
|
|
354
354
|
## `apify actor:set-value KEY [VALUE]`
|
|
355
355
|
|
|
@@ -379,7 +379,7 @@ DESCRIPTION
|
|
|
379
379
|
$ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
-
_See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
382
|
+
_See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/actor/set-value.js)_
|
|
383
383
|
|
|
384
384
|
## `apify call [ACTID]`
|
|
385
385
|
|
|
@@ -404,7 +404,7 @@ DESCRIPTION
|
|
|
404
404
|
takes input for the Actor from the default local key-value store by default.
|
|
405
405
|
```
|
|
406
406
|
|
|
407
|
-
_See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
407
|
+
_See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/call.js)_
|
|
408
408
|
|
|
409
409
|
## `apify create [ACTORNAME]`
|
|
410
410
|
|
|
@@ -426,7 +426,7 @@ OPTIONS
|
|
|
426
426
|
--skip-dependency-install Skip installing actor dependencies.
|
|
427
427
|
```
|
|
428
428
|
|
|
429
|
-
_See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
429
|
+
_See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/create.js)_
|
|
430
430
|
|
|
431
431
|
## `apify info`
|
|
432
432
|
|
|
@@ -440,7 +440,7 @@ DESCRIPTION
|
|
|
440
440
|
The information is printed to the console.
|
|
441
441
|
```
|
|
442
442
|
|
|
443
|
-
_See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
443
|
+
_See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/info.js)_
|
|
444
444
|
|
|
445
445
|
## `apify init [ACTORNAME]`
|
|
446
446
|
|
|
@@ -464,7 +464,7 @@ DESCRIPTION
|
|
|
464
464
|
WARNING: The directory at "storage" will be overwritten if it already exists.
|
|
465
465
|
```
|
|
466
466
|
|
|
467
|
-
_See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
467
|
+
_See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/init.js)_
|
|
468
468
|
|
|
469
469
|
## `apify login`
|
|
470
470
|
|
|
@@ -482,7 +482,7 @@ DESCRIPTION
|
|
|
482
482
|
"apify" commands. To log out, call "apify logout".
|
|
483
483
|
```
|
|
484
484
|
|
|
485
|
-
_See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
485
|
+
_See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/login.js)_
|
|
486
486
|
|
|
487
487
|
## `apify logout`
|
|
488
488
|
|
|
@@ -497,7 +497,7 @@ DESCRIPTION
|
|
|
497
497
|
call "apify login".
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
_See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
500
|
+
_See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/logout.js)_
|
|
501
501
|
|
|
502
502
|
## `apify pull [ACTORID]`
|
|
503
503
|
|
|
@@ -515,7 +515,7 @@ OPTIONS
|
|
|
515
515
|
-v, --version=version Actor version number which will be pulled, e.g. 1.2. Default: the highest version
|
|
516
516
|
```
|
|
517
517
|
|
|
518
|
-
_See code: [src/commands/pull.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
518
|
+
_See code: [src/commands/pull.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/pull.js)_
|
|
519
519
|
|
|
520
520
|
## `apify push [ACTORID]`
|
|
521
521
|
|
|
@@ -553,7 +553,7 @@ DESCRIPTION
|
|
|
553
553
|
WARNING: If the target Actor already exists in your Apify account, it will be overwritten!
|
|
554
554
|
```
|
|
555
555
|
|
|
556
|
-
_See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
556
|
+
_See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/push.js)_
|
|
557
557
|
|
|
558
558
|
## `apify run`
|
|
559
559
|
|
|
@@ -583,7 +583,7 @@ DESCRIPTION
|
|
|
583
583
|
package.json file. You can set up your own main file or environment variables by changing it.
|
|
584
584
|
```
|
|
585
585
|
|
|
586
|
-
_See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
586
|
+
_See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/run.js)_
|
|
587
587
|
|
|
588
588
|
## `apify secrets`
|
|
589
589
|
|
|
@@ -611,7 +611,7 @@ DESCRIPTION
|
|
|
611
611
|
of the actor.
|
|
612
612
|
```
|
|
613
613
|
|
|
614
|
-
_See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
614
|
+
_See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/secrets/index.js)_
|
|
615
615
|
|
|
616
616
|
## `apify secrets:add NAME VALUE`
|
|
617
617
|
|
|
@@ -629,7 +629,7 @@ DESCRIPTION
|
|
|
629
629
|
The secrets are stored to a file at ~/.apify
|
|
630
630
|
```
|
|
631
631
|
|
|
632
|
-
_See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
632
|
+
_See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/secrets/add.js)_
|
|
633
633
|
|
|
634
634
|
## `apify secrets:rm NAME`
|
|
635
635
|
|
|
@@ -643,7 +643,7 @@ ARGUMENTS
|
|
|
643
643
|
NAME Name of the secret
|
|
644
644
|
```
|
|
645
645
|
|
|
646
|
-
_See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
646
|
+
_See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/secrets/rm.js)_
|
|
647
647
|
|
|
648
648
|
## `apify vis [PATH]`
|
|
649
649
|
|
|
@@ -667,5 +667,5 @@ DESCRIPTION
|
|
|
667
667
|
You can also pass any custom path to your input schema to have it validated instead.
|
|
668
668
|
```
|
|
669
669
|
|
|
670
|
-
_See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.19.
|
|
670
|
+
_See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.19.5/src/commands/vis.js)_
|
|
671
671
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.19.3","commands":{"call":{"id":"call","description":"Runs a specific actor remotely on the Apify cloud platform.\nThe Actor is run under your current Apify account. Therefore you need to be logged in by calling \"apify login\". It takes input for the Actor from the default local key-value store by default.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"build":{"name":"build","type":"option","char":"b","description":"Tag or number of the build to run (e.g. \"latest\" or \"1.2.34\").","required":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout for the actor run in seconds. Zero value means there is no timeout.","required":false},"memory":{"name":"memory","type":"option","char":"m","description":"Amount of memory allocated for the actor run, in megabytes.","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to run to finish, if no value passed, it waits forever.","required":false}},"args":[{"name":"actId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command runs the remote actor specified in the \".actor/actor.json\" file.","required":false}]},"check-version":{"id":"check-version","description":"Checks that installed Apify CLI version is up to date.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["cv"],"flags":{"enforce-update":{"name":"enforce-update","type":"boolean","char":"e","description":"[Optional] Enforce version update from NPM","required":false,"allowNo":false}},"args":[]},"create":{"id":"create","description":"Creates a new actor project directory from a selected boilerplate template.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"template":{"name":"template","type":"option","char":"t","description":"Template for the actor. If not provided, the command will prompt for it.\nVisit https://raw.githubusercontent.com/apify/actor-templates/master/templates/manifest.json to find available template names.","required":false},"skip-dependency-install":{"name":"skip-dependency-install","type":"boolean","description":"Skip installing actor dependencies.","required":false,"allowNo":false},"template-archive-url":{"name":"template-archive-url","type":"option","description":"Actor template archive url. Useful for developing new templates.","hidden":true,"required":false}},"args":[{"name":"actorName","description":"Name of the actor and its directory","required":false}]},"edit-input-schema":{"id":"edit-input-schema","description":"Lets you edit your input schema that would be used on the platform in a visual input schema editor.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["eis"],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided default platform location for input schema is used.","required":false}]},"info":{"id":"info","description":"Displays information about the currently active Apify account.\nThe information is printed to the console.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"init-wrap-scrapy":{"id":"init-wrap-scrapy","description":"Wraps your existing Scrapy project to work like an Apify Actor.\n\nIt adds the following features:\n- Automatic retry of failed requests\n- Automatic proxy rotation\n- Automatic user agent rotation\n...\n","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[{"name":"path","description":"Optional path to your scrapy project. If not provided, the current directory is used.","required":false}]},"init":{"id":"init","description":"Initializes a new actor project in an existing directory.\nThe command only creates the \".actor/actor.json\" file and the \"storage\" directory in the current directory, but will not touch anything else.\n\nWARNING: The directory at \"storage\" will be overwritten if it already exists.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Automatic yes to prompts; assume \"yes\" as answer to all prompts. Note that in some cases, the command may still ask for confirmation.","required":false,"allowNo":false}},"args":[{"name":"actorName","description":"Name of the actor. If not provided, you will be prompted for it.","required":false}]},"login-new":{"id":"login-new","description":"Logs in to your Apify account using your API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"login":{"id":"login","description":"Logs in to your Apify account using a provided API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"logout":{"id":"logout","description":"Logs out of your Apify account.\nThe command deletes the API token and all other account information stored in the ~/.apify directory. To log in again, call \"apify login\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"pull":{"id":"pull","description":"Pulls an Actor from the Apify platform to the current directory. If it is defined as Git repository, it will be cloned. If it is defined as Web IDE, it will fetch the files.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version":{"name":"version","type":"option","char":"v","description":"Actor version number which will be pulled, e.g. 1.2. Default: the highest version","required":false}},"args":[{"name":"actorId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will update the Actor in the current directory based on its name in \".actor/actor.json\" file.","required":false}]},"push":{"id":"push","description":"Uploads the actor to the Apify platform and builds it there.\nThe Actor settings are read from the \".actor/actor.json\" file in the current directory, but they can be overridden using command-line options.\nNOTE: If the source files are smaller than 3 MB then they are uploaded as \n\"Multiple source files\", otherwise they are uploaded as \"Zip file\".\n\nWARNING: If the target Actor already exists in your Apify account, it will be overwritten!","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version-number":{"name":"version-number","type":"option","description":"DEPRECATED: Use flag version instead. Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"version":{"name":"version","type":"option","char":"v","description":"Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"build-tag":{"name":"build-tag","type":"option","char":"b","description":"Build tag to be applied to the successful Actor build. By default, it is taken from the \".actor/actor.json\" file","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to build to finish, if no value passed, it waits forever.","required":false},"no-prompt":{"name":"no-prompt","type":"boolean","description":"Do not prompt for opening the actor details in a browser. This will also not open the browser automatically.","required":false,"allowNo":false}},"args":[{"name":"actorId","description":"Name or ID of the Actor to push (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will create or modify the actor with the name specified in \".actor/actor.json\" file.","required":false}]},"run":{"id":"run","description":"Runs the actor locally in the current directory.\nIt sets various APIFY_XYZ environment variables in order to provide a working execution environment for the actor. For example, this causes the actor input, as well as all other data in key-value stores, datasets or request queues to be stored in the \"storage\" directory, rather than on the Apify platform.\n\nNOTE: You can override the command's default behavior for Node.js actors by overriding the \"start\" script in the package.json file. You can set up your own main file or environment variables by changing it.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"purge":{"name":"purge","type":"boolean","char":"p","description":"Shortcut that combines the --purge-queue, --purge-dataset and --purge-key-value-store options.","required":false,"allowNo":false},"purge-queue":{"name":"purge-queue","type":"boolean","description":"Deletes the local directory containing the default request queue before the run starts.","required":false,"allowNo":false},"purge-dataset":{"name":"purge-dataset","type":"boolean","description":"Deletes the local directory containing the default dataset before the run starts.","required":false,"allowNo":false},"purge-key-value-store":{"name":"purge-key-value-store","type":"boolean","description":"Deletes all records from the default key-value store in the local directory before the run starts, except for the \"INPUT\" key.","required":false,"allowNo":false}},"args":[]},"vis":{"id":"vis","description":"Validates input schema and prints errors found.\nThe input schema for the actor is used from these locations in order of preference.\nThe first one found is validated as it would be the one used on the Apify platform.\n1. Directly embedded object in \".actor/actor.json\" under 'input' key\n2. Path to JSON file referenced in \".actor/actor.json\" under 'input' key\n3. JSON file at .actor/INPUT_SCHEMA.json\n4. JSON file at INPUT_SCHEMA.json\n\nYou can also pass any custom path to your input schema to have it validated instead.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used.","required":false}]},"actor:get-input":{"id":"actor:get-input","description":"Gets the actor input value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:get-value":{"id":"actor:get-value","description":"Gets a value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"key","description":"Key of the record in key-value store","required":true}]},"actor":{"id":"actor","description":"Commands are designed to be used in actor runs. All commands are in PoC state, do not use in production environments.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:push-data":{"id":"actor:push-data","description":"Stores an object or an array of objects to the default dataset of the actor run.\nIt is possible to pass data using item argument or stdin.\nPassing data using argument:\n$ apify actor:push-data {\"foo\": \"bar\"}\nPassing data using stdin with pipe:\n$ cat ./test.json | apify actor:push-data\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"item","description":"JSON string with one object or array of objects containing data to be stored in the default dataset.","required":false}]},"actor:set-value":{"id":"actor:set-value","description":"Sets or removes record into the default KeyValueStore associated with the actor run.\nIt is possible to pass data using argument or stdin.\nPassing data using argument:\n$ apify actor:set-value KEY my-value\nPassing data using stdin with pipe:\n$ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"contentType":{"name":"contentType","type":"option","char":"c","description":"Specifies a custom MIME content type of the record. By default \"application/json\" is used.","required":false}},"args":[{"name":"key","description":"Key of the record in key-value store.","required":true},{"name":"value","description":"Record data, which can be one of the following values:\n- If empty, the record in the key-value store is deleted.\n- If no `contentType` flag is specified, value is expected to be any JSON string value.\n- If options.contentType is set, value is taken as is.","required":false}]},"secrets:add":{"id":"secrets:add","description":"Adds a new secret value.\nThe secrets are stored to a file at ~/.apify","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true},{"name":"value","description":"Value of the secret","required":true}]},"secrets":{"id":"secrets","description":"Manages secret values for actor environment variables.\n\nExample:\n$ apify secrets:add mySecret TopSecretValue123\n\nNow the \"mySecret\" value can be used in an environment variable defined in \".actor/actor.json\" file by adding the \"@\" prefix:\n\n{\n \"actorSpecification\": 1,\n \"name\": \"my_actor\",\n \"environmentVariables\": { \"SECRET_ENV_VAR\": \"@mySecret\" },\n \"version\": \"0.1\n}\n\nWhen the actor is pushed to Apify cloud, the \"SECRET_ENV_VAR\" and its value is stored as a secret environment variable of the actor.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"secrets:rm":{"id":"secrets:rm","description":"Removes the secret.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true}]}}}
|
|
1
|
+
{"version":"0.19.5","commands":{"call":{"id":"call","description":"Runs a specific actor remotely on the Apify cloud platform.\nThe Actor is run under your current Apify account. Therefore you need to be logged in by calling \"apify login\". It takes input for the Actor from the default local key-value store by default.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"build":{"name":"build","type":"option","char":"b","description":"Tag or number of the build to run (e.g. \"latest\" or \"1.2.34\").","required":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout for the actor run in seconds. Zero value means there is no timeout.","required":false},"memory":{"name":"memory","type":"option","char":"m","description":"Amount of memory allocated for the actor run, in megabytes.","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to run to finish, if no value passed, it waits forever.","required":false}},"args":[{"name":"actId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command runs the remote actor specified in the \".actor/actor.json\" file.","required":false}]},"check-version":{"id":"check-version","description":"Checks that installed Apify CLI version is up to date.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["cv"],"flags":{"enforce-update":{"name":"enforce-update","type":"boolean","char":"e","description":"[Optional] Enforce version update from NPM","required":false,"allowNo":false}},"args":[]},"create":{"id":"create","description":"Creates a new actor project directory from a selected boilerplate template.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"template":{"name":"template","type":"option","char":"t","description":"Template for the actor. If not provided, the command will prompt for it.\nVisit https://raw.githubusercontent.com/apify/actor-templates/master/templates/manifest.json to find available template names.","required":false},"skip-dependency-install":{"name":"skip-dependency-install","type":"boolean","description":"Skip installing actor dependencies.","required":false,"allowNo":false},"template-archive-url":{"name":"template-archive-url","type":"option","description":"Actor template archive url. Useful for developing new templates.","hidden":true,"required":false}},"args":[{"name":"actorName","description":"Name of the actor and its directory","required":false}]},"edit-input-schema":{"id":"edit-input-schema","description":"Lets you edit your input schema that would be used on the platform in a visual input schema editor.","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":["eis"],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided default platform location for input schema is used.","required":false}]},"info":{"id":"info","description":"Displays information about the currently active Apify account.\nThe information is printed to the console.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"init-wrap-scrapy":{"id":"init-wrap-scrapy","description":"Wraps your existing Scrapy project to work like an Apify Actor.\n\nIt adds the following features:\n- Automatic retry of failed requests\n- Automatic proxy rotation\n- Automatic user agent rotation\n...\n","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[{"name":"path","description":"Optional path to your scrapy project. If not provided, the current directory is used.","required":false}]},"init":{"id":"init","description":"Initializes a new actor project in an existing directory.\nThe command only creates the \".actor/actor.json\" file and the \"storage\" directory in the current directory, but will not touch anything else.\n\nWARNING: The directory at \"storage\" will be overwritten if it already exists.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Automatic yes to prompts; assume \"yes\" as answer to all prompts. Note that in some cases, the command may still ask for confirmation.","required":false,"allowNo":false}},"args":[{"name":"actorName","description":"Name of the actor. If not provided, you will be prompted for it.","required":false}]},"login-new":{"id":"login-new","description":"Logs in to your Apify account using your API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","hidden":true,"aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"login":{"id":"login","description":"Logs in to your Apify account using a provided API token.\nThe API token and other account information is stored in the ~/.apify directory, from where it is read by all other \"apify\" commands. To log out, call \"apify logout\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"[Optional] Apify API token","required":false}},"args":[]},"logout":{"id":"logout","description":"Logs out of your Apify account.\nThe command deletes the API token and all other account information stored in the ~/.apify directory. To log in again, call \"apify login\".","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"pull":{"id":"pull","description":"Pulls an Actor from the Apify platform to the current directory. If it is defined as Git repository, it will be cloned. If it is defined as Web IDE, it will fetch the files.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version":{"name":"version","type":"option","char":"v","description":"Actor version number which will be pulled, e.g. 1.2. Default: the highest version","required":false}},"args":[{"name":"actorId","description":"Name or ID of the actor to run (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will update the Actor in the current directory based on its name in \".actor/actor.json\" file.","required":false}]},"push":{"id":"push","description":"Uploads the actor to the Apify platform and builds it there.\nThe Actor settings are read from the \".actor/actor.json\" file in the current directory, but they can be overridden using command-line options.\nNOTE: If the source files are smaller than 3 MB then they are uploaded as \n\"Multiple source files\", otherwise they are uploaded as \"Zip file\".\n\nWARNING: If the target Actor already exists in your Apify account, it will be overwritten!","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"version-number":{"name":"version-number","type":"option","description":"DEPRECATED: Use flag version instead. Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"version":{"name":"version","type":"option","char":"v","description":"Actor version number to which the files should be pushed. By default, it is taken from the \".actor/actor.json\" file.","required":false},"build-tag":{"name":"build-tag","type":"option","char":"b","description":"Build tag to be applied to the successful Actor build. By default, it is taken from the \".actor/actor.json\" file","required":false},"wait-for-finish":{"name":"wait-for-finish","type":"option","char":"w","description":"Seconds for waiting to build to finish, if no value passed, it waits forever.","required":false},"no-prompt":{"name":"no-prompt","type":"boolean","description":"Do not prompt for opening the actor details in a browser. This will also not open the browser automatically.","required":false,"allowNo":false}},"args":[{"name":"actorId","description":"Name or ID of the Actor to push (e.g. \"apify/hello-world\" or \"E2jjCZBezvAZnX8Rb\"). If not provided, the command will create or modify the actor with the name specified in \".actor/actor.json\" file.","required":false}]},"run":{"id":"run","description":"Runs the actor locally in the current directory.\nIt sets various APIFY_XYZ environment variables in order to provide a working execution environment for the actor. For example, this causes the actor input, as well as all other data in key-value stores, datasets or request queues to be stored in the \"storage\" directory, rather than on the Apify platform.\n\nNOTE: You can override the command's default behavior for Node.js actors by overriding the \"start\" script in the package.json file. You can set up your own main file or environment variables by changing it.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"purge":{"name":"purge","type":"boolean","char":"p","description":"Shortcut that combines the --purge-queue, --purge-dataset and --purge-key-value-store options.","required":false,"allowNo":false},"purge-queue":{"name":"purge-queue","type":"boolean","description":"Deletes the local directory containing the default request queue before the run starts.","required":false,"allowNo":false},"purge-dataset":{"name":"purge-dataset","type":"boolean","description":"Deletes the local directory containing the default dataset before the run starts.","required":false,"allowNo":false},"purge-key-value-store":{"name":"purge-key-value-store","type":"boolean","description":"Deletes all records from the default key-value store in the local directory before the run starts, except for the \"INPUT\" key.","required":false,"allowNo":false}},"args":[]},"vis":{"id":"vis","description":"Validates input schema and prints errors found.\nThe input schema for the actor is used from these locations in order of preference.\nThe first one found is validated as it would be the one used on the Apify platform.\n1. Directly embedded object in \".actor/actor.json\" under 'input' key\n2. Path to JSON file referenced in \".actor/actor.json\" under 'input' key\n3. JSON file at .actor/INPUT_SCHEMA.json\n4. JSON file at INPUT_SCHEMA.json\n\nYou can also pass any custom path to your input schema to have it validated instead.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"Optional path to your INPUT_SCHEMA.json file. If not provided ./INPUT_SCHEMA.json is used.","required":false}]},"actor:get-input":{"id":"actor:get-input","description":"Gets the actor input value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:get-value":{"id":"actor:get-value","description":"Gets a value from the default key-value store associated with the actor run.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"key","description":"Key of the record in key-value store","required":true}]},"actor":{"id":"actor","description":"Commands are designed to be used in actor runs. All commands are in PoC state, do not use in production environments.\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"actor:push-data":{"id":"actor:push-data","description":"Stores an object or an array of objects to the default dataset of the actor run.\nIt is possible to pass data using item argument or stdin.\nPassing data using argument:\n$ apify actor:push-data {\"foo\": \"bar\"}\nPassing data using stdin with pipe:\n$ cat ./test.json | apify actor:push-data\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"item","description":"JSON string with one object or array of objects containing data to be stored in the default dataset.","required":false}]},"actor:set-value":{"id":"actor:set-value","description":"Sets or removes record into the default KeyValueStore associated with the actor run.\nIt is possible to pass data using argument or stdin.\nPassing data using argument:\n$ apify actor:set-value KEY my-value\nPassing data using stdin with pipe:\n$ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain\n","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{"contentType":{"name":"contentType","type":"option","char":"c","description":"Specifies a custom MIME content type of the record. By default \"application/json\" is used.","required":false}},"args":[{"name":"key","description":"Key of the record in key-value store.","required":true},{"name":"value","description":"Record data, which can be one of the following values:\n- If empty, the record in the key-value store is deleted.\n- If no `contentType` flag is specified, value is expected to be any JSON string value.\n- If options.contentType is set, value is taken as is.","required":false}]},"secrets:add":{"id":"secrets:add","description":"Adds a new secret value.\nThe secrets are stored to a file at ~/.apify","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true},{"name":"value","description":"Value of the secret","required":true}]},"secrets":{"id":"secrets","description":"Manages secret values for actor environment variables.\n\nExample:\n$ apify secrets:add mySecret TopSecretValue123\n\nNow the \"mySecret\" value can be used in an environment variable defined in \".actor/actor.json\" file by adding the \"@\" prefix:\n\n{\n \"actorSpecification\": 1,\n \"name\": \"my_actor\",\n \"environmentVariables\": { \"SECRET_ENV_VAR\": \"@mySecret\" },\n \"version\": \"0.1\n}\n\nWhen the actor is pushed to Apify cloud, the \"SECRET_ENV_VAR\" and its value is stored as a secret environment variable of the actor.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"secrets:rm":{"id":"secrets:rm","description":"Removes the secret.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"Name of the secret","required":true}]}}}
|
package/package.json
CHANGED
package/src/commands/run.js
CHANGED
|
@@ -35,6 +35,7 @@ class RunCommand extends ApifyCommand {
|
|
|
35
35
|
const packageJsonExists = fs.existsSync(packageJsonPath);
|
|
36
36
|
const mainPyExists = fs.existsSync(mainPyPath);
|
|
37
37
|
const isScrapyProject = projectType === PROJECT_TYPES.SCRAPY;
|
|
38
|
+
const { language, languageVersion } = detectLocalActorLanguage();
|
|
38
39
|
|
|
39
40
|
if (!packageJsonExists && !mainPyExists && !isScrapyProject) {
|
|
40
41
|
throw new Error(
|
|
@@ -64,20 +65,25 @@ class RunCommand extends ApifyCommand {
|
|
|
64
65
|
CRAWLEE_PURGE_ON_START = '1';
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
|
|
69
|
+
if (language === LANGUAGE.PYTHON) {
|
|
70
|
+
await Promise.all([purgeDefaultQueue(), purgeDefaultKeyValueStore(), purgeDefaultDataset()]);
|
|
71
|
+
info('All default local stores were purged.');
|
|
72
|
+
}
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
// TODO: deprecate these flags
|
|
70
|
-
if (flags.purgeQueue) {
|
|
76
|
+
if (flags.purgeQueue && !flags.purge) {
|
|
71
77
|
await purgeDefaultQueue();
|
|
72
78
|
info('Default local request queue was purged.');
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
if (flags.purgeDataset) {
|
|
81
|
+
if (flags.purgeDataset && !flags.purge) {
|
|
76
82
|
await purgeDefaultDataset();
|
|
77
83
|
info('Default local dataset was purged.');
|
|
78
84
|
}
|
|
79
85
|
|
|
80
|
-
if (flags.purgeKeyValueStore) {
|
|
86
|
+
if (flags.purgeKeyValueStore && !flags.purge) {
|
|
81
87
|
await purgeDefaultKeyValueStore();
|
|
82
88
|
info('Default local key-value store was purged.');
|
|
83
89
|
}
|
|
@@ -110,7 +116,6 @@ class RunCommand extends ApifyCommand {
|
|
|
110
116
|
warning('You are not logged in with your Apify Account. Some features like Apify Proxy will not work. Call "apify login" to fix that.');
|
|
111
117
|
}
|
|
112
118
|
|
|
113
|
-
const { language, languageVersion } = detectLocalActorLanguage();
|
|
114
119
|
if (language === LANGUAGE.NODEJS) { // Actor is written in Node.js
|
|
115
120
|
const currentNodeVersion = languageVersion;
|
|
116
121
|
const minimumSupportedNodeVersion = semver.minVersion(SUPPORTED_NODEJS_VERSION);
|
package/src/lib/exec.js
CHANGED
|
@@ -2,12 +2,17 @@ const { spawn } = require('child_process');
|
|
|
2
2
|
|
|
3
3
|
const outputs = require('./outputs');
|
|
4
4
|
|
|
5
|
+
const windowsOptions = {
|
|
6
|
+
shell: true,
|
|
7
|
+
windowsHide: true,
|
|
8
|
+
};
|
|
9
|
+
|
|
5
10
|
/**
|
|
6
11
|
* Run child process and returns stdout and stderr to user stout
|
|
7
12
|
*/
|
|
8
13
|
const spawnPromised = (cmd, args, opts) => {
|
|
9
14
|
// NOTE: Pipes stderr, stdout to main process
|
|
10
|
-
Object.assign(opts, { stdio: 'inherit' });
|
|
15
|
+
Object.assign(opts, { ...windowsOptions, stdio: 'inherit' });
|
|
11
16
|
|
|
12
17
|
const childProcess = spawn(cmd, args, opts);
|
|
13
18
|
|
package/src/lib/utils.js
CHANGED
|
@@ -557,6 +557,11 @@ const sanitizeActorName = (actorName) => {
|
|
|
557
557
|
return sanitizedName.slice(0, ACTOR_NAME.MAX_LENGTH);
|
|
558
558
|
};
|
|
559
559
|
|
|
560
|
+
const windowsOptions = {
|
|
561
|
+
shell: true,
|
|
562
|
+
windowsHide: true,
|
|
563
|
+
};
|
|
564
|
+
|
|
560
565
|
const getPythonCommand = (directory) => {
|
|
561
566
|
const pythonVenvPath = /^win/.test(process.platform)
|
|
562
567
|
? 'Scripts/python.exe'
|
|
@@ -581,7 +586,11 @@ const getPythonCommand = (directory) => {
|
|
|
581
586
|
const detectPythonVersion = (directory) => {
|
|
582
587
|
const pythonCommand = getPythonCommand(directory);
|
|
583
588
|
try {
|
|
584
|
-
const spawnResult = spawnSync(pythonCommand, ['-c', 'import platform; print(platform.python_version())'], {
|
|
589
|
+
const spawnResult = spawnSync(pythonCommand, ['-c', '"import platform; print(platform.python_version())"'], {
|
|
590
|
+
...windowsOptions,
|
|
591
|
+
encoding: 'utf-8',
|
|
592
|
+
});
|
|
593
|
+
|
|
585
594
|
if (!spawnResult.error && spawnResult.stdout) {
|
|
586
595
|
return spawnResult.stdout.trim();
|
|
587
596
|
}
|
|
@@ -596,7 +605,11 @@ const isPythonVersionSupported = (installedPythonVersion) => {
|
|
|
596
605
|
|
|
597
606
|
const detectNodeVersion = () => {
|
|
598
607
|
try {
|
|
599
|
-
const spawnResult = spawnSync('node', ['--version'], {
|
|
608
|
+
const spawnResult = spawnSync('node', ['--version'], {
|
|
609
|
+
...windowsOptions,
|
|
610
|
+
encoding: 'utf-8',
|
|
611
|
+
});
|
|
612
|
+
|
|
600
613
|
if (!spawnResult.error && spawnResult.stdout) {
|
|
601
614
|
return spawnResult.stdout.trim().replace(/^v/, '');
|
|
602
615
|
}
|
|
@@ -615,7 +628,11 @@ const isNodeVersionSupported = (installedNodeVersion) => {
|
|
|
615
628
|
const detectNpmVersion = () => {
|
|
616
629
|
const npmCommand = getNpmCmd();
|
|
617
630
|
try {
|
|
618
|
-
const spawnResult = spawnSync(npmCommand, ['--version'], {
|
|
631
|
+
const spawnResult = spawnSync(npmCommand, ['--version'], {
|
|
632
|
+
...windowsOptions,
|
|
633
|
+
encoding: 'utf-8',
|
|
634
|
+
});
|
|
635
|
+
|
|
619
636
|
if (!spawnResult.error && spawnResult.stdout) {
|
|
620
637
|
return spawnResult.stdout.trim().replace(/^v/, '');
|
|
621
638
|
}
|