apify-cli 0.7.4 → 0.8.0-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 +30 -30
- package/npm-shrinkwrap.json +1458 -1942
- package/oclif.manifest.json +1 -1
- package/package.json +98 -98
- package/src/commands/push.js +1 -1
- package/src/commands/run.js +10 -4
- package/src/lib/actor.js +5 -8
- package/src/lib/consts.js +3 -1
- package/src/lib/utils.js +4 -4
- package/CHANGELOG.md +0 -200
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.7.4","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 \"apify.json\" file.","required":false}]},"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.Visit https://raw.githubusercontent.com/apify/actor-templates/master/templates/manifest.json to find available template names.","required":false}},"args":[{"name":"actorName","description":"Name of the actor and its directory","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":{"id":"init","description":"Initializes a new actor project in an existing directory.\nThe command only creates the \"apify.json\" file and the \"apify_storage\" directory in the current directory, but will not touch anything else.\n\nWARNING: The directory at \"apify_storage\" will be overwritten if it already exists.","pluginName":"apify-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"actorName","description":"Name of the actor. If not provided, you will be prompted for it.","required":false}]},"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":[]},"push":{"id":"push","description":"Uploads the actor to the Apify platform and builds it there.\nThe actor settings are read from the \"apify.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 \"apify.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 \"apify.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 \"apify.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}},"args":[{"name":"actorId","description":"ID of an existing actor on the Apify platform where the files will be pushed. If not provided, the command will create or modify the actor with the name specified in \"apify.json\" file.","required":false}]},"run":{"id":"run","description":"Runs the actor locally in the current directory by executing \"npm start\".\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 \"apify_storage\" directory, rather than on the Apify platform.\n\nNOTE: You can override the default behaviour of command overriding npm start script value in a 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.json file and prints errors found.","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 \"apify.json\" file by adding the \"@\" prefix:\n\n{\n \"name\": \"my_actor\",\n \"env\": { \"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.8.0","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 \"apify.json\" file.","required":false}]},"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.Visit https://raw.githubusercontent.com/apify/actor-templates/master/templates/manifest.json to find available template names.","required":false}},"args":[{"name":"actorName","description":"Name of the actor and its directory","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":{"id":"init","description":"Initializes a new actor project in an existing directory.\nThe command only creates the \"apify.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":{},"args":[{"name":"actorName","description":"Name of the actor. If not provided, you will be prompted for it.","required":false}]},"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":[]},"push":{"id":"push","description":"Uploads the actor to the Apify platform and builds it there.\nThe actor settings are read from the \"apify.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 \"apify.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 \"apify.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 \"apify.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}},"args":[{"name":"actorId","description":"ID of an existing actor on the Apify platform where the files will be pushed. If not provided, the command will create or modify the actor with the name specified in \"apify.json\" file.","required":false}]},"run":{"id":"run","description":"Runs the actor locally in the current directory by executing \"npm start\".\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 default behaviour of command overriding npm start script value in a 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.json file and prints errors found.","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 \"apify.json\" file by adding the \"@\" prefix:\n\n{\n \"name\": \"my_actor\",\n \"env\": { \"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,101 +1,101 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
2
|
+
"name": "apify-cli",
|
|
3
|
+
"version": "0.8.0-beta.2",
|
|
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": "mocha --timeout 180000 --recursive",
|
|
8
|
+
"lint": "eslint src test",
|
|
9
|
+
"lint:fix": "eslint src test --fix",
|
|
10
|
+
"commands-md": "npm run manifest && oclif-dev readme",
|
|
11
|
+
"prod-shrinkwrap": "rm -rf node_modules && npm install --production && npm shrinkwrap",
|
|
12
|
+
"manifest": "rm -f oclif.manifest.json && oclif-dev manifest"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"oclif.manifest.json",
|
|
17
|
+
"index.js",
|
|
18
|
+
"package.json"
|
|
19
|
+
],
|
|
20
|
+
"bin": {
|
|
21
|
+
"apify": "./src/bin/run"
|
|
22
|
+
},
|
|
23
|
+
"contributors": [
|
|
24
|
+
"Jakub Drobník <jakub.drobnik@apify.com>",
|
|
25
|
+
"Jan Curn <jan@apify.com>"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/apify/apify-cli.git"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"apify",
|
|
33
|
+
"client",
|
|
34
|
+
"node",
|
|
35
|
+
"command",
|
|
36
|
+
"line",
|
|
37
|
+
"bash"
|
|
38
|
+
],
|
|
39
|
+
"author": {
|
|
40
|
+
"name": "Apify",
|
|
41
|
+
"email": "support@apify.com",
|
|
42
|
+
"url": "https://www.apify.com"
|
|
43
|
+
},
|
|
44
|
+
"license": "Apache-2.0",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/apify/apify-cli/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/apify/apify-cli#readme",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=12.0.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@apify/actor-templates": "^0.1.3",
|
|
54
|
+
"@apify/consts": "^1.7.0",
|
|
55
|
+
"@apify/input_schema": "^2.0.8",
|
|
56
|
+
"@crawlee/memory-storage": "^3.0.3",
|
|
57
|
+
"@oclif/command": "^1.8.16",
|
|
58
|
+
"@oclif/config": "^1.18.3",
|
|
59
|
+
"@oclif/errors": "^1.3.5",
|
|
60
|
+
"@oclif/plugin-commands": "^2.1.0",
|
|
61
|
+
"@oclif/plugin-help": "^5.1.12",
|
|
62
|
+
"ajv": "^8.10.0",
|
|
63
|
+
"apify-client": "^2.2.0",
|
|
64
|
+
"archiver-promise": "^1.0.0",
|
|
65
|
+
"chalk": "^4.1.2",
|
|
66
|
+
"child-process-promise": "^2.2.1",
|
|
67
|
+
"extract-zip": "^2.0.1",
|
|
68
|
+
"globby": "^11.1.0",
|
|
69
|
+
"got-scraping": "^3.2.9",
|
|
70
|
+
"inquirer": "^7.3.3",
|
|
71
|
+
"is-online": "^10.0.0",
|
|
72
|
+
"load-json-file": "^6.2.0",
|
|
73
|
+
"mime": "^2.6.0",
|
|
74
|
+
"minimist": "^1.2.5",
|
|
75
|
+
"ow": "^0.28.1",
|
|
76
|
+
"rimraf": "^3.0.2",
|
|
77
|
+
"semver": "^7.3.5",
|
|
78
|
+
"underscore": "^1.13.2",
|
|
79
|
+
"unzipper": "^0.10.11",
|
|
80
|
+
"write-json-file": "^4.3.0"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@apify/eslint-config": "^0.2.3",
|
|
84
|
+
"@oclif/dev-cli": "^1.26.0",
|
|
85
|
+
"@oclif/test": "^2.1.0",
|
|
86
|
+
"chai": "^4.3.4",
|
|
87
|
+
"chai-as-promised": "^7.1.1",
|
|
88
|
+
"eslint": "^8.11.0",
|
|
89
|
+
"mocha": "^10.0.0",
|
|
90
|
+
"sinon": "^9.2.4"
|
|
91
|
+
},
|
|
92
|
+
"oclif": {
|
|
93
|
+
"bin": "apify",
|
|
94
|
+
"commands": "./src/commands",
|
|
95
|
+
"hooks": {
|
|
96
|
+
"prerun": [
|
|
97
|
+
"./src/hooks/pre_run.js"
|
|
98
|
+
]
|
|
100
99
|
}
|
|
100
|
+
}
|
|
101
101
|
}
|
package/src/commands/push.js
CHANGED
|
@@ -24,7 +24,7 @@ class PushCommand extends ApifyCommand {
|
|
|
24
24
|
let actorId;
|
|
25
25
|
let actor;
|
|
26
26
|
// User can override actor version and build tag, attributes in localConfig will remain same.
|
|
27
|
-
const version = flags.version || flags.versionNumber || localConfig.version;
|
|
27
|
+
const version = flags.version || flags.versionNumber || localConfig.version || '0.0';
|
|
28
28
|
const buildTag = flags.buildTag || localConfig.buildTag;
|
|
29
29
|
const waitForFinishMillis = Number.isNaN(flags.waitForFinish)
|
|
30
30
|
? undefined
|
package/src/commands/run.js
CHANGED
|
@@ -5,7 +5,7 @@ const loadJson = require('load-json-file');
|
|
|
5
5
|
const { ENV_VARS } = require('@apify/consts');
|
|
6
6
|
const semver = require('semver');
|
|
7
7
|
const execWithLog = require('../lib/exec');
|
|
8
|
-
const { DEFAULT_LOCAL_STORAGE_DIR, SUPPORTED_NODEJS_VERSION } = require('../lib/consts');
|
|
8
|
+
const { LEGACY_LOCAL_STORAGE_DIR, DEFAULT_LOCAL_STORAGE_DIR, SUPPORTED_NODEJS_VERSION } = require('../lib/consts');
|
|
9
9
|
const { ApifyCommand } = require('../lib/apify_command');
|
|
10
10
|
const {
|
|
11
11
|
getLocalUserInfo, purgeDefaultQueue, purgeDefaultKeyValueStore,
|
|
@@ -31,6 +31,13 @@ class RunCommand extends ApifyCommand {
|
|
|
31
31
|
throw new Error('The "npm start" script was not found in package.json. Please set it up for your project. '
|
|
32
32
|
+ 'For more information about that call "apify help run".');
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
if (fs.existsSync(LEGACY_LOCAL_STORAGE_DIR) && !fs.existsSync(DEFAULT_LOCAL_STORAGE_DIR)) {
|
|
36
|
+
fs.renameSync(LEGACY_LOCAL_STORAGE_DIR, DEFAULT_LOCAL_STORAGE_DIR);
|
|
37
|
+
warning("The legacy 'apify_storage' directory was renamed to 'storage' to align it with Apify SDK v3."
|
|
38
|
+
+ ' Contents were left intact.');
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
// Purge stores
|
|
35
42
|
if (flags.purge) {
|
|
36
43
|
await Promise.all([purgeDefaultQueue(), purgeDefaultKeyValueStore(), purgeDefaultDataset()]);
|
|
@@ -49,12 +56,11 @@ class RunCommand extends ApifyCommand {
|
|
|
49
56
|
info('Default local key-value store was purged.');
|
|
50
57
|
}
|
|
51
58
|
|
|
52
|
-
// Check if apify storage were purge, if not print error
|
|
53
59
|
if (!flags.purge) {
|
|
54
60
|
const isStorageEmpty = await checkIfStorageIsEmpty();
|
|
55
61
|
if (!isStorageEmpty) {
|
|
56
|
-
warning('The
|
|
57
|
-
+ 'To start from the initial state, use --purge parameter to clean the
|
|
62
|
+
warning('The storage directory contains a previous state, the actor will continue where it left off. '
|
|
63
|
+
+ 'To start from the initial state, use --purge parameter to clean the storage directory.');
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
66
|
|
package/src/lib/actor.js
CHANGED
|
@@ -2,9 +2,9 @@ const { ApifyClient } = require('apify-client');
|
|
|
2
2
|
const { pipeline } = require('stream');
|
|
3
3
|
const { promisify } = require('util');
|
|
4
4
|
const { default: ow } = require('ow');
|
|
5
|
-
const {
|
|
5
|
+
const { MemoryStorage } = require('@crawlee/memory-storage');
|
|
6
6
|
const { ENV_VARS, LOCAL_ENV_VARS, KEY_VALUE_STORE_KEYS } = require('@apify/consts');
|
|
7
|
-
const { getLocalUserInfo } = require('./utils');
|
|
7
|
+
const { getLocalUserInfo, getLocalStorageDir } = require('./utils');
|
|
8
8
|
|
|
9
9
|
const pipelinePromise = promisify(pipeline);
|
|
10
10
|
|
|
@@ -18,17 +18,14 @@ const APIFY_STORAGE_TYPES = {
|
|
|
18
18
|
* Returns instance of ApifyClient or ApifyStorageLocal based on environment variables.
|
|
19
19
|
* @param options - ApifyClient options
|
|
20
20
|
* @param forceCloud - If true then ApifyClient will be returned.
|
|
21
|
-
* @return {
|
|
21
|
+
* @return {MemoryStorage|ApifyClient}
|
|
22
22
|
*/
|
|
23
23
|
const getApifyStorageClient = (options = {}, forceCloud = false) => {
|
|
24
|
-
const storageDir =
|
|
24
|
+
const storageDir = getLocalStorageDir();
|
|
25
25
|
|
|
26
26
|
if (storageDir && !forceCloud) {
|
|
27
|
-
|
|
28
|
-
const enableWalMode = !!process.env.APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE;
|
|
29
|
-
return new ApifyStorageLocal({
|
|
27
|
+
return new MemoryStorage({
|
|
30
28
|
storageDir,
|
|
31
|
-
enableWalMode,
|
|
32
29
|
...options,
|
|
33
30
|
});
|
|
34
31
|
}
|
package/src/lib/consts.js
CHANGED
|
@@ -2,7 +2,9 @@ const os = require('os');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { KEY_VALUE_STORE_KEYS } = require('@apify/consts');
|
|
4
4
|
|
|
5
|
-
exports.DEFAULT_LOCAL_STORAGE_DIR = '
|
|
5
|
+
exports.DEFAULT_LOCAL_STORAGE_DIR = 'storage';
|
|
6
|
+
|
|
7
|
+
exports.LEGACY_LOCAL_STORAGE_DIR = 'apify_storage';
|
|
6
8
|
|
|
7
9
|
exports.EMPTY_LOCAL_CONFIG = {
|
|
8
10
|
name: null,
|
package/src/lib/utils.js
CHANGED
|
@@ -13,7 +13,6 @@ const https = require('https');
|
|
|
13
13
|
const { ApifyClient } = require('apify-client');
|
|
14
14
|
const { execSync, spawnSync } = require('child_process');
|
|
15
15
|
const semver = require('semver');
|
|
16
|
-
const isOnline = require('is-online');
|
|
17
16
|
const { GLOBAL_CONFIGS_FOLDER, AUTH_FILE_PATH, LOCAL_CONFIG_NAME, INPUT_FILE_REG_EXP, DEFAULT_LOCAL_STORAGE_DIR } = require('./consts');
|
|
18
17
|
const { ensureFolderExistsSync, rimrafPromised, deleteFile } = require('./files');
|
|
19
18
|
const { warning, info } = require('./outputs');
|
|
@@ -104,7 +103,7 @@ const getLocalConfig = () => {
|
|
|
104
103
|
const getLocalConfigOrThrow = async () => {
|
|
105
104
|
let localConfig = getLocalConfig();
|
|
106
105
|
if (!localConfig) {
|
|
107
|
-
|
|
106
|
+
return {};
|
|
108
107
|
}
|
|
109
108
|
// 27-11-2018: Check if apify.json contains old deprecated structure. If so, updates it.
|
|
110
109
|
if (localConfig.version && _.isObject(localConfig.version)) {
|
|
@@ -205,7 +204,7 @@ const createSourceFiles = async (paths) => {
|
|
|
205
204
|
* All dot files(.file) and folders(.folder/) are included.
|
|
206
205
|
*/
|
|
207
206
|
const getActorLocalFilePaths = () => globby(['*', '**/**'], {
|
|
208
|
-
ignore: ['.git/**'],
|
|
207
|
+
ignore: ['.git/**', 'apify_storage', 'node_modules', 'storage', 'crawlee_storage'],
|
|
209
208
|
gitignore: true,
|
|
210
209
|
dot: true,
|
|
211
210
|
});
|
|
@@ -257,7 +256,8 @@ const checkLatestVersion = async () => {
|
|
|
257
256
|
// Run check approximately every 10. call
|
|
258
257
|
if (Math.random() <= 0.8) return;
|
|
259
258
|
// Skip if user is offline
|
|
260
|
-
|
|
259
|
+
const isOnline = await import('is-online');
|
|
260
|
+
if (!await isOnline.default({ timeout: 500 })) return;
|
|
261
261
|
|
|
262
262
|
const latestVersion = spawnSync('npm', ['view', 'apify-cli', 'version']).stdout.toString().trim();
|
|
263
263
|
const currentVersion = require('../../package.json').version; // eslint-disable-line
|
package/CHANGELOG.md
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
**Changelog file is no longer maintained, you can check all changes in [GitHub Releases](https://github.com/apify/apify-cli/releases).**
|
|
2
|
-
|
|
3
|
-
0.6.1 / 2020-05-18
|
|
4
|
-
==================
|
|
5
|
-
- **BREAKING:** Templates are now fully decoupled from this project and
|
|
6
|
-
the [templates repository](https://github.com/apify/actor-templates)
|
|
7
|
-
serves as the single source of truth. Some templates were replaced
|
|
8
|
-
and others were renamed to better clarify their purpose.
|
|
9
|
-
- **BREAKING:** Providing an invalid template in `apify.json` no longer
|
|
10
|
-
throws, but rather silently uses a reasonable default configuration.
|
|
11
|
-
This is to support regular changes to templates without breaking older
|
|
12
|
-
versions of the CLI.
|
|
13
|
-
|
|
14
|
-
0.5.3 / 2020-03-03
|
|
15
|
-
==================
|
|
16
|
-
- Moved templates to separate repository
|
|
17
|
-
- Fixed: creating `apify_storage` in root folder after `apify create` command
|
|
18
|
-
|
|
19
|
-
0.5.2 / 2020-01-22
|
|
20
|
-
==================
|
|
21
|
-
- Added bot(dependabot.com) to check latest Apify SDK version in all templates
|
|
22
|
-
- Updated apify package in all templates
|
|
23
|
-
- Updated npm packages and fixed all npm audit issues
|
|
24
|
-
|
|
25
|
-
0.5.1 / 2019-12-19
|
|
26
|
-
==================
|
|
27
|
-
- Added warning about outdated node.js version
|
|
28
|
-
- Fixed infinite push, when the previous one was interrupted
|
|
29
|
-
- Fixed calling public actors with `apify call`
|
|
30
|
-
- `apify init` create empty INPUT.json file
|
|
31
|
-
|
|
32
|
-
0.5.0 / 2019-11-27
|
|
33
|
-
==================
|
|
34
|
-
- Drop support for node 8 and 9
|
|
35
|
-
- Fix: Pass the --max-http-header-size=80000 to the nodeJs process
|
|
36
|
-
|
|
37
|
-
0.4.1 / 2019-10-02
|
|
38
|
-
==================
|
|
39
|
-
- New actor template for Apify projects, you can create it with `apify create --template apify_project`
|
|
40
|
-
- `apify vis` - Using improved schema validator
|
|
41
|
-
|
|
42
|
-
0.4.0 / 2019-09-23
|
|
43
|
-
==================
|
|
44
|
-
- Breaking Change - `apify push`: Pushes source code as a "Multiple source files" in case source code is less that 3 MB
|
|
45
|
-
|
|
46
|
-
0.3.12 / 2019-09-18
|
|
47
|
-
==================
|
|
48
|
-
Bug fixes:
|
|
49
|
-
- `apify create`: Added validation for actor name
|
|
50
|
-
- `apify init` skips creation of apify.json if already exists
|
|
51
|
-
- `apify run -p` runs actor, if apify_storage doesn't exist
|
|
52
|
-
- Updated packages
|
|
53
|
-
- Additional minor fixes
|
|
54
|
-
|
|
55
|
-
0.3.11 / 2019-07-26
|
|
56
|
-
==================
|
|
57
|
-
- Updated packages
|
|
58
|
-
- Updated Cheerio Crawler template
|
|
59
|
-
- Updated Apify package version in all templates
|
|
60
|
-
|
|
61
|
-
0.3.10 / 2019-06-03
|
|
62
|
-
==================
|
|
63
|
-
- Updated packages
|
|
64
|
-
|
|
65
|
-
0.3.9 / 2019-05-15
|
|
66
|
-
==================
|
|
67
|
-
- Improved the templates and texts
|
|
68
|
-
|
|
69
|
-
0.3.8 / 2019-03-29
|
|
70
|
-
==================
|
|
71
|
-
- Updated all templates regarding the last version of apify SDK.
|
|
72
|
-
|
|
73
|
-
0.3.7 / 2019-03-18
|
|
74
|
-
==================
|
|
75
|
-
- Fixed templates to use Apify.getInput(), replaced deprecated function and options,
|
|
76
|
-
added debug fields, added .idea to .gitignore
|
|
77
|
-
- Updated packages
|
|
78
|
-
- Fixed bug: Users without username can use push/call command
|
|
79
|
-
|
|
80
|
-
0.3.6 / 2019-01-29
|
|
81
|
-
==================
|
|
82
|
-
- Added command `apify vis` that validates actor input schema.
|
|
83
|
-
|
|
84
|
-
0.3.5 / 2019-01-25
|
|
85
|
-
==================
|
|
86
|
-
- Upgraded to apify@0.11 in templates
|
|
87
|
-
|
|
88
|
-
0.3.3 / 2018-12-12
|
|
89
|
-
==================
|
|
90
|
-
- Omitted CMD command in all templates Dockerfile.
|
|
91
|
-
|
|
92
|
-
0.3.2 / 2018-12-05
|
|
93
|
-
==================
|
|
94
|
-
- Updated apify-client package. It fixed bug, when user can not push actor, whe he changed version in apify.json.
|
|
95
|
-
|
|
96
|
-
0.3.1 / 2018-11-29
|
|
97
|
-
==================
|
|
98
|
-
- :tada: New commands to manage secret environment variables: `apify secrets:add`, `apify secrets:rm`.
|
|
99
|
-
- New documentation how to set environment variable in `apify.json`, see [documentation](https://github.com/apify/apify-cli/blob/master/README.md#environment-variables).
|
|
100
|
-
- **BREAKING CHANGES**: Simplified `apify.json` structure. It will be updated automatically before execution apify run and push command.
|
|
101
|
-
- Command `apify create` now shows progress bar of npm install.
|
|
102
|
-
- Small bugs fixes
|
|
103
|
-
|
|
104
|
-
0.2.7 / 2018-11-27
|
|
105
|
-
==================
|
|
106
|
-
- Updated all templates to latest apify packages
|
|
107
|
-
|
|
108
|
-
0.2.6 / 2018-11-09
|
|
109
|
-
==================
|
|
110
|
-
- Added warning if `apify run` reuse old state in storage
|
|
111
|
-
- Fixed issues #70 #65 #68
|
|
112
|
-
|
|
113
|
-
0.2.5 / 2018-10-31
|
|
114
|
-
==================
|
|
115
|
-
- Updated NPM dependencies
|
|
116
|
-
- Upgraded to apify-shared@0.1.6
|
|
117
|
-
- Fixed templates to use apify/actor-node-chrome Docker image instead of outdated apify/actor-node-puppeteer
|
|
118
|
-
|
|
119
|
-
0.2.3 / 2018-09-17
|
|
120
|
-
==================
|
|
121
|
-
- Updated all templates to apify version 0.8.*
|
|
122
|
-
- Added template named hello_word
|
|
123
|
-
|
|
124
|
-
0.2.1 / 2018-09-17
|
|
125
|
-
==================
|
|
126
|
-
- **BREAKING CHANGES**: The local storage directories have been renamed and package.json files needs a new `start` command.
|
|
127
|
-
See [migration guide](/MIGRATIONS.md) for existing projects if you are upgrading from 0.1.* to 0.2.*.
|
|
128
|
-
- You can specified another file that main.js for `apify run` command using npm start script.
|
|
129
|
-
|
|
130
|
-
0.2.0 / 2018-09-12
|
|
131
|
-
==================
|
|
132
|
-
- **BREAKING CHANGES**: Version 0.2.0 of Apify CLI supports only version 0.7.0 of API SDK or newer as management of environment variables
|
|
133
|
-
has been changed according to Apify SDK version 0.7.0.
|
|
134
|
-
- Dropped support for Node 7
|
|
135
|
-
|
|
136
|
-
0.1.18 / 2018-09-12
|
|
137
|
-
===================
|
|
138
|
-
- Updated NPM dependencies, npm-shrinkwrap.json replaced with package-lock.json
|
|
139
|
-
- Updated NPM dependencies in code templates
|
|
140
|
-
|
|
141
|
-
0.1.15 / 2018-07-23
|
|
142
|
-
===================
|
|
143
|
-
- Rename act to actor
|
|
144
|
-
|
|
145
|
-
0.1.13 / 2018-07-12
|
|
146
|
-
===================
|
|
147
|
-
- Add environment variables for enable live view for local actors.
|
|
148
|
-
|
|
149
|
-
0.1.12 / 2018-06-28
|
|
150
|
-
===================
|
|
151
|
-
- From now `apify call` and `apify push` commands stream live logs from run and build to your terminal
|
|
152
|
-
- Add options -p, --purge, --purge-dataset, --purge-key-value-store, --purge-queue in `apify run` to clean stores before runs actor locally
|
|
153
|
-
- Add option -w, --wait-for-finish=wait-for-finish in `apify push` and `apify call` - command waits x seconds to finish run or build on Apify
|
|
154
|
-
- Fixes #26, #33, #34, #36, #38, #39, #37, #35
|
|
155
|
-
|
|
156
|
-
0.1.11 / 2018-05-30
|
|
157
|
-
===================
|
|
158
|
-
- Use npm-shrinkwrap.json instead of package-lock.json for published module
|
|
159
|
-
- Update template, where we using proxy
|
|
160
|
-
- Fix #30
|
|
161
|
-
|
|
162
|
-
0.1.9 / 2018-04-18
|
|
163
|
-
==================
|
|
164
|
-
- apify run takes APIFY_USER_ID and APIFY_TOKEN as environments variables, if client is logged locally
|
|
165
|
-
- apify call takes input from default local key-value-store
|
|
166
|
-
- Fix: duplicates new lines in log
|
|
167
|
-
|
|
168
|
-
0.1.8 / 2018-04-17
|
|
169
|
-
==================
|
|
170
|
-
- Print warning if you have old version of cli
|
|
171
|
-
- apify run - kills all sub processes for SIGINT signal (ctrl+c) - It kills all related browsers in apify run command, related issue:
|
|
172
|
-
https://github.com/apify/apify-js/issues/72
|
|
173
|
-
|
|
174
|
-
0.1.7 / 2018-04-12
|
|
175
|
-
==================
|
|
176
|
-
- Readme and templates updates
|
|
177
|
-
|
|
178
|
-
0.1.6 / 2018-04-11
|
|
179
|
-
==================
|
|
180
|
-
- Add support for request queue
|
|
181
|
-
|
|
182
|
-
0.1.5 / 2018-04-09
|
|
183
|
-
==================
|
|
184
|
-
- Works for windows
|
|
185
|
-
- New command apify info
|
|
186
|
-
|
|
187
|
-
0.1.x / 2018-04-01
|
|
188
|
-
==================
|
|
189
|
-
- The first public release
|
|
190
|
-
|
|
191
|
-
0.0.x / 2018-03-01
|
|
192
|
-
==================
|
|
193
|
-
- Initial development, lot of new stuff
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|