Using https://github.com/fson/react-native/commit/8048dc7bba4cc554bcb8a36d3f1007cfb48ce727 and @react-native-community/[email protected].
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: x64 Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz
Memory: 814.21 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.9.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.8.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react-native: /Users/ville/Projects/react-native => 1000.0.0
npmGlobalPackages:
react-native-cli: 2.0.1
I was trying to test https://github.com/facebook/react-native/pull/23563 end-to-end, so I ran react-native init HelloWorld --version <path-to-local-react-native-folder>. This failed with Error: EISDIR: illegal operation on a directory, read.
Output:
% react-native init HelloWorld --version /Users/ville/Projects/react-native
This will walk you through creating a new React Native project in /Users/ville/Projects/HelloWorld
Using yarn v1.13.0
Installing /Users/ville/Projects/react-native...
yarn add v1.13.0
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
...
✨ Done in 59.92s.
Setting up new React Native app in /Users/ville/Projects/HelloWorld
/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/graceful-fs/polyfills.js:144
throw er
^
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:515:3)
at Object.readSync (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/graceful-fs/polyfills.js:138:28)
at tryReadSync (fs.js:338:20)
at Object.readFileSync (fs.js:375:19)
at copyAndReplace (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/util/copyAndReplace.js:77:22)
at walk.forEach.absoluteSrcFilePath (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/generator/copyProjectTemplateAndReplace.js:94:5)
at Array.forEach (<anonymous>)
at copyProjectTemplateAndReplace (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/generator/copyProjectTemplateAndReplace.js:49:17)
at createProjectFromTemplate (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/generator/templates.js:31:3)
at generateProject (/Users/ville/Projects/HelloWorld/node_modules/react-native/node_modules/@react-native-community/cli/build/init/init.js:83:3)
This is also reproducible in current master of facebook/react-native:
cd react-native
git checkout f32dc635467a2e93371f0cf2e40b07a712349288
yarn
cd ..
react-native init HelloWorld --version $PWD/react-native
cc @Esemesek who's working on new version of init
I am working on it. Right now, I don't think --version works like that - you can only pass custom rn versions. To have a custom version of react-native, I use verdaccio to publish new version of react-native to local npm proxy. I wrote about this here.
--version supports file paths, it's explicitly documented in the code. I think we should make sure that keeps working, so it's easier to make changes to the template and debug them.
I avoided using Verdaccio on purpose, because publishing to a local npm after every edit is a bit of a pain and doesn't result in a pleasant edit-compile-debug cycle.
I tried this briefly while moving codebase to separate repository and it seemed like it doesn't work. I agree that this is a painful flow to work with init.
I think we should make sure it's still possible to init a project by setting path to a React Native version. In the future, given the new init workflow, the --version will not be needed at all since CLI will pick React Native files directly from node_modules.
@fson, make sure to run npm pack and pass a path to a tgz file instead to a folder.
Should be:
$ react-native init HelloWorld --version /Users/ville/Projects/react-native/path-to-packed-files.tgz
Since you are testing iOS only - there's no extra work you need to do. In order to be able to have Android sources up to date, you would have to build ReactAndroid too.
See releases script for the exact set of commands to run here and here
Most helpful comment
I think we should make sure it's still possible to init a project by setting path to a React Native version. In the future, given the new
initworkflow, the--versionwill not be needed at all since CLI will pick React Native files directly fromnode_modules.@fson, make sure to run
npm packand pass a path to atgzfile instead to a folder.Should be:
Since you are testing iOS only - there's no extra work you need to do. In order to be able to have Android sources up to date, you would have to build
ReactAndroidtoo.See releases script for the exact set of commands to run here and here