react-native-macos 0.74.11 → 0.74.13
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/Libraries/Core/ReactNativeVersion.js +1 -1
- package/React/Base/RCTVersion.m +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/local-cli/runMacOS/runMacOS.js +123 -76
- package/package.json +2 -1
- package/react-native.config.js +7 -3
- package/local-cli/runMacOS/findXcodeProject.js +0 -37
package/React/Base/RCTVersion.m
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
* @format
|
|
5
|
-
* @ts-check
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
@@ -20,14 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @typedef {{
|
|
22
22
|
* name: string;
|
|
23
|
+
* path: string;
|
|
23
24
|
* isWorkspace: boolean;
|
|
24
25
|
* }} XcodeProject
|
|
26
|
+
*
|
|
27
|
+
* @typedef {{
|
|
28
|
+
* project?: {
|
|
29
|
+
* macos?: {
|
|
30
|
+
* sourceDir: string;
|
|
31
|
+
* xcodeProject: XcodeProject;
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* }} ProjectConfig
|
|
25
35
|
*/
|
|
26
36
|
|
|
27
|
-
const findXcodeProject = require('./findXcodeProject');
|
|
28
37
|
const chalk = require('chalk');
|
|
29
38
|
const child_process = require('child_process');
|
|
30
|
-
const fs = require('fs');
|
|
31
39
|
const path = require('path');
|
|
32
40
|
const {logger, CLIError, getDefaultUserTerminal} = (() => {
|
|
33
41
|
const cli = require.resolve('@react-native-community/cli/package.json');
|
|
@@ -37,17 +45,11 @@ const {logger, CLIError, getDefaultUserTerminal} = (() => {
|
|
|
37
45
|
})();
|
|
38
46
|
|
|
39
47
|
/**
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {Record<string, unknown>} _ctx
|
|
48
|
+
* @param {ProjectConfig} ctx
|
|
42
49
|
* @param {Options} args
|
|
50
|
+
* @returns {{ sourceDir: string, xcodeProject: XcodeProject, scheme: string }}
|
|
43
51
|
*/
|
|
44
|
-
function
|
|
45
|
-
if (!fs.existsSync(args.projectPath)) {
|
|
46
|
-
throw new CLIError(
|
|
47
|
-
'macOS project folder not found. Are you sure this is a React Native project?',
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
52
|
+
function parseArgs(ctx, args) {
|
|
51
53
|
if (args.configuration) {
|
|
52
54
|
logger.warn(
|
|
53
55
|
'Argument --configuration has been deprecated and will be removed in a future release, please use --mode instead.',
|
|
@@ -58,15 +60,20 @@ function runMacOS(_, _ctx, args) {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
const {sourceDir, xcodeProject} = ctx.project?.macos ?? {};
|
|
64
|
+
if (!sourceDir) {
|
|
65
|
+
throw new CLIError(
|
|
66
|
+
'macOS project folder not found. Are you sure this is a React Native project?',
|
|
67
|
+
);
|
|
68
|
+
}
|
|
62
69
|
|
|
63
|
-
const xcodeProject = findXcodeProject(fs.readdirSync('.'));
|
|
64
70
|
if (!xcodeProject) {
|
|
65
71
|
throw new CLIError(
|
|
66
|
-
|
|
72
|
+
'Xcode project for macOS not found. Did you forget to run `pod install`?',
|
|
67
73
|
);
|
|
68
74
|
}
|
|
69
75
|
|
|
76
|
+
// TODO: Find schemes using https://github.com/microsoft/rnx-kit/blob/2b4c569cda9e3755ba7afce42d846601bcc7c4e3/packages/tools-apple/src/scheme.ts#L5
|
|
70
77
|
const inferredSchemeName =
|
|
71
78
|
path.basename(xcodeProject.name, path.extname(xcodeProject.name)) +
|
|
72
79
|
'-macOS';
|
|
@@ -78,16 +85,37 @@ function runMacOS(_, _ctx, args) {
|
|
|
78
85
|
} "${chalk.bold(xcodeProject.name)}"`,
|
|
79
86
|
);
|
|
80
87
|
|
|
81
|
-
return
|
|
88
|
+
return {sourceDir, xcodeProject, scheme};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {string[]} _
|
|
93
|
+
* @param {ProjectConfig} ctx
|
|
94
|
+
* @param {Options} args
|
|
95
|
+
*/
|
|
96
|
+
function buildMacOS(_, ctx, args) {
|
|
97
|
+
const {sourceDir, xcodeProject, scheme} = parseArgs(ctx, args);
|
|
98
|
+
return buildProject(sourceDir, xcodeProject, scheme, {...args, packager: false});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {string[]} _
|
|
103
|
+
* @param {ProjectConfig} ctx
|
|
104
|
+
* @param {Options} args
|
|
105
|
+
*/
|
|
106
|
+
function runMacOS(_, ctx, args) {
|
|
107
|
+
const {sourceDir, xcodeProject, scheme} = parseArgs(ctx, args);
|
|
108
|
+
return run(sourceDir, xcodeProject, scheme, args);
|
|
82
109
|
}
|
|
83
110
|
|
|
84
111
|
/**
|
|
112
|
+
* @param {string} sourceDir
|
|
85
113
|
* @param {XcodeProject} xcodeProject
|
|
86
114
|
* @param {string} scheme
|
|
87
115
|
* @param {Options} args
|
|
88
116
|
*/
|
|
89
|
-
async function run(xcodeProject, scheme, args) {
|
|
90
|
-
await buildProject(xcodeProject, scheme, args);
|
|
117
|
+
async function run(sourceDir, xcodeProject, scheme, args) {
|
|
118
|
+
await buildProject(sourceDir, xcodeProject, scheme, args);
|
|
91
119
|
|
|
92
120
|
const buildSettings = getBuildSettings(xcodeProject, args.mode, scheme);
|
|
93
121
|
const appPath = path.join(
|
|
@@ -113,7 +141,7 @@ async function run(xcodeProject, scheme, args) {
|
|
|
113
141
|
|
|
114
142
|
child_process.exec(
|
|
115
143
|
'open -b ' + bundleID + ' -a ' + '"' + appPath + '"',
|
|
116
|
-
(error,
|
|
144
|
+
(error, _stdout, stderr) => {
|
|
117
145
|
if (error) {
|
|
118
146
|
logger.error('Failed to launch the app', stderr);
|
|
119
147
|
} else {
|
|
@@ -124,15 +152,17 @@ async function run(xcodeProject, scheme, args) {
|
|
|
124
152
|
}
|
|
125
153
|
|
|
126
154
|
/**
|
|
155
|
+
* @param {string} sourceDir
|
|
127
156
|
* @param {XcodeProject} xcodeProject
|
|
128
157
|
* @param {string} scheme
|
|
129
158
|
* @param {Options} args
|
|
159
|
+
* @returns {Promise<void>}
|
|
130
160
|
*/
|
|
131
|
-
function buildProject(xcodeProject, scheme, args) {
|
|
161
|
+
function buildProject(sourceDir, xcodeProject, scheme, args) {
|
|
132
162
|
return new Promise((resolve, reject) => {
|
|
133
163
|
const xcodebuildArgs = [
|
|
134
164
|
xcodeProject.isWorkspace ? '-workspace' : '-project',
|
|
135
|
-
xcodeProject.name,
|
|
165
|
+
path.join(sourceDir, xcodeProject.path, xcodeProject.name),
|
|
136
166
|
'-configuration',
|
|
137
167
|
args.mode,
|
|
138
168
|
'-scheme',
|
|
@@ -272,58 +302,75 @@ function getProcessOptions({packager, terminal, port}) {
|
|
|
272
302
|
};
|
|
273
303
|
}
|
|
274
304
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
'
|
|
306
|
-
'
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
305
|
+
const commonOptions = [
|
|
306
|
+
{
|
|
307
|
+
name: '--mode [string]',
|
|
308
|
+
description:
|
|
309
|
+
'Explicitly set the scheme configuration to use, corresponds to `--configuration` in `xcodebuild` command, e.g. Debug, Release.',
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: '--scheme [string]',
|
|
313
|
+
description:
|
|
314
|
+
'Explicitly set Xcode scheme to use, corresponds to `--scheme` in `xcodebuild` command.',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: '--project-path [string]',
|
|
318
|
+
description:
|
|
319
|
+
'Path relative to project root where the Xcode project (.xcodeproj) lives.',
|
|
320
|
+
default: 'macos',
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: '--verbose',
|
|
324
|
+
description: 'Do not use xcpretty even if installed',
|
|
325
|
+
},
|
|
326
|
+
];
|
|
327
|
+
|
|
328
|
+
module.exports = [
|
|
329
|
+
{
|
|
330
|
+
name: 'build-macos',
|
|
331
|
+
description: 'builds your app',
|
|
332
|
+
func: buildMacOS,
|
|
333
|
+
examples: [
|
|
334
|
+
{
|
|
335
|
+
desc: 'Build the macOS app',
|
|
336
|
+
cmd: 'react-native build-macos',
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
options: commonOptions,
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
name: 'run-macos',
|
|
343
|
+
description: 'builds your app and starts it',
|
|
344
|
+
func: runMacOS,
|
|
345
|
+
examples: [
|
|
346
|
+
{
|
|
347
|
+
desc: 'Run the macOS app',
|
|
348
|
+
cmd: 'react-native run-macos',
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
options: [
|
|
352
|
+
{
|
|
353
|
+
name: '--configuration [string]',
|
|
354
|
+
description:
|
|
355
|
+
'[Deprecated] Explicitly set the scheme configuration to use',
|
|
356
|
+
default: 'Debug',
|
|
357
|
+
},
|
|
358
|
+
...commonOptions,
|
|
359
|
+
{
|
|
360
|
+
name: '--no-packager',
|
|
361
|
+
description: 'Do not launch packager while building',
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: '--port [number]',
|
|
365
|
+
default: process.env.RCT_METRO_PORT || 8081,
|
|
366
|
+
parse: val => Number(val),
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: '--terminal [string]',
|
|
370
|
+
description:
|
|
371
|
+
'Launches the Metro Bundler in a new window using the specified terminal path.',
|
|
372
|
+
default: getDefaultUserTerminal,
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-macos",
|
|
3
|
-
"version": "0.74.
|
|
3
|
+
"version": "0.74.13",
|
|
4
4
|
"description": "React Native for macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
111
111
|
"@react-native-community/cli": "13.6.9",
|
|
112
112
|
"@react-native-community/cli-platform-android": "13.6.9",
|
|
113
|
+
"@react-native-community/cli-platform-apple": "13.6.9",
|
|
113
114
|
"@react-native-community/cli-platform-ios": "13.6.9",
|
|
114
115
|
"@react-native-mac/virtualized-lists": "0.74.87",
|
|
115
116
|
"@react-native/assets-registry": "0.74.87",
|
package/react-native.config.js
CHANGED
|
@@ -11,13 +11,17 @@
|
|
|
11
11
|
|
|
12
12
|
const android = require('@react-native-community/cli-platform-android');
|
|
13
13
|
const ios = require('@react-native-community/cli-platform-ios');
|
|
14
|
+
const {
|
|
15
|
+
getDependencyConfig,
|
|
16
|
+
getProjectConfig,
|
|
17
|
+
} = require('@react-native-community/cli-platform-apple'); // [macOS]
|
|
14
18
|
const {
|
|
15
19
|
bundleCommand,
|
|
16
20
|
ramBundleCommand,
|
|
17
21
|
startCommand,
|
|
18
22
|
} = require('@react-native/community-cli-plugin');
|
|
19
23
|
|
|
20
|
-
const macosCommands =
|
|
24
|
+
const macosCommands = require('./local-cli/runMacOS/runMacOS'); // [macOS]
|
|
21
25
|
|
|
22
26
|
const codegenCommand = {
|
|
23
27
|
name: 'codegen',
|
|
@@ -95,8 +99,8 @@ module.exports = {
|
|
|
95
99
|
) => {},
|
|
96
100
|
};
|
|
97
101
|
},
|
|
98
|
-
projectConfig: ()
|
|
99
|
-
dependencyConfig: ()
|
|
102
|
+
projectConfig: getProjectConfig({platformName: 'macos'}),
|
|
103
|
+
dependencyConfig: getDependencyConfig({platformName: 'macos'}),
|
|
100
104
|
npmPackageName: 'react-native-macos', // [macOS]
|
|
101
105
|
},
|
|
102
106
|
},
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
* @ts-check
|
|
6
|
-
*/
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
const path = require('path');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param {string[]} files
|
|
13
|
-
*/
|
|
14
|
-
function findXcodeProject(files) {
|
|
15
|
-
const sortedFiles = files.sort();
|
|
16
|
-
for (let i = sortedFiles.length - 1; i >= 0; i--) {
|
|
17
|
-
const fileName = files[i];
|
|
18
|
-
const ext = path.extname(fileName);
|
|
19
|
-
|
|
20
|
-
if (ext === '.xcworkspace') {
|
|
21
|
-
return {
|
|
22
|
-
name: fileName,
|
|
23
|
-
isWorkspace: true,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
if (ext === '.xcodeproj') {
|
|
27
|
-
return {
|
|
28
|
-
name: fileName,
|
|
29
|
-
isWorkspace: false,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
module.exports = findXcodeProject;
|