Skip to content

Commit 83e802f

Browse files
committed
make it run
1 parent 51c9462 commit 83e802f

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

packages/config/src/lib/config.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type PluginApi = {
4444
extraSources: string[];
4545
ignorePaths: string[];
4646
};
47-
getBundlerStart: () => ({ args: any }) => Promise<void>;
47+
getBundlerStart: () => ({ args }: { args: any }) => void;
4848
};
4949

5050
type PluginType = (args: PluginApi) => PluginOutput;
@@ -85,7 +85,7 @@ export type ConfigType = {
8585
plugins?: PluginType[];
8686
platforms?: Record<string, PlatformType>;
8787
commands?: Array<CommandType>;
88-
remoteCacheProvider?: null | 'github-actions' |(() => RemoteBuildCache);
88+
remoteCacheProvider?: null | 'github-actions' | (() => RemoteBuildCache);
8989
fingerprint?: {
9090
extraSources?: string[];
9191
ignorePaths?: string[];
@@ -175,6 +175,8 @@ export async function getConfig(
175175
process.exit(1);
176176
}
177177

178+
let bundler: BundlerPluginOutput | undefined;
179+
178180
const api = {
179181
registerCommand: (command: CommandType) => {
180182
validatedConfig.commands = [...(validatedConfig.commands || []), command];
@@ -200,21 +202,21 @@ export async function getConfig(
200202
},
201203
getBundlerStart:
202204
() =>
203-
({ args: any }) =>
204-
bundler?.start({
205+
({ args }: { args: any }) => {
206+
return bundler?.start({
205207
root: api.getProjectRoot(),
206208
args,
207209
reactNativeVersion: api.getReactNativeVersion(),
208210
reactNativePath: api.getReactNativePath(),
209211
platforms: api.getPlatforms(),
210-
}),
212+
});
213+
},
211214
};
212215

213216
const platforms: Record<string, PlatformOutput> = {};
214217
if (validatedConfig.platforms) {
215218
// platforms register commands and custom platform functionality (TBD)
216219
for (const platform in validatedConfig.platforms) {
217-
// @ts-expect-error tbd
218220
const platformOutput = validatedConfig.platforms[platform](api);
219221
platforms[platform] = platformOutput;
220222
}
@@ -231,7 +233,6 @@ export async function getConfig(
231233
// @ts-expect-error tbd
232234
bundler = assignOriginToCommand(
233235
validatedConfig.bundler,
234-
// @ts-expect-error tbd
235236
api,
236237
validatedConfig
237238
);
@@ -249,6 +250,8 @@ export async function getConfig(
249250
root: projectRoot,
250251
commands: validatedConfig.commands ?? [],
251252
platforms: platforms ?? {},
253+
// @ts-expect-error tbd
254+
bundler,
252255
...api,
253256
};
254257

packages/platform-android/src/lib/commands/runAndroid/runAndroid.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function runAndroid(
5555
reactNativeVersion: string;
5656
reactNativePath: string;
5757
platforms: Record<string, object>;
58-
}) => Promise<void>
58+
}) => void
5959
) {
6060
intro('Running Android app');
6161

@@ -84,6 +84,18 @@ export async function runAndroid(
8484
}
8585
}
8686

87+
logger.info('Starting dev server...');
88+
startDevServer({
89+
root: projectRoot,
90+
reactNativePath: './node_modules/react-native',
91+
reactNativeVersion: '0.79',
92+
platforms: { ios: {}, android: {} },
93+
args: {
94+
interactive: isInteractive(),
95+
clientLogs: true,
96+
},
97+
});
98+
8799
if (device) {
88100
if (!(await getDevices()).find((d) => d === device.deviceId)) {
89101
// deviceId is undefined until it's launched, hence overwriting it here
@@ -105,14 +117,6 @@ export async function runAndroid(
105117
await tryLaunchEmulator();
106118
}
107119
}
108-
console.log('xd');
109-
startDevServer({
110-
root: projectRoot,
111-
reactNativePath: './node_modules/react-native',
112-
reactNativeVersion: '0.79',
113-
platforms: { ios: {}, android: {} },
114-
args,
115-
});
116120

117121
await runGradle({ tasks, androidProject, args });
118122

0 commit comments

Comments
 (0)