Skip to content

Commit

Permalink
Move codegen into packages/react-native-codegen
Browse files Browse the repository at this point in the history
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.

Reviewed By: rickhanlonii, TheSavior

Differential Revision: D13974180

fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
  • Loading branch information
cpojer authored and facebook-github-bot committed Feb 7, 2019
1 parent f307ac7 commit 5ed749e
Show file tree
Hide file tree
Showing 46 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Libraries/Components/Switch/SwitchSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

import type {SchemaType} from '../../../codegen/src/CodegenSchema.js';
import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js';

const SwitchSchema: SchemaType = {
modules: {
Expand Down
7 changes: 0 additions & 7 deletions codegen/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion codegen/BUCK → packages/react-native-codegen/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", "APPLE"
load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary")
load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "rn_xplat_cxx_library")
load("@fbsource//xplat/js/react-native-github/codegen:DEFS.bzl", "rn_codegen_test")
load("@fbsource//xplat/js/react-native-github/packages/react-native-codegen:DEFS.bzl", "rn_codegen_test")

fb_native.sh_binary(
name = "copy_fixture_schema",
Expand Down
4 changes: 2 additions & 2 deletions codegen/DEFS.bzl → packages/react-native-codegen/DEFS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def rn_codegen_test(
fb_native.genrule(
name = copy_schema_name,
srcs = [],
cmd = "$(exe xplat//js/react-native-github/codegen:copy_fixture_schema) {} $OUT".format(fixture_name),
cmd = "$(exe xplat//js/react-native-github/packages/react-native-codegen:copy_fixture_schema) {} $OUT".format(fixture_name),
out = "schema-{}.json".format(fixture_name),
)

Expand All @@ -38,7 +38,7 @@ def rn_codegen(
fb_native.genrule(
name = generate_fixtures_rule_name,
srcs = [],
cmd = "$(exe xplat//js/react-native-github/codegen:rn_codegen) $(location {}) {} $OUT".format(schema_target, name),
cmd = "$(exe xplat//js/react-native-github/packages/react-native-codegen:rn_codegen) $(location {}) {} $OUT".format(schema_target, name),
out = "codegenfiles-{}".format(name),
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ set -u
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)

# shellcheck source=xplat/js/env-utils/setup_env_vars.sh
source "$THIS_DIR/../../../env-utils/setup_env_vars.sh"
source "$THIS_DIR/../../../../env-utils/setup_env_vars.sh"

exec "$FLOW_NODE_BINARY" "$THIS_DIR/combine-js-to-schema.js" "$@"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ set -u
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)

# shellcheck source=xplat/js/env-utils/setup_env_vars.sh
source "$THIS_DIR/../../../env-utils/setup_env_vars.sh"
source "$THIS_DIR/../../../../env-utils/setup_env_vars.sh"

exec "$FLOW_NODE_BINARY" "$THIS_DIR/copy-fixture.js" "$@"
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -u
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)

# shellcheck source=xplat/js/env-utils/setup_env_vars.sh
source "$THIS_DIR/../../../env-utils/setup_env_vars.sh"
source "$THIS_DIR/../../../../env-utils/setup_env_vars.sh"

pushd "$THIS_DIR/.." >/dev/null
"$INSTALL_NODE_MODULES"
Expand Down
14 changes: 14 additions & 0 deletions packages/react-native-codegen/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.0.1",
"name": "react-native-codgen",
"description": "⚛️ Code generation tools for React Native",
"repository": {
"type": "git",
"url": "[email protected]:facebook/react-native.git"
},
"dependencies": {
"jscodeshift": "^0.6.2",
"nullthrows": "^1.1.0"
},
"license": "MIT"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5ed749e

Please sign in to comment.