apify-cli 0.14.2-beta.0 → 0.14.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm-shrinkwrap.json +13 -3
- package/package.json +2 -2
- package/src/commands/create.js +1 -1
- package/src/lib/version_check.js +48 -6
package/npm-shrinkwrap.json
CHANGED
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"ajv": "^8.10.0",
|
|
24
24
|
"apify-client": "^2.2.0",
|
|
25
25
|
"archiver-promise": "^1.0.0",
|
|
26
|
+
"axios": "^0.21.1",
|
|
26
27
|
"chalk": "^4.1.2",
|
|
27
28
|
"computer-name": "^0.1.0",
|
|
28
29
|
"cors": "^2.8.5",
|
|
29
|
-
"cross-spawn": "^7.0.3",
|
|
30
30
|
"detect-indent": "^6.1.0",
|
|
31
31
|
"express": "^4.18.2",
|
|
32
32
|
"globby": "^11.1.0",
|
|
@@ -2153,6 +2153,7 @@
|
|
|
2153
2153
|
"version": "7.0.3",
|
|
2154
2154
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
|
2155
2155
|
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
|
2156
|
+
"dev": true,
|
|
2156
2157
|
"dependencies": {
|
|
2157
2158
|
"path-key": "^3.1.0",
|
|
2158
2159
|
"shebang-command": "^2.0.0",
|
|
@@ -6176,6 +6177,7 @@
|
|
|
6176
6177
|
"version": "3.1.1",
|
|
6177
6178
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
|
6178
6179
|
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
|
6180
|
+
"dev": true,
|
|
6179
6181
|
"engines": {
|
|
6180
6182
|
"node": ">=8"
|
|
6181
6183
|
}
|
|
@@ -7037,6 +7039,7 @@
|
|
|
7037
7039
|
"version": "2.0.0",
|
|
7038
7040
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
|
7039
7041
|
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
|
7042
|
+
"dev": true,
|
|
7040
7043
|
"dependencies": {
|
|
7041
7044
|
"shebang-regex": "^3.0.0"
|
|
7042
7045
|
},
|
|
@@ -7048,6 +7051,7 @@
|
|
|
7048
7051
|
"version": "3.0.0",
|
|
7049
7052
|
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
|
7050
7053
|
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
|
7054
|
+
"dev": true,
|
|
7051
7055
|
"engines": {
|
|
7052
7056
|
"node": ">=8"
|
|
7053
7057
|
}
|
|
@@ -7775,6 +7779,7 @@
|
|
|
7775
7779
|
"version": "2.0.2",
|
|
7776
7780
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
|
7777
7781
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
|
7782
|
+
"dev": true,
|
|
7778
7783
|
"dependencies": {
|
|
7779
7784
|
"isexe": "^2.0.0"
|
|
7780
7785
|
},
|
|
@@ -9644,6 +9649,7 @@
|
|
|
9644
9649
|
"version": "7.0.3",
|
|
9645
9650
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
|
9646
9651
|
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
|
9652
|
+
"dev": true,
|
|
9647
9653
|
"requires": {
|
|
9648
9654
|
"path-key": "^3.1.0",
|
|
9649
9655
|
"shebang-command": "^2.0.0",
|
|
@@ -12602,7 +12608,8 @@
|
|
|
12602
12608
|
"path-key": {
|
|
12603
12609
|
"version": "3.1.1",
|
|
12604
12610
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
|
12605
|
-
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
|
|
12611
|
+
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
|
12612
|
+
"dev": true
|
|
12606
12613
|
},
|
|
12607
12614
|
"path-parse": {
|
|
12608
12615
|
"version": "1.0.7",
|
|
@@ -13249,6 +13256,7 @@
|
|
|
13249
13256
|
"version": "2.0.0",
|
|
13250
13257
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
|
13251
13258
|
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
|
13259
|
+
"dev": true,
|
|
13252
13260
|
"requires": {
|
|
13253
13261
|
"shebang-regex": "^3.0.0"
|
|
13254
13262
|
}
|
|
@@ -13256,7 +13264,8 @@
|
|
|
13256
13264
|
"shebang-regex": {
|
|
13257
13265
|
"version": "3.0.0",
|
|
13258
13266
|
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
|
13259
|
-
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
|
|
13267
|
+
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
|
13268
|
+
"dev": true
|
|
13260
13269
|
},
|
|
13261
13270
|
"side-channel": {
|
|
13262
13271
|
"version": "1.0.4",
|
|
@@ -13823,6 +13832,7 @@
|
|
|
13823
13832
|
"version": "2.0.2",
|
|
13824
13833
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
|
13825
13834
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
|
13835
|
+
"dev": true,
|
|
13826
13836
|
"requires": {
|
|
13827
13837
|
"isexe": "^2.0.0"
|
|
13828
13838
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apify-cli",
|
|
3
|
-
"version": "0.14.2-beta.
|
|
3
|
+
"version": "0.14.2-beta.2",
|
|
4
4
|
"description": "Apify command-line interface helps you create, develop, build and run Apify actors, and manage the Apify cloud platform.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"ajv": "^8.10.0",
|
|
66
66
|
"apify-client": "^2.2.0",
|
|
67
67
|
"archiver-promise": "^1.0.0",
|
|
68
|
+
"axios": "^0.21.1",
|
|
68
69
|
"chalk": "^4.1.2",
|
|
69
70
|
"computer-name": "^0.1.0",
|
|
70
71
|
"cors": "^2.8.5",
|
|
71
|
-
"cross-spawn": "^7.0.3",
|
|
72
72
|
"detect-indent": "^6.1.0",
|
|
73
73
|
"express": "^4.18.2",
|
|
74
74
|
"globby": "^11.1.0",
|
package/src/commands/create.js
CHANGED
|
@@ -100,7 +100,7 @@ class CreateCommand extends ApifyCommand {
|
|
|
100
100
|
}
|
|
101
101
|
await execWithLog(
|
|
102
102
|
pythonCommand,
|
|
103
|
-
['-m', 'pip', 'install', '--no-cache-dir', '--no-warn-script-location', '--upgrade', 'pip'],
|
|
103
|
+
['-m', 'pip', 'install', '--no-cache-dir', '--no-warn-script-location', '--upgrade', 'pip', 'setuptools', 'wheel'],
|
|
104
104
|
{ cwd: actFolderDir },
|
|
105
105
|
);
|
|
106
106
|
await execWithLog(
|
package/src/lib/version_check.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
const process = require('process');
|
|
3
|
+
const axios = require('axios');
|
|
1
4
|
const chalk = require('chalk');
|
|
2
|
-
const { spawn } = require('cross-spawn');
|
|
3
5
|
const semver = require('semver');
|
|
4
6
|
const {
|
|
5
7
|
CHECK_VERSION_EVERY_MILLIS,
|
|
@@ -13,16 +15,54 @@ const {
|
|
|
13
15
|
extendLocalState,
|
|
14
16
|
} = require('./local_state');
|
|
15
17
|
|
|
16
|
-
const
|
|
18
|
+
const INSTALLATION_TYPE = {
|
|
19
|
+
HOMEBREW: 'HOMEBREW',
|
|
20
|
+
NPM: 'NPM',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const UPDATE_COMMAND = {
|
|
24
|
+
[INSTALLATION_TYPE.HOMEBREW]: 'brew update && brew upgrade apify-cli',
|
|
25
|
+
[INSTALLATION_TYPE.NPM]: 'npm install -g apify-cli@latest',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Detect through which package manager the Apify CLI was installed.
|
|
30
|
+
* @returns {INSTALLATION_TYPE} The installation type of the CLI.
|
|
31
|
+
*/
|
|
32
|
+
const detectInstallationType = () => {
|
|
33
|
+
// The path of the alias to the `src/bin/run` file is in process.argv[1]
|
|
34
|
+
const commandPath = process.argv[1];
|
|
35
|
+
|
|
36
|
+
if (commandPath) {
|
|
37
|
+
// If the real command path is like `/opt/homebrew/Cellar/apify-cli/...` or `/home/linuxbrew/.linuxbrew/Cellar/apify-cli/...`,
|
|
38
|
+
// then the CLI is installed via Homebrew
|
|
39
|
+
if (process.platform === 'linux' || process.platform === 'darwin') {
|
|
40
|
+
const realCommandPath = execSync(`realpath "${commandPath}"`);
|
|
41
|
+
if (realCommandPath.includes('homebrew/Cellar') || realCommandPath.includes('linuxbrew/Cellar')) {
|
|
42
|
+
return INSTALLATION_TYPE.HOMEBREW;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Add more install types here once we have the CLI in other package managers
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// If we didn't detect otherwise, assume the CLI was installed through NPM
|
|
49
|
+
return INSTALLATION_TYPE.NPM;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getLatestNpmVersion = async () => {
|
|
53
|
+
const response = await axios({ url: 'https://registry.npmjs.org/apify-cli/latest' });
|
|
54
|
+
const latestVersion = response.data.version;
|
|
55
|
+
return latestVersion;
|
|
56
|
+
};
|
|
17
57
|
|
|
18
58
|
/**
|
|
19
59
|
* Fetches the latest NPM version of Apify CLI and caches it locally.
|
|
20
60
|
*/
|
|
21
|
-
const getAndCacheLatestNpmVersion = () => {
|
|
61
|
+
const getAndCacheLatestNpmVersion = async () => {
|
|
22
62
|
try {
|
|
23
63
|
info('Making sure that Apify CLI is up to date...');
|
|
24
64
|
|
|
25
|
-
const latestNpmVersion = getLatestNpmVersion();
|
|
65
|
+
const latestNpmVersion = await getLatestNpmVersion();
|
|
26
66
|
|
|
27
67
|
extendLocalState({
|
|
28
68
|
latestNpmVersion,
|
|
@@ -54,15 +94,17 @@ const checkLatestVersion = async (enforeUpdate = false) => {
|
|
|
54
94
|
// If check is outdated and we are online then update the current NPM version.
|
|
55
95
|
const shouldGetCurrentVersion = enforeUpdate || (isCheckOutdated && await isOnline.default({ timeout: 500 }));
|
|
56
96
|
const latestNpmVersion = shouldGetCurrentVersion
|
|
57
|
-
? getAndCacheLatestNpmVersion()
|
|
97
|
+
? await getAndCacheLatestNpmVersion()
|
|
58
98
|
: cachedLatestNpmVersion;
|
|
59
99
|
|
|
60
100
|
const currentNpmVersion = require('../../package.json').version; // eslint-disable-line
|
|
61
101
|
|
|
62
102
|
if (latestNpmVersion && semver.gt(latestNpmVersion, currentNpmVersion)) {
|
|
103
|
+
const installationType = detectInstallationType();
|
|
104
|
+
const updateCommand = `' ${UPDATE_COMMAND[installationType]} '`;
|
|
63
105
|
console.log('');
|
|
64
106
|
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(
|
|
107
|
+
console.log(` ↪ Run ${chalk.bgWhite(chalk.black(updateCommand))} to update! 👍 \n`);
|
|
66
108
|
} else if (shouldGetCurrentVersion) {
|
|
67
109
|
// In this case the version was refreshed from the NPM which took a while and "Info: Making sure that Apify ..." was printed
|
|
68
110
|
// so also print the state.
|