Files
react-native/scripts/template
Ruslan Lesiutin e11cfe98e9 feat(react-native/template): use verdaccio to publish local packages before testing template app (#35444)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35444

Changelog:
[Internal][Changed] - now using Verdaccio to publish necessary packages for template app

- Adds script `/scripts/template/install-dependencies.js`, which incapsulates the logic of installing dependencies of template app
- The idea of the script is to run verdaccio and publish all necessary packages to node_modules, since these packages might not yet be present on npm
- This should also potentially resolve some template app test failures on CircleCI related to package-ifying Animated, VirtualizedList, FlatList modules

Reviewed By: cortinico

Differential Revision: D41498086

fbshipit-source-id: 48fbbb1c9334e7a9e7657e6275b7b04f9ce290b5
2022-11-23 13:20:00 -08:00
..

Why?

The main purpose of install-dependencies.js is to bootstrap Verdaccio. It will host all the local packages, which are not yet present on npm registry. In the near future this should help us in keep template tests green, because once we move to monorepo structure, template app may use some versions of dependencies that are not yet present on npm registry.

I have migrated some module to package, which is not yet published to npm, how to use it?

First of all, you need to modify Verdaccio config:

 packages:
+ '<my-migrated-package-name>':
+   access: $all
+   publish: $all
  '@*/*':
    access: $all
    publish: $authenticated
    proxy: npmjs
  '**':
    access: $all
    publish: $all
    proxy: npmjs

After that, you should modify install-dependencies script to include your package for publishing

const PACKAGES_TO_PUBLISH_PATHS = [
  ...
+ "packages/<your-package-folder-name>"
];