apify-cli 1.0.0-beta.63 → 1.0.0-beta.64
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 +36 -36
- package/dist/.tsbuildinfo +1 -1
- package/dist/commands/call.js +3 -3
- package/dist/commands/create.js +3 -3
- package/dist/commands/push.js +9 -9
- package/dist/lib/actor.d.ts +1 -1
- package/dist/lib/actor.js +1 -1
- package/dist/lib/utils.d.ts +4 -4
- package/dist/lib/utils.js +5 -5
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/dist/commands/call.js
CHANGED
|
@@ -44,7 +44,7 @@ export class CallCommand extends ApifyCommand {
|
|
|
44
44
|
if (localInput) {
|
|
45
45
|
// TODO: For some reason we cannot pass json as buffer with right contentType into apify-client.
|
|
46
46
|
// It will save malformed JSON which looks like buffer as INPUT.
|
|
47
|
-
// We need to fix this in v1 during removing call under
|
|
47
|
+
// We need to fix this in v1 during removing call under Actor namespace.
|
|
48
48
|
const input = mime.getExtension(localInput.contentType) === 'json' ? JSON.parse(localInput.body.toString('utf-8')) : localInput.body;
|
|
49
49
|
run = await apifyClient.actor(actorId).start(input, { ...runOpts, contentType: localInput.contentType });
|
|
50
50
|
}
|
|
@@ -96,7 +96,7 @@ export class CallCommand extends ApifyCommand {
|
|
|
96
96
|
id: actor.id,
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
// Try fetching
|
|
99
|
+
// Try fetching Actor directly by name
|
|
100
100
|
if (actorId) {
|
|
101
101
|
const actor = await client.actor(`${usernameOrId}/${actorId.toLowerCase()}`).get();
|
|
102
102
|
if (!actor) {
|
|
@@ -118,7 +118,7 @@ export class CallCommand extends ApifyCommand {
|
|
|
118
118
|
id: actor.id,
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
throw new Error('Please provide an Actor ID or name, or run this command from a directory with a valid Apify
|
|
121
|
+
throw new Error('Please provide an Actor ID or name, or run this command from a directory with a valid Apify Actor.');
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
Object.defineProperty(CallCommand, "description", {
|
package/dist/commands/create.js
CHANGED
|
@@ -40,7 +40,7 @@ export class CreateCommand extends ApifyCommand {
|
|
|
40
40
|
actFolderDir = join(cwd, actorName);
|
|
41
41
|
continue;
|
|
42
42
|
}
|
|
43
|
-
// Create
|
|
43
|
+
// Create Actor directory structure
|
|
44
44
|
if (!folderExists) {
|
|
45
45
|
mkdirSync(actFolderDir);
|
|
46
46
|
}
|
|
@@ -86,9 +86,9 @@ export class CreateCommand extends ApifyCommand {
|
|
|
86
86
|
warning(`You are running Node.js version ${currentNodeVersion}, which is no longer supported. `
|
|
87
87
|
+ `Please upgrade to Node.js version ${minimumSupportedNodeVersion} or later.`);
|
|
88
88
|
}
|
|
89
|
-
// If the
|
|
89
|
+
// If the Actor is a Node.js Actor (has package.json), run `npm install`
|
|
90
90
|
await updateLocalJson(packageJsonPath, { name: actorName });
|
|
91
|
-
// Run npm install in
|
|
91
|
+
// Run npm install in Actor dir.
|
|
92
92
|
// For efficiency, don't install Puppeteer for templates that don't use it
|
|
93
93
|
const cmdArgs = ['install'];
|
|
94
94
|
if (skipOptionalDeps) {
|
package/dist/commands/push.js
CHANGED
|
@@ -22,7 +22,7 @@ const DEFAULT_RUN_OPTIONS = {
|
|
|
22
22
|
const DEFAULT_ACTOR_VERSION_NUMBER = '0.0';
|
|
23
23
|
// It would be better to use `version-0.0` or similar,
|
|
24
24
|
// or even have no default tag, but the platform complains when
|
|
25
|
-
//
|
|
25
|
+
// Actor does not have a build with a `latest` tag, so until
|
|
26
26
|
// that changes, we have to add it.
|
|
27
27
|
const DEFAULT_BUILD_TAG = 'latest';
|
|
28
28
|
export class PushCommand extends ApifyCommand {
|
|
@@ -35,7 +35,7 @@ export class PushCommand extends ApifyCommand {
|
|
|
35
35
|
// Validate there are files before rest of the logic
|
|
36
36
|
const filePathsToPush = await getActorLocalFilePaths(cwd);
|
|
37
37
|
if (!filePathsToPush.length) {
|
|
38
|
-
error('You need to call this command from a folder that has an
|
|
38
|
+
error('You need to call this command from a folder that has an Actor in it!');
|
|
39
39
|
process.exitCode = CommandExitCodes.NoFilesToPush;
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
@@ -51,8 +51,8 @@ export class PushCommand extends ApifyCommand {
|
|
|
51
51
|
'.actor',
|
|
52
52
|
].some((filePath) => filePathsToPush.some((fp) => fp === filePath || fp.startsWith(filePath)))) {
|
|
53
53
|
error([
|
|
54
|
-
'A valid
|
|
55
|
-
'You can also turn this directory into an
|
|
54
|
+
'A valid Actor could not be found in the current directory. Please make sure you are in the correct directory.',
|
|
55
|
+
'You can also turn this directory into an Actor by running `apify init`.',
|
|
56
56
|
].join('\n'));
|
|
57
57
|
process.exitCode = CommandExitCodes.NoFilesToPush;
|
|
58
58
|
return;
|
|
@@ -65,7 +65,7 @@ export class PushCommand extends ApifyCommand {
|
|
|
65
65
|
let actorId;
|
|
66
66
|
let actor;
|
|
67
67
|
let isActorCreatedNow = false;
|
|
68
|
-
// User can override
|
|
68
|
+
// User can override Actor version and build tag, attributes in localConfig will remain same.
|
|
69
69
|
const version = this.flags.version || this.flags.versionNumber || localConfig?.version || DEFAULT_ACTOR_VERSION_NUMBER;
|
|
70
70
|
let buildTag = this.flags.buildTag || localConfig.buildTag;
|
|
71
71
|
// We can't add the default build tag to everything. If a user creates a new
|
|
@@ -78,8 +78,8 @@ export class PushCommand extends ApifyCommand {
|
|
|
78
78
|
const waitForFinishMillis = Number.isNaN(this.flags.waitForFinish)
|
|
79
79
|
? undefined
|
|
80
80
|
: Number.parseInt(this.flags.waitForFinish, 10) * 1000;
|
|
81
|
-
// User can override actorId of pushing
|
|
82
|
-
// It causes that we push
|
|
81
|
+
// User can override actorId of pushing Actor.
|
|
82
|
+
// It causes that we push Actor to this id but attributes in localConfig will remain same.
|
|
83
83
|
const forceActorId = this.args.actorId;
|
|
84
84
|
if (forceActorId) {
|
|
85
85
|
actor = (await apifyClient.actor(forceActorId).get());
|
|
@@ -157,7 +157,7 @@ Skipping push. Use --force to override.`);
|
|
|
157
157
|
tarballUrl = `${apifyClient.baseUrl}/key-value-stores/${store.id}/records/${key}?disableRedirect=true`;
|
|
158
158
|
sourceType = ACTOR_SOURCE_TYPES.TARBALL;
|
|
159
159
|
}
|
|
160
|
-
// Update
|
|
160
|
+
// Update Actor version
|
|
161
161
|
const actorCurrentVersion = await actorClient.version(version).get();
|
|
162
162
|
const envVars = localConfig.environmentVariables
|
|
163
163
|
? transformEnvToEnvVars(localConfig.environmentVariables)
|
|
@@ -182,7 +182,7 @@ Skipping push. Use --force to override.`);
|
|
|
182
182
|
});
|
|
183
183
|
run(`Created version ${version} for Actor ${actor.name}.`);
|
|
184
184
|
}
|
|
185
|
-
// Build
|
|
185
|
+
// Build Actor on Apify and wait for build to finish
|
|
186
186
|
run(`Building Actor ${actor.name}`);
|
|
187
187
|
let build = await actorClient.build(version, {
|
|
188
188
|
useCache: true,
|
package/dist/lib/actor.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const APIFY_STORAGE_TYPES: {
|
|
|
14
14
|
export declare const getApifyStorageClient: (options?: MemoryStorageOptions | ApifyClientOptions, forceCloud?: boolean) => Promise<StorageClient>;
|
|
15
15
|
/**
|
|
16
16
|
* Returns default storage id based on environment variables.
|
|
17
|
-
* Throws error if not set and
|
|
17
|
+
* Throws error if not set and Actor running on platform.
|
|
18
18
|
* @param storeType
|
|
19
19
|
*/
|
|
20
20
|
export declare const getDefaultStorageId: (storeType: (typeof APIFY_STORAGE_TYPES)[keyof typeof APIFY_STORAGE_TYPES]) => string;
|
package/dist/lib/actor.js
CHANGED
|
@@ -40,7 +40,7 @@ export const getApifyStorageClient = async (options = {}, forceCloud = Reflect.h
|
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
42
|
* Returns default storage id based on environment variables.
|
|
43
|
-
* Throws error if not set and
|
|
43
|
+
* Throws error if not set and Actor running on platform.
|
|
44
44
|
* @param storeType
|
|
45
45
|
*/
|
|
46
46
|
export const getDefaultStorageId = (storeType) => {
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -48,16 +48,16 @@ export declare const createSourceFiles: (paths: string[], cwd: string) => Promis
|
|
|
48
48
|
content: string;
|
|
49
49
|
}[]>;
|
|
50
50
|
/**
|
|
51
|
-
* Get
|
|
51
|
+
* Get Actor local files, omit files defined in .gitignore and .git folder
|
|
52
52
|
* All dot files(.file) and folders(.folder/) are included.
|
|
53
53
|
*/
|
|
54
54
|
export declare const getActorLocalFilePaths: (cwd?: string) => Promise<string[]>;
|
|
55
55
|
/**
|
|
56
|
-
* Create zip file with all
|
|
56
|
+
* Create zip file with all Actor files specified with pathsToZip
|
|
57
57
|
*/
|
|
58
58
|
export declare const createActZip: (zipName: string, pathsToZip: string[], cwd: string) => Promise<void>;
|
|
59
59
|
/**
|
|
60
|
-
* Get
|
|
60
|
+
* Get Actor input from local store
|
|
61
61
|
*/
|
|
62
62
|
export declare const getLocalInput: (cwd: string) => {
|
|
63
63
|
body: Buffer;
|
|
@@ -77,7 +77,7 @@ export declare const getNpmCmd: () => string;
|
|
|
77
77
|
*/
|
|
78
78
|
export declare const checkIfStorageIsEmpty: () => Promise<boolean>;
|
|
79
79
|
/**
|
|
80
|
-
* Validates
|
|
80
|
+
* Validates Actor name, if finds issue throws error.
|
|
81
81
|
* @param actorName
|
|
82
82
|
*/
|
|
83
83
|
export declare const validateActorName: (actorName: string) => void;
|
package/dist/lib/utils.js
CHANGED
|
@@ -43,7 +43,7 @@ export const httpsGet = async (url) => {
|
|
|
43
43
|
}).on('error', reject);
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
-
// Properties from apify.json file that will me migrated to
|
|
46
|
+
// Properties from apify.json file that will me migrated to Actor specs in .actor/actor.json
|
|
47
47
|
const MIGRATED_APIFY_JSON_PROPERTIES = ['name', 'version', 'buildTag'];
|
|
48
48
|
export const getLocalStorageDir = () => {
|
|
49
49
|
const envVar = APIFY_ENV_VARS.LOCAL_STORAGE_DIR;
|
|
@@ -288,7 +288,7 @@ export const createSourceFiles = async (paths, cwd) => {
|
|
|
288
288
|
});
|
|
289
289
|
};
|
|
290
290
|
/**
|
|
291
|
-
* Get
|
|
291
|
+
* Get Actor local files, omit files defined in .gitignore and .git folder
|
|
292
292
|
* All dot files(.file) and folders(.folder/) are included.
|
|
293
293
|
*/
|
|
294
294
|
export const getActorLocalFilePaths = async (cwd) => globby(['*', '**/**'], {
|
|
@@ -298,7 +298,7 @@ export const getActorLocalFilePaths = async (cwd) => globby(['*', '**/**'], {
|
|
|
298
298
|
cwd,
|
|
299
299
|
});
|
|
300
300
|
/**
|
|
301
|
-
* Create zip file with all
|
|
301
|
+
* Create zip file with all Actor files specified with pathsToZip
|
|
302
302
|
*/
|
|
303
303
|
export const createActZip = async (zipName, pathsToZip, cwd) => {
|
|
304
304
|
// NOTE: There can be a zip from a previous unfinished operation.
|
|
@@ -312,7 +312,7 @@ export const createActZip = async (zipName, pathsToZip, cwd) => {
|
|
|
312
312
|
await archive.finalize();
|
|
313
313
|
};
|
|
314
314
|
/**
|
|
315
|
-
* Get
|
|
315
|
+
* Get Actor input from local store
|
|
316
316
|
*/
|
|
317
317
|
export const getLocalInput = (cwd) => {
|
|
318
318
|
const defaultLocalStorePath = getLocalKeyValueStorePath();
|
|
@@ -465,7 +465,7 @@ const updateLocalConfigStructure = (localConfig) => {
|
|
|
465
465
|
return updatedLocalConfig;
|
|
466
466
|
};
|
|
467
467
|
/**
|
|
468
|
-
* Validates
|
|
468
|
+
* Validates Actor name, if finds issue throws error.
|
|
469
469
|
* @param actorName
|
|
470
470
|
*/
|
|
471
471
|
export const validateActorName = (actorName) => {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apify-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.64",
|
|
4
4
|
"description": "Apify command-line interface (CLI) helps you manage the Apify cloud platform and develop, build, and deploy Apify Actors.",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@apify/actor-templates": "~0.1.5",
|
|
59
|
-
"@apify/consts": "~2.
|
|
59
|
+
"@apify/consts": "~2.27.0",
|
|
60
60
|
"@apify/input_schema": "~3.5.15",
|
|
61
61
|
"@apify/utilities": "~2.10.0",
|
|
62
62
|
"@crawlee/memory-storage": "~3.9.0",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"topicSeparator": " "
|
|
147
147
|
},
|
|
148
148
|
"volta": {
|
|
149
|
-
"node": "20.
|
|
149
|
+
"node": "20.13.0",
|
|
150
150
|
"yarn": "4.2.1"
|
|
151
151
|
},
|
|
152
152
|
"packageManager": "yarn@4.2.1"
|