Skip to content

Commit 7b88962

Browse files
Merge branch 'main' into nitro-view
2 parents fa24990 + 23f5ac7 commit 7b88962

File tree

8 files changed

+73
-53
lines changed

8 files changed

+73
-53
lines changed

docs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.6.1](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.6.1) (2025-04-02)
7+
8+
### Bug Fixes
9+
10+
- remove resolvePackageJsonImports: false since Metro supports it from 0.82.0 ([7ac5d1a](https://github.com/callstack/react-native-builder-bob/commit/7ac5d1a93f1a2f154eefa4aa5bde06e6f5b6b249)) - by @satya164
11+
612
# [0.6.0](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.6.0) (2025-03-29)
713

814
### Features

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docs",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"private": true,
55
"description": "Documentation for react-native-builder-bob",
66
"scripts": {

packages/create-react-native-library/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.49.1](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.49.1) (2025-04-02)
7+
8+
### Bug Fixes
9+
10+
- remove resolvePackageJsonImports: false since Metro supports it from 0.82.0 ([7ac5d1a](https://github.com/callstack/react-native-builder-bob/commit/7ac5d1a93f1a2f154eefa4aa5bde06e6f5b6b249)) - by @satya164
11+
612
# [0.49.0](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.49.0) (2025-03-29)
713

814
### Bug Fixes

packages/create-react-native-library/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-react-native-library",
3-
"version": "0.49.0",
3+
"version": "0.49.1",
44
"description": "CLI to scaffold React Native libraries",
55
"keywords": [
66
"react-native",

packages/react-native-builder-bob/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.39.1](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.39.1) (2025-04-02)
7+
8+
### Bug Fixes
9+
10+
- promisify the workers in bob ([c1b49c9](https://github.com/callstack/react-native-builder-bob/commit/c1b49c934261b0762722aec05db389d5b10667f0)) - by @satya164
11+
612
# [0.39.0](https://github.com/callstack/react-native-builder-bob/compare/[email protected]@0.39.0) (2025-03-29)
713

814
### Bug Fixes

packages/react-native-builder-bob/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-builder-bob",
3-
"version": "0.39.0",
3+
"version": "0.39.1",
44
"description": "CLI to build JavaScript files for React Native libraries",
55
"keywords": [
66
"react-native",

packages/react-native-builder-bob/src/build.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export async function build(argv: Argv) {
8888
};
8989

9090
if (argv.target != null) {
91-
buildTarget({
91+
await buildTarget({
9292
root,
9393
target: argv.target,
9494
source,
@@ -98,17 +98,19 @@ export async function build(argv: Argv) {
9898
variants,
9999
});
100100
} else {
101-
for (const target of options.targets!) {
102-
buildTarget({
103-
root,
104-
target,
105-
source,
106-
output,
107-
exclude,
108-
options,
109-
variants,
110-
});
111-
}
101+
await Promise.all(
102+
options.targets?.map((target) =>
103+
buildTarget({
104+
root,
105+
target,
106+
source,
107+
output,
108+
exclude,
109+
options,
110+
variants,
111+
})
112+
)
113+
);
112114
}
113115
}
114116

packages/react-native-builder-bob/src/utils/workerize.ts

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import kleur from 'kleur';
21
import {
32
Worker,
43
isMainThread,
@@ -33,42 +32,46 @@ export const run = async <T extends Target>(
3332
throw new Error('Worker can only be run from the main thread');
3433
}
3534

36-
const worker = new Worker(__filename, {
37-
workerData: {
38-
target,
39-
data,
40-
} satisfies WorkerData<T>,
41-
env: {
42-
...process.env,
43-
FORCE_COLOR: process.stdout.isTTY ? '1' : '0',
44-
},
45-
});
35+
return new Promise<void>((resolve, reject) => {
36+
const worker = new Worker(__filename, {
37+
workerData: {
38+
target,
39+
data,
40+
} satisfies WorkerData<T>,
41+
env: {
42+
...process.env,
43+
FORCE_COLOR: process.stdout.isTTY ? '1' : '0',
44+
},
45+
});
4646

47-
worker.on('message', (message) => {
48-
switch (message.type) {
49-
case 'info':
50-
report.info(message.message);
51-
break;
52-
case 'warn':
53-
report.warn(message.message);
54-
break;
55-
case 'error':
56-
report.error(message.message);
57-
break;
58-
case 'success':
59-
report.success(message.message);
60-
break;
61-
}
62-
});
47+
worker.on('message', (message) => {
48+
switch (message.type) {
49+
case 'info':
50+
report.info(message.message);
51+
break;
52+
case 'warn':
53+
report.warn(message.message);
54+
break;
55+
case 'error':
56+
report.error(message.message);
57+
break;
58+
case 'success':
59+
report.success(message.message);
60+
break;
61+
}
62+
});
6363

64-
worker.on('error', (error) => {
65-
report.error(error.message);
66-
});
64+
worker.on('error', (error) => {
65+
reject(error);
66+
});
6767

68-
worker.on('exit', (code) => {
69-
if (code !== 0) {
70-
report.error(`exited with code ${kleur.red(code)}`);
71-
}
68+
worker.on('exit', (code) => {
69+
if (code !== 0) {
70+
reject(new Error(`Worker exited with code ${code}`));
71+
} else {
72+
resolve();
73+
}
74+
});
7275
});
7376
};
7477

@@ -84,10 +87,7 @@ if (!isMainThread) {
8487

8588
if (target in targets) {
8689
// @ts-expect-error - typescript doesn't support correlated union types https://github.com/microsoft/TypeScript/issues/30581
87-
targets[target]({ ...data, report }).catch((error) => {
88-
console.log(error);
89-
process.exit(1);
90-
});
90+
targets[target]({ ...data, report });
9191
} else {
9292
throw new Error(`Unknown target: ${target}`);
9393
}

0 commit comments

Comments
 (0)