diff --git a/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs-cli.js b/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs-cli.js deleted file mode 100644 index 2ce923a97a1..00000000000 --- a/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs-cli.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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. - * - * @flow - * @format - */ - -'use strict'; - -const generate = require('./generate-view-configs'); -const yargs = require('yargs'); - -const yargv = yargs.strict().option('t', { - alias: 'test', - describe: 'Test the changes and do not write files', - requiresArg: false, - type: 'boolean', -}); - -const argv = yargv.argv; -const fileList = argv._[0].split('\n'); - -const CURRENT_VIEW_CONFIG_FILES = []; - -generate( - fileList.filter(fileName => - CURRENT_VIEW_CONFIG_FILES.find(supportedFileName => - fileName.endsWith(supportedFileName), - ), - ), - /* $FlowFixMe(>=0.99.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.99 was deployed. To see the error, delete this - * comment and run Flow. */ - {test: argv.test, parser: 'flow'}, -); diff --git a/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs.js b/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs.js deleted file mode 100644 index 9730f9722ed..00000000000 --- a/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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. - * - * @flow - * @format - */ - -'use strict'; - -const RNCodegen = require('../../generators/RNCodegen.js'); -const SchemaParser = require('../../parsers/schema'); -const FlowParser = require('../../parsers/flow'); - -const path = require('path'); - -type Result = $ReadOnly<{| - libraryName: string, - success: boolean, -|}>; - -type Config = $ReadOnly<{| - test?: boolean, - parser?: 'schema' | 'flow', -|}>; - -function generateFilesWithResults( - files: Array, - config: Config, -): Array { - return files.reduce((aggregated, filename) => { - const schema = - config.parser === 'flow' - ? FlowParser.parseFile(filename) - : SchemaParser.parse(filename); - if (schema && schema.modules) { - const libraryName = path - .basename(filename) - .replace(/NativeComponent\.js$/, ''); - const success = RNCodegen.generate( - { - schema, - libraryName, - outputDirectory: path.dirname(filename), - }, - {generators: ['view-configs'], test: config.test}, - ); - - aggregated.push({ - libraryName, - success, - }); - } - return aggregated; - }, []); -} - -function generate(files: Array, config: Config): void { - console.log(`${config.test ? 'Testing' : 'Generating'} view configs`); - - const results = generateFilesWithResults(files, config); - - const failed = results.filter(result => !result.success); - const totalCount = results.length; - - console.log( - `\n${config.test ? 'Tested' : 'Generated'} ${totalCount} view configs`, - ); - - if (failed.length) { - if (config.test === true) { - console.error(`${failed.length} configs changed`); - console.error("Please re-run 'js1 build viewconfigs'"); - } - process.exit(1); - } -} - -module.exports = generate; diff --git a/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs.sh b/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs.sh deleted file mode 100755 index 355c9fe560b..00000000000 --- a/packages/react-native-codegen/src/cli/viewconfigs/generate-view-configs.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# set -euo pipefail - -set -e -set -u - -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) - -FILES=$(find "$JS_DIR/" -name "*NativeComponent.js" -print -type f) - -# shellcheck source=xplat/js/env-utils/setup_env_vars.sh -source "$THIS_DIR/../../../../../../env-utils/setup_env_vars.sh" - -exec "$FLOW_NODE_BINARY" "$THIS_DIR/generate-view-configs-cli.js" "$@" "$FILES"