@devicecloud.dev/dcd 0.0.1-alpha.0 → 0.0.1-alpha.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.
package/README.md CHANGED
@@ -5,14 +5,14 @@ One line swap out for Maestro Cloud
5
5
 
6
6
  Install:
7
7
  ```sh-session
8
- $ npm install -g @devicecloud/dcd
8
+ $ npm install -g @devicecloud.dev/dcd
9
9
  ```
10
10
 
11
11
  Use:
12
- ```sh
12
+ ```sh-session
13
13
  # maestro cloud --apiKey <apiKey> <appFile> .myFlows/
14
14
 
15
- dcd cloud --apiKey <apiKey> <appFile> .myFlows/
15
+ $ dcd cloud --apiKey <apiKey> <appFile> .myFlows/
16
16
  ```
17
17
 
18
18
  See full documentation: [Docs](https://docs.devicecloud.dev)
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
+ const archiver = require("archiver");
5
+ const node_fs_1 = require("node:fs");
4
6
  const promises_1 = require("node:fs/promises");
5
7
  const mimeTypeLookupByExtension = {
6
8
  apk: 'application/vnd.android.package-archive',
@@ -14,6 +16,18 @@ const typeSafeFetch = async (baseUrl, path, init) => {
14
16
  }
15
17
  return res.json();
16
18
  };
19
+ const compress = async (zipTargetPath, sourceDir) => {
20
+ const output = (0, node_fs_1.createWriteStream)(zipTargetPath);
21
+ const archive = archiver('zip', {
22
+ zlib: { level: 9 },
23
+ });
24
+ archive.on('error', (err) => {
25
+ throw err;
26
+ });
27
+ archive.pipe(output);
28
+ archive.directory(sourceDir, false);
29
+ await archive.finalize();
30
+ };
17
31
  class Cloud extends core_1.Command {
18
32
  static args = {
19
33
  firstFile: core_1.Args.string({
@@ -103,12 +117,16 @@ class Cloud extends core_1.Command {
103
117
  finalBinaryId = binaryId;
104
118
  }
105
119
  const testFormData = new FormData();
106
- const blob = new Blob([await (0, promises_1.readFile)(flowFile)], {
107
- type: mimeTypeLookupByExtension[flowFile.split('.').pop()],
120
+ const flowFileDirectory = flowFile.split('/').slice(0, -1).join('/');
121
+ const yamlFileName = flowFile.split('/').pop();
122
+ console.log({ flowFileDirectory, yamlFileName });
123
+ await compress('flows.zip', flowFileDirectory);
124
+ const blob = new Blob([await (0, promises_1.readFile)('flows.zip')], {
125
+ type: mimeTypeLookupByExtension.zip,
108
126
  });
109
- testFormData.set('file', blob, flowFile);
127
+ testFormData.set('file', blob, 'flowFile.zip');
110
128
  testFormData.set('appBinaryId', finalBinaryId);
111
- testFormData.set('testFileName', flowFile);
129
+ testFormData.set('testFileName', yamlFileName);
112
130
  for (const [key, value] of Object.entries(rest)) {
113
131
  if (value) {
114
132
  testFormData.set(key, value);
@@ -109,5 +109,5 @@
109
109
  ]
110
110
  }
111
111
  },
112
- "version": "0.0.1-alpha.0"
112
+ "version": "0.0.1-alpha.1"
113
113
  }
package/package.json CHANGED
@@ -10,12 +10,14 @@
10
10
  "@oclif/plugin-not-found": "^3.0.10",
11
11
  "@oclif/plugin-plugins": "^4",
12
12
  "@oclif/plugin-update": "^4.1.11",
13
- "@oclif/plugin-warn-if-update-available": "^3.0.10"
13
+ "@oclif/plugin-warn-if-update-available": "^3.0.10",
14
+ "archiver": "^6.0.1"
14
15
  },
15
16
  "description": "Better cloud maestro testing",
16
17
  "devDependencies": {
17
18
  "@oclif/prettier-config": "^0.2.1",
18
19
  "@oclif/test": "^3",
20
+ "@types/archiver": "^6.0.2",
19
21
  "@types/chai": "^4",
20
22
  "@types/mocha": "^9.0.0",
21
23
  "chai": "^4",
@@ -68,15 +70,17 @@
68
70
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
69
71
  "version": "oclif readme && git add README.md"
70
72
  },
71
- "version": "0.0.1-alpha.0",
73
+ "version": "0.0.1-alpha.1",
72
74
  "bugs": {
73
75
  "url": "https://discord.gg/GzZBHcUJ"
74
76
  },
75
77
  "keywords": [
76
- "oclif"
78
+ "devicecloud",
79
+ "devicecloud.dev",
80
+ "dcd",
81
+ "cloud",
82
+ "maestro",
83
+ "testing"
77
84
  ],
78
- "types": "dist/index.d.ts",
79
- "directories": {
80
- "test": "test"
81
- }
82
- }
85
+ "types": "dist/index.d.ts"
86
+ }