@devicecloud.dev/dcd 3.5.0 → 3.5.1

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,6 +41,7 @@ export default class Cloud extends Command {
41
41
  async: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
42
42
  'device-locale': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
43
43
  'download-artifacts': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
44
+ 'artifacts-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
44
45
  env: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
45
46
  'exclude-flows': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
46
47
  'exclude-tags': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -80,7 +80,7 @@ class Cloud extends core_1.Command {
80
80
  let output = null;
81
81
  try {
82
82
  const { args, flags, raw } = await this.parse(Cloud);
83
- let { 'additional-app-binary-ids': nonFlatAdditionalAppBinaryIds, 'additional-app-files': nonFlatAdditionalAppFiles, 'android-api-level': androidApiLevel, 'android-device': androidDevice, apiKey: apiKeyFlag, apiUrl, 'app-binary-id': appBinaryId, 'app-file': appFile, async, 'device-locale': deviceLocale, 'download-artifacts': downloadArtifacts, env, 'exclude-flows': excludeFlows, 'exclude-tags': excludeTags, flows, 'google-play': googlePlay, 'include-tags': includeTags, 'ignore-sha-check': ignoreShaCheck, 'ios-device': iOSDevice, 'ios-version': iOSVersion, 'maestro-version': maestroVersion, name, orientation, quiet, retry, report, 'runner-type': runnerType, 'x86-arch': x86Arch, json, ...rest } = flags;
83
+ let { 'additional-app-binary-ids': nonFlatAdditionalAppBinaryIds, 'additional-app-files': nonFlatAdditionalAppFiles, 'android-api-level': androidApiLevel, 'android-device': androidDevice, apiKey: apiKeyFlag, apiUrl, 'app-binary-id': appBinaryId, 'app-file': appFile, 'artifacts-path': artifactsPath, async, 'device-locale': deviceLocale, 'download-artifacts': downloadArtifacts, env, 'exclude-flows': excludeFlows, 'exclude-tags': excludeTags, flows, 'google-play': googlePlay, 'include-tags': includeTags, 'ignore-sha-check': ignoreShaCheck, 'ios-device': iOSDevice, 'ios-version': iOSVersion, 'maestro-version': maestroVersion, name, orientation, quiet, retry, report, 'runner-type': runnerType, 'x86-arch': x86Arch, json, ...rest } = flags;
84
84
  // If in JSON mode, temporarily intercept stdout to suppress the warning
85
85
  if (json) {
86
86
  const originalStdoutWrite = process.stdout.write;
@@ -375,9 +375,9 @@ class Cloud extends core_1.Command {
375
375
  'content-type': 'application/json',
376
376
  'x-app-api-key': apiKey,
377
377
  },
378
- });
378
+ }, artifactsPath);
379
379
  this.log('\n');
380
- this.log('Test artifacts have been downloaded to ./artifacts.zip');
380
+ this.log(`Test artifacts have been downloaded to ${artifactsPath || './artifacts.zip'}`);
381
381
  }
382
382
  catch {
383
383
  this.warn('Failed to download artifacts');
@@ -11,6 +11,7 @@ export declare const flags: {
11
11
  async: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
12
  'device-locale': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
13
  'download-artifacts': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ 'artifacts-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
15
  env: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
16
  'exclude-flows': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
16
17
  'exclude-tags': import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
package/dist/constants.js CHANGED
@@ -59,6 +59,10 @@ exports.flags = {
59
59
  description: 'Download a zip containing the logs, screenshots and videos for each result in this run. You will debited a $0.01 egress fee for each result. Use --download-artifacts=FAILED for failures only or --download-artifacts=ALL for every result.',
60
60
  options: ['ALL', 'FAILED'],
61
61
  }),
62
+ 'artifacts-path': core_1.Flags.string({
63
+ description: 'Custom file path for downloaded artifacts (default: ./artifacts.zip)',
64
+ dependsOn: ['download-artifacts'],
65
+ }),
62
66
  env: core_1.Flags.file({
63
67
  char: 'e',
64
68
  description: 'One or more environment variables to inject into your flows',
package/dist/methods.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare const typeSafePost: <T extends keyof paths>(baseUrl: string, path
8
8
  export declare const typeSafePostDownload: (baseUrl: string, path: string, init?: {
9
9
  body?: BodyInit;
10
10
  headers?: HeadersInit;
11
- }) => Promise<void>;
11
+ }, artifactsPath?: string) => Promise<void>;
12
12
  export declare const typeSafeGet: <T extends keyof paths>(baseUrl: string, path: string, init?: {
13
13
  body?: FormData;
14
14
  headers?: HeadersInit;
package/dist/methods.js CHANGED
@@ -18,6 +18,8 @@ const StreamZip = require("node-stream-zip");
18
18
  const plist_1 = require("plist");
19
19
  const node_crypto_1 = require("node:crypto");
20
20
  const path = require("path");
21
+ const node_path_1 = require("node:path");
22
+ const os = require("node:os");
21
23
  const cloud_1 = require("./commands/cloud");
22
24
  const PERMITTED_EXTENSIONS = new Set([
23
25
  'yml',
@@ -40,7 +42,7 @@ const typeSafePost = async (baseUrl, path, init) => {
40
42
  return res.json();
41
43
  };
42
44
  exports.typeSafePost = typeSafePost;
43
- const typeSafePostDownload = async (baseUrl, path, init) => {
45
+ const typeSafePostDownload = async (baseUrl, path, init, artifactsPath) => {
44
46
  const res = await fetch(baseUrl + path, {
45
47
  ...init,
46
48
  method: 'POST',
@@ -48,7 +50,25 @@ const typeSafePostDownload = async (baseUrl, path, init) => {
48
50
  if (!res.ok) {
49
51
  throw new Error(await res.text());
50
52
  }
51
- const fileStream = (0, node_fs_1.createWriteStream)('./artifacts.zip', { flags: 'wx' });
53
+ let outputPath = artifactsPath || './artifacts.zip';
54
+ // Handle tilde expansion for home directory
55
+ if (outputPath.startsWith('~/') || outputPath === '~') {
56
+ outputPath = outputPath.replace(/^~(?=$|\/|\\)/, os.homedir());
57
+ }
58
+ // Create directory structure if it doesn't exist
59
+ const directory = (0, node_path_1.dirname)(outputPath);
60
+ if (directory !== '.') {
61
+ try {
62
+ (0, node_fs_1.mkdirSync)(directory, { recursive: true });
63
+ }
64
+ catch (error) {
65
+ // Ignore if directory already exists
66
+ if (error.code !== 'EEXIST') {
67
+ throw error;
68
+ }
69
+ }
70
+ }
71
+ const fileStream = (0, node_fs_1.createWriteStream)(outputPath, { flags: 'wx' });
52
72
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
73
  await (0, promises_2.finished)(node_stream_1.Readable.fromWeb(res.body).pipe(fileStream));
54
74
  };
@@ -138,6 +138,16 @@
138
138
  ],
139
139
  "type": "option"
140
140
  },
141
+ "artifacts-path": {
142
+ "dependsOn": [
143
+ "download-artifacts"
144
+ ],
145
+ "description": "Custom file path for downloaded artifacts (default: ./artifacts.zip)",
146
+ "name": "artifacts-path",
147
+ "hasDynamicHelp": false,
148
+ "multiple": false,
149
+ "type": "option"
150
+ },
141
151
  "env": {
142
152
  "char": "e",
143
153
  "description": "One or more environment variables to inject into your flows",
@@ -483,5 +493,5 @@
483
493
  ]
484
494
  }
485
495
  },
486
- "version": "3.5.0"
496
+ "version": "3.5.1"
487
497
  }
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.5.0",
83
+ "version": "3.5.1",
84
84
  "bugs": {
85
85
  "url": "https://discord.gg/gm3mJwcNw8"
86
86
  },