Skip to content

Commit 918f02d

Browse files
huntiefacebook-github-bot
authored andcommitted
Consolidate JS API scripts under scripts/js-api/, update docs (#52469)
Summary: Pull Request resolved: #52469 Organise `scripts/build-types/` and `scripts/diff-api-snapshot/` into a single grouping `scripts/js-api/` parent dir — matching the newly relocated `scripts/cxx-api/`. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D77865488 fbshipit-source-id: 33754d9275e65c3bda686294f18d855221ec7bff
1 parent 5fe782a commit 918f02d

74 files changed

Lines changed: 44 additions & 25 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/diff-js-api-breaking-changes/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
env:
1818
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
1919
run: |
20-
node ./scripts/diff-api-snapshot \
20+
node ./scripts/js-api/diff-api-snapshot \
2121
${{ github.workspace }}/packages/react-native/ReactNativeApi.d.ts \
2222
$SCRATCH_DIR/ReactNativeApi-after.d.ts \
2323
> $SCRATCH_DIR/output.json

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"android": "yarn --cwd packages/rn-tester android",
99
"build-android": "./gradlew :packages:react-native:ReactAndroid:build",
1010
"build": "node ./scripts/build/build.js",
11-
"build-types": "node ./scripts/build-types",
11+
"build-types": "node ./scripts/js-api/build-types",
1212
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
1313
"clean": "node ./scripts/build/clean.js",
1414
"cxx-api-build": "node ./scripts/cxx-api/public-api.js",
@@ -17,6 +17,7 @@
1717
"format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",
1818
"format": "npm run prettier && npm run clang-format",
1919
"featureflags": "yarn --cwd packages/react-native featureflags",
20+
"js-api-diff": "node ./scripts/js-api/diff-api-snapshot",
2021
"lint-ci": "./.github/workflow-scripts/analyze_code.sh && yarn shellcheck",
2122
"lint-markdown": "markdownlint-cli2 2>&1",
2223
"lint": "eslint --max-warnings 0 .",

packages/react-native/ReactNativeApi.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<b56aa13d53b10140225651b9701de96d>>
7+
* @generated SignedSource<<83d07f37fd6028027511209f02e7f056>>
88
*
9-
* This file was generated by scripts/build-types/index.js.
9+
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
1111

1212
// ----------------------------------------------------------------------------
Lines changed: 24 additions & 6 deletions

scripts/build-types/BuildApiSnapshot.js renamed to scripts/js-api/build-types/buildApiSnapshot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
import type {PluginObj} from '@babel/core';
1313

14-
const {PACKAGES_DIR, REACT_NATIVE_PACKAGE_DIR} = require('../consts');
15-
const {isGitRepo} = require('../scm-utils');
16-
const {API_EXTRACTOR_CONFIG_FILE, TYPES_OUTPUT_DIR} = require('./config');
14+
const {PACKAGES_DIR, REACT_NATIVE_PACKAGE_DIR} = require('../../consts');
15+
const {isGitRepo} = require('../../scm-utils');
16+
const {API_EXTRACTOR_CONFIG_FILE, TYPES_OUTPUT_DIR} = require('../config');
1717
const apiSnapshotTemplate = require('./templates/ReactNativeApi.d.ts-template.js');
1818
const applyBabelTransformsSeq = require('./utils/applyBabelTransformsSeq');
1919
const resolveCyclicImportsInDefinition = require('./utils/resolveCyclicImportsInDefinition');

scripts/build-types/buildGeneratedTypes.js renamed to scripts/js-api/build-types/buildGeneratedTypes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* @format
99
*/
1010

11-
const {PACKAGES_DIR, REPO_ROOT} = require('../consts');
12-
const {ENTRY_POINT, IGNORE_PATTERNS, TYPES_OUTPUT_DIR} = require('./config');
11+
const {PACKAGES_DIR, REPO_ROOT} = require('../../consts');
12+
const {ENTRY_POINT, IGNORE_PATTERNS, TYPES_OUTPUT_DIR} = require('../config');
1313
const getRequireStack = require('./resolution/getRequireStack');
1414
const translatedModuleTemplate = require('./templates/translatedModule.d.ts-template');
1515
const translateSourceFile = require('./translateSourceFile');
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* @format
99
*/
1010

11-
require('../babel-register').registerForScript();
11+
require('../../babel-register').registerForScript();
1212

13-
const buildApiSnapshot = require('./BuildApiSnapshot');
13+
const buildApiSnapshot = require('./buildApiSnapshot');
1414
const buildGeneratedTypes = require('./buildGeneratedTypes');
1515
const debug = require('debug');
1616
const {parseArgs, styleText} = require('util');
@@ -40,7 +40,7 @@ async function main() {
4040

4141
if (help) {
4242
console.log(`
43-
Usage: node ./scripts/build-types
43+
Usage: node ./scripts/js-api/build-types
4444
4545
Build generated TypeScript types for react-native.
4646
File renamed without changes.
File renamed without changes.

scripts/build-types/resolution/resolveTypeInputFile.js renamed to scripts/js-api/build-types/resolution/resolveTypeInputFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @format
99
*/
1010

11-
const {REPO_ROOT} = require('../../consts');
11+
const {REPO_ROOT} = require('../../../consts');
1212
const debug = require('debug')('build-types:resolution');
1313
const fs = require('fs');
1414
const path = require('path');

0 commit comments

Comments
 (0)