apify-cli 0.19.1 → 0.19.2-beta.1

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
@@ -109,6 +109,10 @@ Before you can run your project locally using `apify run`, you have to set up th
109
109
  ```
110
110
  You can find more information about by running `apify help run`.
111
111
 
112
+ ### Create a new Actor from Scrapy project
113
+
114
+ If you want to run a Scrapy project on Apify platform, follow the Scrapy integration guide [here](https://docs.apify.com/cli/docs/integrating-scrapy).
115
+
112
116
  ### Run the actor locally
113
117
 
114
118
  ```bash
@@ -299,7 +303,7 @@ USAGE
299
303
  $ apify actor
300
304
  ```
301
305
 
302
- _See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/actor/index.js)_
306
+ _See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/actor/index.js)_
303
307
 
304
308
  ## `apify actor:get-input`
305
309
 
@@ -310,7 +314,7 @@ USAGE
310
314
  $ apify actor:get-input
311
315
  ```
312
316
 
313
- _See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/actor/get-input.js)_
317
+ _See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/actor/get-input.js)_
314
318
 
315
319
  ## `apify actor:get-value KEY`
316
320
 
@@ -324,7 +328,7 @@ ARGUMENTS
324
328
  KEY Key of the record in key-value store
325
329
  ```
326
330
 
327
- _See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/actor/get-value.js)_
331
+ _See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/actor/get-value.js)_
328
332
 
329
333
  ## `apify actor:push-data [ITEM]`
330
334
 
@@ -345,7 +349,7 @@ DESCRIPTION
345
349
  $ cat ./test.json | apify actor:push-data
346
350
  ```
347
351
 
348
- _See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/actor/push-data.js)_
352
+ _See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/actor/push-data.js)_
349
353
 
350
354
  ## `apify actor:set-value KEY [VALUE]`
351
355
 
@@ -375,7 +379,7 @@ DESCRIPTION
375
379
  $ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain
376
380
  ```
377
381
 
378
- _See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/actor/set-value.js)_
382
+ _See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/actor/set-value.js)_
379
383
 
380
384
  ## `apify call [ACTID]`
381
385
 
@@ -400,7 +404,7 @@ DESCRIPTION
400
404
  takes input for the Actor from the default local key-value store by default.
401
405
  ```
402
406
 
403
- _See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/call.js)_
407
+ _See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/call.js)_
404
408
 
405
409
  ## `apify create [ACTORNAME]`
406
410
 
@@ -422,7 +426,7 @@ OPTIONS
422
426
  --skip-dependency-install Skip installing actor dependencies.
423
427
  ```
424
428
 
425
- _See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/create.js)_
429
+ _See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/create.js)_
426
430
 
427
431
  ## `apify info`
428
432
 
@@ -436,7 +440,7 @@ DESCRIPTION
436
440
  The information is printed to the console.
437
441
  ```
438
442
 
439
- _See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/info.js)_
443
+ _See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/info.js)_
440
444
 
441
445
  ## `apify init [ACTORNAME]`
442
446
 
@@ -460,7 +464,7 @@ DESCRIPTION
460
464
  WARNING: The directory at "storage" will be overwritten if it already exists.
461
465
  ```
462
466
 
463
- _See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/init.js)_
467
+ _See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/init.js)_
464
468
 
465
469
  ## `apify login`
466
470
 
@@ -478,7 +482,7 @@ DESCRIPTION
478
482
  "apify" commands. To log out, call "apify logout".
479
483
  ```
480
484
 
481
- _See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/login.js)_
485
+ _See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/login.js)_
482
486
 
483
487
  ## `apify logout`
484
488
 
@@ -493,7 +497,7 @@ DESCRIPTION
493
497
  call "apify login".
494
498
  ```
495
499
 
496
- _See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/logout.js)_
500
+ _See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/logout.js)_
497
501
 
498
502
  ## `apify pull [ACTORID]`
499
503
 
@@ -511,7 +515,7 @@ OPTIONS
511
515
  -v, --version=version Actor version number which will be pulled, e.g. 1.2. Default: the highest version
512
516
  ```
513
517
 
514
- _See code: [src/commands/pull.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/pull.js)_
518
+ _See code: [src/commands/pull.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/pull.js)_
515
519
 
516
520
  ## `apify push [ACTORID]`
517
521
 
@@ -549,7 +553,7 @@ DESCRIPTION
549
553
  WARNING: If the target Actor already exists in your Apify account, it will be overwritten!
550
554
  ```
551
555
 
552
- _See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/push.js)_
556
+ _See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/push.js)_
553
557
 
554
558
  ## `apify run`
555
559
 
@@ -579,7 +583,7 @@ DESCRIPTION
579
583
  package.json file. You can set up your own main file or environment variables by changing it.
580
584
  ```
581
585
 
582
- _See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/run.js)_
586
+ _See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/run.js)_
583
587
 
584
588
  ## `apify secrets`
585
589
 
@@ -607,7 +611,7 @@ DESCRIPTION
607
611
  of the actor.
608
612
  ```
609
613
 
610
- _See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/secrets/index.js)_
614
+ _See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/secrets/index.js)_
611
615
 
612
616
  ## `apify secrets:add NAME VALUE`
613
617
 
@@ -625,7 +629,7 @@ DESCRIPTION
625
629
  The secrets are stored to a file at ~/.apify
626
630
  ```
627
631
 
628
- _See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/secrets/add.js)_
632
+ _See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/secrets/add.js)_
629
633
 
630
634
  ## `apify secrets:rm NAME`
631
635
 
@@ -639,7 +643,7 @@ ARGUMENTS
639
643
  NAME Name of the secret
640
644
  ```
641
645
 
642
- _See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/secrets/rm.js)_
646
+ _See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/secrets/rm.js)_
643
647
 
644
648
  ## `apify vis [PATH]`
645
649
 
@@ -663,5 +667,5 @@ DESCRIPTION
663
667
  You can also pass any custom path to your input schema to have it validated instead.
664
668
  ```
665
669
 
666
- _See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.19.1/src/commands/vis.js)_
670
+ _See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.19.2/src/commands/vis.js)_
667
671
  <!-- commandsstop -->
@@ -1 +1 @@
1
- {"version":"0.19.1","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.2","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
@@ -1,117 +1,114 @@
1
1
  {
2
- "name": "apify-cli",
3
- "version": "0.19.1",
4
- "description": "Apify command-line interface helps you create, develop, build and run Apify actors, and manage the Apify cloud platform.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "cross-env APIFY_CLI_SKIP_UPDATE_CHECK=1 mocha --timeout 180000 --recursive",
8
- "test-python": "npm run test -- --grep '\\[python\\]'",
9
- "lint": "eslint src test",
10
- "lint:fix": "eslint src test --fix",
11
- "commands-md": "npm run manifest && oclif-dev readme",
12
- "prepare-release": "npm run commands-md && npm run prod-shrinkwrap",
13
- "prod-shrinkwrap": "rm -rf node_modules && npm install --production && npm shrinkwrap",
14
- "manifest": "rm -f oclif.manifest.json && oclif-dev manifest",
15
- "postinstall": "node \"./src/bin/run\" check-version && node ./src/lib/community"
16
- },
17
- "files": [
18
- "src",
19
- "oclif.manifest.json",
20
- "index.js",
21
- "package.json"
22
- ],
23
- "bin": {
24
- "apify": "./src/bin/run"
25
- },
26
- "contributors": [
27
- "Jakub Drobník <jakub.drobnik@apify.com>",
28
- "Jan Curn <jan@apify.com>"
29
- ],
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/apify/apify-cli.git"
33
- },
34
- "keywords": [
35
- "apify",
36
- "client",
37
- "node",
38
- "command",
39
- "line",
40
- "bash"
41
- ],
42
- "author": {
43
- "name": "Apify",
44
- "email": "support@apify.com",
45
- "url": "https://www.apify.com"
46
- },
47
- "license": "Apache-2.0",
48
- "bugs": {
49
- "url": "https://github.com/apify/apify-cli/issues"
50
- },
51
- "homepage": "https://github.com/apify/apify-cli#readme",
52
- "engines": {
53
- "node": ">=16.0.0"
54
- },
55
- "dependencies": {
56
- "@apify/actor-templates": "^0.1.4",
57
- "@apify/consts": "^2.23.0",
58
- "@apify/input_schema": "^3.5.8",
59
- "@apify/utilities": "^2.9.3",
60
- "@crawlee/memory-storage": "^3.5.8",
61
- "@oclif/command": "^1.8.36",
62
- "@oclif/config": "^1.18.17",
63
- "@oclif/errors": "^1.3.6",
64
- "@oclif/plugin-commands": "^2.1.0",
65
- "@oclif/plugin-help": "^5.1.12",
66
- "@root/walk": "^1.1.0",
67
- "adm-zip": "^0.5.10",
68
- "ajv": "^8.12.0",
69
- "apify-client": "^2.8.2",
70
- "archiver-promise": "^1.0.0",
71
- "axios": "^1.6.1",
72
- "chalk": "^4.1.2",
73
- "computer-name": "^0.1.0",
74
- "configparser": "^0.3.10",
75
- "cors": "^2.8.5",
76
- "detect-indent": "^6.1.0",
77
- "escape-string-regexp": "^4.0.0",
78
- "express": "^4.18.2",
79
- "globby": "^11.1.0",
80
- "handlebars": "^4.7.8",
81
- "inquirer": "^7.3.3",
82
- "is-ci": "^3.0.1",
83
- "is-online": "^10.0.0",
84
- "istextorbinary": "^8.0.0",
85
- "jju": "^1.4.0",
86
- "load-json-file": "^6.2.0",
87
- "mime": "^3.0.0",
88
- "mixpanel": "^0.18.0",
89
- "open": "^8.4.0",
90
- "ow": "^0.28.2",
91
- "rimraf": "^3.0.2",
92
- "semver": "^7.5.4",
93
- "tiged": "^2.12.5",
94
- "underscore": "^1.13.6",
95
- "write-json-file": "^4.3.0"
96
- },
97
- "devDependencies": {
98
- "@apify/eslint-config": "^0.4.0",
99
- "@oclif/dev-cli": "^1.26.0",
100
- "@oclif/test": "^2.1.0",
101
- "chai": "^4.3.4",
102
- "chai-match": "^1.1.1",
103
- "cross-env": "^7.0.3",
104
- "eslint": "^8.53.0",
105
- "mocha": "^10.0.0",
106
- "sinon": "^17.0.0"
107
- },
108
- "oclif": {
109
- "bin": "apify",
110
- "commands": "./src/commands",
111
- "hooks": {
112
- "init": [
113
- "./src/hooks/init"
114
- ]
115
- }
2
+ "name": "apify-cli",
3
+ "version": "0.19.2-beta.1",
4
+ "description": "Apify command-line interface helps you create, develop, build and run Apify actors, and manage the Apify cloud platform.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "cross-env APIFY_CLI_SKIP_UPDATE_CHECK=1 vitest run",
8
+ "test-python": "cross-env APIFY_CLI_SKIP_UPDATE_CHECK=1 vitest run -t '.*\\[python\\]'",
9
+ "lint": "eslint src test",
10
+ "lint:fix": "eslint src test --fix",
11
+ "commands-md": "npm run manifest && oclif-dev readme",
12
+ "prepare-release": "npm run commands-md && npm run prod-shrinkwrap",
13
+ "prod-shrinkwrap": "rm -rf node_modules && npm install --production && npm shrinkwrap",
14
+ "manifest": "rm -f oclif.manifest.json && oclif-dev manifest",
15
+ "postinstall": "node \"./src/bin/run\" check-version && node ./src/lib/community"
16
+ },
17
+ "files": [
18
+ "src",
19
+ "oclif.manifest.json",
20
+ "index.js",
21
+ "package.json"
22
+ ],
23
+ "bin": {
24
+ "apify": "./src/bin/run"
25
+ },
26
+ "contributors": [
27
+ "Jakub Drobník <jakub.drobnik@apify.com>",
28
+ "Jan Curn <jan@apify.com>"
29
+ ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/apify/apify-cli.git"
33
+ },
34
+ "keywords": [
35
+ "apify",
36
+ "client",
37
+ "node",
38
+ "command",
39
+ "line",
40
+ "bash"
41
+ ],
42
+ "author": {
43
+ "name": "Apify",
44
+ "email": "support@apify.com",
45
+ "url": "https://www.apify.com"
46
+ },
47
+ "license": "Apache-2.0",
48
+ "bugs": {
49
+ "url": "https://github.com/apify/apify-cli/issues"
50
+ },
51
+ "homepage": "https://github.com/apify/apify-cli#readme",
52
+ "engines": {
53
+ "node": ">=16.0.0"
54
+ },
55
+ "dependencies": {
56
+ "@apify/actor-templates": "^0.1.4",
57
+ "@apify/consts": "^2.23.0",
58
+ "@apify/input_schema": "^3.5.8",
59
+ "@apify/utilities": "^2.9.3",
60
+ "@crawlee/memory-storage": "^3.5.8",
61
+ "@oclif/command": "^1.8.36",
62
+ "@oclif/config": "^1.18.17",
63
+ "@oclif/errors": "^1.3.6",
64
+ "@oclif/plugin-commands": "^2.1.0",
65
+ "@oclif/plugin-help": "^5.1.12",
66
+ "@root/walk": "^1.1.0",
67
+ "adm-zip": "^0.5.10",
68
+ "ajv": "^8.12.0",
69
+ "apify-client": "^2.8.2",
70
+ "archiver-promise": "^1.0.0",
71
+ "axios": "^1.6.1",
72
+ "chalk": "^4.1.2",
73
+ "computer-name": "^0.1.0",
74
+ "configparser": "^0.3.10",
75
+ "cors": "^2.8.5",
76
+ "detect-indent": "^6.1.0",
77
+ "escape-string-regexp": "^4.0.0",
78
+ "express": "^4.18.2",
79
+ "globby": "^11.1.0",
80
+ "handlebars": "^4.7.8",
81
+ "inquirer": "^7.3.3",
82
+ "is-ci": "^3.0.1",
83
+ "is-online": "^10.0.0",
84
+ "istextorbinary": "^8.0.0",
85
+ "jju": "^1.4.0",
86
+ "load-json-file": "^6.2.0",
87
+ "mime": "^3.0.0",
88
+ "mixpanel": "^0.18.0",
89
+ "open": "^8.4.0",
90
+ "ow": "^0.28.2",
91
+ "rimraf": "^3.0.2",
92
+ "semver": "^7.5.4",
93
+ "tiged": "^2.12.5",
94
+ "underscore": "^1.13.6",
95
+ "write-json-file": "^4.3.0"
96
+ },
97
+ "devDependencies": {
98
+ "@apify/eslint-config": "^0.4.0",
99
+ "@oclif/dev-cli": "^1.26.0",
100
+ "@oclif/test": "^2.1.0",
101
+ "cross-env": "^7.0.3",
102
+ "eslint": "^8.53.0",
103
+ "vitest": "^1.0.4"
104
+ },
105
+ "oclif": {
106
+ "bin": "apify",
107
+ "commands": "./src/commands",
108
+ "hooks": {
109
+ "init": [
110
+ "./src/hooks/init"
111
+ ]
116
112
  }
113
+ }
117
114
  }
@@ -70,7 +70,7 @@ class CreateCommand extends ApifyCommand {
70
70
  try {
71
71
  fs.mkdirSync(actFolderDir);
72
72
  } catch (err) {
73
- if (err.code && err.code === 'EEXIST') {
73
+ if (err?.code === 'EEXIST') {
74
74
  outputs.error(`Cannot create new actor, directory '${actorName}' already exists. `
75
75
  + 'You can use "apify init" to create a local actor environment inside an existing directory.');
76
76
  return;
@@ -162,6 +162,7 @@ class CreateCommand extends ApifyCommand {
162
162
 
163
163
  if (dependenciesInstalled) {
164
164
  outputs.success(`Actor '${actorName}' was created. To run it, run "cd ${actorName}" and "apify run".`);
165
+ outputs.success('To push your actor to the Apify platform, run "apify push".');
165
166
  if (messages?.postCreate) {
166
167
  outputs.info(messages?.postCreate);
167
168
  }
@@ -9,7 +9,7 @@ const { createPrefilledInputFileFromInputSchema } = require('../lib/input_schema
9
9
  const outputs = require('../lib/outputs');
10
10
  const { ProjectAnalyzer } = require('../lib/project_analyzer');
11
11
  const { wrapScrapyProject } = require('../lib/scrapy-wrapper');
12
- const { setLocalConfig, setLocalEnv, getLocalConfig, getLocalConfigOrThrow, detectLocalActorLanguage } = require('../lib/utils');
12
+ const { setLocalConfig, setLocalEnv, getLocalConfig, getLocalConfigOrThrow, detectLocalActorLanguage, validateActorName } = require('../lib/utils');
13
13
 
14
14
  class InitCommand extends ApifyCommand {
15
15
  async run() {
@@ -34,8 +34,19 @@ class InitCommand extends ApifyCommand {
34
34
  outputs.warning(`Skipping creation of "${LOCAL_CONFIG_PATH}", the file already exists in the current directory.`);
35
35
  } else {
36
36
  if (!actorName) {
37
- const answer = await inquirer.prompt([{ name: 'actName', message: 'Actor name:', default: path.basename(cwd) }]);
38
- ({ actName: actorName } = answer);
37
+ let response = null;
38
+
39
+ while (!response) {
40
+ try {
41
+ const answer = await inquirer.prompt([{ name: 'actName', message: 'Actor name:', default: path.basename(cwd) }]);
42
+ validateActorName(answer.actName);
43
+ response = answer;
44
+ } catch (err) {
45
+ outputs.error(err.message);
46
+ }
47
+ }
48
+
49
+ ({ actName: actorName } = response);
39
50
  }
40
51
  // Migrate apify.json to .actor/actor.json
41
52
  const localConfig = { ...EMPTY_LOCAL_CONFIG, ...await getLocalConfigOrThrow() };
@@ -9,7 +9,7 @@ const inquirer = require('inquirer');
9
9
 
10
10
  const { ScrapyProjectAnalyzer } = require('./ScrapyProjectAnalyzer');
11
11
  const outputs = require('../outputs');
12
- const { downloadAndUnzip } = require('../utils');
12
+ const { downloadAndUnzip, sanitizeActorName } = require('../utils');
13
13
 
14
14
  /**
15
15
  * Files that should be concatenated instead of copied (and overwritten).
@@ -86,7 +86,7 @@ async function wrapScrapyProject({ projectPath }) {
86
86
  }
87
87
 
88
88
  const templateBindings = {
89
- botName: analyzer.settings.BOT_NAME,
89
+ botName: sanitizeActorName(analyzer.settings.BOT_NAME),
90
90
  scrapy_settings_module: analyzer.configuration.get('settings', 'default'),
91
91
  apify_module_path: `${analyzer.settings.BOT_NAME}.apify`,
92
92
  spider_class_name: analyzer.getAvailableSpiders()[spiderIndex].class_name,
package/src/lib/utils.js CHANGED
@@ -536,6 +536,19 @@ const validateActorName = (actorName) => {
536
536
  }
537
537
  };
538
538
 
539
+ const sanitizeActorName = (actorName) => {
540
+ let sanitizedName = actorName
541
+ .replaceAll(/[^a-zA-Z0-9-]/g, '-');
542
+
543
+ if (sanitizedName.length < ACTOR_NAME.MIN_LENGTH) {
544
+ sanitizedName = `${sanitizedName}-apify-actor`;
545
+ }
546
+
547
+ sanitizedName = sanitizedName.replaceAll(/^-+/g, '').replaceAll(/-+$/g, '');
548
+
549
+ return sanitizedName.slice(0, ACTOR_NAME.MAX_LENGTH);
550
+ };
551
+
539
552
  const getPythonCommand = (directory) => {
540
553
  const pythonVenvPath = /^win/.test(process.platform)
541
554
  ? 'Scripts/python.exe'
@@ -665,4 +678,5 @@ module.exports = {
665
678
  detectNpmVersion,
666
679
  detectLocalActorLanguage,
667
680
  downloadAndUnzip,
681
+ sanitizeActorName,
668
682
  };