-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
React
version
field should match package.json (#24445)
The `version` field exported by the React package currently corresponds to the `@next` release for that build. This updates the build script to output the same version that is used in the package.json file. It works by doing a find-and-replace of the React version after the build has completed. This is a bit weird but it saves us from having to build the `@next` and `@latest` releases separately; they are identical except for the version numbers.
- Loading branch information
Showing
2 changed files
with
90 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails react-core | ||
* @jest-environment node | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// NOTE: Intentionally using the dynamic version of the `gate` pragma to opt out | ||
// the negative test behavior. If this test happens to pass when running | ||
// against files source, that's fine. But all we care about is the behavior of | ||
// the build artifacts. | ||
// TODO: The experimental builds have a different version at runtime than | ||
// the package.json because DevTools uses it for feature detection. Consider | ||
// some other way of handling that. | ||
test('ReactVersion matches package.json', () => { | ||
if (gate(flags => flags.build && flags.stable && !flags.www)) { | ||
const React = require('react'); | ||
const packageJSON = require('react/package.json'); | ||
expect(React.version).toBe(packageJSON.version); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters