@capawesome/cli 4.17.2 → 4.18.0-dev.9810ff51.1785743282
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/CHANGELOG.md +16 -0
- package/dist/commands/apps/automations/create.js +141 -0
- package/dist/commands/apps/automations/create.test.js +162 -0
- package/dist/commands/apps/automations/delete.js +66 -0
- package/dist/commands/apps/automations/delete.test.js +127 -0
- package/dist/commands/apps/automations/get.js +62 -0
- package/dist/commands/apps/automations/get.test.js +118 -0
- package/dist/commands/apps/automations/list.js +46 -0
- package/dist/commands/apps/automations/list.test.js +92 -0
- package/dist/commands/apps/automations/update.js +118 -0
- package/dist/commands/apps/automations/update.test.js +124 -0
- package/dist/commands/apps/builds/create.js +31 -1
- package/dist/commands/apps/builds/create.test.js +15 -0
- package/dist/commands/apps/builds/run.js +265 -0
- package/dist/commands/apps/configurations/create.js +51 -0
- package/dist/commands/apps/configurations/create.test.js +120 -0
- package/dist/commands/apps/configurations/delete.js +61 -0
- package/dist/commands/apps/configurations/delete.test.js +112 -0
- package/dist/commands/apps/configurations/get.js +65 -0
- package/dist/commands/apps/configurations/get.test.js +119 -0
- package/dist/commands/apps/configurations/list.js +39 -0
- package/dist/commands/apps/configurations/list.test.js +94 -0
- package/dist/commands/apps/configurations/update.js +61 -0
- package/dist/commands/apps/configurations/update.test.js +122 -0
- package/dist/commands/apps/import.js +419 -0
- package/dist/commands/apps/import.test.js +308 -0
- package/dist/index.js +13 -0
- package/dist/services/app-automations.js +64 -0
- package/dist/services/app-configurations.js +77 -0
- package/dist/types/app-automation.js +1 -0
- package/dist/types/app-configuration.js +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/android-emulator.js +170 -0
- package/dist/utils/app-import.js +10 -0
- package/dist/utils/appflow-export.js +391 -0
- package/dist/utils/appflow-export.test.js +277 -0
- package/dist/utils/ios-simulator.js +57 -0
- package/dist/utils/zip.js +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getCodeFromUnknownError, UserError } from '../utils/error.js';
|
|
2
|
+
import { execFileSync } from 'child_process';
|
|
3
|
+
/**
|
|
4
|
+
* Find all available iOS simulators installed on this machine.
|
|
5
|
+
*/
|
|
6
|
+
export const findAllIosSimulators = () => {
|
|
7
|
+
const output = runSimctl(['list', 'devices', 'available', '--json']);
|
|
8
|
+
const devicesByRuntime = (JSON.parse(output).devices ?? {});
|
|
9
|
+
return Object.entries(devicesByRuntime)
|
|
10
|
+
.filter(([runtime]) => runtime.includes('iOS'))
|
|
11
|
+
.flatMap(([runtime, devices]) => devices.map((device) => ({
|
|
12
|
+
id: device.udid,
|
|
13
|
+
name: device.name,
|
|
14
|
+
running: device.state === 'Booted',
|
|
15
|
+
sdkVersion: getRuntimeVersion(runtime),
|
|
16
|
+
})));
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Boot an iOS simulator, wait until it has finished booting and bring it to the front.
|
|
20
|
+
*/
|
|
21
|
+
export const bootIosSimulator = (simulator) => {
|
|
22
|
+
runSimctl(['bootstatus', simulator.id, '-b']);
|
|
23
|
+
run('open', ['-a', 'Simulator'], 'open');
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Install an app bundle on a booted iOS simulator.
|
|
27
|
+
*/
|
|
28
|
+
export const installIosApp = (id, appPath) => {
|
|
29
|
+
runSimctl(['install', id, appPath]);
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Launch an app on a booted iOS simulator.
|
|
33
|
+
*/
|
|
34
|
+
export const launchIosApp = (id, packageName) => {
|
|
35
|
+
runSimctl(['launch', id, packageName]);
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Extract the version from a simulator runtime identifier (e.g. `18.2`).
|
|
39
|
+
*/
|
|
40
|
+
const getRuntimeVersion = (runtime) => {
|
|
41
|
+
const identifier = runtime.split('.').pop() ?? runtime;
|
|
42
|
+
const [, ...version] = identifier.split('-');
|
|
43
|
+
return version.join('.');
|
|
44
|
+
};
|
|
45
|
+
const runSimctl = (args) => run('xcrun', ['simctl', ...args], 'simctl');
|
|
46
|
+
const run = (command, args, toolName) => {
|
|
47
|
+
try {
|
|
48
|
+
return execFileSync(command, args, { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (getCodeFromUnknownError(error) === 'ENOENT') {
|
|
52
|
+
throw new UserError(`Could not find "${toolName}". Make sure Xcode is installed.`);
|
|
53
|
+
}
|
|
54
|
+
const stderr = error.stderr?.trim();
|
|
55
|
+
throw new UserError(stderr ? `The command "${toolName}" failed: ${stderr}` : `The command "${toolName}" failed.`);
|
|
56
|
+
}
|
|
57
|
+
};
|
package/dist/utils/zip.js
CHANGED
|
@@ -4,6 +4,10 @@ import { globby } from 'globby';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
const MAX_ZIP_ENTRIES = 65535;
|
|
6
6
|
class ZipImpl {
|
|
7
|
+
async unzipToFolder(buffer, targetFolder) {
|
|
8
|
+
const zip = new AdmZip(buffer);
|
|
9
|
+
zip.extractAllTo(targetFolder, true);
|
|
10
|
+
}
|
|
7
11
|
async zipFolder(sourceFolder) {
|
|
8
12
|
const zip = new AdmZip();
|
|
9
13
|
zip.addLocalFolder(sourceFolder);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.0-dev.9810ff51.1785743282",
|
|
4
4
|
"description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@robingenz/zli": "0.2.0",
|
|
61
61
|
"@sentry/node": "10.58.0",
|
|
62
62
|
"adm-zip": "0.6.0",
|
|
63
|
-
"axios": "1.
|
|
63
|
+
"axios": "1.18.1",
|
|
64
64
|
"axios-retry": "4.5.0",
|
|
65
65
|
"c12": "3.3.3",
|
|
66
66
|
"consola": "3.3.0",
|