mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ba24f5f903
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53438 Changelog: [Internal] Makes `flavor: 'prebuilt'` the default mode of launching the RNDT standalone shell, and the *only* mode supported in the published version of the package. See D78351931 for more context. With this, we can demote `electron` from `dependencies` to `devDependencies`. This makes it possible to make `debugger-shell` a dependency of `dev-middleware` (and thus of all major frameworks) without significantly impacting `npm install` times. We'll add this dependency on `debugger-shell` in an upcoming diff (D78351937). We also stop publishing the `dist/electron` subdirectory (and `src/electron` for good measure) since the corresponding code will always be bundled into the prebuilt binary instead. Reviewed By: huntie Differential Revision: D78351934 fbshipit-source-id: 2a4b03e852c4d0330250567c41dca09d1c4f3abd
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const semver = require('semver');
|
|
|
|
// This test ensures that the electron dependency declared in our package.json
|
|
// is semver-satisfied by the actual version of the electron package we're using.
|
|
// While this is normally the job of a package manager like Yarn, in our case we
|
|
// may use Yarn forced resolutions that defeat versioning, so we want additional
|
|
// safety to ensure the target of the resolution is in sync with the declared dependency.
|
|
describe('Electron dependency', () => {
|
|
test('should be semver-satisfied by the actual electron version', () => {
|
|
// $FlowFixMe[untyped-import] - package.json is not typed
|
|
const ourPackageJson = require('../package.json');
|
|
|
|
const declaredElectronVersion = ourPackageJson.devDependencies.electron;
|
|
expect(declaredElectronVersion).toBeTruthy();
|
|
|
|
// $FlowFixMe[untyped-import] - package.json is not typed
|
|
const electronPackageJson = require('electron/package.json');
|
|
|
|
const actualElectronVersion = electronPackageJson.version;
|
|
expect(actualElectronVersion).toBeTruthy();
|
|
|
|
const isSatisfied = semver.satisfies(
|
|
actualElectronVersion,
|
|
declaredElectronVersion,
|
|
);
|
|
|
|
expect(isSatisfied).toBe(true);
|
|
});
|
|
});
|