[generator-macos] Enable auto-linking of native modules (#312)
* [generator-macos] Guard against package.json not having scripts yet * [generator-macos] Enable auto-linking Currently uses @react-native-communit/cli-platform-ios, but this is mostly semantics as they work the same. In the future this will move into a cli-platform-apple package which will hold common iOS and macOS tooling.
This commit is contained in:
Родитель
a0e09ab4f0
Коммит
f940702eae
|
@ -134,8 +134,11 @@ function installDependencies(options) {
|
|||
|
||||
// Patch package.json to have start:macos
|
||||
const projectPackageJsonPath = path.join(cwd, 'package.json');
|
||||
/** @type {{ scripts?: {} }} */
|
||||
const projectPackageJson = JSON.parse(fs.readFileSync(projectPackageJsonPath, { encoding: 'UTF8' }));
|
||||
projectPackageJson.scripts['start:macos'] = 'node node_modules/react-native-macos/local-cli/cli.js start --use-react-native-macos';
|
||||
const scripts = projectPackageJson.scripts || {};
|
||||
scripts['start:macos'] = 'node node_modules/react-native-macos/local-cli/cli.js start --use-react-native-macos';
|
||||
projectPackageJson.scripts = scripts;
|
||||
fs.writeFileSync(projectPackageJsonPath, JSON.stringify(projectPackageJson, null, 2));
|
||||
|
||||
// Install dependencies using correct package manager
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
||||
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
||||
|
||||
abstract_target 'Shared' do
|
||||
# use_native_modules!
|
||||
use_native_modules!
|
||||
|
||||
pod 'React', :path => "../node_modules/react-native-macos/"
|
||||
pod 'React-Core', :path => "../node_modules/react-native-macos/React"
|
||||
|
|
Загрузка…
Ссылка в новой задаче