Skip to content

Commit 082040f

Browse files
authored
fix: add support for react-native-windows 0.64 (#296)
1 parent 05e2700 commit 082040f

10 files changed

Lines changed: 81 additions & 55 deletions

File tree

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"react": "~16.8.6 || ~16.9.0 || ~16.11.0 || ~16.13.1 || ~17.0.1",
2020
"react-native": "^0.0.0-0 || ^0.60.6 || ^0.61.5 || ^0.62.2 || ^0.63.2 || ^0.64.0 || 1000.0.0",
2121
"react-native-macos": "^0.60.0 || ^0.61.0 || ^0.62.0 || ^0.63.0",
22-
"react-native-windows": "^0.62.0 || ^0.63.0"
22+
"react-native-windows": "^0.62.0 || ^0.63.0 || ^0.64.0"
2323
},
2424
"devDependencies": {
2525
"@babel/core": "^7.0.0",
2626
"mkdirp": "^0.5.1",
2727
"react": "16.13.1",
2828
"react-native": "0.63.4",
29-
"react-native-macos": "0.63.3",
29+
"react-native-macos": "0.63.23",
3030
"react-native-test-app": "../",
31-
"react-native-windows": "0.63.14"
31+
"react-native-windows": "0.63.24"
3232
}
3333
}

example/react-native.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ const path = require("path");
22

33
if (
44
process.argv.includes("--config=metro.config.windows.js") ||
5+
process.argv.includes("autolink-windows") ||
56
process.argv.includes("run-windows")
67
) {
78
const sourceDir = "windows";
89
module.exports = {
910
project: {
1011
windows: {
1112
sourceDir,
13+
solutionFile: path.join(sourceDir, "Example.sln"),
1214
project: {
1315
projectFile: path.relative(
1416
path.join(__dirname, sourceDir),

example/yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,10 @@
880880
sudo-prompt "^9.0.0"
881881
wcwidth "^1.0.1"
882882

883-
"@react-native-windows/cli@0.63.7":
884-
version "0.63.7"
885-
resolved "https://registry.npmjs.org/@react-native-windows/cli/-/cli-0.63.7.tgz#5b034ff816e5a36bfa655e859adae9425a30af88"
886-
integrity sha512-LmTJc80iT06pWLSdTpNuQEcA6gN2eSuQIQzKQBI45ClnGJ+oow3GrztACyUAArUN+QSieX3VhYVSiB6eMJ03QQ==
883+
"@react-native-windows/cli@0.63.10":
884+
version "0.63.10"
885+
resolved "https://registry.npmjs.org/@react-native-windows/cli/-/cli-0.63.10.tgz#d26f54003ebf6fa4909db57d07a765057b35f7b8"
886+
integrity sha512-nCVCN6DKciOtmou71Sj3b30CvQfnD+t9TbSYa8uuGTguB57A3F2gOBl+6fS+r9cAQ5V5mMAX2LWg1YovT8sPcw==
887887
dependencies:
888888
"@react-native-windows/telemetry" "^0.63.4"
889889
chalk "^3.0.0"
@@ -3628,10 +3628,10 @@ react-is@^16.12.0, react-is@^16.8.1, react-is@^16.8.4:
36283628
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
36293629
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
36303630

3631-
react-native-macos@0.63.3:
3632-
version "0.63.3"
3633-
resolved "https://registry.npmjs.org/react-native-macos/-/react-native-macos-0.63.3.tgz#ada9b877db886a8b9f3f4ff234cd545ba2110445"
3634-
integrity sha512-y0R5Pd34OuuM7af9BQ6MI9N19OLBgIU13v2AYw9gmmHz1LupiYd1311YhjHhc/LimNpT0ymUl7Ppwbhio/0zWw==
3631+
react-native-macos@0.63.23:
3632+
version "0.63.23"
3633+
resolved "https://registry.npmjs.org/react-native-macos/-/react-native-macos-0.63.23.tgz#9dd4afb0786415e29ecaf3cdc44f8975f6ffd34b"
3634+
integrity sha512-ofFMO2YC3DSUP+vtFXyTf9XC4R+xuJ3jZWBNuIrYhg7mRMTo7z6BiG/VELYStnemQKReWNEQv0FblsDQ98ktpA==
36353635
dependencies:
36363636
"@babel/runtime" "^7.0.0"
36373637
"@react-native-community/cli" "^4.10.0"
@@ -3672,13 +3672,13 @@ react-native-test-app@../:
36723672
rimraf "^3.0.0"
36733673
yargs "^16.0.0"
36743674

3675-
react-native-windows@0.63.14:
3676-
version "0.63.14"
3677-
resolved "https://registry.npmjs.org/react-native-windows/-/react-native-windows-0.63.14.tgz#cf1306c6a1160823674259c3f0e9f01557253847"
3678-
integrity sha512-l+pKQQRir8YOy/kwqf5gctoKB7j/fhNcKYw21QELvCTlM5Iv5RzJISj0O4SZYAa3nIzJ6hhpzHgmIHVQFHwH6A==
3675+
react-native-windows@0.63.24:
3676+
version "0.63.24"
3677+
resolved "https://registry.npmjs.org/react-native-windows/-/react-native-windows-0.63.24.tgz#40d6aca2a748ef3985b5942b29d0b05631fecca7"
3678+
integrity sha512-N+C3NR4cYM7uOXbhx4sMT3QmjSJ7tPKEJBZOVlieEHJ1Bm0ZyP9Bv7ZKzLeouCA/z78/5NhixIwiJVJ1CPIjMA==
36793679
dependencies:
36803680
"@babel/runtime" "^7.8.4"
3681-
"@react-native-windows/cli" "0.63.7"
3681+
"@react-native-windows/cli" "0.63.10"
36823682
abort-controller "^3.0.0"
36833683
anser "^1.4.9"
36843684
base64-js "^1.1.2"

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"react": "~16.8.6 || ~16.9.0 || ~16.11.0 || ~16.13.1 || ~17.0.1",
5959
"react-native": "^0.0.0-0 || ^0.60.6 || ^0.61.5 || ^0.62.2 || ^0.63.2 || ^0.64.0 || 1000.0.0",
6060
"react-native-macos": "^0.60.0 || ^0.61.0 || ^0.62.0 || ^0.63.0",
61-
"react-native-windows": "^0.62.0 || ^0.63.0"
61+
"react-native-windows": "^0.62.0 || ^0.63.0 || ^0.64.0"
6262
},
6363
"peerDependenciesMeta": {
6464
"mustache": {
@@ -87,8 +87,8 @@
8787
"prettier": "2.1.2",
8888
"react": "16.13.1",
8989
"react-native": "0.63.4",
90-
"react-native-macos": "0.63.3",
91-
"react-native-windows": "0.63.14",
90+
"react-native-macos": "0.63.23",
91+
"react-native-windows": "0.63.24",
9292
"semantic-release": "^17.0.0",
9393
"suggestion-bot": "^1.0.0",
9494
"typescript": "^4.0.0"

scripts/configure.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function warn(message, tag = "[!]") {
182182
* @param {ConfigureParams} params
183183
* @returns {string | FileCopy}
184184
*/
185-
function reactNativeConfig({ testAppPath, platforms, flatten }) {
185+
function reactNativeConfig({ name, testAppPath, platforms, flatten }) {
186186
const shouldFlatten = platforms.length === 1 && flatten;
187187
if (shouldFlatten) {
188188
switch (platforms[0]) {
@@ -232,6 +232,7 @@ function reactNativeConfig({ testAppPath, platforms, flatten }) {
232232
" project: {",
233233
" windows: {",
234234
" sourceDir,",
235+
` solutionFile: path.join(sourceDir, "${name}.sln"),`,
235236
" project: {",
236237
" projectFile: path.relative(",
237238
" path.join(__dirname, sourceDir),",

scripts/set-react-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const profiles = {
3939
react: "17.0.1",
4040
"react-native": "0.64.0",
4141
"react-native-macos": undefined,
42-
"react-native-windows": undefined,
42+
"react-native-windows": "0.64.1",
4343
},
4444
master: {
4545
"@react-native-community/cli": "^5.0.1-alpha.0",

test/configure/reactNativeConfig.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe("reactNativeConfig()", () => {
5959
test("throws when an unknown platform is specified", () => {
6060
// @ts-ignore intentional use of unsupported platform
6161
const params = mockParams({ platforms: ["nextstep"], flatten: true });
62-
expect(() => reactNativeConfig(params)).toThrowError(
62+
expect(() => reactNativeConfig(params)).toThrow(
6363
"Unknown platform: nextstep"
6464
);
6565
});

windows/ReactTestApp/AutolinkedNativeModules.g.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
<!-- AutolinkedNativeModules.g.props contents generated by "react-native autolink-windows" -->
44
<PropertyGroup>
55
</PropertyGroup>
6-
</Project>
6+
</Project>

windows/test-app.js

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -327,17 +327,30 @@ function generateSolution(destPath, noAutolink) {
327327
.join(os.EOL);
328328

329329
// The mustache template was introduced in 0.63
330-
const solutionTemplatePath = findNearest(
331-
path.join(
332-
nodeModulesDir,
333-
"@react-native-windows",
334-
"cli",
335-
"templates",
336-
"cpp",
337-
"proj",
338-
"MyApp.sln"
339-
)
340-
);
330+
const solutionTemplatePath =
331+
findNearest(
332+
// In 0.64, the template was moved into `react-native-windows`
333+
path.join(
334+
nodeModulesDir,
335+
"react-native-windows",
336+
"template",
337+
"cpp-app",
338+
"proj",
339+
"MyApp.sln"
340+
)
341+
) ||
342+
findNearest(
343+
// In 0.63, the template is in `@react-native-windows/cli`
344+
path.join(
345+
nodeModulesDir,
346+
"@react-native-windows",
347+
"cli",
348+
"templates",
349+
"cpp",
350+
"proj",
351+
"MyApp.sln"
352+
)
353+
);
341354

342355
if (!solutionTemplatePath) {
343356
copyAndReplace(
@@ -387,19 +400,29 @@ function generateSolution(destPath, noAutolink) {
387400
encoding: "utf8",
388401
mode: 0o644,
389402
},
390-
(e) => {
391-
if (e) throw e;
403+
(error) => {
404+
if (error) {
405+
throw error;
406+
}
392407
}
393408
);
394409
if (!noAutolink) {
395410
Promise.all([...copyTasks, solutionTask]).then(() => {
396411
const { spawn } = require("child_process");
397-
spawn(path.join(path.dirname(process.argv0), "npx.cmd"), [
398-
"react-native",
399-
"autolink-windows",
400-
"--proj",
401-
reactTestAppProjectPath,
402-
]);
412+
spawn(
413+
path.join(path.dirname(process.argv0), "npx.cmd"),
414+
[
415+
"react-native",
416+
"autolink-windows",
417+
"--proj",
418+
reactTestAppProjectPath,
419+
],
420+
{ stdio: "inherit" }
421+
).on("close", (code) => {
422+
if (code !== 0) {
423+
process.exit(code);
424+
}
425+
});
403426
});
404427
}
405428
}

yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,10 +1379,10 @@
13791379
sudo-prompt "^9.0.0"
13801380
wcwidth "^1.0.1"
13811381

1382-
"@react-native-windows/cli@0.63.7":
1383-
version "0.63.7"
1384-
resolved "https://registry.npmjs.org/@react-native-windows/cli/-/cli-0.63.7.tgz#5b034ff816e5a36bfa655e859adae9425a30af88"
1385-
integrity sha512-LmTJc80iT06pWLSdTpNuQEcA6gN2eSuQIQzKQBI45ClnGJ+oow3GrztACyUAArUN+QSieX3VhYVSiB6eMJ03QQ==
1382+
"@react-native-windows/cli@0.63.10":
1383+
version "0.63.10"
1384+
resolved "https://registry.npmjs.org/@react-native-windows/cli/-/cli-0.63.10.tgz#d26f54003ebf6fa4909db57d07a765057b35f7b8"
1385+
integrity sha512-nCVCN6DKciOtmou71Sj3b30CvQfnD+t9TbSYa8uuGTguB57A3F2gOBl+6fS+r9cAQ5V5mMAX2LWg1YovT8sPcw==
13861386
dependencies:
13871387
"@react-native-windows/telemetry" "^0.63.4"
13881388
chalk "^3.0.0"
@@ -8276,10 +8276,10 @@ react-is@^17.0.1:
82768276
resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.1.tgz#5b3531bd76a645a4c9fb6e693ed36419e3301339"
82778277
integrity sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA==
82788278

8279-
react-native-macos@0.63.3:
8280-
version "0.63.3"
8281-
resolved "https://registry.npmjs.org/react-native-macos/-/react-native-macos-0.63.3.tgz#ada9b877db886a8b9f3f4ff234cd545ba2110445"
8282-
integrity sha512-y0R5Pd34OuuM7af9BQ6MI9N19OLBgIU13v2AYw9gmmHz1LupiYd1311YhjHhc/LimNpT0ymUl7Ppwbhio/0zWw==
8279+
react-native-macos@0.63.23:
8280+
version "0.63.23"
8281+
resolved "https://registry.npmjs.org/react-native-macos/-/react-native-macos-0.63.23.tgz#9dd4afb0786415e29ecaf3cdc44f8975f6ffd34b"
8282+
integrity sha512-ofFMO2YC3DSUP+vtFXyTf9XC4R+xuJ3jZWBNuIrYhg7mRMTo7z6BiG/VELYStnemQKReWNEQv0FblsDQ98ktpA==
82838283
dependencies:
82848284
"@babel/runtime" "^7.0.0"
82858285
"@react-native-community/cli" "^4.10.0"
@@ -8309,13 +8309,13 @@ react-native-macos@0.63.3:
83098309
use-subscription "^1.0.0"
83108310
whatwg-fetch "^3.0.0"
83118311

8312-
react-native-windows@0.63.14:
8313-
version "0.63.14"
8314-
resolved "https://registry.npmjs.org/react-native-windows/-/react-native-windows-0.63.14.tgz#cf1306c6a1160823674259c3f0e9f01557253847"
8315-
integrity sha512-l+pKQQRir8YOy/kwqf5gctoKB7j/fhNcKYw21QELvCTlM5Iv5RzJISj0O4SZYAa3nIzJ6hhpzHgmIHVQFHwH6A==
8312+
react-native-windows@0.63.24:
8313+
version "0.63.24"
8314+
resolved "https://registry.npmjs.org/react-native-windows/-/react-native-windows-0.63.24.tgz#40d6aca2a748ef3985b5942b29d0b05631fecca7"
8315+
integrity sha512-N+C3NR4cYM7uOXbhx4sMT3QmjSJ7tPKEJBZOVlieEHJ1Bm0ZyP9Bv7ZKzLeouCA/z78/5NhixIwiJVJ1CPIjMA==
83168316
dependencies:
83178317
"@babel/runtime" "^7.8.4"
8318-
"@react-native-windows/cli" "0.63.7"
8318+
"@react-native-windows/cli" "0.63.10"
83198319
abort-controller "^3.0.0"
83208320
anser "^1.4.9"
83218321
base64-js "^1.1.2"

0 commit comments

Comments
 (0)