-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
chore: bump RN to 0.83.0-rc.4 #8706
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
base: main
Are you sure you want to change the base?
Changes from 7 commits
c4d0525
2eb7d75
eb1978e
4b31ad0
96fb248
e77b9cb
b6a5977
fd85705
cf815c7
8e645f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,26 +7,60 @@ const path = require('path'); | |
| /** | ||
| * @param {Object<string, string>} dependencies | ||
| * @param {Set<string>} exclude | ||
| * @param {((moduleName: string) => string) | undefined} localResolve | ||
| */ | ||
| function resolveDependencies(dependencies = {}, exclude) { | ||
| function resolveDependencies(dependencies = {}, exclude, localResolve) { | ||
| return Object.fromEntries( | ||
| Object.keys(dependencies) | ||
| .filter((name) => !exclude.has(name)) | ||
| .map((name) => [ | ||
| name, | ||
| { root: path.resolve(__dirname, `../../../node_modules/${name}`) }, | ||
| { | ||
| root: getRootPath(name, localResolve), | ||
| }, | ||
| ]) | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * @param {string} moduleName | ||
| * @param {((moduleName: string) => string) | undefined} localResolve | ||
| */ | ||
| function getRootPath(moduleName, localResolve) { | ||
| let root; | ||
| if (localResolve) { | ||
| try { | ||
| root = path.dirname(localResolve(moduleName)); | ||
| } catch { | ||
| // If a package defines an `exports` field, `require.resolve` can fail. | ||
| // Fortunately, none of the packages we care about cause this issue. | ||
| } | ||
| } | ||
| if (!root) { | ||
| try { | ||
| root = path.dirname(require.resolve(`${moduleName}/package.json`)); | ||
| } catch { | ||
| // If a package defines an `exports` field, `require.resolve` can fail. | ||
| // Fortunately, none of the packages we care about cause this issue. | ||
| } | ||
| } | ||
tjzel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return root; | ||
| } | ||
|
|
||
| /** | ||
| * This function will return the dependencies from the common-app package that | ||
| * aren't listed in the current app's package.json | ||
| * | ||
| * @param {string} currentAppDir - The current app directory (e.g. __dirname) | ||
| * @param {string[]} exclude - The dependencies to exclude from the common-app | ||
| * @param {string} [currentAppDir='.'] - The current app directory (e.g. | ||
| * __dirname). Default is `'.'` | ||
| * @param {string[]} [exclude=[]] - The dependencies to exclude from the | ||
| * common-app. Default is `[]` | ||
| * @param {(moduleName: string) => string} [localResolve] - Function that | ||
| * resolves a module name to its path from the app directory. This way modules | ||
| * resolved from the concrete app are prioritized before those from | ||
| * common-app. | ||
| */ | ||
| function getDependencies(currentAppDir = '.', exclude = []) { | ||
| function getDependencies(currentAppDir = '.', exclude = [], localResolve) { | ||
| const commonAppDir = path.resolve(__dirname, '..'); | ||
| const commonAppPkg = require(path.resolve(commonAppDir, 'package.json')); | ||
|
|
||
|
|
@@ -40,8 +74,16 @@ function getDependencies(currentAppDir = '.', exclude = []) { | |
|
|
||
| return { | ||
| // Get all common-app dependencies that aren't already in the current app | ||
| ...resolveDependencies(commonAppPkg.devDependencies, excludedDependencies), | ||
| ...resolveDependencies(commonAppPkg.dependencies, excludedDependencies), | ||
| ...resolveDependencies( | ||
| commonAppPkg.devDependencies, | ||
| excludedDependencies, | ||
| localResolve | ||
| ), | ||
| ...resolveDependencies( | ||
| commonAppPkg.dependencies, | ||
| excludedDependencies, | ||
| localResolve | ||
| ), | ||
| }; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.