@devicecloud.dev/dcd 0.0.1 → 0.0.3

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.
@@ -59,27 +59,33 @@ const compressDir = async (sourceDir) => {
59
59
  archive.on('error', (err) => {
60
60
  throw err;
61
61
  });
62
- archive.directory(sourceDir, false, (data) => {
62
+ archive.directory(sourceDir, '.', (data) => {
63
+ if (data.name.split('/')[0] === 'node_modules')
64
+ return false;
63
65
  if (PERMITTED_EXTENSIONS.has(data.name.split('.').pop())) {
64
66
  return data;
65
67
  }
66
68
  return false;
67
69
  });
68
70
  const buffer = await toBuffer(archive);
69
- return buffer;
70
- };
71
- const compressFile = async (sourceFile) => {
72
- const archive = archiver('zip', {
73
- zlib: { level: 9 },
74
- });
75
- archive.on('error', (err) => {
76
- throw err;
77
- });
78
- archive.file(sourceFile, { name: sourceFile });
79
- const buffer = await toBuffer(archive);
80
71
  // await writeFile('./my-zip.zip', buffer);
81
72
  return buffer;
82
73
  };
74
+ // const compressFile = async (sourceFile: string) => {
75
+ // const archive = archiver('zip', {
76
+ // zlib: { level: 9 },
77
+ // });
78
+ // archive.on('error', (err) => {
79
+ // throw err;
80
+ // });
81
+ // console.log(sourceFile, sourceFile.split('/').pop());
82
+ // archive.file(sourceFile.includes('/') ? sourceFile : './' + sourceFile, {
83
+ // name: sourceFile.split('/').pop()!,
84
+ // });
85
+ // const buffer = await toBuffer(archive);
86
+ // await writeFile('./my-file-zip.zip', buffer);
87
+ // return buffer;
88
+ // };
83
89
  var EiOSDevices;
84
90
  (function (EiOSDevices) {
85
91
  EiOSDevices["ipad-pro-6th-gen"] = "ipad-pro-6th-gen";
@@ -325,9 +331,14 @@ class Cloud extends core_1.Command {
325
331
  acc[key] = value;
326
332
  return acc;
327
333
  }, {});
328
- const buffer = [...sequentialFlows, ...testFileNames]?.length > 1
329
- ? await compressDir(flowFile.split('/').slice(0, -1).join('/'))
330
- : await compressFile(flowFile);
334
+ const path = flowFile.split('/').slice(0, -1).join('/');
335
+ const buffer = await compressDir(path?.length ? path : './');
336
+ // const buffer =
337
+ // totalFlowFiles > 1 || flowFile?.endsWith('/')
338
+ // ? await compressDir(
339
+ // flowFile!.split('/').slice(0, -1).join('/') ?? '.',
340
+ // )
341
+ // : await compressFile(flowFile!);
331
342
  const blob = new Blob([buffer], {
332
343
  type: mimeTypeLookupByExtension.zip,
333
344
  });
@@ -386,9 +397,9 @@ class Cloud extends core_1.Command {
386
397
  clearInterval(intervalId);
387
398
  (0, errors_1.error)('No results found');
388
399
  }
389
- core_1.ux.action.status = '\nStatus | Test\n─────────── ───────────────';
400
+ core_1.ux.action.status = '\nStatus Test\n─────────── ───────────────';
390
401
  for (const { status, test_file_name: test } of updatedResults) {
391
- core_1.ux.action.status += `\n${status.padEnd(10, ' ')} | ${test}`;
402
+ core_1.ux.action.status += `\n${status.padEnd(10, ' ')} ${test}`;
392
403
  }
393
404
  if (updatedResults.every((result) => !['PENDING', 'RUNNING'].includes(result.status))) {
394
405
  core_1.ux.action.stop('completed');
@@ -400,7 +411,8 @@ class Cloud extends core_1.Command {
400
411
  (0, cli_ux_1.info)('\n');
401
412
  clearInterval(intervalId);
402
413
  if (updatedResults.some((result) => result.status === 'FAILED')) {
403
- (0, cli_ux_1.exit)(1);
414
+ // eslint-disable-next-line no-process-exit, unicorn/no-process-exit
415
+ process.exit(2);
404
416
  }
405
417
  }
406
418
  }, 5000);
package/dist/plan.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  interface IExecutionPlan {
2
2
  flowsToRun: string[];
3
3
  sequence?: IFlowSequence | null;
4
+ totalFlowFiles: number;
4
5
  }
5
6
  interface IFlowSequence {
6
7
  continueOnFailure?: boolean;
package/dist/plan.js CHANGED
@@ -68,7 +68,7 @@ async function plan(input, includeTags, excludeTags) {
68
68
  throw new Error(`Flow path does not exist: ${path.resolve(input)}`);
69
69
  }
70
70
  if (fs.lstatSync(input).isFile()) {
71
- return { flowsToRun: [input] };
71
+ return { flowsToRun: [input.split('/').pop() ?? input], totalFlowFiles: 1 };
72
72
  }
73
73
  let unfilteredFlowFiles = await walk(input, isFlowFile);
74
74
  if (unfilteredFlowFiles.length === 0) {
@@ -147,6 +147,7 @@ async function plan(input, includeTags, excludeTags) {
147
147
  continueOnFailure: workspaceConfig.executionOrder?.continueOnFailure,
148
148
  flows: flowsToRunInSequence,
149
149
  },
150
+ totalFlowFiles: unfilteredFlowFiles.length,
150
151
  };
151
152
  }
152
153
  exports.plan = plan;
@@ -220,5 +220,5 @@
220
220
  ]
221
221
  }
222
222
  },
223
- "version": "0.0.1"
223
+ "version": "0.0.3"
224
224
  }
package/package.json CHANGED
@@ -72,9 +72,9 @@
72
72
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
73
73
  "version": "oclif readme && git add README.md"
74
74
  },
75
- "version": "0.0.1",
75
+ "version": "0.0.3",
76
76
  "bugs": {
77
- "url": "https://discord.gg/GzZBHcUJ"
77
+ "url": "https://discord.gg/gm3mJwcNw8"
78
78
  },
79
79
  "keywords": [
80
80
  "devicecloud",
@@ -85,4 +85,4 @@
85
85
  "testing"
86
86
  ],
87
87
  "types": "dist/index.d.ts"
88
- }
88
+ }