@devicecloud.dev/dcd 3.4.4 → 3.5.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.
@@ -41,7 +41,8 @@ class Status extends core_1.Command {
41
41
  }
42
42
  async run() {
43
43
  const { flags } = await this.parse(Status);
44
- const { apiUrl, apiKey, name, 'upload-id': uploadId, json } = flags;
44
+ const { apiUrl, apiKey: apiKeyFlag, name, 'upload-id': uploadId, json, } = flags;
45
+ const apiKey = apiKeyFlag || process.env.DEVICE_CLOUD_API_KEY;
45
46
  if (!apiKey) {
46
47
  this.error('API Key is required. Please provide it via --api-key flag or DEVICE_CLOUD_API_KEY environment variable.');
47
48
  return;
@@ -0,0 +1,17 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Upload extends Command {
3
+ static args: {
4
+ appFile: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ apiKey: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ apiUrl: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ 'ignore-sha-check': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ static enableJsonFlag: boolean;
14
+ run(): Promise<{
15
+ appBinaryId: string;
16
+ } | undefined>;
17
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const constants_1 = require("../constants");
5
+ const methods_1 = require("../methods");
6
+ class Upload extends core_1.Command {
7
+ static args = {
8
+ appFile: core_1.Args.string({
9
+ description: 'The binary file to upload (e.g. test.apk for android or test.app/.zip for ios)',
10
+ required: true,
11
+ name: 'App file',
12
+ }),
13
+ };
14
+ static description = 'Upload an app binary to devicecloud.dev';
15
+ static examples = [
16
+ '<%= config.bin %> <%= command.id %> path/to/app.apk',
17
+ '<%= config.bin %> <%= command.id %> path/to/app.zip --api-key YOUR_API_KEY',
18
+ ];
19
+ static flags = {
20
+ apiKey: constants_1.flags.apiKey,
21
+ apiUrl: constants_1.flags.apiUrl,
22
+ 'ignore-sha-check': constants_1.flags['ignore-sha-check'],
23
+ };
24
+ static enableJsonFlag = true;
25
+ async run() {
26
+ try {
27
+ const { args, flags } = await this.parse(Upload);
28
+ const { appFile } = args;
29
+ const { apiKey: apiKeyFlag, apiUrl, 'ignore-sha-check': ignoreShaCheck, json, } = flags;
30
+ const apiKey = apiKeyFlag || process.env.DEVICE_CLOUD_API_KEY;
31
+ if (!apiKey) {
32
+ throw new Error('You must provide an API key via --api-key flag or DEVICE_CLOUD_API_KEY environment variable');
33
+ }
34
+ if (!['apk', '.app', '.zip'].some((ext) => appFile.endsWith(ext))) {
35
+ throw new Error('App file must be a .apk for android or .app/.zip file for iOS');
36
+ }
37
+ if (appFile.endsWith('.zip')) {
38
+ await (0, methods_1.verifyAppZip)(appFile);
39
+ }
40
+ this.log(`
41
+ Uploading app binary
42
+ → File: ${appFile}
43
+ `);
44
+ const appBinaryId = await (0, methods_1.uploadBinary)(appFile, apiUrl, apiKey, ignoreShaCheck, !json);
45
+ if (json) {
46
+ return { appBinaryId };
47
+ }
48
+ this.log(`\nUpload complete. Binary ID: ${appBinaryId}\n`);
49
+ this.log(`You can use this Binary ID in subsequent test runs with:`);
50
+ this.log(`dcd cloud --app-binary-id ${appBinaryId} path/to/flow.yaml\n`);
51
+ }
52
+ catch (error) {
53
+ this.error(error, { exit: 1 });
54
+ }
55
+ }
56
+ }
57
+ exports.default = Upload;
@@ -414,7 +414,74 @@
414
414
  "commands",
415
415
  "status.js"
416
416
  ]
417
+ },
418
+ "upload": {
419
+ "aliases": [],
420
+ "args": {
421
+ "appFile": {
422
+ "description": "The binary file to upload (e.g. test.apk for android or test.app/.zip for ios)",
423
+ "name": "appFile",
424
+ "required": true
425
+ }
426
+ },
427
+ "description": "Upload an app binary to devicecloud.dev",
428
+ "examples": [
429
+ "<%= config.bin %> <%= command.id %> path/to/app.apk",
430
+ "<%= config.bin %> <%= command.id %> path/to/app.zip --api-key YOUR_API_KEY"
431
+ ],
432
+ "flags": {
433
+ "json": {
434
+ "description": "Format output as json.",
435
+ "helpGroup": "GLOBAL",
436
+ "name": "json",
437
+ "allowNo": false,
438
+ "type": "boolean"
439
+ },
440
+ "apiKey": {
441
+ "aliases": [
442
+ "api-key"
443
+ ],
444
+ "description": "API key for devicecloud.dev (find this in the console UI). You can also set the DEVICE_CLOUD_API_KEY environment variable.",
445
+ "name": "apiKey",
446
+ "hasDynamicHelp": false,
447
+ "multiple": false,
448
+ "type": "option"
449
+ },
450
+ "apiUrl": {
451
+ "aliases": [
452
+ "api-url",
453
+ "apiURL"
454
+ ],
455
+ "description": "API base URL",
456
+ "hidden": true,
457
+ "name": "apiUrl",
458
+ "default": "https://api.devicecloud.dev",
459
+ "hasDynamicHelp": false,
460
+ "multiple": false,
461
+ "type": "option"
462
+ },
463
+ "ignore-sha-check": {
464
+ "description": "Ignore the sha hash check and upload the binary regardless of whether it already exists (not recommended)",
465
+ "name": "ignore-sha-check",
466
+ "allowNo": false,
467
+ "type": "boolean"
468
+ }
469
+ },
470
+ "hasDynamicHelp": false,
471
+ "hiddenAliases": [],
472
+ "id": "upload",
473
+ "pluginAlias": "@devicecloud.dev/dcd",
474
+ "pluginName": "@devicecloud.dev/dcd",
475
+ "pluginType": "core",
476
+ "strict": true,
477
+ "enableJsonFlag": true,
478
+ "isESM": false,
479
+ "relativePath": [
480
+ "dist",
481
+ "commands",
482
+ "upload.js"
483
+ ]
417
484
  }
418
485
  },
419
- "version": "3.4.4"
486
+ "version": "3.5.0"
420
487
  }
package/package.json CHANGED
@@ -80,7 +80,7 @@
80
80
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
81
81
  "version": "oclif readme && git add README.md"
82
82
  },
83
- "version": "3.4.4",
83
+ "version": "3.5.0",
84
84
  "bugs": {
85
85
  "url": "https://discord.gg/gm3mJwcNw8"
86
86
  },