-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generate example with symlink by default #309
Conversation
/merge master |
by the following shell command: yarn add link:../ as suggested in #232 by @sunnylqm fix and update the description of --generate-example option previous example file linkage behavior (`yarn add file:../`) may be enabled by using the new --example-file-linkage option (`exampleFileLinkage: true` in the library API) which is already deprecated at this point omit postinstall scripts entry in example package.json unless the deprecated --example-file-linkage option is used (with minor console logging updates) overwrite the example metro.config.js with quick workaround for an issue with symlinked modules, unless the deprecated --example-file-linkage option is used (with thanks to @johnryan for the pointer) *tested* with React Native 0.60 (known issue with React Native 0.61 & 0.62 at this point) update the following test cases to test with the deprecated `exampleFileLinkage: true` setting: - json-eacces-error.test.js - json-enoent-error.test.js - recover-from-missing-package-scripts.test.js - create-with-example-with-options.test.js - create-with-example-with-options.test.js Co-authored-by: Christopher J. Brody <chris.brody+brodybits@gmail.com> Co-authored-by: Sunny Luo <sunnylqm@qq.com>
(postinstall workaround script) add the postinstall workaround script *only* if the deprecated --example-file-linkage option is enabled
and update the test snapshots
9e1b6e8
to
db24dea
Compare
/merge brodybits-generate-example-with-symlink-by-default |
for an issue with symlinks encountered starting with metro@0.55 / React Native 0.61 (not needed for React Native 0.60 / metro@0.54) add and update descriptive comments in example metro.config.js *tested* generated example with: - native view on React Native 0.62 on Android & iOS - native module on React Native 0.62 on Android & iOS - native view on react-native-tvos@0.61 on Android, iOS, & tvOS - native module on react-native-tvos@0.61 on Android, iOS, & tvOS - native view on React Native 0.61 on Android & iOS - native module on React Native 0.61 on Android & iOS - native view on react-native-tvos@0.60.4-6 on Android, iOS, & tvOS - native module on react-native-tvos@0.60.4-6 on Android, iOS, & tvOS - native view on React Native 0.60 on Android & iOS - native module on React Native 0.60 on Android & iOS
7cad734
to
8fcda63
Compare
Hi @brodybits , I use option am I missing something? Please help, thank you |
After a morning deep dive into the problem, I ended up with a simple solution:
After this every changes from library with get effected into example project Sorry for commenting directly here |
As suggested by @sunnylqm in #232 (resolves #232):
Uses the following command to link the example as the default behavior:
From #232: This symlink behavior should enable the user to "
directly
modify the library code and test [...] in the example project ".The previous file linkage behavior (
yarn add file:../
) may be enabled by using the new, deprecated--example-file-linkage
option.No example postinstall workaround script will be added unless the deprecated
--example-file-linkage
option is used.Assuming the deprecated
--example-file-linkage
option is not used, this update will overwrite the examplemetro.config.js
with the following workaround config code, as needed for Metro to work with the symlink:This symlink behavior is more consistent with the new, interactive
brodybits/react-native-module-init
CLI tool that I made around this one.Due credit belongs to the following:
Now tested generated example with: