runcloud 0.1.23 → 0.1.24
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/dist/commands/desktop.js +11 -6
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/desktop.js
CHANGED
|
@@ -2,19 +2,20 @@ import { execFileSync } from 'node:child_process';
|
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
const DESKTOP_RUN_START_URL = 'http://127.0.0.1:4500/run/start';
|
|
5
|
-
export function desktopRunUrl(project, mode, start = true) {
|
|
5
|
+
export function desktopRunUrl(project, mode, start = true, platform = 'ios') {
|
|
6
6
|
const url = new URL('newly://run');
|
|
7
7
|
url.searchParams.set('project', resolve(project));
|
|
8
8
|
url.searchParams.set('mode', mode);
|
|
9
|
+
url.searchParams.set('platform', platform);
|
|
9
10
|
url.searchParams.set('start', start ? '1' : '0');
|
|
10
11
|
url.searchParams.set('request', randomUUID());
|
|
11
12
|
return url.toString();
|
|
12
13
|
}
|
|
13
|
-
export async function startDesktopRun(project, mode, fetchImpl = fetch) {
|
|
14
|
+
export async function startDesktopRun(project, mode, platform = 'ios', fetchImpl = fetch) {
|
|
14
15
|
const response = await fetchImpl(DESKTOP_RUN_START_URL, {
|
|
15
16
|
method: 'POST',
|
|
16
17
|
headers: { 'content-type': 'application/json' },
|
|
17
|
-
body: JSON.stringify({ cwd: resolve(project), key: 'default', mode }),
|
|
18
|
+
body: JSON.stringify({ cwd: resolve(project), key: 'default', mode, platform }),
|
|
18
19
|
});
|
|
19
20
|
if (response.ok)
|
|
20
21
|
return;
|
|
@@ -33,14 +34,18 @@ export function registerDesktop(program) {
|
|
|
33
34
|
const desktop = program.command('desktop').description('Control the Newly desktop app');
|
|
34
35
|
desktop
|
|
35
36
|
.command('run')
|
|
37
|
+
.alias('simulator')
|
|
36
38
|
.requiredOption('--project <path>', 'local Expo project directory')
|
|
37
39
|
.option('--mode <mode>', 'simulator mode: local or remote', 'local')
|
|
40
|
+
.option('--platform <platform>', 'simulator platform: ios or android', 'ios')
|
|
38
41
|
.action(async (opts) => {
|
|
39
42
|
if (opts.mode !== 'local' && opts.mode !== 'remote')
|
|
40
43
|
throw new Error('--mode must be local or remote');
|
|
41
|
-
|
|
44
|
+
if (opts.platform !== 'ios' && opts.platform !== 'android')
|
|
45
|
+
throw new Error('--platform must be ios or android');
|
|
46
|
+
const url = desktopRunUrl(opts.project, opts.mode, false, opts.platform);
|
|
42
47
|
openDesktopUrl(url);
|
|
43
|
-
await startDesktopRun(opts.project, opts.mode);
|
|
44
|
-
console.log(`Opened Newly and started the ${opts.mode} simulator run for ${resolve(opts.project)}`);
|
|
48
|
+
await startDesktopRun(opts.project, opts.mode, opts.platform);
|
|
49
|
+
console.log(`Opened Newly and started the ${opts.mode} ${opts.platform} simulator run for ${resolve(opts.project)}`);
|
|
45
50
|
});
|
|
46
51
|
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.1.
|
|
1
|
+
export const CLI_VERSION = '0.1.24';
|