apify-cli 0.11.1 → 0.13.0-beta.0

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
@@ -284,7 +284,7 @@ USAGE
284
284
  $ apify actor
285
285
  ```
286
286
 
287
- _See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/actor/index.js)_
287
+ _See code: [src/commands/actor/index.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/actor/index.js)_
288
288
 
289
289
  ## `apify actor:get-input`
290
290
 
@@ -295,7 +295,7 @@ USAGE
295
295
  $ apify actor:get-input
296
296
  ```
297
297
 
298
- _See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/actor/get-input.js)_
298
+ _See code: [src/commands/actor/get-input.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/actor/get-input.js)_
299
299
 
300
300
  ## `apify actor:get-value KEY`
301
301
 
@@ -309,7 +309,7 @@ ARGUMENTS
309
309
  KEY Key of the record in key-value store
310
310
  ```
311
311
 
312
- _See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/actor/get-value.js)_
312
+ _See code: [src/commands/actor/get-value.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/actor/get-value.js)_
313
313
 
314
314
  ## `apify actor:push-data [ITEM]`
315
315
 
@@ -330,7 +330,7 @@ DESCRIPTION
330
330
  $ cat ./test.json | apify actor:push-data
331
331
  ```
332
332
 
333
- _See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/actor/push-data.js)_
333
+ _See code: [src/commands/actor/push-data.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/actor/push-data.js)_
334
334
 
335
335
  ## `apify actor:set-value KEY [VALUE]`
336
336
 
@@ -360,7 +360,7 @@ DESCRIPTION
360
360
  $ cat ./my-text-file.txt | apify actor:set-value KEY --contentType text/plain
361
361
  ```
362
362
 
363
- _See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/actor/set-value.js)_
363
+ _See code: [src/commands/actor/set-value.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/actor/set-value.js)_
364
364
 
365
365
  ## `apify call [ACTID]`
366
366
 
@@ -385,7 +385,7 @@ DESCRIPTION
385
385
  takes input for the actor from the default local key-value store by default.
386
386
  ```
387
387
 
388
- _See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/call.js)_
388
+ _See code: [src/commands/call.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/call.js)_
389
389
 
390
390
  ## `apify create [ACTORNAME]`
391
391
 
@@ -404,7 +404,7 @@ OPTIONS
404
404
  find available template names.
405
405
  ```
406
406
 
407
- _See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/create.js)_
407
+ _See code: [src/commands/create.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/create.js)_
408
408
 
409
409
  ## `apify info`
410
410
 
@@ -418,7 +418,7 @@ DESCRIPTION
418
418
  The information is printed to the console.
419
419
  ```
420
420
 
421
- _See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/info.js)_
421
+ _See code: [src/commands/info.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/info.js)_
422
422
 
423
423
  ## `apify init [ACTORNAME]`
424
424
 
@@ -438,7 +438,7 @@ DESCRIPTION
438
438
  WARNING: The directory at "storage" will be overwritten if it already exists.
439
439
  ```
440
440
 
441
- _See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/init.js)_
441
+ _See code: [src/commands/init.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/init.js)_
442
442
 
443
443
  ## `apify login`
444
444
 
@@ -456,7 +456,7 @@ DESCRIPTION
456
456
  "apify" commands. To log out, call "apify logout".
457
457
  ```
458
458
 
459
- _See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/login.js)_
459
+ _See code: [src/commands/login.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/login.js)_
460
460
 
461
461
  ## `apify logout`
462
462
 
@@ -471,7 +471,7 @@ DESCRIPTION
471
471
  call "apify login".
472
472
  ```
473
473
 
474
- _See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/logout.js)_
474
+ _See code: [src/commands/logout.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/logout.js)_
475
475
 
476
476
  ## `apify push [ACTORID]`
477
477
 
@@ -506,7 +506,7 @@ DESCRIPTION
506
506
  WARNING: If the target actor already exists in your Apify account, it will be overwritten!
507
507
  ```
508
508
 
509
- _See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/push.js)_
509
+ _See code: [src/commands/push.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/push.js)_
510
510
 
511
511
  ## `apify run`
512
512
 
@@ -536,7 +536,7 @@ DESCRIPTION
536
536
  You can set up your own main file or environment variables by changing it.
537
537
  ```
538
538
 
539
- _See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/run.js)_
539
+ _See code: [src/commands/run.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/run.js)_
540
540
 
541
541
  ## `apify secrets`
542
542
 
@@ -564,7 +564,7 @@ DESCRIPTION
564
564
  of the actor.
565
565
  ```
566
566
 
567
- _See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/secrets/index.js)_
567
+ _See code: [src/commands/secrets/index.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/secrets/index.js)_
568
568
 
569
569
  ## `apify secrets:add NAME VALUE`
570
570
 
@@ -582,7 +582,7 @@ DESCRIPTION
582
582
  The secrets are stored to a file at ~/.apify
583
583
  ```
584
584
 
585
- _See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/secrets/add.js)_
585
+ _See code: [src/commands/secrets/add.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/secrets/add.js)_
586
586
 
587
587
  ## `apify secrets:rm NAME`
588
588
 
@@ -596,7 +596,7 @@ ARGUMENTS
596
596
  NAME Name of the secret
597
597
  ```
598
598
 
599
- _See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/secrets/rm.js)_
599
+ _See code: [src/commands/secrets/rm.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/secrets/rm.js)_
600
600
 
601
601
  ## `apify vis [PATH]`
602
602
 
@@ -620,5 +620,5 @@ DESCRIPTION
620
620
  You can also pass any custom path to your input schema to have it validated instead.
621
621
  ```
622
622
 
623
- _See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.11.1/src/commands/vis.js)_
623
+ _See code: [src/commands/vis.js](https://github.com/apify/apify-cli/blob/v0.13.0/src/commands/vis.js)_
624
624
  <!-- commandsstop -->
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "apify-cli",
3
- "version": "0.11.1",
3
+ "version": "0.13.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "apify-cli",
9
- "version": "0.11.1",
9
+ "version": "0.13.0",
10
+ "hasInstallScript": true,
10
11
  "license": "Apache-2.0",
11
12
  "dependencies": {
12
13
  "@apify/actor-templates": "^0.1.3",
13
- "@apify/consts": "^2.4.1",
14
+ "@apify/consts": "^2.7.0",
14
15
  "@apify/input_schema": "^3.3.0",
15
16
  "@apify/utilities": "^2.2.3",
16
17
  "@crawlee/memory-storage": "^3.0.3",
@@ -25,6 +26,7 @@
25
26
  "chalk": "^4.1.2",
26
27
  "child-process-promise": "^2.2.1",
27
28
  "cors": "^2.8.5",
29
+ "cross-spawn": "^7.0.3",
28
30
  "detect-indent": "^6.1.0",
29
31
  "express": "^4.18.2",
30
32
  "extract-zip": "^2.0.1",
@@ -53,6 +55,7 @@
53
55
  "@oclif/test": "^2.1.0",
54
56
  "chai": "^4.3.4",
55
57
  "chai-as-promised": "^7.1.1",
58
+ "chai-match": "^1.1.1",
56
59
  "eslint": "^8.11.0",
57
60
  "mocha": "^10.0.0",
58
61
  "sinon": "^9.2.4"
@@ -67,9 +70,9 @@
67
70
  "integrity": "sha512-sEASkPNvZ2ZWqSyUftJYhZo5EyWOqSnuVyQOzNDzvnYqN7Ev/H4f4tHas84BxWRdI8GPsIXLnArg0p4b6QrhJw=="
68
71
  },
69
72
  "node_modules/@apify/consts": {
70
- "version": "2.5.0",
71
- "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.5.0.tgz",
72
- "integrity": "sha512-QQuQq+lYBcQGvDg1DYTNqkh7YKRJdqeHYQ/b9+dlQW/ZNIf61ncx8n92DRIyv+nBe/vMT0YRNojuDLUlJTlnMQ=="
73
+ "version": "2.7.0",
74
+ "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.7.0.tgz",
75
+ "integrity": "sha512-Wt6tLqXLlS2ZNOvu/es9UjODjw3V5We8frO8B2qBTBp0zj9J2jIE9LKj67zN3GwcE5GmhvTOkZ8+CYAUtrTvPQ=="
73
76
  },
74
77
  "node_modules/@apify/eslint-config": {
75
78
  "version": "0.2.4",
@@ -1721,6 +1724,12 @@
1721
1724
  "chai": ">= 2.1.2 < 5"
1722
1725
  }
1723
1726
  },
1727
+ "node_modules/chai-match": {
1728
+ "version": "1.1.1",
1729
+ "resolved": "https://registry.npmjs.org/chai-match/-/chai-match-1.1.1.tgz",
1730
+ "integrity": "sha512-gea2rl5SgzF11CopH4yCmFTmPCXSN+e2GSJL33SfM+/WPP/cDk1tmrc0GDU2JRiFVJUJel/2zaNkNfyJKN7CtA==",
1731
+ "dev": true
1732
+ },
1724
1733
  "node_modules/chainsaw": {
1725
1734
  "version": "0.1.0",
1726
1735
  "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
@@ -1818,6 +1827,15 @@
1818
1827
  "promise-polyfill": "^6.0.1"
1819
1828
  }
1820
1829
  },
1830
+ "node_modules/child-process-promise/node_modules/cross-spawn": {
1831
+ "version": "4.0.2",
1832
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz",
1833
+ "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==",
1834
+ "dependencies": {
1835
+ "lru-cache": "^4.0.1",
1836
+ "which": "^1.2.9"
1837
+ }
1838
+ },
1821
1839
  "node_modules/chokidar": {
1822
1840
  "version": "3.5.3",
1823
1841
  "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
@@ -2152,12 +2170,38 @@
2152
2170
  }
2153
2171
  },
2154
2172
  "node_modules/cross-spawn": {
2155
- "version": "4.0.2",
2156
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz",
2157
- "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==",
2173
+ "version": "7.0.3",
2174
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
2175
+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
2158
2176
  "dependencies": {
2159
- "lru-cache": "^4.0.1",
2160
- "which": "^1.2.9"
2177
+ "path-key": "^3.1.0",
2178
+ "shebang-command": "^2.0.0",
2179
+ "which": "^2.0.1"
2180
+ },
2181
+ "engines": {
2182
+ "node": ">= 8"
2183
+ }
2184
+ },
2185
+ "node_modules/cross-spawn/node_modules/path-key": {
2186
+ "version": "3.1.1",
2187
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
2188
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
2189
+ "engines": {
2190
+ "node": ">=8"
2191
+ }
2192
+ },
2193
+ "node_modules/cross-spawn/node_modules/which": {
2194
+ "version": "2.0.2",
2195
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
2196
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
2197
+ "dependencies": {
2198
+ "isexe": "^2.0.0"
2199
+ },
2200
+ "bin": {
2201
+ "node-which": "bin/node-which"
2202
+ },
2203
+ "engines": {
2204
+ "node": ">= 8"
2161
2205
  }
2162
2206
  },
2163
2207
  "node_modules/css-select": {
@@ -6882,7 +6926,6 @@
6882
6926
  "version": "2.0.0",
6883
6927
  "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
6884
6928
  "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
6885
- "dev": true,
6886
6929
  "dependencies": {
6887
6930
  "shebang-regex": "^3.0.0"
6888
6931
  },
@@ -6894,7 +6937,6 @@
6894
6937
  "version": "3.0.0",
6895
6938
  "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
6896
6939
  "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
6897
- "dev": true,
6898
6940
  "engines": {
6899
6941
  "node": ">=8"
6900
6942
  }
@@ -7803,9 +7845,9 @@
7803
7845
  "integrity": "sha512-sEASkPNvZ2ZWqSyUftJYhZo5EyWOqSnuVyQOzNDzvnYqN7Ev/H4f4tHas84BxWRdI8GPsIXLnArg0p4b6QrhJw=="
7804
7846
  },
7805
7847
  "@apify/consts": {
7806
- "version": "2.5.0",
7807
- "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.5.0.tgz",
7808
- "integrity": "sha512-QQuQq+lYBcQGvDg1DYTNqkh7YKRJdqeHYQ/b9+dlQW/ZNIf61ncx8n92DRIyv+nBe/vMT0YRNojuDLUlJTlnMQ=="
7848
+ "version": "2.7.0",
7849
+ "resolved": "https://registry.npmjs.org/@apify/consts/-/consts-2.7.0.tgz",
7850
+ "integrity": "sha512-Wt6tLqXLlS2ZNOvu/es9UjODjw3V5We8frO8B2qBTBp0zj9J2jIE9LKj67zN3GwcE5GmhvTOkZ8+CYAUtrTvPQ=="
7809
7851
  },
7810
7852
  "@apify/eslint-config": {
7811
7853
  "version": "0.2.4",
@@ -9088,6 +9130,12 @@
9088
9130
  "check-error": "^1.0.2"
9089
9131
  }
9090
9132
  },
9133
+ "chai-match": {
9134
+ "version": "1.1.1",
9135
+ "resolved": "https://registry.npmjs.org/chai-match/-/chai-match-1.1.1.tgz",
9136
+ "integrity": "sha512-gea2rl5SgzF11CopH4yCmFTmPCXSN+e2GSJL33SfM+/WPP/cDk1tmrc0GDU2JRiFVJUJel/2zaNkNfyJKN7CtA==",
9137
+ "dev": true
9138
+ },
9091
9139
  "chainsaw": {
9092
9140
  "version": "0.1.0",
9093
9141
  "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
@@ -9161,6 +9209,17 @@
9161
9209
  "cross-spawn": "^4.0.2",
9162
9210
  "node-version": "^1.0.0",
9163
9211
  "promise-polyfill": "^6.0.1"
9212
+ },
9213
+ "dependencies": {
9214
+ "cross-spawn": {
9215
+ "version": "4.0.2",
9216
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz",
9217
+ "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==",
9218
+ "requires": {
9219
+ "lru-cache": "^4.0.1",
9220
+ "which": "^1.2.9"
9221
+ }
9222
+ }
9164
9223
  }
9165
9224
  },
9166
9225
  "chokidar": {
@@ -9426,12 +9485,28 @@
9426
9485
  }
9427
9486
  },
9428
9487
  "cross-spawn": {
9429
- "version": "4.0.2",
9430
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz",
9431
- "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==",
9488
+ "version": "7.0.3",
9489
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
9490
+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
9432
9491
  "requires": {
9433
- "lru-cache": "^4.0.1",
9434
- "which": "^1.2.9"
9492
+ "path-key": "^3.1.0",
9493
+ "shebang-command": "^2.0.0",
9494
+ "which": "^2.0.1"
9495
+ },
9496
+ "dependencies": {
9497
+ "path-key": {
9498
+ "version": "3.1.1",
9499
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
9500
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
9501
+ },
9502
+ "which": {
9503
+ "version": "2.0.2",
9504
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
9505
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
9506
+ "requires": {
9507
+ "isexe": "^2.0.0"
9508
+ }
9509
+ }
9435
9510
  }
9436
9511
  },
9437
9512
  "css-select": {
@@ -12927,7 +13002,6 @@
12927
13002
  "version": "2.0.0",
12928
13003
  "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
12929
13004
  "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
12930
- "dev": true,
12931
13005
  "requires": {
12932
13006
  "shebang-regex": "^3.0.0"
12933
13007
  }
@@ -12935,8 +13009,7 @@
12935
13009
  "shebang-regex": {
12936
13010
  "version": "3.0.0",
12937
13011
  "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
12938
- "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
12939
- "dev": true
13012
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
12940
13013
  },
12941
13014
  "side-channel": {
12942
13015
  "version": "1.0.4",
@@ -1 +1 @@
1
- {"version":"0.11.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}]},"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}]},"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":{"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":{},"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 \".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}},"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 \".actor/actor.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 command's default behavior by overriding the 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 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.13.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 \".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.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}]},"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":{"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":{},"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 \".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}},"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 \".actor/actor.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 command's default behavior by overriding the 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 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,107 +1,110 @@
1
1
  {
2
- "name": "apify-cli",
3
- "version": "0.11.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": "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": "^2.4.1",
55
- "@apify/input_schema": "^3.3.0",
56
- "@apify/utilities": "^2.2.3",
57
- "@crawlee/memory-storage": "^3.0.3",
58
- "@oclif/command": "^1.8.16",
59
- "@oclif/config": "^1.18.3",
60
- "@oclif/errors": "^1.3.5",
61
- "@oclif/plugin-commands": "^2.1.0",
62
- "@oclif/plugin-help": "^5.1.12",
63
- "ajv": "^8.10.0",
64
- "apify-client": "^2.2.0",
65
- "archiver-promise": "^1.0.0",
66
- "chalk": "^4.1.2",
67
- "child-process-promise": "^2.2.1",
68
- "cors": "^2.8.5",
69
- "detect-indent": "^6.1.0",
70
- "express": "^4.18.2",
71
- "extract-zip": "^2.0.1",
72
- "globby": "^11.1.0",
73
- "got-scraping": "^3.2.9",
74
- "inquirer": "^7.3.3",
75
- "is-online": "^10.0.0",
76
- "istextorbinary": "^6.0.0",
77
- "load-json-file": "^6.2.0",
78
- "mime": "^2.6.0",
79
- "minimist": "^1.2.5",
80
- "open": "^8.4.0",
81
- "ow": "^0.28.1",
82
- "rimraf": "^3.0.2",
83
- "semver": "^7.3.5",
84
- "underscore": "^1.13.2",
85
- "unzipper": "^0.10.11",
86
- "write-json-file": "^4.3.0"
87
- },
88
- "devDependencies": {
89
- "@apify/eslint-config": "^0.2.3",
90
- "@oclif/dev-cli": "^1.26.0",
91
- "@oclif/test": "^2.1.0",
92
- "chai": "^4.3.4",
93
- "chai-as-promised": "^7.1.1",
94
- "eslint": "^8.11.0",
95
- "mocha": "^10.0.0",
96
- "sinon": "^9.2.4"
97
- },
98
- "oclif": {
99
- "bin": "apify",
100
- "commands": "./src/commands",
101
- "hooks": {
102
- "prerun": [
103
- "./src/hooks/pre_run.js"
104
- ]
105
- }
2
+ "name": "apify-cli",
3
+ "version": "0.13.0-beta.0",
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
+ "postinstall": "node \"./src/bin/run\" check-version"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "oclif.manifest.json",
18
+ "index.js",
19
+ "package.json"
20
+ ],
21
+ "bin": {
22
+ "apify": "./src/bin/run"
23
+ },
24
+ "contributors": [
25
+ "Jakub Drobník <jakub.drobnik@apify.com>",
26
+ "Jan Curn <jan@apify.com>"
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/apify/apify-cli.git"
31
+ },
32
+ "keywords": [
33
+ "apify",
34
+ "client",
35
+ "node",
36
+ "command",
37
+ "line",
38
+ "bash"
39
+ ],
40
+ "author": {
41
+ "name": "Apify",
42
+ "email": "support@apify.com",
43
+ "url": "https://www.apify.com"
44
+ },
45
+ "license": "Apache-2.0",
46
+ "bugs": {
47
+ "url": "https://github.com/apify/apify-cli/issues"
48
+ },
49
+ "homepage": "https://github.com/apify/apify-cli#readme",
50
+ "engines": {
51
+ "node": ">=12.0.0"
52
+ },
53
+ "dependencies": {
54
+ "@apify/actor-templates": "^0.1.3",
55
+ "@apify/consts": "^2.7.0",
56
+ "@apify/input_schema": "^3.3.0",
57
+ "@apify/utilities": "^2.2.3",
58
+ "@crawlee/memory-storage": "^3.0.3",
59
+ "@oclif/command": "^1.8.16",
60
+ "@oclif/config": "^1.18.3",
61
+ "@oclif/errors": "^1.3.5",
62
+ "@oclif/plugin-commands": "^2.1.0",
63
+ "@oclif/plugin-help": "^5.1.12",
64
+ "ajv": "^8.10.0",
65
+ "apify-client": "^2.2.0",
66
+ "archiver-promise": "^1.0.0",
67
+ "chalk": "^4.1.2",
68
+ "child-process-promise": "^2.2.1",
69
+ "cors": "^2.8.5",
70
+ "cross-spawn": "^7.0.3",
71
+ "detect-indent": "^6.1.0",
72
+ "express": "^4.18.2",
73
+ "extract-zip": "^2.0.1",
74
+ "globby": "^11.1.0",
75
+ "got-scraping": "^3.2.9",
76
+ "inquirer": "^7.3.3",
77
+ "is-online": "^10.0.0",
78
+ "istextorbinary": "^6.0.0",
79
+ "load-json-file": "^6.2.0",
80
+ "mime": "^2.6.0",
81
+ "minimist": "^1.2.5",
82
+ "open": "^8.4.0",
83
+ "ow": "^0.28.1",
84
+ "rimraf": "^3.0.2",
85
+ "semver": "^7.3.5",
86
+ "underscore": "^1.13.2",
87
+ "unzipper": "^0.10.11",
88
+ "write-json-file": "^4.3.0"
89
+ },
90
+ "devDependencies": {
91
+ "@apify/eslint-config": "^0.2.3",
92
+ "@oclif/dev-cli": "^1.26.0",
93
+ "@oclif/test": "^2.1.0",
94
+ "chai": "^4.3.4",
95
+ "chai-as-promised": "^7.1.1",
96
+ "chai-match": "^1.1.1",
97
+ "eslint": "^8.11.0",
98
+ "mocha": "^10.0.0",
99
+ "sinon": "^9.2.4"
100
+ },
101
+ "oclif": {
102
+ "bin": "apify",
103
+ "commands": "./src/commands",
104
+ "hooks": {
105
+ "init": [
106
+ "./src/hooks/init"
107
+ ]
106
108
  }
109
+ }
107
110
  }
@@ -0,0 +1,27 @@
1
+ const { flags: flagsHelper } = require('@oclif/command');
2
+ const { ApifyCommand } = require('../lib/apify_command');
3
+ const { checkLatestVersion } = require('../lib/version_check');
4
+
5
+ class CheckVersionCommand extends ApifyCommand {
6
+ async run() {
7
+ const { flags } = this.parse(CheckVersionCommand);
8
+
9
+ checkLatestVersion(flags.enforceUpdate);
10
+ }
11
+ }
12
+
13
+ CheckVersionCommand.description = 'Checks that installed Apify CLI version is up to date.';
14
+
15
+ CheckVersionCommand.flags = {
16
+ 'enforce-update': flagsHelper.boolean({
17
+ char: 'e',
18
+ description: '[Optional] Enforce version update from NPM',
19
+ required: false,
20
+ }),
21
+ };
22
+
23
+ CheckVersionCommand.hidden = true;
24
+
25
+ CheckVersionCommand.aliases = ['cv'];
26
+
27
+ module.exports = CheckVersionCommand;
@@ -0,0 +1,13 @@
1
+ const { checkLatestVersion } = require('../lib/version_check');
2
+
3
+ /**
4
+ * This code'll be call before each commmand run
5
+ * @return {Promise<void>}
6
+ */
7
+ exports.default = async (params) => {
8
+ // This is not nessesary when you call the `--check-version` as the same command is called there.
9
+ if (['cv', 'check-version'].includes(params.id)) return;
10
+
11
+ // Check package latest version
12
+ await checkLatestVersion();
13
+ };
package/src/lib/actor.js CHANGED
@@ -4,7 +4,7 @@ const { promisify } = require('util');
4
4
  const { default: ow } = require('ow');
5
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, getLocalStorageDir } = require('./utils');
7
+ const { getLocalUserInfo, getLocalStorageDir, getApifyClientOptions } = require('./utils');
8
8
 
9
9
  const pipelinePromise = promisify(pipeline);
10
10
 
@@ -41,7 +41,7 @@ const getApifyStorageClient = (options = {}, forceCloud = false) => {
41
41
  }
42
42
 
43
43
  return new ApifyClient({
44
- token: apifyToken,
44
+ ...getApifyClientOptions(apifyToken),
45
45
  ...options,
46
46
  });
47
47
  };
package/src/lib/consts.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const os = require('os');
2
2
  const path = require('path');
3
- const { KEY_VALUE_STORE_KEYS } = require('@apify/consts');
3
+ const { KEY_VALUE_STORE_KEYS, META_ORIGINS } = require('@apify/consts');
4
4
 
5
5
  exports.DEFAULT_LOCAL_STORAGE_DIR = 'storage';
6
6
 
@@ -16,12 +16,16 @@ exports.EMPTY_LOCAL_CONFIG = {
16
16
  environmentVariables: {},
17
17
  };
18
18
 
19
+ exports.CHECK_VERSION_EVERY_MILLIS = 24 * 60 * 60 * 1000; // Once a day
20
+
19
21
  exports.GLOBAL_CONFIGS_FOLDER = path.join(os.homedir(), '.apify');
20
22
 
21
23
  exports.AUTH_FILE_PATH = path.join(exports.GLOBAL_CONFIGS_FOLDER, 'auth.json');
22
24
 
23
25
  exports.SECRETS_FILE_PATH = path.join(exports.GLOBAL_CONFIGS_FOLDER, 'secrets.json');
24
26
 
27
+ exports.STATE_FILE_PATH = path.join(exports.GLOBAL_CONFIGS_FOLDER, 'state.json');
28
+
25
29
  exports.DEPRECATED_LOCAL_CONFIG_NAME = 'apify.json';
26
30
 
27
31
  exports.ACTOR_SPECIFICATION_FOLDER = '.actor';
@@ -37,3 +41,5 @@ exports.MAIN_FILE = 'main.js';
37
41
  exports.UPLOADS_STORE_NAME = 'apify-cli-deployments';
38
42
 
39
43
  exports.SUPPORTED_NODEJS_VERSION = require('../../package.json').engines.node; // eslint-disable-line;
44
+
45
+ exports.APIFY_CLIENT_DEFAULT_HEADERS = { 'X-Apify-Request-Origin': META_ORIGINS.CLI };
@@ -0,0 +1,38 @@
1
+ const loadJson = require('load-json-file');
2
+ const writeJson = require('write-json-file');
3
+ const {
4
+ STATE_FILE_PATH,
5
+ } = require('./consts');
6
+
7
+ /**
8
+ * Returns state object from auth file or empty object.
9
+ * This method is synchronous/blocking to avoid different race conditions.
10
+ *
11
+ * @return {Object}
12
+ */
13
+ const getLocalState = () => {
14
+ try {
15
+ return loadJson.sync(STATE_FILE_PATH) || {};
16
+ } catch (e) {
17
+ return {};
18
+ }
19
+ };
20
+
21
+ /**
22
+ * Extends local state by given values.
23
+ * This method is synchronous/blocking to avoid different race conditions.
24
+ *
25
+ * @param {Object} data
26
+ */
27
+ const extendLocalState = (data) => {
28
+ const state = getLocalState();
29
+ writeJson.sync(STATE_FILE_PATH, {
30
+ ...state,
31
+ ...data,
32
+ });
33
+ };
34
+
35
+ module.exports = {
36
+ getLocalState,
37
+ extendLocalState,
38
+ };
package/src/lib/utils.js CHANGED
@@ -8,12 +8,19 @@ const archiver = require('archiver-promise');
8
8
  const loadJson = require('load-json-file');
9
9
  const writeJson = require('write-json-file');
10
10
  const inquirer = require('inquirer');
11
- const { LOCAL_STORAGE_SUBDIRS, ENV_VARS, LOCAL_ENV_VARS,
12
- KEY_VALUE_STORE_KEYS, ACT_JOB_TERMINAL_STATUSES, SOURCE_FILE_FORMATS, ACTOR_NAME } = require('@apify/consts');
11
+ const { LOCAL_STORAGE_SUBDIRS,
12
+ ENV_VARS,
13
+ LOCAL_ENV_VARS,
14
+ KEY_VALUE_STORE_KEYS,
15
+ ACT_JOB_TERMINAL_STATUSES,
16
+ SOURCE_FILE_FORMATS,
17
+ ACTOR_NAME,
18
+ } = require('@apify/consts');
13
19
  const https = require('https');
14
20
  const { ApifyClient } = require('apify-client');
15
- const { execSync, spawnSync } = require('child_process');
16
- const semver = require('semver');
21
+ const {
22
+ execSync,
23
+ } = require('child_process');
17
24
  const {
18
25
  GLOBAL_CONFIGS_FOLDER,
19
26
  AUTH_FILE_PATH,
@@ -22,9 +29,16 @@ const {
22
29
  LOCAL_CONFIG_PATH,
23
30
  DEPRECATED_LOCAL_CONFIG_NAME,
24
31
  ACTOR_SPECIFICATION_VERSION,
32
+ APIFY_CLIENT_DEFAULT_HEADERS,
25
33
  } = require('./consts');
26
- const { ensureFolderExistsSync, rimrafPromised, deleteFile } = require('./files');
27
- const { warning, info } = require('./outputs');
34
+ const {
35
+ ensureFolderExistsSync,
36
+ rimrafPromised,
37
+ deleteFile,
38
+ } = require('./files');
39
+ const {
40
+ info,
41
+ } = require('./outputs');
28
42
 
29
43
  // Properties from apify.json file that will me migrated to actor specs in .actor/actor.json
30
44
  const MIGRATED_APIFY_JSON_PROPERTIES = ['name', 'version', 'buildTag'];
@@ -77,6 +91,26 @@ const getLoggedClientOrThrow = async () => {
77
91
  return loggedClient;
78
92
  };
79
93
 
94
+ /**
95
+ * Returns options for ApifyClient
96
+ * @param {String|null|undefined} token
97
+ * @returns {Object}
98
+ */
99
+ const getApifyClientOptions = (token) => {
100
+ if (!token && fs.existsSync(GLOBAL_CONFIGS_FOLDER) && fs.existsSync(AUTH_FILE_PATH)) {
101
+ ({ token } = loadJson.sync(AUTH_FILE_PATH));
102
+ }
103
+
104
+ return {
105
+ token,
106
+ baseUrl: process.env.APIFY_CLIENT_BASE_URL,
107
+ requestInterceptors: [(config) => {
108
+ config.headers = { ...APIFY_CLIENT_DEFAULT_HEADERS, ...config.headers };
109
+ return config;
110
+ }],
111
+ };
112
+ };
113
+
80
114
  /**
81
115
  * Gets instance of ApifyClient for token or for params from global auth file.
82
116
  * NOTE: It refreshes global auth file each run
@@ -84,11 +118,7 @@ const getLoggedClientOrThrow = async () => {
84
118
  * @return {Promise<*>}
85
119
  */
86
120
  const getLoggedClient = async (token) => {
87
- if (!token && fs.existsSync(GLOBAL_CONFIGS_FOLDER) && fs.existsSync(AUTH_FILE_PATH)) {
88
- ({ token } = loadJson.sync(AUTH_FILE_PATH));
89
- }
90
-
91
- const apifyClient = new ApifyClient({ token, baseUrl: process.env.APIFY_CLIENT_BASE_URL });
121
+ const apifyClient = new ApifyClient(getApifyClientOptions(token));
92
122
  let userInfo;
93
123
  try {
94
124
  userInfo = await apifyClient.user('me').get();
@@ -98,7 +128,7 @@ const getLoggedClient = async (token) => {
98
128
 
99
129
  // Always refresh Auth file
100
130
  if (!fs.existsSync(GLOBAL_CONFIGS_FOLDER)) fs.mkdirSync(GLOBAL_CONFIGS_FOLDER);
101
- writeJson.sync(AUTH_FILE_PATH, { token, ...userInfo });
131
+ writeJson.sync(AUTH_FILE_PATH, { token: apifyClient.token, ...userInfo });
102
132
  return apifyClient;
103
133
  };
104
134
 
@@ -318,31 +348,6 @@ const getLocalInput = () => {
318
348
  return { body: inputFile, contentType };
319
349
  };
320
350
 
321
- /**
322
- * Logs warning if client local package is not in the latest version
323
- * Check'll be skip if user is offline
324
- * Check'll run approximately every 10. call
325
- * @return {Promise<void>}
326
- */
327
- const checkLatestVersion = async () => {
328
- try {
329
- // Run check approximately every 10. call
330
- if (Math.random() <= 0.8) return;
331
- // Skip if user is offline
332
- const isOnline = await import('is-online');
333
- if (!await isOnline.default({ timeout: 500 })) return;
334
-
335
- const latestVersion = spawnSync('npm', ['view', 'apify-cli', 'version']).stdout.toString().trim();
336
- const currentVersion = require('../../package.json').version; // eslint-disable-line
337
-
338
- if (semver.gt(latestVersion, currentVersion)) {
339
- warning('You are using an old version of apify-cli. Run "npm install apify-cli@latest -g" to install the latest version.');
340
- }
341
- } catch (err) {
342
- // Check should not break all commands
343
- }
344
- };
345
-
346
351
  const purgeDefaultQueue = async () => {
347
352
  const defaultQueuesPath = getLocalRequestQueuePath();
348
353
  if (fs.existsSync(getLocalStorageDir()) && fs.existsSync(defaultQueuesPath)) {
@@ -493,7 +498,6 @@ module.exports = {
493
498
  createActZip,
494
499
  getLocalUserInfo,
495
500
  getLocalConfigOrThrow,
496
- checkLatestVersion,
497
501
  getLocalInput,
498
502
  purgeDefaultQueue,
499
503
  purgeDefaultDataset,
@@ -510,4 +514,5 @@ module.exports = {
510
514
  createSourceFiles,
511
515
  validateActorName,
512
516
  getJsonFileContent,
517
+ getApifyClientOptions,
513
518
  };
@@ -0,0 +1,76 @@
1
+ const chalk = require('chalk');
2
+ const { spawn } = require('cross-spawn');
3
+ const semver = require('semver');
4
+ const {
5
+ CHECK_VERSION_EVERY_MILLIS,
6
+ } = require('./consts');
7
+ const {
8
+ warning,
9
+ info,
10
+ } = require('./outputs');
11
+ const {
12
+ getLocalState,
13
+ extendLocalState,
14
+ } = require('./local_state');
15
+
16
+ const getLatestNpmVersion = () => spawn.sync('npm', ['view', 'apify-cli', 'version']).stdout.toString().trim();
17
+
18
+ /**
19
+ * Fetches the latest NPM version of Apify CLI and caches it locally.
20
+ */
21
+ const getAndCacheLatestNpmVersion = () => {
22
+ try {
23
+ info('Making sure that Apify CLI is up to date...');
24
+
25
+ const latestNpmVersion = getLatestNpmVersion();
26
+
27
+ extendLocalState({
28
+ latestNpmVersion,
29
+ latestNpmVersionCheckedAt: new Date(),
30
+ });
31
+
32
+ return latestNpmVersion;
33
+ } catch (err) {
34
+ console.log(err);
35
+ warning('Cannot fetch the latest Apify CLI version from NPM, using the cached version instead.');
36
+ }
37
+ };
38
+
39
+ /**
40
+ * Logs warning if client local package is not in the latest version
41
+ * Check'll be skip if user is offline
42
+ * Check results will be cached for 24 hours
43
+ * @return {Promise<void>}
44
+ */
45
+ const checkLatestVersion = async (enforeUpdate = false) => {
46
+ const {
47
+ latestNpmVersion: cachedLatestNpmVersion,
48
+ latestNpmVersionCheckedAt,
49
+ } = getLocalState();
50
+
51
+ const isCheckOutdated = !latestNpmVersionCheckedAt || Date.now() - new Date(latestNpmVersionCheckedAt) > CHECK_VERSION_EVERY_MILLIS;
52
+ const isOnline = await import('is-online');
53
+
54
+ // If check is outdated and we are online then update the current NPM version.
55
+ const shouldGetCurrentVersion = enforeUpdate || (isCheckOutdated && await isOnline.default({ timeout: 500 }));
56
+ const latestNpmVersion = shouldGetCurrentVersion
57
+ ? getAndCacheLatestNpmVersion()
58
+ : cachedLatestNpmVersion;
59
+
60
+ const currentNpmVersion = require('../../package.json').version; // eslint-disable-line
61
+
62
+ if (latestNpmVersion && semver.gt(latestNpmVersion, currentNpmVersion)) {
63
+ console.log('');
64
+ warning('You are using an old version of Apify CLI. We strongly recommend you always use the latest available version.');
65
+ console.log(` ↪ Run ${chalk.bgWhite(chalk.black(' npm install apify-cli@latest -g '))} to install it! 👍 \n`);
66
+ } else if (shouldGetCurrentVersion) {
67
+ // In this case the version was refreshed from the NPM which took a while and "Info: Making sure that Apify ..." was printed
68
+ // so also print the state.
69
+ info('Apify CLI is up to date 👍 \n');
70
+ }
71
+ };
72
+
73
+ module.exports = {
74
+ checkLatestVersion,
75
+ getLatestNpmVersion,
76
+ };
@@ -1,10 +0,0 @@
1
- const { checkLatestVersion } = require('../lib/utils');
2
-
3
- /**
4
- * This code'll be call before each commmand run
5
- * @return {Promise<void>}
6
- */
7
- exports.preRunHook = async () => {
8
- // Check package latest version
9
- await checkLatestVersion();
10
- };