mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Convert build scripts to regular Flow syntax (#49103)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49103 Changelog: [Internal] Reviewed By: j-piasecki Differential Revision: D68960540 fbshipit-source-id: 0ac01529eaea97db98b85b6021532092997d633b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e1575857dd
commit
3cf400a51b
+9
-11
@@ -9,13 +9,12 @@
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
/*::
|
||||
require('../babel-register').registerForScript();
|
||||
|
||||
import type {BabelCoreOptions} from '@babel/core';
|
||||
*/
|
||||
|
||||
const {ModuleResolutionKind} = require('typescript');
|
||||
|
||||
/*::
|
||||
export type BuildOptions = $ReadOnly<{
|
||||
// The target runtime to compile for.
|
||||
target: 'node',
|
||||
@@ -31,7 +30,6 @@ export type BuildConfig = $ReadOnly<{
|
||||
// The packages to include for build and their build options.
|
||||
packages: $ReadOnly<{[packageName: string]: BuildOptions}>,
|
||||
}>;
|
||||
*/
|
||||
|
||||
/**
|
||||
* - BUILD CONFIG -
|
||||
@@ -40,7 +38,7 @@ export type BuildConfig = $ReadOnly<{
|
||||
* setup. These must use a consistent package structure and (today) target
|
||||
* Node.js packages only.
|
||||
*/
|
||||
const buildConfig /*: BuildConfig */ = {
|
||||
const buildConfig: BuildConfig = {
|
||||
/* eslint sort-keys: "error" */
|
||||
packages: {
|
||||
'community-cli-plugin': {
|
||||
@@ -67,8 +65,8 @@ const defaultBuildOptions = {
|
||||
};
|
||||
|
||||
function getBuildOptions(
|
||||
packageName /*: $Keys<BuildConfig['packages']> */,
|
||||
) /*: Required<BuildOptions> */ {
|
||||
packageName: $Keys<BuildConfig['packages']>,
|
||||
): Required<BuildOptions> {
|
||||
return {
|
||||
...defaultBuildOptions,
|
||||
...buildConfig.packages[packageName],
|
||||
@@ -76,8 +74,8 @@ function getBuildOptions(
|
||||
}
|
||||
|
||||
function getBabelConfig(
|
||||
packageName /*: $Keys<BuildConfig['packages']> */,
|
||||
) /*: BabelCoreOptions */ {
|
||||
packageName: $Keys<BuildConfig['packages']>,
|
||||
): BabelCoreOptions {
|
||||
const {target} = getBuildOptions(packageName);
|
||||
|
||||
switch (target) {
|
||||
@@ -87,8 +85,8 @@ function getBabelConfig(
|
||||
}
|
||||
|
||||
function getTypeScriptCompilerOptions(
|
||||
packageName /*: $Keys<BuildConfig['packages']> */,
|
||||
) /*: Object */ {
|
||||
packageName: $Keys<BuildConfig['packages']>,
|
||||
): Object {
|
||||
const {target} = getBuildOptions(packageName);
|
||||
|
||||
switch (target) {
|
||||
|
||||
Reference in New Issue
Block a user