Skip to content

Commit fc45adc

Browse files
Merge branch 'react-native-community:main' into fix/destination-buildproject
2 parents 754bd48 + 9147b97 commit fc45adc

File tree

22 files changed

+184
-83
lines changed

22 files changed

+184
-83
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Our release cycle is independent of `react-native`. We follow semver and here is
2323

2424
| `@react-native-community/cli` | `react-native` |
2525
| ------------------------------------------------------------------ | ------------------------- |
26-
| [^20.0.0](https://github.com/react-native-community/cli/tree/main) | ^0.81.0 |
26+
| [^20.0.0](https://github.com/react-native-community/cli/tree/main) | ^0.81.0, ^0.82.0 |
2727
| [^19.0.0](https://github.com/react-native-community/cli/tree/19.x) | ^0.80.0 |
2828
| [^18.0.0](https://github.com/react-native-community/cli/tree/18.x) | ^0.79.0 |
2929
| [^15.0.0](https://github.com/react-native-community/cli/tree/15.x) | ^0.76.0, ^0.77.0, ^0.78.0 |

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "20.0.1",
2+
"version": "20.0.2",
33
"npmClient": "yarn",
44
"exact": true,
55
"$schema": "node_modules/lerna/schemas/lerna-schema.json"

packages/cli-clean/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@react-native-community/cli-clean",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"main": "build/index.js",
66
"publishConfig": {
77
"access": "public"
88
},
99
"types": "build/index.d.ts",
1010
"dependencies": {
11-
"@react-native-community/cli-tools": "20.0.1",
11+
"@react-native-community/cli-tools": "20.0.2",
1212
"chalk": "^4.1.2",
1313
"execa": "^5.0.0",
1414
"fast-glob": "^3.3.2"
@@ -19,7 +19,7 @@
1919
"!*.map"
2020
],
2121
"devDependencies": {
22-
"@react-native-community/cli-types": "20.0.1",
22+
"@react-native-community/cli-types": "20.0.2",
2323
"@types/prompts": "^2.4.4"
2424
},
2525
"homepage": "https://github.com/react-native-community/cli/tree/main/packages/cli-clean",

packages/cli-config-android/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@react-native-community/cli-config-android",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"main": "build/index.js",
66
"publishConfig": {
77
"access": "public"
88
},
99
"dependencies": {
10-
"@react-native-community/cli-tools": "20.0.1",
10+
"@react-native-community/cli-tools": "20.0.2",
1111
"chalk": "^4.1.2",
1212
"fast-glob": "^3.3.2",
1313
"fast-xml-parser": "^4.4.1"
@@ -19,7 +19,7 @@
1919
"native_modules.gradle"
2020
],
2121
"devDependencies": {
22-
"@react-native-community/cli-types": "20.0.1"
22+
"@react-native-community/cli-types": "20.0.2"
2323
},
2424
"homepage": "https://github.com/react-native-community/cli/tree/main/packages/cli-config-android",
2525
"repository": {

packages/cli-config-apple/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"name": "@react-native-community/cli-config-apple",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"main": "build/index.js",
66
"publishConfig": {
77
"access": "public"
88
},
99
"dependencies": {
10-
"@react-native-community/cli-tools": "20.0.1",
10+
"@react-native-community/cli-tools": "20.0.2",
1111
"chalk": "^4.1.2",
1212
"execa": "^5.0.0",
1313
"fast-glob": "^3.3.2"
1414
},
1515
"devDependencies": {
16-
"@react-native-community/cli-types": "20.0.1",
16+
"@react-native-community/cli-types": "20.0.2",
1717
"ora": "^5.4.1"
1818
},
1919
"files": [

packages/cli-config/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@react-native-community/cli-config",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"main": "build/index.js",
66
"publishConfig": {
77
"access": "public"
88
},
99
"types": "build/index.d.ts",
1010
"dependencies": {
11-
"@react-native-community/cli-tools": "20.0.1",
11+
"@react-native-community/cli-tools": "20.0.2",
1212
"chalk": "^4.1.2",
1313
"cosmiconfig": "^9.0.0",
1414
"deepmerge": "^4.3.0",
@@ -21,7 +21,7 @@
2121
"!*.map"
2222
],
2323
"devDependencies": {
24-
"@react-native-community/cli-types": "20.0.1",
24+
"@react-native-community/cli-types": "20.0.2",
2525
"@types/cosmiconfig": "^5.0.3"
2626
},
2727
"homepage": "https://github.com/react-native-community/cli/tree/main/packages/cli-config",

packages/cli-doctor/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "@react-native-community/cli-doctor",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"main": "build/index.js",
66
"publishConfig": {
77
"access": "public"
88
},
99
"types": "build/index.d.ts",
1010
"dependencies": {
11-
"@react-native-community/cli-config": "20.0.1",
12-
"@react-native-community/cli-platform-android": "20.0.1",
13-
"@react-native-community/cli-platform-apple": "20.0.1",
14-
"@react-native-community/cli-platform-ios": "20.0.1",
15-
"@react-native-community/cli-tools": "20.0.1",
11+
"@react-native-community/cli-config": "20.0.2",
12+
"@react-native-community/cli-platform-android": "20.0.2",
13+
"@react-native-community/cli-platform-apple": "20.0.2",
14+
"@react-native-community/cli-platform-ios": "20.0.2",
15+
"@react-native-community/cli-tools": "20.0.2",
1616
"chalk": "^4.1.2",
1717
"command-exists": "^1.2.8",
1818
"deepmerge": "^4.3.0",
@@ -30,7 +30,7 @@
3030
"!*.map"
3131
],
3232
"devDependencies": {
33-
"@react-native-community/cli-types": "20.0.1",
33+
"@react-native-community/cli-types": "20.0.2",
3434
"@types/command-exists": "^1.2.0",
3535
"@types/envinfo": "^7.8.4",
3636
"@types/ip": "^1.1.0",

packages/cli-doctor/src/tools/healthchecks/__tests__/androidStudio.test.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,65 @@ describe('androidStudio', () => {
7474
}".`,
7575
);
7676
});
77+
78+
it('detects Android Studio in the fallback Windows installation path', async () => {
79+
// Make CLI think Android Studio was not found
80+
environmentInfo.IDEs['Android Studio'] = 'Not Found';
81+
// Force platform to win32 for the test
82+
// TODO: use cleaner jest.replaceProperty in jest 29+
83+
const originalPlatform = process.platform;
84+
Object.defineProperty(process, 'platform', {
85+
value: 'win32',
86+
writable: true,
87+
configurable: true,
88+
});
89+
90+
// First WMIC (primary) returns empty, second (fallback) returns version
91+
(execa as unknown as jest.Mock)
92+
.mockResolvedValueOnce({stdout: ''})
93+
.mockResolvedValueOnce({stdout: '4.2.1.0'});
94+
95+
const diagnostics = await androidStudio.getDiagnostics(environmentInfo);
96+
97+
expect(diagnostics.needsToBeFixed).toBe(false);
98+
expect(diagnostics.version).toBe('4.2.1.0');
99+
100+
// Restore original platform
101+
// TODO: use cleaner mockRestore in jest 29+
102+
Object.defineProperty(process, 'platform', {
103+
value: originalPlatform,
104+
writable: true,
105+
configurable: true,
106+
});
107+
});
108+
109+
it('detects when Android Studio is also not in fallback installation path', async () => {
110+
// Make CLI think Android Studio was not found
111+
environmentInfo.IDEs['Android Studio'] = 'Not Found';
112+
// Force the platform to win32 for the test
113+
// TODO: use cleaner jest.replaceProperty in jest 29+
114+
const originalPlatform = process.platform;
115+
Object.defineProperty(process, 'platform', {
116+
value: 'win32',
117+
writable: true,
118+
configurable: true,
119+
});
120+
121+
// First WMIC (primary) returns empty, second (fallback) returns version
122+
(execa as unknown as jest.Mock)
123+
.mockResolvedValueOnce({stdout: ''})
124+
.mockResolvedValueOnce({stdout: ''});
125+
126+
const diagnostics = await androidStudio.getDiagnostics(environmentInfo);
127+
128+
expect(diagnostics.needsToBeFixed).toBe(true);
129+
130+
// Restore original platform
131+
// TODO: use cleaner mockRestore in jest 29+
132+
Object.defineProperty(process, 'platform', {
133+
value: originalPlatform,
134+
writable: true,
135+
configurable: true,
136+
});
137+
});
77138
});

packages/cli-doctor/src/tools/healthchecks/androidStudio.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,43 @@ export default {
2424
if (needsToBeFixed && process.platform === 'win32') {
2525
const archSuffix = process.arch === 'x64' ? '64' : '';
2626

27-
const androidStudioPath = join(
27+
// Check if Android Studio is installed in one of its default locations
28+
const primaryAndroidStudioPath = join(
2829
getUserAndroidPath(),
2930
'android-studio',
3031
'bin',
3132
`studio${archSuffix}.exe`,
3233
).replace(/\\/g, '\\\\');
3334
const {stdout} = await executeCommand(
34-
`wmic datafile where name="${androidStudioPath}" get Version`,
35+
`wmic datafile where name="${primaryAndroidStudioPath}" get Version`,
3536
);
36-
const version = stdout.replace(/(\r\n|\n|\r)/gm, '').trim();
37+
let version = stdout.replace(/(\r\n|\n|\r)/gm, '').trim();
38+
39+
if (version !== '') {
40+
return {
41+
needsToBeFixed: false,
42+
version,
43+
};
44+
}
45+
46+
// 2) fallback path under %LOCALAPPDATA%\Programs\Android Studio
47+
// This is the path used by the JetBrains Toolbox / Android Studio installer
48+
const altBase = process.env.LOCALAPPDATA || '';
49+
const fallbackPath = join(
50+
altBase,
51+
'Programs',
52+
'Android Studio',
53+
'bin',
54+
`studio${archSuffix}.exe`,
55+
).replace(/\\/g, '\\\\');
56+
try {
57+
const {stdout} = await executeCommand(
58+
`wmic datafile where name="${fallbackPath}" get Version`,
59+
);
60+
version = stdout.replace(/(\r\n|\n|\r)/gm, '').trim();
61+
} catch {
62+
version = '';
63+
}
3764

3865
if (version === '') {
3966
return missing;

packages/cli-link-assets/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "@react-native-community/cli-link-assets",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"main": "build/index.js",
66
"publishConfig": {
77
"access": "public"
88
},
99
"types": "build/index.d.ts",
1010
"dependencies": {
11-
"@react-native-community/cli-config": "20.0.1",
12-
"@react-native-community/cli-platform-android": "20.0.1",
13-
"@react-native-community/cli-platform-apple": "20.0.1",
14-
"@react-native-community/cli-platform-ios": "20.0.1",
15-
"@react-native-community/cli-tools": "20.0.1",
11+
"@react-native-community/cli-config": "20.0.2",
12+
"@react-native-community/cli-platform-android": "20.0.2",
13+
"@react-native-community/cli-platform-apple": "20.0.2",
14+
"@react-native-community/cli-platform-ios": "20.0.2",
15+
"@react-native-community/cli-tools": "20.0.2",
1616
"chalk": "^4.1.2",
1717
"fast-glob": "^3.3.2",
1818
"fast-xml-parser": "^4.4.1",
@@ -26,7 +26,7 @@
2626
"!*.map"
2727
],
2828
"devDependencies": {
29-
"@react-native-community/cli-types": "20.0.1",
29+
"@react-native-community/cli-types": "20.0.2",
3030
"@types/plist": "^3.0.5",
3131
"type-fest": "^4.10.2"
3232
},

0 commit comments

Comments
 (0)